diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2014-12-07 22:54:56 -0800 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2014-12-15 17:41:37 -0800 |
commit | 10f1ed5e311e7092d3e24b58c4960f5e8a511ac0 (patch) | |
tree | ef72767ba32a4268b20002c1a80a0d13ea9b47a4 /components/layout/wrapper.rs | |
parent | e0e14c60d68474a0dec94d2ec71d979a95fbc6a6 (diff) | |
download | servo-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/wrapper.rs')
-rw-r--r-- | components/layout/wrapper.rs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index 9a70539c78b..ba16eb885a9 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -56,11 +56,12 @@ use servo_msg::constellation_msg::{PipelineId, SubpageId}; use servo_util::str::{LengthOrPercentageOrAuto, is_whitespace}; use std::kinds::marker::ContravariantLifetime; use std::mem; +use string_cache::{Atom, Namespace}; use style::computed_values::{content, display, white_space}; -use style::{AnyNamespace, AttrSelector, IntegerAttribute, LengthAttribute}; -use style::{PropertyDeclarationBlock, SpecificNamespace, TElement, TElementAttributes, TNode}; +use style::{AnyNamespace, AttrSelector, BorderUnsignedIntegerAttribute, IntegerAttribute}; +use style::{LengthAttribute, PropertyDeclarationBlock, SpecificNamespace, TElement}; +use style::{TElementAttributes, TNode, UnsignedIntegerAttribute}; use url::Url; -use string_cache::{Atom, Namespace}; use std::cell::{Ref, RefMut}; @@ -580,6 +581,17 @@ impl<'le> TElement<'le> for LayoutElement<'le> { } } } + + #[inline] + fn has_nonzero_border(self) -> bool { + unsafe { + match self.element + .get_unsigned_integer_attribute_for_layout(BorderUnsignedIntegerAttribute) { + None | Some(0) => false, + _ => true, + } + } + } } impl<'le> TElementAttributes for LayoutElement<'le> { @@ -594,6 +606,12 @@ impl<'le> TElementAttributes for LayoutElement<'le> { self.element.get_integer_attribute_for_layout(integer_attribute) } } + + fn get_unsigned_integer_attribute(self, attribute: UnsignedIntegerAttribute) -> Option<u32> { + unsafe { + self.element.get_unsigned_integer_attribute_for_layout(attribute) + } + } } fn get_content(content_list: &content::T) -> String { |