Bug 1375332 - stylo: force restyle descendants after character set is updated.
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
--- 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]