From 9dba9b9447306d93a81ed90d8b6aaaf9e662c69e Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Tue, 8 Jul 2014 11:18:33 +1000 Subject: [PATCH] Make pseudo :before and :after elements inherit style from attached element, as per http://dev.w3.org/csswg/css2/generate.html, rather than from the parent element. --- src/components/layout/css/matching.rs | 4 ++-- src/test/ref/basic.list | 1 + src/test/ref/pseudo_inherit.html | 17 +++++++++++++++++ src/test/ref/pseudo_inherit_ref.html | 14 ++++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 src/test/ref/pseudo_inherit.html create mode 100644 src/test/ref/pseudo_inherit_ref.html diff --git a/src/components/layout/css/matching.rs b/src/components/layout/css/matching.rs index 514a4767dc8..afce7c237f0 100644 --- a/src/components/layout/css/matching.rs +++ b/src/components/layout/css/matching.rs @@ -553,14 +553,14 @@ impl<'ln> MatchMethods for LayoutNode<'ln> { applicable_declarations_cache, applicable_declarations.normal_shareable); if applicable_declarations.before.len() > 0 { - self.cascade_node_pseudo_element(parent_style, + self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.get_ref()), 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(parent_style, + self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.get_ref()), applicable_declarations.after.as_slice(), &mut layout_data.data.after_style, applicable_declarations_cache, diff --git a/src/test/ref/basic.list b/src/test/ref/basic.list index 6f6c775d685..91eba682ffb 100644 --- a/src/test/ref/basic.list +++ b/src/test/ref/basic.list @@ -82,3 +82,4 @@ == position_fixed_background_color_a.html position_fixed_background_color_b.html == position_fixed_overflow_a.html position_fixed_overflow_b.html == noscript.html noscript_ref.html +== pseudo_inherit.html pseudo_inherit_ref.html diff --git a/src/test/ref/pseudo_inherit.html b/src/test/ref/pseudo_inherit.html new file mode 100644 index 00000000000..d536abbfbda --- /dev/null +++ b/src/test/ref/pseudo_inherit.html @@ -0,0 +1,17 @@ + + + + + + + +

B

+ + diff --git a/src/test/ref/pseudo_inherit_ref.html b/src/test/ref/pseudo_inherit_ref.html new file mode 100644 index 00000000000..0195f154cf3 --- /dev/null +++ b/src/test/ref/pseudo_inherit_ref.html @@ -0,0 +1,14 @@ + + + + + + + +

AB

+ +