Bug 1365162 - Part 1: Restyle entire subtree when lang="" or xml:lang="" changes. r=emilio draft
authorCameron McCormack <cam@mcc.id.au>
Mon, 05 Jun 2017 13:05:19 +0800
changeset 590153 a2b131e57c9f2caac9eac23ec026175edd43e003
parent 590152 25f53b0364d7cbb25cb40b5b1613390f626d5c79
child 590154 69293fa3683e504ffd581563b3625a5a4238d4de
push id62612
push userbmo:cam@mcc.id.au
push dateWed, 07 Jun 2017 07:54:44 +0000
reviewersemilio
bugs1365162
milestone55.0a1
Bug 1365162 - Part 1: Restyle entire subtree when lang="" or xml:lang="" changes. r=emilio MozReview-Commit-ID: 46YSGTxjshc
layout/base/ServoRestyleManager.cpp
layout/reftests/bugs/reftest.list
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -802,22 +802,26 @@ ServoRestyleManager::AttributeChanged(El
   nsChangeHint hint = aElement->GetAttributeChangeHint(aAttribute, aModType);
   if (hint) {
     PostRestyleEvent(aElement, nsRestyleHint(0), hint);
   }
 
   if (aAttribute == nsGkAtoms::style) {
     PostRestyleEvent(aElement, eRestyle_StyleAttribute, nsChangeHint(0));
   }
-  // <td> is affected by the cellpadding on its ancestor table,
-  // so we should restyle the whole subtree
-  if (aAttribute == nsGkAtoms::cellpadding && aElement->IsHTMLElement(nsGkAtoms::table)) {
+
+  // For some attribute changes we must restyle the whole subtree:
+  //
+  // * <td> is affected by the cellpadding on its ancestor table
+  // * lang="" and xml:lang="" can affect all descendants due to :lang()
+  if ((aAttribute == nsGkAtoms::cellpadding &&
+       aElement->IsHTMLElement(nsGkAtoms::table)) ||
+      aAttribute == nsGkAtoms::lang) {
     PostRestyleEvent(aElement, eRestyle_Subtree, nsChangeHint(0));
-  }
-  if (aElement->IsAttributeMapped(aAttribute)) {
+  } else if (aElement->IsAttributeMapped(aAttribute)) {
     Servo_NoteExplicitHints(aElement, eRestyle_Self, nsChangeHint(0));
   }
 }
 
 nsresult
 ServoRestyleManager::ReparentStyleContext(nsIFrame* aFrame)
 {
   NS_WARNING("stylo: ServoRestyleManager::ReparentStyleContext not implemented");
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1644,17 +1644,17 @@ skip-if(Android) == 621253-1-internalFil
 HTTP(..) == 621253-2-externalFilter.html 621253-2-ref.html
 == 621253-2-internalFilter.html 621253-2-ref.html
 random-if(winWidget) == 621918-1.svg 621918-1-ref.svg # 1-pixel diacritic positioning discrepancy in rotated text (may depend on platform fonts)
 random-if(winWidget) HTTP(..) == 621918-2.svg 621918-2-ref.svg # same 1px issue as above, and HTTP(..) for filters.svg, used to mask antialiasing issues where glyphs touch
 fuzzy-if(d2d,5,1) == 622585-1.html 622585-1-ref.html # bug 789402
 fuzzy-if(Android,8,300) fuzzy-if(skiaContent,1,40000) == 625409-1.html 625409-1-ref.html
 == 627393-1.html about:blank
 fuzzy-if(skiaContent,1,500) == 630835-1.html about:blank
-fails-if(styloVsGecko||stylo) == 631352-1.html 631352-1-ref.html
+== 631352-1.html 631352-1-ref.html
 skip-if(!haveTestPlugin) fails-if(Android) fuzzy-if(winWidget&&!layersGPUAccelerated,102,535) fuzzy-if(skiaContent&&!Android,102,11000) HTTP == 632423-1.html 632423-1-ref.html
 skip-if(Android) random-if(winWidget||OSX==1010) == 632781-verybig.html 632781-ref.html
 == 632781-normalsize.html 632781-ref.html
 fuzzy-if(d2d&&/^Windows\x20NT\x206\.2/.test(http.oscpu),1,559) fuzzy-if(!isDebugBuild&&gtkWidget&&/^Linux\x20i686/.test(http.oscpu),102,140) == 633344-1.html 633344-1-ref.html # bug 1103623, Linux32 from GCC update
 fuzzy-if(skiaContent,1,500) == 634232-1.html 634232-1-ref.html
 fuzzy-if(skiaContent,3,120000) == 635302-1.html 635302-1-ref.html
 fuzzy(1,68) fuzzy-if(gtkWidget,1,70) fails-if(Android) fuzzy-if(skiaContent&&!Android,1,300) == 635373-1.html 635373-1-ref.html
 random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,20,118) fuzzy-if(skiaContent&&!Android,2,550) == 635373-2.html 635373-2-ref.html