Bug 1457102: Ensure a style flush happens after a compat mode change. r?heycam
This is the actual fix. The compat mode changed (well, it didn't), but we were
not scheduling a style flush.
Then someone called getComputedStyle on an element in this document, and the
styles were thought clean, thus we didn't flush style, and we assert when style
resolution happened.
MozReview-Commit-ID: KkM6NwzD640
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1171,25 +1171,22 @@ nsPresContext::GetRootPresContext()
void
nsPresContext::CompatibilityModeChanged()
{
if (!mShell) {
return;
}
- nsIDocument* doc = mShell->GetDocument();
- if (!doc) {
- return;
- }
-
ServoStyleSet* styleSet = mShell->StyleSet();
styleSet->CompatibilityModeChanged();
- if (doc->IsSVGDocument()) {
+ mShell->EnsureStyleFlush();
+
+ if (mDocument->IsSVGDocument()) {
// SVG documents never load quirk.css.
return;
}
bool needsQuirkSheet = CompatibilityMode() == eCompatibility_NavQuirks;
if (mQuirkSheetAdded == needsQuirkSheet) {
return;
}