aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/css/node_util.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-12-07 22:54:56 -0800
committerPatrick Walton <pcwalton@mimiga.net>2014-12-15 17:41:37 -0800
commit10f1ed5e311e7092d3e24b58c4960f5e8a511ac0 (patch)
treeef72767ba32a4268b20002c1a80a0d13ea9b47a4 /components/layout/css/node_util.rs
parente0e14c60d68474a0dec94d2ec71d979a95fbc6a6 (diff)
downloadservo-10f1ed5e311e7092d3e24b58c4960f5e8a511ac0.tar.gz
servo-10f1ed5e311e7092d3e24b58c4960f5e8a511ac0.zip
style: Parse the legacy `border` attribute per the legacy HTML specification.
Additionally, this patch cleans up some miscellaneous formatting issues and refactors files in `layout/css/` somewhat to eliminate needless levels of indirection. It also fixes our handling of presentational hints that only apply if border is nonzero.
Diffstat (limited to 'components/layout/css/node_util.rs')
-rw-r--r--components/layout/css/node_util.rs75
1 files changed, 0 insertions, 75 deletions
diff --git a/components/layout/css/node_util.rs b/components/layout/css/node_util.rs
deleted file mode 100644
index eb447b0cf6b..00000000000
--- a/components/layout/css/node_util.rs
+++ /dev/null
@@ -1,75 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use util::LayoutDataAccess;
-use wrapper::ThreadSafeLayoutNode;
-use wrapper::{After, Before, Normal};
-
-use std::mem;
-use style::ComputedValues;
-use sync::Arc;
-
-pub trait NodeUtil {
- fn get_css_select_results<'a>(&'a self) -> &'a Arc<ComputedValues>;
- fn have_css_select_results(&self) -> bool;
- fn remove_css_select_results(self);
-}
-
-impl<'ln> NodeUtil for ThreadSafeLayoutNode<'ln> {
- /// Returns the style results for the given node. If CSS selector
- /// matching has not yet been performed, fails.
- #[inline]
- fn get_css_select_results<'a>(&'a self) -> &'a Arc<ComputedValues> {
- unsafe {
- let layout_data_ref = self.borrow_layout_data();
- match self.get_pseudo_element_type() {
- Before(_) => {
- mem::transmute(layout_data_ref.as_ref()
- .unwrap()
- .data
- .before_style
- .as_ref()
- .unwrap())
- }
- After(_) => {
- mem::transmute(layout_data_ref.as_ref()
- .unwrap()
- .data
- .after_style
- .as_ref()
- .unwrap())
- }
- Normal => {
- mem::transmute(layout_data_ref.as_ref()
- .unwrap()
- .shared_data
- .style
- .as_ref()
- .unwrap())
- }
- }
- }
- }
-
- /// Does this node have a computed style yet?
- fn have_css_select_results(&self) -> bool {
- let layout_data_ref = self.borrow_layout_data();
- layout_data_ref.as_ref().unwrap().shared_data.style.is_some()
- }
-
- fn remove_css_select_results(self) {
- let mut layout_data_ref = self.mutate_layout_data();
- let layout_data = layout_data_ref.as_mut().expect("no layout data");
-
- let style =
- match self.get_pseudo_element_type() {
- Before(_) => &mut layout_data.data.before_style,
- After (_) => &mut layout_data.data.after_style,
- Normal => &mut layout_data.shared_data.style,
- };
-
- *style = None;
- }
-}
-