Bug 1457102: Avoid all the work if the compat mode hasn't actually changed. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 26 Apr 2018 16:07:30 +0200
changeset 415916 681cf57b9ff3a8e6493ef5e42e4fc6289db469d2
parent 415915 87498d129369be6098544c6345c6a3f8f363094c
child 415917 860f468355b9545e50e26fd83e7abb4a3429b8bb
push id33911
push usercsabou@mozilla.com
push dateFri, 27 Apr 2018 10:01:39 +0000
treeherdermozilla-central@822936017145 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1457102
milestone61.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 1457102: Avoid all the work if the compat mode hasn't actually changed. r=heycam In this case the stylist is marked dirty because a compat mode change. The change just doesn't exist (NavQuirks -> NavQuirks). So avoid the work in the first place. MozReview-Commit-ID: lchKJECNkO
dom/html/nsHTMLDocument.cpp
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -847,16 +847,19 @@ nsHTMLDocument::EndLoad()
 }
 
 void
 nsHTMLDocument::SetCompatibilityMode(nsCompatibility aMode)
 {
   NS_ASSERTION(IsHTMLDocument() || aMode == eCompatibility_FullStandards,
                "Bad compat mode for XHTML document!");
 
+  if (mCompatMode == aMode) {
+    return;
+  }
   mCompatMode = aMode;
   CSSLoader()->SetCompatibilityMode(mCompatMode);
   RefPtr<nsPresContext> pc = GetPresContext();
   if (pc) {
     pc->CompatibilityModeChanged();
   }
 }