diff options
author | Glenn Watson <gw@intuitionlibrary.com> | 2014-09-26 17:12:22 +1000 |
---|---|---|
committer | Glenn Watson <gw@intuitionlibrary.com> | 2014-09-26 17:12:22 +1000 |
commit | cf79e64a5aae68604e2c194310b650aca481c92a (patch) | |
tree | 49906a2fb459f3ab7d42f36a472042523b971309 /components/layout/css | |
parent | 20f5fdd000408867ac2d3a90ad9a8b55cfb8bc9e (diff) | |
download | servo-cf79e64a5aae68604e2c194310b650aca481c92a.tar.gz servo-cf79e64a5aae68604e2c194310b650aca481c92a.zip |
Improve acid2. Fix line height calculation. Text fragments get correct enclosing element style.
* Enabled acid2 on mac + linux. Updated the reference image. The only difference from the
real acid2 now is the paint order and a 1 pixel horizontal offset on the nose.
* Change line-height to be calculated correctly.
* Apply enclosing element style to text fragments.
Diffstat (limited to 'components/layout/css')
-rw-r--r-- | components/layout/css/matching.rs | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index 6913b43bfc4..90526ef0e8f 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -8,8 +8,9 @@ use css::node_style::StyledNode; use construct::FlowConstructor; use context::LayoutContext; use util::{LayoutDataAccess, LayoutDataWrapper}; -use wrapper::{LayoutElement, LayoutNode, PostorderNodeMutTraversal, ThreadSafeLayoutNode}; +use wrapper::{LayoutElement, LayoutNode, PostorderNodeMutTraversal, ThreadSafeLayoutNode, TLayoutNode}; +use script::dom::node::{TextNodeTypeId}; use servo_util::atom::Atom; use servo_util::bloom::BloomFilter; use servo_util::cache::{Cache, LRUCache, SimpleHashCache}; @@ -616,24 +617,32 @@ impl<'ln> MatchMethods for LayoutNode<'ln> { match &mut *layout_data_ref { &None => fail!("no layout data"), &Some(ref mut layout_data) => { - self.cascade_node_pseudo_element(parent_style, - applicable_declarations.normal.as_slice(), - &mut layout_data.shared_data.style, - applicable_declarations_cache, - applicable_declarations.normal_shareable); - if applicable_declarations.before.len() > 0 { - self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.as_ref().unwrap()), - applicable_declarations.before.as_slice(), - &mut layout_data.data.before_style, - applicable_declarations_cache, - false); - } - if applicable_declarations.after.len() > 0 { - self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.as_ref().unwrap()), - applicable_declarations.after.as_slice(), - &mut layout_data.data.after_style, - applicable_declarations_cache, - false); + match self.type_id() { + Some(TextNodeTypeId) => { + let cloned_parent_style = parent_style.unwrap().clone(); + layout_data.shared_data.style = Some(cloned_parent_style); + } + _ => { + self.cascade_node_pseudo_element(parent_style, + applicable_declarations.normal.as_slice(), + &mut layout_data.shared_data.style, + applicable_declarations_cache, + applicable_declarations.normal_shareable); + if applicable_declarations.before.len() > 0 { + self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.as_ref().unwrap()), + applicable_declarations.before.as_slice(), + &mut layout_data.data.before_style, + applicable_declarations_cache, + false); + } + if applicable_declarations.after.len() > 0 { + self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.as_ref().unwrap()), + applicable_declarations.after.as_slice(), + &mut layout_data.data.after_style, + applicable_declarations_cache, + false); + } + } } } } |