зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1120203 - Transitioning mPresShellResolution field of FrameMetrics to use getters/setters. r=kats
This commit is contained in:
Родитель
307c807855
Коммит
98a481bdeb
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
//
|
||||
|
|
|
@ -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)",
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче