Bug 1542935 - Document::CompatibilityModeChanged should call EnsureStyleFlush. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 15 Apr 2019 05:27:37 +0000
changeset 531367 6ff81d173403221744b133b086c4c2377d2a9478
parent 531366 3b45bccf61cff70c9f444ad6e155792bc93d1271
child 531368 f0ee3a81b17968c5cb3e2a508820ff636ccc3db5
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [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();