Bug 1542935 - Document::CompatibilityModeChanged should call EnsureStyleFlush. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 15 Apr 2019 05:27:37 +0000
changeset 469489 6ff81d173403221744b133b086c4c2377d2a9478
parent 469488 3b45bccf61cff70c9f444ad6e155792bc93d1271
child 469490 f0ee3a81b17968c5cb3e2a508820ff636ccc3db5
push id112797
push userncsoregi@mozilla.com
push dateMon, 15 Apr 2019 15:29:43 +0000
treeherdermozilla-inbound@a2b89a27e8eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1542935, 1535788
milestone68.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 1542935 - Document::CompatibilityModeChanged should call EnsureStyleFlush. r=heycam Following the reasoning from the previous commit. Selectors may become case sensitive or case insensitive as a result of this operation, something I forgot about when writing the patch for bug 1535788. Now Document::CompatibilityModeChanged is actually only called if the compatibility mode actually changes, and thus we always need to restyle. The Stylist already takes care of fully invalidating the document when it changes (via mark_origins_dirty and co.), so we technically just need to guarantee that a style flush will happen. In practice I doubt this call will have any effect in practice given how early in the document's lifetime the compatibility mode can change, but still I think it's worth landing. Depends on D27416 Differential Revision: https://phabricator.services.mozilla.com/D27417
dom/base/Document.cpp
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -2386,16 +2386,21 @@ void Document::FillStyleSetDocumentSheet
   AppendSheetsToStyleSet(mStyleSet.get(), mAdditionalSheets[eAuthorSheet],
                          SheetType::Doc);
 }
 
 void Document::CompatibilityModeChanged() {
   MOZ_ASSERT(IsHTMLOrXHTML());
   CSSLoader()->SetCompatibilityMode(mCompatMode);
   mStyleSet->CompatibilityModeChanged();
+  if (PresShell* presShell = GetPresShell()) {
+    // Selectors may have become case-sensitive / case-insensitive, the stylist
+    // has already performed the relevant invalidation.
+    presShell->EnsureStyleFlush();
+  }
   if (!mStyleSetFilled) {
     MOZ_ASSERT(!mQuirkSheetAdded);
     return;
   }
   if (mQuirkSheetAdded == NeedsQuirksSheet()) {
     return;
   }
   auto cache = nsLayoutStylesheetCache::Singleton();