Bug 1298588 part 1. Make StyleStructContext work with a const nsPresContext. r=bholley
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 04 Jan 2017 14:52:26 -0500
changeset 375255 82ae3ed4c30cab84ad51baeb53f03c0e4732b26e
parent 375254 50c889c86cb89df0f39514e67ed87d5df29f5f9b
child 375256 f230c3fb62f5d4635ef5ccafaaf5258932a587fa
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1298588
milestone53.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 1298588 part 1. Make StyleStructContext work with a const nsPresContext. r=bholley
layout/base/nsPresContext.h
layout/style/StyleStructContext.h
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -246,17 +246,17 @@ public:
 
   nsRefreshDriver* RefreshDriver() { return mRefreshDriver; }
 
   mozilla::RestyleManagerHandle RestyleManager() {
     MOZ_ASSERT(mRestyleManager);
     return mRestyleManager;
   }
 
-  mozilla::CounterStyleManager* CounterStyleManager() {
+  mozilla::CounterStyleManager* CounterStyleManager() const {
     return mCounterStyleManager;
   }
 #endif
 
   /**
    * Rebuilds all style data by throwing out the old rule tree and
    * building a new one, and additionally applying aExtraHint (which
    * must not contain nsChangeHint_ReconstructFrame) to the root frame.
@@ -542,22 +542,22 @@ public:
   * This is a scaling factor for the display of the print preview.  It
   * does not affect layout.  It only affects the size of the onscreen pages
   * in print preview.
   * XXX Temporary: see http://wiki.mozilla.org/Gecko:PrintPreview
   */
   float GetPrintPreviewScale() { return mPPScale; }
   void SetPrintPreviewScale(float aScale) { mPPScale = aScale; }
 
-  nsDeviceContext* DeviceContext() { return mDeviceContext; }
+  nsDeviceContext* DeviceContext() const { return mDeviceContext; }
   mozilla::EventStateManager* EventStateManager() { return mEventManager; }
   nsIAtom* GetLanguageFromCharset() const { return mLanguage; }
   already_AddRefed<nsIAtom> GetContentLanguage() const;
 
-  float TextZoom() { return mTextZoom; }
+  float TextZoom() const { return mTextZoom; }
   void SetTextZoom(float aZoom) {
     MOZ_ASSERT(aZoom > 0.0f, "invalid zoom factor");
     if (aZoom == mTextZoom)
       return;
 
     mTextZoom = aZoom;
     if (HasCachedStyleData()) {
       // Media queries could have changed, since we changed the meaning
--- a/layout/style/StyleStructContext.h
+++ b/layout/style/StyleStructContext.h
@@ -37,17 +37,17 @@ class nsDeviceContext;
  */
 #ifdef MOZ_STYLO
 #define SERVO_DEFAULT(default_val) { if (!mPresContext) { return default_val; } }
 #else
 #define SERVO_DEFAULT(default_val) { MOZ_ASSERT(mPresContext); }
 #endif
 class StyleStructContext {
 public:
-  MOZ_IMPLICIT StyleStructContext(nsPresContext* aPresContext)
+  MOZ_IMPLICIT StyleStructContext(const nsPresContext* aPresContext)
     : mPresContext(aPresContext) { MOZ_ASSERT(aPresContext); }
   static StyleStructContext ServoContext() { return StyleStructContext(); }
 
   // XXXbholley: Need to make text zoom work with stylo. This probably means
   // moving the zoom handling out of computed values and into a post-
   // computation.
   float TextZoom()
   {
@@ -108,14 +108,14 @@ private:
   {
     SERVO_DEFAULT(HackilyFindSomeDeviceContext());
     return mPresContext->DeviceContext();
   }
 
   nsDeviceContext* HackilyFindSomeDeviceContext();
 
   StyleStructContext() : mPresContext(nullptr) {}
-  nsPresContext* mPresContext;
+  const nsPresContext* mPresContext;
 };
 
 #undef SERVO_DEFAULT
 
 #endif // mozilla_StyleStructContext_h