From 69769e44935a7e208efcf7a56ab161f0cddfe2d3 Mon Sep 17 00:00:00 2001 From: Alexandrov Sergey Date: Sun, 31 Jul 2016 12:00:07 +0300 Subject: [PATCH 1/4] do not reset pseudo elements style --- components/layout/construct.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 33b88f6b8c0..bb7f0372189 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -714,7 +714,11 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode> } let mut style = (*style).clone(); - properties::modify_style_for_text(&mut style); + match node.get_pseudo_element_type() { + PseudoElementType::Before(_) | + PseudoElementType::After(_) => {} + _ => properties::modify_style_for_text(&mut style) + } let selected_style = node.selected_style(self.style_context()); @@ -950,7 +954,11 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode> // Modify the style as necessary. (See the comment in // `properties::modify_style_for_replaced_content()`.) let mut style = node.style(self.style_context()).clone(); - properties::modify_style_for_replaced_content(&mut style); + match node.get_pseudo_element_type() { + PseudoElementType::Before(_) | + PseudoElementType::After(_) => {} + _ => properties::modify_style_for_replaced_content(&mut style) + } // If this is generated content, then we need to initialize the accumulator with the // fragment corresponding to that content. Otherwise, just initialize with the ordinary From 49b50e45a393e0b60aae45d6e4d19800b5d0c551 Mon Sep 17 00:00:00 2001 From: Alexandrov Sergey Date: Sun, 31 Jul 2016 12:01:16 +0300 Subject: [PATCH 2/4] do not merge inline fragments if there is space in between --- components/layout/inline.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 0bc24d76276..5d637b0f2da 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -358,6 +358,10 @@ impl LineBreaker { let need_to_merge = match (&mut result.specific, &candidate.specific) { (&mut SpecificFragmentInfo::ScannedText(ref mut result_info), &SpecificFragmentInfo::ScannedText(ref candidate_info)) => { + result.margin.inline_end == Au(0) && + candidate.margin.inline_start == Au(0) && + result.border_padding.inline_end == Au(0) && + candidate.border_padding.inline_start == Au(0) && result_info.selected() == candidate_info.selected() && arc_ptr_eq(&result_info.run, &candidate_info.run) && inline_contexts_are_equal(&result.inline_context, From 93334cf178d81881af1d851cf4152e80eae103f3 Mon Sep 17 00:00:00 2001 From: Alexandrov Sergey Date: Sun, 31 Jul 2016 14:56:16 +0300 Subject: [PATCH 3/4] add tests to check if inline pseudo elements paddings and margins are accounted correctly --- tests/wpt/mozilla/meta/MANIFEST.json | 48 +++++++++++++++++++ .../css/pseudo_element_spacing_margin.html | 31 ++++++++++++ .../css/pseudo_element_spacing_padding.html | 31 ++++++++++++ .../tests/css/pseudo_element_spacing_ref.html | 19 ++++++++ 4 files changed, 129 insertions(+) create mode 100644 tests/wpt/mozilla/tests/css/pseudo_element_spacing_margin.html create mode 100644 tests/wpt/mozilla/tests/css/pseudo_element_spacing_padding.html create mode 100644 tests/wpt/mozilla/tests/css/pseudo_element_spacing_ref.html diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 5aa73e95581..815909738ab 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -4432,6 +4432,30 @@ "url": "/_mozilla/css/pseudo_element_restyle_no_rules.html" } ], + "css/pseudo_element_spacing_margin.html": [ + { + "path": "css/pseudo_element_spacing_margin.html", + "references": [ + [ + "/_mozilla/css/pseudo_element_spacing_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/pseudo_element_spacing_margin.html" + } + ], + "css/pseudo_element_spacing_padding.html": [ + { + "path": "css/pseudo_element_spacing_padding.html", + "references": [ + [ + "/_mozilla/css/pseudo_element_spacing_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/pseudo_element_spacing_padding.html" + } + ], "css/pseudo_inherit.html": [ { "path": "css/pseudo_inherit.html", @@ -13610,6 +13634,30 @@ "url": "/_mozilla/css/pseudo_element_restyle_no_rules.html" } ], + "css/pseudo_element_spacing_margin.html": [ + { + "path": "css/pseudo_element_spacing_margin.html", + "references": [ + [ + "/_mozilla/css/pseudo_element_spacing_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/pseudo_element_spacing_margin.html" + } + ], + "css/pseudo_element_spacing_padding.html": [ + { + "path": "css/pseudo_element_spacing_padding.html", + "references": [ + [ + "/_mozilla/css/pseudo_element_spacing_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/pseudo_element_spacing_padding.html" + } + ], "css/pseudo_inherit.html": [ { "path": "css/pseudo_inherit.html", diff --git a/tests/wpt/mozilla/tests/css/pseudo_element_spacing_margin.html b/tests/wpt/mozilla/tests/css/pseudo_element_spacing_margin.html new file mode 100644 index 00000000000..8ca773655a5 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/pseudo_element_spacing_margin.html @@ -0,0 +1,31 @@ + + + + + + + + + |b|
+ |b| + + diff --git a/tests/wpt/mozilla/tests/css/pseudo_element_spacing_padding.html b/tests/wpt/mozilla/tests/css/pseudo_element_spacing_padding.html new file mode 100644 index 00000000000..63de712937b --- /dev/null +++ b/tests/wpt/mozilla/tests/css/pseudo_element_spacing_padding.html @@ -0,0 +1,31 @@ + + + + + + + + + |b|
+ |b| + + diff --git a/tests/wpt/mozilla/tests/css/pseudo_element_spacing_ref.html b/tests/wpt/mozilla/tests/css/pseudo_element_spacing_ref.html new file mode 100644 index 00000000000..9eb5ee245cf --- /dev/null +++ b/tests/wpt/mozilla/tests/css/pseudo_element_spacing_ref.html @@ -0,0 +1,19 @@ + + + + + |abc|
+ |abc| + + From a9c1817fee4d5c64176447822345a6bc2e7512bc Mon Sep 17 00:00:00 2001 From: Alexandrov Sergey Date: Tue, 9 Aug 2016 22:57:28 +0300 Subject: [PATCH 4/4] update tests expectations --- .../css-transitions-1_dev/html/pseudo-elements-001.htm.ini | 7 ------- .../css21_dev/html4/pseudo-elements-001.htm.ini | 7 ------- 2 files changed, 14 deletions(-) diff --git a/tests/wpt/metadata-css/css-transitions-1_dev/html/pseudo-elements-001.htm.ini b/tests/wpt/metadata-css/css-transitions-1_dev/html/pseudo-elements-001.htm.ini index 784c08016a2..f786f4bc4ac 100644 --- a/tests/wpt/metadata-css/css-transitions-1_dev/html/pseudo-elements-001.htm.ini +++ b/tests/wpt/metadata-css/css-transitions-1_dev/html/pseudo-elements-001.htm.ini @@ -5,10 +5,3 @@ [transition padding-left on :after / values] expected: FAIL - - [transition padding-left on :before, changing content / values] - expected: FAIL - - [transition padding-left on :after, changing content / values] - expected: FAIL - diff --git a/tests/wpt/metadata-css/css21_dev/html4/pseudo-elements-001.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/pseudo-elements-001.htm.ini index 784c08016a2..f786f4bc4ac 100644 --- a/tests/wpt/metadata-css/css21_dev/html4/pseudo-elements-001.htm.ini +++ b/tests/wpt/metadata-css/css21_dev/html4/pseudo-elements-001.htm.ini @@ -5,10 +5,3 @@ [transition padding-left on :after / values] expected: FAIL - - [transition padding-left on :before, changing content / values] - expected: FAIL - - [transition padding-left on :after, changing content / values] - expected: FAIL -