Bug 1575806 - Cleanup a bit preference-stylesheet-related code. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 22 Aug 2019 23:15:13 +0000
changeset 489556 a7b4cf929f403e089a769b88865fd25dc2ec5a9d
parent 489555 3a2413d91a19af0be169bfd313243e14c296f806
child 489557 c8fcbaade215ecf3cd353b4196787d8c5826527a
push id36476
push userncsoregi@mozilla.com
push dateFri, 23 Aug 2019 15:36:51 +0000
treeherdermozilla-central@8f6e40f9a0ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1575806
milestone70.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 1575806 - Cleanup a bit preference-stylesheet-related code. r=heycam Some of it was dead code, another was inlining a not very useful function (and in one case redundant, since EnsureInitialized() happened right after Refresh()). Differential Revision: https://phabricator.services.mozilla.com/D43042
layout/base/nsPresContext.cpp
layout/base/nsPresContext.h
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -326,37 +326,27 @@ static bool sLookAndFeelChanged;
 // because mTheme is a service, so there's no need to notify it from more than
 // one prescontext.
 static bool sThemeChanged;
 
 bool nsPresContext::IsChrome() const {
   return Document()->IsInChromeDocShell();
 }
 
-bool nsPresContext::IsChromeOriginImage() const {
-  return Document()->IsBeingUsedAsImage() &&
-         Document()->IsDocumentURISchemeChrome();
-}
-
-void nsPresContext::GetDocumentColorPreferences() {
-  PreferenceSheet::EnsureInitialized();
-}
-
 void nsPresContext::GetUserPreferences() {
   if (!GetPresShell()) {
     // No presshell means nothing to do here.  We'll do this when we
     // get a presshell.
     return;
   }
 
   mAutoQualityMinFontSizePixelsPref =
       Preferences::GetInt("browser.display.auto_quality_min_font_size");
 
-  // * document colors
-  GetDocumentColorPreferences();
+  PreferenceSheet::EnsureInitialized();
 
   mSendAfterPaintToContent = Preferences::GetBool(
       "dom.send_after_paint_to_content", mSendAfterPaintToContent);
 
   mPrefScrollbarSide = Preferences::GetInt("layout.scrollbar.side");
 
   Document()->SetMayNeedFontPrefsUpdate();
 
@@ -1331,22 +1321,20 @@ void nsPresContext::SysColorChangedInter
     // Don't use the cached values for the system colors
     LookAndFeel::Refresh();
     sLookAndFeelChanged = false;
   }
 
   // Invalidate cached '-moz-windows-accent-color-applies' media query:
   RefreshSystemMetrics();
 
+  // Reset default background and foreground colors for the document since they
+  // may be using system colors
   PreferenceSheet::Refresh();
 
-  // Reset default background and foreground colors for the document since
-  // they may be using system colors
-  GetDocumentColorPreferences();
-
   // The system color values are computed to colors in the style data,
   // so normal style data comparison is sufficient here.
   RebuildAllStyleData(nsChangeHint(0), RestyleHint{0});
 }
 
 void nsPresContext::RefreshSystemMetrics() {
   // This will force the system metrics to be generated the next time they're
   // used.
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -801,17 +801,16 @@ class nsPresContext : public nsISupports
             mType == eContext_PrintPreview);
   }
   bool IsPrintingOrPrintPreview() {
     return (mType == eContext_Print || mType == eContext_PrintPreview);
   }
 
   // Is this presentation in a chrome docshell?
   bool IsChrome() const;
-  bool IsChromeOriginImage() const;
 
   // Public API for native theme code to get style internals.
   bool HasAuthorSpecifiedRules(const nsIFrame* aFrame,
                                uint32_t ruleTypeMask) const;
 
   // Explicitly enable and disable paint flashing.
   void SetPaintFlashing(bool aPaintFlashing) {
     mPaintFlashing = aPaintFlashing;
@@ -1036,17 +1035,16 @@ class nsPresContext : public nsISupports
   // scale factor from the parent, which will be applied to the subdocument's
   // device context instead of retrieving a scale from the widget.
   static bool UIResolutionChangedSubdocumentCallback(
       mozilla::dom::Document* aDocument, void* aData);
 
   void SetImgAnimations(nsIContent* aParent, uint16_t aMode);
   void SetSMILAnimations(mozilla::dom::Document* aDoc, uint16_t aNewMode,
                          uint16_t aOldMode);
-  void GetDocumentColorPreferences();
 
   void PreferenceChanged(const char* aPrefName);
 
   void UpdateAfterPreferencesChanged();
   void DispatchPrefChangedRunnableIfNeeded();
 
   void GetUserPreferences();