diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 6943ee2df508..4e5dd926d779 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -251,7 +251,7 @@ TabChildBase::InitializeRootMetrics() mLastRootMetrics.SetCumulativeResolution(mLastRootMetrics.GetZoom() / mLastRootMetrics.GetDevPixelsPerCSSPixel() * ParentLayerToLayerScale(1)); // This is the root layer, so the cumulative resolution is the same // as the resolution. - mLastRootMetrics.mPresShellResolution = mLastRootMetrics.GetCumulativeResolution().scale; + mLastRootMetrics.SetPresShellResolution(mLastRootMetrics.GetCumulativeResolution().scale); mLastRootMetrics.SetScrollOffset(CSSPoint(0, 0)); TABC_LOG("After InitializeRootMetrics, mLastRootMetrics is %s\n", @@ -434,8 +434,8 @@ TabChildBase::HandlePossibleViewportChange(const ScreenIntSize& aOldScreenSize) * ParentLayerToLayerScale(1)); // This is the root layer, so the cumulative resolution is the same // as the resolution. - metrics.mPresShellResolution = metrics.GetCumulativeResolution().scale; - utils->SetResolutionAndScaleTo(metrics.mPresShellResolution, metrics.mPresShellResolution); + metrics.SetPresShellResolution(metrics.GetCumulativeResolution().scale); + utils->SetResolutionAndScaleTo(metrics.GetPresShellResolution(), metrics.GetPresShellResolution()); CSSSize scrollPort = metrics.CalculateCompositedSizeInCssPixels(); utils->SetScrollPositionClampingScrollPortSize(scrollPort.width, scrollPort.height); @@ -978,8 +978,8 @@ TabChild::Observe(nsISupports *aSubject, // until we we get an inner size. if (HasValidInnerSize()) { InitializeRootMetrics(); - utils->SetResolution(mLastRootMetrics.mPresShellResolution, - mLastRootMetrics.mPresShellResolution); + utils->SetResolution(mLastRootMetrics.GetPresShellResolution(), + mLastRootMetrics.GetPresShellResolution()); HandlePossibleViewportChange(mInnerSize); } } diff --git a/gfx/layers/FrameMetrics.h b/gfx/layers/FrameMetrics.h index a204e4b41cd1..ab176db00e14 100644 --- a/gfx/layers/FrameMetrics.h +++ b/gfx/layers/FrameMetrics.h @@ -251,20 +251,17 @@ public: // layout/paint time. ParentLayerRect mCompositionBounds; - // --------------------------------------------------------------------------- - // The following metrics are dimensionless. - // - - // The pres-shell resolution that has been induced on the document containing - // this scroll frame as a result of zooming this scroll frame (whether via - // user action, or choosing an initial zoom level on page load). This can - // only be different from 1.0 for frames that are zoomable, which currently - // is just the root content document's root scroll frame (mIsRoot = true). - // This is a plain float rather than a ScaleFactor because in and of itself - // it does not convert between any coordinate spaces for which we have names. - float mPresShellResolution; - public: + void SetPresShellResolution(const float aPresShellResolution) + { + mPresShellResolution = aPresShellResolution; + } + + float GetPresShellResolution() const + { + return mPresShellResolution; + } + void SetDisplayPort(const CSSRect& aDisplayPort) { mDisplayPort = aDisplayPort; @@ -523,6 +520,16 @@ public: } private: + + // The pres-shell resolution that has been induced on the document containing + // this scroll frame as a result of zooming this scroll frame (whether via + // user action, or choosing an initial zoom level on page load). This can + // only be different from 1.0 for frames that are zoomable, which currently + // is just the root content document's root scroll frame (mIsRoot = true). + // This is a plain float rather than a ScaleFactor because in and of itself + // it does not convert between any coordinate spaces for which we have names. + float mPresShellResolution; + // The area of a frame's contents that has been painted, relative to // mCompositionBounds. // diff --git a/gfx/layers/LayersLogging.cpp b/gfx/layers/LayersLogging.cpp index 7d68e8f692f6..a5659914fe4a 100644 --- a/gfx/layers/LayersLogging.cpp +++ b/gfx/layers/LayersLogging.cpp @@ -190,7 +190,7 @@ AppendToString(std::stringstream& aStream, const FrameMetrics& m, AppendToString(aStream, m.GetRootCompositionSize(), "] [rcs="); AppendToString(aStream, m.GetViewport(), "] [v="); aStream << nsPrintfCString("] [z=(ld=%.3f r=%.3f cr=%.3f z=%.3f er=%.3f)", - m.GetDevPixelsPerCSSPixel().scale, m.mPresShellResolution, + m.GetDevPixelsPerCSSPixel().scale, m.GetPresShellResolution(), m.GetCumulativeResolution().scale, m.GetZoom().scale, m.GetExtraResolution().scale).get(); aStream << nsPrintfCString("] [u=(%d %d %lu)", diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index a6d1f6778c48..7db57ed8ac25 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -246,7 +246,7 @@ ComputeClipRegion(GeckoContentController* aController, // resolution. LayoutDeviceToParentLayerScale parentCumulativeResolution = aLayer.Metrics().GetCumulativeResolution() - / ParentLayerToLayerScale(aLayer.Metrics().mPresShellResolution); + / ParentLayerToLayerScale(aLayer.Metrics().GetPresShellResolution()); // Not sure what rounding option is the most correct here, but if we ever // figure it out we can change this. For now I'm rounding in to minimize // the chances of getting a complex region. diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 537a4c49b046..28437cd516ff 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -2775,8 +2775,8 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri // since the repaint request. float totalResolutionChange = aLayerMetrics.GetCumulativeResolution().scale / mFrameMetrics.GetCumulativeResolution().scale; - float presShellResolutionChange = aLayerMetrics.mPresShellResolution - / mFrameMetrics.mPresShellResolution; + float presShellResolutionChange = aLayerMetrics.GetPresShellResolution() + / mFrameMetrics.GetPresShellResolution(); mFrameMetrics.ZoomBy(totalResolutionChange / presShellResolutionChange); } else { // Take the new zoom as either device scale or composition width or @@ -2791,7 +2791,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri } mFrameMetrics.mCompositionBounds = aLayerMetrics.mCompositionBounds; mFrameMetrics.SetRootCompositionSize(aLayerMetrics.GetRootCompositionSize()); - mFrameMetrics.mPresShellResolution = aLayerMetrics.mPresShellResolution; + mFrameMetrics.SetPresShellResolution(aLayerMetrics.GetPresShellResolution()); mFrameMetrics.SetCumulativeResolution(aLayerMetrics.GetCumulativeResolution()); mFrameMetrics.SetHasScrollgrab(aLayerMetrics.GetHasScrollgrab()); diff --git a/gfx/layers/apz/util/APZCCallbackHelper.cpp b/gfx/layers/apz/util/APZCCallbackHelper.cpp index e8990717e840..4fca6f7ed23b 100644 --- a/gfx/layers/apz/util/APZCCallbackHelper.cpp +++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp @@ -143,7 +143,7 @@ APZCCallbackHelper::UpdateRootFrame(nsIDOMWindowUtils* aUtils, // The pres shell resolution is updated by the the async zoom since the // last paint. - float presShellResolution = aMetrics.mPresShellResolution + float presShellResolution = aMetrics.GetPresShellResolution() * aMetrics.GetAsyncZoom().scale; aUtils->SetResolutionAndScaleTo(presShellResolution, presShellResolution); diff --git a/gfx/layers/client/ClientTiledPaintedLayer.cpp b/gfx/layers/client/ClientTiledPaintedLayer.cpp index da803a4d09d5..5189e1e23271 100644 --- a/gfx/layers/client/ClientTiledPaintedLayer.cpp +++ b/gfx/layers/client/ClientTiledPaintedLayer.cpp @@ -83,7 +83,7 @@ GetTransformToAncestorsParentLayer(Layer* aStart, const LayerMetricsWrapper& aAn // parent layer of the displayport-ancestor, which we don't reach in this // loop, so we don't need to worry about it. const FrameMetrics& metrics = iter.Metrics(); - transform.PostScale(metrics.mPresShellResolution, metrics.mPresShellResolution, 1.f); + transform.PostScale(metrics.GetPresShellResolution(), metrics.GetPresShellResolution(), 1.f); } } return transform; diff --git a/gfx/layers/client/TiledContentClient.cpp b/gfx/layers/client/TiledContentClient.cpp index f92b9a40e809..6b84dffb4266 100644 --- a/gfx/layers/client/TiledContentClient.cpp +++ b/gfx/layers/client/TiledContentClient.cpp @@ -1272,7 +1272,7 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile, #ifdef GFX_TILEDLAYER_DEBUG_OVERLAY DrawDebugOverlay(drawTarget, aTileOrigin.x * mResolution, - aTileOrigin.y * mPresShellResolution, GetTileLength(), GetTileLength()); + aTileOrigin.y * GetPresShellResolution(), GetTileLength(), GetTileLength()); #endif ctxt = nullptr; diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index e981a7e6291e..37c6a49c6846 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -744,7 +744,7 @@ ApplyAsyncTransformToScrollbarForContent(Layer* aScrollbar, // aScrollbarIsDescendant hunk below we apply a resolution-cancelling // transform which ensures the scroll thumb isn't actually rendered // at a larger scale. - yTranslation *= metrics.mPresShellResolution; + yTranslation *= metrics.GetPresShellResolution(); } scrollbarTransform.PostScale(1.f, yScale, 1.f); @@ -772,7 +772,7 @@ ApplyAsyncTransformToScrollbarForContent(Layer* aScrollbar, xTranslation -= thumbOriginDeltaPL; if (aScrollbarIsDescendant) { - xTranslation *= metrics.mPresShellResolution; + xTranslation *= metrics.GetPresShellResolution(); } scrollbarTransform.PostScale(xScale, 1.f, 1.f); @@ -802,8 +802,8 @@ ApplyAsyncTransformToScrollbarForContent(Layer* aScrollbar, // in the same coordinate space. This requires applying the content // transform and then unapplying it after unapplying the async transform. Matrix4x4 resolutionCancellingTransform = - Matrix4x4::Scaling(metrics.mPresShellResolution, - metrics.mPresShellResolution, + Matrix4x4::Scaling(metrics.GetPresShellResolution(), + metrics.GetPresShellResolution(), 1.0f).Inverse(); Matrix4x4 asyncUntransform = (asyncTransform * apzc->GetOverscrollTransform()).Inverse(); Matrix4x4 contentTransform = aContent.GetTransform(); diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 91d51b1ce0f0..547b0a48d97f 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -915,7 +915,7 @@ LayerManagerComposite::ComputeRenderIntegrity() Layer* rootScrollable = rootScrollableLayers[0]; const FrameMetrics& metrics = LayerMetricsWrapper::TopmostScrollableMetrics(rootScrollable); Matrix4x4 transform = rootScrollable->GetEffectiveTransform(); - transform.PostScale(metrics.mPresShellResolution, metrics.mPresShellResolution, 1); + transform.PostScale(metrics.GetPresShellResolution(), metrics.GetPresShellResolution(), 1); // Clip the screen rect to the document bounds Rect documentBounds = diff --git a/gfx/tests/gtest/TestAsyncPanZoomController.cpp b/gfx/tests/gtest/TestAsyncPanZoomController.cpp index 3822a8c86e87..966b1824157e 100644 --- a/gfx/tests/gtest/TestAsyncPanZoomController.cpp +++ b/gfx/tests/gtest/TestAsyncPanZoomController.cpp @@ -821,7 +821,7 @@ TEST_F(APZCBasicTester, ComplexTransform) { metrics.SetScrollOffset(CSSPoint(10, 10)); metrics.SetScrollableRect(CSSRect(0, 0, 50, 50)); metrics.SetCumulativeResolution(LayoutDeviceToLayerScale(2)); - metrics.mPresShellResolution = 2.0f; + metrics.SetPresShellResolution(2.0f); metrics.SetZoom(CSSToParentLayerScale(6)); metrics.SetDevPixelsPerCSSPixel(CSSToLayoutDeviceScale(3)); metrics.SetScrollId(FrameMetrics::START_SCROLL_ID); diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 8aaa36fd4213..41e6fd5bf98b 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -769,9 +769,9 @@ nsDisplayScrollLayer::ComputeFrameMetrics(nsIFrame* aForFrame, // Only the root scrollable frame for a given presShell should pick up // the presShell's resolution. All the other frames are 1.0. if (aScrollFrame == presShell->GetRootScrollFrame()) { - metrics.mPresShellResolution = presShell->GetXResolution(); + metrics.SetPresShellResolution(presShell->GetXResolution()); } else { - metrics.mPresShellResolution = 1.0f; + metrics.SetPresShellResolution(1.0f); } // The cumulative resolution is the resolution at which the scroll frame's // content is actually rendered. It includes the pres shell resolutions of diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 1f64bc2f2ba2..a474eff5d9aa 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -2818,7 +2818,7 @@ CalculateFrameMetricsForDisplayPort(nsIScrollableFrame* aScrollFrame) { LayerToParentLayerScale layerToParentLayerScale(1.0f); metrics.SetDevPixelsPerCSSPixel(deviceScale); - metrics.mPresShellResolution = resolution; + metrics.SetPresShellResolution(resolution); metrics.SetCumulativeResolution(cumulativeResolution); metrics.SetZoom(deviceScale * cumulativeResolution * layerToParentLayerScale);