Bug 1375332 - stylo: force restyle descendants after character set is updated. r=emilio
authorJeremy Chen <jeremychen@mozilla.com>
Mon, 21 Aug 2017 18:58:53 +0800
changeset 426009 716ca00ed476419c0a5a56f0c3d345e0a33398a6
parent 426008 665197f96a9bcbbac99fe24db19532876bef9dd1
child 426010 adff388db8bc1a8f445babcb470d1dde2d6709f3
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1375332
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1375332 - stylo: force restyle descendants after character set is updated. r=emilio In Stylo, if there exists one or more <script> elements in the document, frame construction might happen earlier than the UpdateCharSet(), which leads to an incorrect style data for the frames. So, we force a restyle in this situation, to make the style data of all the descendants up-to-date. MozReview-Commit-ID: BwCwp6Ndvmc
layout/base/nsPresContext.cpp
layout/base/tests/mochitest.ini
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1076,17 +1076,22 @@ nsPresContext::DetachShell()
   }
 }
 
 void
 nsPresContext::DoChangeCharSet(NotNull<const Encoding*> aCharSet)
 {
   UpdateCharSet(aCharSet);
   mDeviceContext->FlushFontCache();
-  RebuildAllStyleData(NS_STYLE_HINT_REFLOW, nsRestyleHint(0));
+  // In Stylo, if a document contains one or more <script> elements, frame
+  // construction might happen earlier than the UpdateCharSet(), so we need to
+  // restyle descendants to make their style data up-to-date.
+  RebuildAllStyleData(NS_STYLE_HINT_REFLOW,
+                      mDocument->IsStyledByServo()
+                      ? eRestyle_ForceDescendants : nsRestyleHint(0));
 }
 
 void
 nsPresContext::UpdateCharSet(NotNull<const Encoding*> aCharSet)
 {
   mLanguage = mLangService->LookupCharSet(aCharSet);
   // this will be a language group (or script) code rather than a true language code
 
--- a/layout/base/tests/mochitest.ini
+++ b/layout/base/tests/mochitest.ini
@@ -72,17 +72,16 @@ skip-if = toolkit == 'android' # Require
 [test_bug646757.html]
 [test_bug667512.html]
 [test_bug677878.html]
 [test_bug687297.html]
 support-files =
   bug687297_a.html
   bug687297_b.html
   bug687297_c.html
-fail-if = stylo # bug 1375332
 [test_bug696020.html]
 [test_bug718809.html]
 [test_bug725426.html]
 [test_bug731777.html]
 [test_bug749186.html]
 [test_bug761572.html]
 [test_bug770106.html]
 [test_bug842853.html]