Bug 1347411 part 1. Make sure to correctly update anon boxes belonging to ::before/::after pseudo-elements. r?heycam draft
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 15 Mar 2017 11:48:26 -0400
changeset 499346 26ea9a4d09f743ef7a347aed86d2e12ba336718a
parent 498360 2baef2ffbaedb7354286726660ebd36e84b432f0
child 499347 958d0030a496b56c4a6199648b11ed1a278a36bd
push id49371
push userbzbarsky@mozilla.com
push dateWed, 15 Mar 2017 16:46:41 +0000
reviewersheycam
bugs1347411
milestone55.0a1
Bug 1347411 part 1. Make sure to correctly update anon boxes belonging to ::before/::after pseudo-elements. r?heycam MozReview-Commit-ID: AzF9WdUo1E
layout/base/ServoRestyleManager.cpp
layout/reftests/generated-content/dynamic-table-cell-indent-ref.html
layout/reftests/generated-content/dynamic-table-cell-indent.html
layout/reftests/generated-content/reftest-stylo.list
layout/reftests/generated-content/reftest.list
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -244,16 +244,23 @@ ServoRestyleManager::ProcessPostTraversa
       if (nsIFrame* pseudoFrame = FrameForPseudoElement(aElement, pseudoTag)) {
         // TODO: we could maybe make this more performant via calling into
         // Servo just once to know which pseudo-elements we've got to restyle?
         RefPtr<nsStyleContext> pseudoContext =
           aStyleSet->ProbePseudoElementStyle(aElement, pseudoType, newContext);
         MOZ_ASSERT(pseudoContext, "should have taken the ReconstructFrame path above");
         pseudoFrame->SetStyleContext(pseudoContext);
 
+        if (pseudoFrame->GetStateBits() & NS_FRAME_OWNS_ANON_BOXES) {
+          // XXX It really would be good to pass the actual changehint for our
+          // ::before/::after here, but we never computed it!
+          pseudoFrame->UpdateStyleOfOwnedAnonBoxes(*aStyleSet, aChangeList,
+                                                   nsChangeHint_Hints_NotHandledForDescendants);
+        }
+
         // We only care restyling text nodes, since other type of nodes
         // (images), are still not supported. If that eventually changes, we
         // may have to write more code here... Or not, I don't think too
         // many inherited properties can affect those other frames.
         StyleChildrenIterator it(pseudoFrame->GetContent());
         for (nsIContent* n = it.GetNextChild(); n; n = it.GetNextChild()) {
           if (n->IsNodeOfType(nsINode::eTEXT)) {
             RefPtr<nsStyleContext> childContext =
new file mode 100644
--- /dev/null
+++ b/layout/reftests/generated-content/dynamic-table-cell-indent-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<table cellpadding="0">
+   <tr><td style="text-indent: 50px">Some text</td></tr>
+</table>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/generated-content/dynamic-table-cell-indent.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <style>
+    tr::before {
+      content: "Some text";
+      display: table-cell;
+    }
+    tr.i::before {
+      text-indent: 50px;
+    }
+  </style>
+  <table cellpadding="0">
+    <tr></tr>
+  </table>
+  <script>
+    onload = function() {
+      var tr = document.querySelector("tr");
+      // Make sure it's laid out
+      window.w = tr.offsetWidth;
+      document.querySelector("tr").className = "i";
+      document.documentElement.className = "";
+    }
+  </script>
+</html>
--- a/layout/reftests/generated-content/reftest-stylo.list
+++ b/layout/reftests/generated-content/reftest-stylo.list
@@ -5,14 +5,15 @@ fails == display-types-01.html display-t
 fails == dynamic-attr-01.html dynamic-attr-01.html
 fails == dynamic-button-01a.html dynamic-button-01a.html
 fails == dynamic-button-01b.html dynamic-button-01b.html
 fails == dynamic-fieldset-01a.html dynamic-fieldset-01a.html
 fails == dynamic-fieldset-01b.html dynamic-fieldset-01b.html
 == dynamic-restyle-01.html dynamic-restyle-01.html
 == dynamic-table-cell-01a.html dynamic-table-cell-01a.html
 == dynamic-table-cell-01b.html dynamic-table-cell-01b.html
+== dynamic-table-cell-indent.html dynamic-table-cell-indent.html
 fails == floated-01.html floated-01.html
 == images-01.html images-01.html
 fails == positioned-01.html positioned-01.html
 fuzzy-if(OSX==1010,1,10) == quotes-001.xml quotes-001.xml
 fails == table-ignoring-whitespace-01.html table-ignoring-whitespace-01.html
 fails == table-parts-01.html table-parts-01.html
--- a/layout/reftests/generated-content/reftest.list
+++ b/layout/reftests/generated-content/reftest.list
@@ -4,14 +4,15 @@ fuzzy-if(OSX==1010,1,10) == display-type
 fuzzy-if(OSX==1010,1,10) == dynamic-attr-01.html dynamic-attr-01-ref.html
 fuzzy-if(OSX==1010,1,10) == dynamic-button-01a.html dynamic-button-01-ref.html
 fuzzy-if(OSX==1010,1,10) == dynamic-button-01b.html dynamic-button-01-ref.html
 fuzzy-if(OSX==1010,1,10) == dynamic-fieldset-01a.html dynamic-fieldset-01-ref.html
 fuzzy-if(OSX==1010,1,10) == dynamic-fieldset-01b.html dynamic-fieldset-01-ref.html
 fuzzy-if(OSX==1010,1,10) == dynamic-restyle-01.html dynamic-restyle-01-ref.html
 fuzzy-if(OSX==1010,1,10) == dynamic-table-cell-01a.html dynamic-table-cell-01-ref.html
 fuzzy-if(OSX==1010,1,10) == dynamic-table-cell-01b.html dynamic-table-cell-01-ref.html
+== dynamic-table-cell-indent.html dynamic-table-cell-indent-ref.html
 fuzzy-if(OSX==1010,1,10) == floated-01.html floated-01-ref.html
 fuzzy-if(OSX==1010,1,10) == images-01.html images-01-ref.html
 fuzzy-if(OSX==1010,1,10) == positioned-01.html positioned-01-ref.html
 fuzzy-if(OSX==1010,1,10) == quotes-001.xml quotes-001-ref.xml
 fuzzy-if(OSX==1010,1,10) == table-ignoring-whitespace-01.html table-ignoring-whitespace-01-ref.html
 fuzzy-if(OSX==1010,1,10) == table-parts-01.html table-parts-01-ref.html