зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1160566 - Make FrameMetrics.mCompositionBounds private and add a getter/setter for it. r=botond
This commit is contained in:
Родитель
1b70cf8a52
Коммит
e237a366e0
|
@ -195,9 +195,9 @@ TabChildBase::InitializeRootMetrics()
|
|||
// be keeping, as well as putting the scroll offset back to
|
||||
// the top-left of the page.
|
||||
mLastRootMetrics.SetViewport(CSSRect(CSSPoint(), kDefaultViewportSize));
|
||||
mLastRootMetrics.mCompositionBounds = ParentLayerRect(
|
||||
mLastRootMetrics.SetCompositionBounds(ParentLayerRect(
|
||||
ParentLayerPoint(),
|
||||
ParentLayerSize(ViewAs<ParentLayerPixel>(mInnerSize, PixelCastJustification::ScreenIsParentLayerForRoot)));
|
||||
ParentLayerSize(ViewAs<ParentLayerPixel>(mInnerSize, PixelCastJustification::ScreenIsParentLayerForRoot))));
|
||||
mLastRootMetrics.SetZoom(CSSToParentLayerScale2D(mLastRootMetrics.CalculateIntrinsicScale()));
|
||||
mLastRootMetrics.SetDevPixelsPerCSSPixel(WebWidget()->GetDefaultScale());
|
||||
// We use ParentLayerToLayerScale(1) below in order to turn the
|
||||
|
@ -336,9 +336,9 @@ TabChildBase::HandlePossibleViewportChange(const ScreenIntSize& aOldScreenSize)
|
|||
|
||||
FrameMetrics metrics(mLastRootMetrics);
|
||||
metrics.SetViewport(CSSRect(CSSPoint(), viewport));
|
||||
metrics.mCompositionBounds = ParentLayerRect(
|
||||
metrics.SetCompositionBounds(ParentLayerRect(
|
||||
ParentLayerPoint(),
|
||||
ParentLayerSize(ViewAs<ParentLayerPixel>(mInnerSize, PixelCastJustification::ScreenIsParentLayerForRoot)));
|
||||
ParentLayerSize(ViewAs<ParentLayerPixel>(mInnerSize, PixelCastJustification::ScreenIsParentLayerForRoot))));
|
||||
metrics.SetRootCompositionSize(
|
||||
ScreenSize(mInnerSize) * ScreenToLayoutDeviceScale(1.0f) / metrics.GetDevPixelsPerCSSPixel());
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ public:
|
|||
static const FrameMetrics sNullMetrics; // We often need an empty metrics
|
||||
|
||||
FrameMetrics()
|
||||
: mCompositionBounds(0, 0, 0, 0)
|
||||
, mPresShellResolution(1)
|
||||
: mPresShellResolution(1)
|
||||
, mCompositionBounds(0, 0, 0, 0)
|
||||
, mDisplayPort(0, 0, 0, 0)
|
||||
, mCriticalDisplayPort(0, 0, 0, 0)
|
||||
, mScrollableRect(0, 0, 0, 0)
|
||||
|
@ -239,27 +239,6 @@ public:
|
|||
return copy;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// The following metrics are all in widget space/device pixels.
|
||||
//
|
||||
|
||||
// This is the area within the widget that we're compositing to. It is in the
|
||||
// same coordinate space as the reference frame for the scrolled frame.
|
||||
//
|
||||
// This is useful because, on mobile, the viewport and composition dimensions
|
||||
// are not always the same. In this case, we calculate the displayport using
|
||||
// an area bigger than the region we're compositing to. If we used the
|
||||
// viewport dimensions to calculate the displayport, we'd run into situations
|
||||
// where we're prerendering the wrong regions and the content may be clipped,
|
||||
// or too much of it prerendered. If the composition dimensions are the same as the
|
||||
// viewport dimensions, there is no need for this and we can just use the viewport
|
||||
// instead.
|
||||
//
|
||||
// This value is valid for nested scrollable layers as well, and is still
|
||||
// relative to the layer tree origin. This value is provided by Gecko at
|
||||
// layout/paint time.
|
||||
ParentLayerRect mCompositionBounds;
|
||||
|
||||
public:
|
||||
void SetPresShellResolution(float aPresShellResolution)
|
||||
{
|
||||
|
@ -271,6 +250,16 @@ public:
|
|||
return mPresShellResolution;
|
||||
}
|
||||
|
||||
void SetCompositionBounds(const ParentLayerRect& aCompositionBounds)
|
||||
{
|
||||
mCompositionBounds = aCompositionBounds;
|
||||
}
|
||||
|
||||
const ParentLayerRect& GetCompositionBounds() const
|
||||
{
|
||||
return mCompositionBounds;
|
||||
}
|
||||
|
||||
void SetDisplayPort(const CSSRect& aDisplayPort)
|
||||
{
|
||||
mDisplayPort = aDisplayPort;
|
||||
|
@ -539,6 +528,23 @@ private:
|
|||
// it does not convert between any coordinate spaces for which we have names.
|
||||
float mPresShellResolution;
|
||||
|
||||
// This is the area within the widget that we're compositing to. It is in the
|
||||
// same coordinate space as the reference frame for the scrolled frame.
|
||||
//
|
||||
// This is useful because, on mobile, the viewport and composition dimensions
|
||||
// are not always the same. In this case, we calculate the displayport using
|
||||
// an area bigger than the region we're compositing to. If we used the
|
||||
// viewport dimensions to calculate the displayport, we'd run into situations
|
||||
// where we're prerendering the wrong regions and the content may be clipped,
|
||||
// or too much of it prerendered. If the composition dimensions are the same
|
||||
// as the viewport dimensions, there is no need for this and we can just use
|
||||
// the viewport instead.
|
||||
//
|
||||
// This value is valid for nested scrollable layers as well, and is still
|
||||
// relative to the layer tree origin. This value is provided by Gecko at
|
||||
// layout/paint time.
|
||||
ParentLayerRect mCompositionBounds;
|
||||
|
||||
// The area of a frame's contents that has been painted, relative to
|
||||
// mCompositionBounds.
|
||||
//
|
||||
|
|
|
@ -169,7 +169,7 @@ AppendToString(std::stringstream& aStream, const FrameMetrics& m,
|
|||
const char* pfx, const char* sfx, bool detailed)
|
||||
{
|
||||
aStream << pfx;
|
||||
AppendToString(aStream, m.mCompositionBounds, "{ [cb=");
|
||||
AppendToString(aStream, m.GetCompositionBounds(), "{ [cb=");
|
||||
AppendToString(aStream, m.GetScrollableRect(), "] [sr=");
|
||||
AppendToString(aStream, m.GetScrollOffset(), "] [s=");
|
||||
if (m.GetDoSmoothScroll()) {
|
||||
|
|
|
@ -209,7 +209,7 @@ ComputeClipRegion(GeckoContentController* aController,
|
|||
// root scrollable layer in a process, or for some of the LayerMetrics
|
||||
// expansions of a multi-metrics layer), fall back to using the comp
|
||||
// bounds which should be equivalent.
|
||||
clipRegion = RoundedToInt(aLayer.Metrics().mCompositionBounds);
|
||||
clipRegion = RoundedToInt(aLayer.Metrics().GetCompositionBounds());
|
||||
}
|
||||
|
||||
// Optionally, the GeckoContentController can provide a touch-sensitive
|
||||
|
@ -244,7 +244,8 @@ APZCTreeManager::PrintAPZCInfo(const LayerMetricsWrapper& aLayer,
|
|||
const AsyncPanZoomController* apzc)
|
||||
{
|
||||
const FrameMetrics& metrics = aLayer.Metrics();
|
||||
mApzcTreeLog << "APZC " << apzc->GetGuid() << "\tcb=" << metrics.mCompositionBounds
|
||||
mApzcTreeLog << "APZC " << apzc->GetGuid()
|
||||
<< "\tcb=" << metrics.GetCompositionBounds()
|
||||
<< "\tsr=" << metrics.GetScrollableRect()
|
||||
<< (aLayer.IsScrollInfoLayer() ? "\tscrollinfo" : "")
|
||||
<< (apzc->HasScrollgrab() ? "\tscrollgrab" : "") << "\t"
|
||||
|
@ -272,7 +273,7 @@ GetEventRegions(const LayerMetricsWrapper& aLayer)
|
|||
{
|
||||
if (aLayer.IsScrollInfoLayer()) {
|
||||
return EventRegions(nsIntRegion(ParentLayerIntRect::ToUntyped(
|
||||
RoundedToInt(aLayer.Metrics().mCompositionBounds))));
|
||||
RoundedToInt(aLayer.Metrics().GetCompositionBounds()))));
|
||||
}
|
||||
return aLayer.GetEventRegions();
|
||||
}
|
||||
|
|
|
@ -1273,7 +1273,7 @@ nsEventStatus AsyncPanZoomController::OnScaleBegin(const PinchGestureInput& aEve
|
|||
SetState(PINCHING);
|
||||
mX.SetVelocity(0);
|
||||
mY.SetVelocity(0);
|
||||
mLastZoomFocus = aEvent.mLocalFocusPoint - mFrameMetrics.mCompositionBounds.TopLeft();
|
||||
mLastZoomFocus = aEvent.mLocalFocusPoint - mFrameMetrics.GetCompositionBounds().TopLeft();
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
@ -1309,7 +1309,7 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
|
|||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
|
||||
CSSToParentLayerScale userZoom = mFrameMetrics.GetZoom().ToScaleFactor();
|
||||
ParentLayerPoint focusPoint = aEvent.mLocalFocusPoint - mFrameMetrics.mCompositionBounds.TopLeft();
|
||||
ParentLayerPoint focusPoint = aEvent.mLocalFocusPoint - mFrameMetrics.GetCompositionBounds().TopLeft();
|
||||
CSSPoint cssFocusPoint = focusPoint / mFrameMetrics.GetZoom();
|
||||
|
||||
CSSPoint focusChange = (mLastZoomFocus - focusPoint) / userZoom;
|
||||
|
@ -1327,9 +1327,9 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
|
|||
CSSToParentLayerScale realMinZoom = mZoomConstraints.mMinZoom;
|
||||
CSSToParentLayerScale realMaxZoom = mZoomConstraints.mMaxZoom;
|
||||
realMinZoom.scale = std::max(realMinZoom.scale,
|
||||
mFrameMetrics.mCompositionBounds.width / mFrameMetrics.GetScrollableRect().width);
|
||||
mFrameMetrics.GetCompositionBounds().width / mFrameMetrics.GetScrollableRect().width);
|
||||
realMinZoom.scale = std::max(realMinZoom.scale,
|
||||
mFrameMetrics.mCompositionBounds.height / mFrameMetrics.GetScrollableRect().height);
|
||||
mFrameMetrics.GetCompositionBounds().height / mFrameMetrics.GetScrollableRect().height);
|
||||
if (realMaxZoom < realMinZoom) {
|
||||
realMaxZoom = realMinZoom;
|
||||
}
|
||||
|
@ -1851,7 +1851,7 @@ bool AsyncPanZoomController::Contains(const ScreenIntPoint& aPoint) const
|
|||
ParentLayerIntRect cb;
|
||||
{
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
GetFrameMetrics().mCompositionBounds.ToIntRect(&cb);
|
||||
GetFrameMetrics().GetCompositionBounds().ToIntRect(&cb);
|
||||
}
|
||||
return cb.Contains(point);
|
||||
}
|
||||
|
@ -2810,8 +2810,8 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
|||
mPaintThrottler.TaskComplete(GetFrameTime());
|
||||
bool needContentRepaint = false;
|
||||
bool viewportUpdated = false;
|
||||
if (FuzzyEqualsAdditive(aLayerMetrics.mCompositionBounds.width, mFrameMetrics.mCompositionBounds.width) &&
|
||||
FuzzyEqualsAdditive(aLayerMetrics.mCompositionBounds.height, mFrameMetrics.mCompositionBounds.height)) {
|
||||
if (FuzzyEqualsAdditive(aLayerMetrics.GetCompositionBounds().width, mFrameMetrics.GetCompositionBounds().width) &&
|
||||
FuzzyEqualsAdditive(aLayerMetrics.GetCompositionBounds().height, mFrameMetrics.GetCompositionBounds().height)) {
|
||||
// Remote content has sync'd up to the composition geometry
|
||||
// change, so we can accept the viewport it's calculated.
|
||||
if (mFrameMetrics.GetViewport().width != aLayerMetrics.GetViewport().width ||
|
||||
|
@ -2857,7 +2857,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
|||
// in some things into our local mFrameMetrics because these things are
|
||||
// determined by Gecko and our copy in mFrameMetrics may be stale.
|
||||
|
||||
if (FuzzyEqualsAdditive(mFrameMetrics.mCompositionBounds.width, aLayerMetrics.mCompositionBounds.width) &&
|
||||
if (FuzzyEqualsAdditive(mFrameMetrics.GetCompositionBounds().width, aLayerMetrics.GetCompositionBounds().width) &&
|
||||
mFrameMetrics.GetDevPixelsPerCSSPixel() == aLayerMetrics.GetDevPixelsPerCSSPixel() &&
|
||||
!viewportUpdated) {
|
||||
// Any change to the pres shell resolution was requested by APZ and is
|
||||
|
@ -2883,7 +2883,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
|||
mFrameMetrics.SetScrollableRect(aLayerMetrics.GetScrollableRect());
|
||||
needContentRepaint = true;
|
||||
}
|
||||
mFrameMetrics.mCompositionBounds = aLayerMetrics.mCompositionBounds;
|
||||
mFrameMetrics.SetCompositionBounds(aLayerMetrics.GetCompositionBounds());
|
||||
mFrameMetrics.SetRootCompositionSize(aLayerMetrics.GetRootCompositionSize());
|
||||
mFrameMetrics.SetPresShellResolution(aLayerMetrics.GetPresShellResolution());
|
||||
mFrameMetrics.SetCumulativeResolution(aLayerMetrics.GetCumulativeResolution());
|
||||
|
@ -2986,7 +2986,7 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect) {
|
|||
{
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
|
||||
ParentLayerRect compositionBounds = mFrameMetrics.mCompositionBounds;
|
||||
ParentLayerRect compositionBounds = mFrameMetrics.GetCompositionBounds();
|
||||
CSSRect cssPageRect = mFrameMetrics.GetScrollableRect();
|
||||
CSSPoint scrollOffset = mFrameMetrics.GetScrollOffset();
|
||||
CSSToParentLayerScale currentZoom = mFrameMetrics.GetZoom().ToScaleFactor();
|
||||
|
|
|
@ -533,7 +533,7 @@ ParentLayerCoord Axis::GetOrigin() const {
|
|||
}
|
||||
|
||||
ParentLayerCoord Axis::GetCompositionLength() const {
|
||||
return GetRectLength(GetFrameMetrics().mCompositionBounds);
|
||||
return GetRectLength(GetFrameMetrics().GetCompositionBounds());
|
||||
}
|
||||
|
||||
ParentLayerCoord Axis::GetPageStart() const {
|
||||
|
@ -548,7 +548,7 @@ ParentLayerCoord Axis::GetPageLength() const {
|
|||
|
||||
bool Axis::ScaleWillOverscrollBothSides(float aScale) const {
|
||||
const FrameMetrics& metrics = GetFrameMetrics();
|
||||
ParentLayerRect screenCompositionBounds = metrics.mCompositionBounds
|
||||
ParentLayerRect screenCompositionBounds = metrics.GetCompositionBounds()
|
||||
/ ParentLayerToParentLayerScale(aScale);
|
||||
return GetRectLength(screenCompositionBounds) - GetPageLength() > COORDINATE_EPSILON;
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ ClientTiledPaintedLayer::BeginPaint()
|
|||
if (!hasTransformAnimation) {
|
||||
ParentLayerRect criticalDisplayPort =
|
||||
(displayportMetrics.GetCriticalDisplayPort() * displayportMetrics.GetZoom())
|
||||
+ displayportMetrics.mCompositionBounds.TopLeft();
|
||||
+ displayportMetrics.GetCompositionBounds().TopLeft();
|
||||
mPaintData.mCriticalDisplayPort = RoundedToInt(
|
||||
ApplyParentLayerToLayerTransform(transformDisplayPortToLayer, criticalDisplayPort));
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ ClientTiledPaintedLayer::BeginPaint()
|
|||
gfx::Matrix4x4 transformToBounds = mPaintData.mTransformToCompBounds;
|
||||
transformToBounds.Invert();
|
||||
mPaintData.mCompositionBounds = ApplyParentLayerToLayerTransform(
|
||||
transformToBounds, scrollMetrics.mCompositionBounds);
|
||||
transformToBounds, scrollMetrics.GetCompositionBounds());
|
||||
TILING_LOG("TILING %p: Composition bounds %s\n", this, Stringify(mPaintData.mCompositionBounds).c_str());
|
||||
|
||||
// Calculate the scroll offset since the last transaction
|
||||
|
|
|
@ -1350,7 +1350,7 @@ GetCompositorSideCompositionBounds(const LayerMetricsWrapper& aScrollAncestor,
|
|||
{
|
||||
Matrix4x4 transform = aTransformToCompBounds * Matrix4x4(aAPZTransform);
|
||||
return TransformTo<LayerPixel>(transform.Inverse(),
|
||||
aScrollAncestor.Metrics().mCompositionBounds);
|
||||
aScrollAncestor.Metrics().GetCompositionBounds());
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -642,7 +642,7 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer)
|
|||
ParentLayerRect transformed = TransformTo<ParentLayerPixel>(
|
||||
(Matrix4x4(asyncTransformWithoutOverscroll) * overscrollTransform),
|
||||
ParentLayerRect(*clipRect));
|
||||
clipRect = Some(RoundedOut(transformed.Intersect(metrics.mCompositionBounds)));
|
||||
clipRect = Some(RoundedOut(transformed.Intersect(metrics.GetCompositionBounds())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1010,28 +1010,28 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
|||
Point3D overscrollTranslation;
|
||||
if (userScroll.x < contentScreenRect.x) {
|
||||
overscrollTranslation.x = contentScreenRect.x - userScroll.x;
|
||||
} else if (userScroll.x + metrics.mCompositionBounds.width > contentScreenRect.XMost()) {
|
||||
} else if (userScroll.x + metrics.GetCompositionBounds().width > contentScreenRect.XMost()) {
|
||||
overscrollTranslation.x = contentScreenRect.XMost() -
|
||||
(userScroll.x + metrics.mCompositionBounds.width);
|
||||
(userScroll.x + metrics.GetCompositionBounds().width);
|
||||
}
|
||||
if (userScroll.y < contentScreenRect.y) {
|
||||
overscrollTranslation.y = contentScreenRect.y - userScroll.y;
|
||||
} else if (userScroll.y + metrics.mCompositionBounds.height > contentScreenRect.YMost()) {
|
||||
} else if (userScroll.y + metrics.GetCompositionBounds().height > contentScreenRect.YMost()) {
|
||||
overscrollTranslation.y = contentScreenRect.YMost() -
|
||||
(userScroll.y + metrics.mCompositionBounds.height);
|
||||
(userScroll.y + metrics.GetCompositionBounds().height);
|
||||
}
|
||||
oldTransform.PreTranslate(overscrollTranslation.x,
|
||||
overscrollTranslation.y,
|
||||
overscrollTranslation.z);
|
||||
|
||||
gfx::Size underZoomScale(1.0f, 1.0f);
|
||||
if (mContentRect.width * userZoom.scale < metrics.mCompositionBounds.width) {
|
||||
if (mContentRect.width * userZoom.scale < metrics.GetCompositionBounds().width) {
|
||||
underZoomScale.width = (mContentRect.width * userZoom.scale) /
|
||||
metrics.mCompositionBounds.width;
|
||||
metrics.GetCompositionBounds().width;
|
||||
}
|
||||
if (mContentRect.height * userZoom.scale < metrics.mCompositionBounds.height) {
|
||||
if (mContentRect.height * userZoom.scale < metrics.GetCompositionBounds().height) {
|
||||
underZoomScale.height = (mContentRect.height * userZoom.scale) /
|
||||
metrics.mCompositionBounds.height;
|
||||
metrics.GetCompositionBounds().height;
|
||||
}
|
||||
oldTransform.PreScale(underZoomScale.width, underZoomScale.height, 1);
|
||||
|
||||
|
|
|
@ -396,7 +396,7 @@ RenderLayers(ContainerT* aContainer,
|
|||
if (layer->GetFrameMetrics(i - 1).IsScrollable()) {
|
||||
// Since the composition bounds are in the parent layer's coordinates,
|
||||
// use the parent's effective transform rather than the layer's own.
|
||||
ParentLayerRect compositionBounds = layer->GetFrameMetrics(i - 1).mCompositionBounds;
|
||||
ParentLayerRect compositionBounds = layer->GetFrameMetrics(i - 1).GetCompositionBounds();
|
||||
aManager->GetCompositor()->DrawDiagnostics(DiagnosticFlags::CONTAINER,
|
||||
compositionBounds.ToUnknownRect(),
|
||||
gfx::Rect(aClipRect.ToUnknownRect()),
|
||||
|
|
|
@ -1075,7 +1075,7 @@ LayerManagerComposite::ComputeRenderIntegrity()
|
|||
// the root layer.
|
||||
rootMetrics = LayerMetricsWrapper(root).Metrics();
|
||||
}
|
||||
ParentLayerIntRect bounds = RoundedToInt(rootMetrics.mCompositionBounds);
|
||||
ParentLayerIntRect bounds = RoundedToInt(rootMetrics.GetCompositionBounds());
|
||||
IntRect screenRect(bounds.x,
|
||||
bounds.y,
|
||||
bounds.width,
|
||||
|
|
|
@ -227,7 +227,7 @@ TestFrameMetrics()
|
|||
FrameMetrics fm;
|
||||
|
||||
fm.SetDisplayPort(CSSRect(0, 0, 10, 10));
|
||||
fm.mCompositionBounds = ParentLayerRect(0, 0, 10, 10);
|
||||
fm.SetCompositionBounds(ParentLayerRect(0, 0, 10, 10));
|
||||
fm.SetCriticalDisplayPort(CSSRect(0, 0, 10, 10));
|
||||
fm.SetScrollableRect(CSSRect(0, 0, 100, 100));
|
||||
|
||||
|
@ -706,7 +706,7 @@ protected:
|
|||
FrameMetrics GetPinchableFrameMetrics()
|
||||
{
|
||||
FrameMetrics fm;
|
||||
fm.mCompositionBounds = ParentLayerRect(200, 200, 100, 200);
|
||||
fm.SetCompositionBounds(ParentLayerRect(200, 200, 100, 200));
|
||||
fm.SetScrollableRect(CSSRect(0, 0, 980, 1000));
|
||||
fm.SetScrollOffset(CSSPoint(300, 300));
|
||||
fm.SetZoom(CSSToParentLayerScale2D(2.0, 2.0));
|
||||
|
@ -852,7 +852,7 @@ TEST_F(APZCPinchGestureDetectorTester, Pinch_PreventDefault) {
|
|||
TEST_F(APZCBasicTester, Overzoom) {
|
||||
// the visible area of the document in CSS pixels is x=10 y=0 w=100 h=100
|
||||
FrameMetrics fm;
|
||||
fm.mCompositionBounds = ParentLayerRect(0, 0, 100, 100);
|
||||
fm.SetCompositionBounds(ParentLayerRect(0, 0, 100, 100));
|
||||
fm.SetScrollableRect(CSSRect(0, 0, 125, 150));
|
||||
fm.SetScrollOffset(CSSPoint(10, 0));
|
||||
fm.SetZoom(CSSToParentLayerScale2D(1.0, 1.0));
|
||||
|
@ -920,7 +920,7 @@ TEST_F(APZCBasicTester, ComplexTransform) {
|
|||
nsRefPtr<Layer> root = CreateLayerTree(layerTreeSyntax, layerVisibleRegion, transforms, lm, layers);
|
||||
|
||||
FrameMetrics metrics;
|
||||
metrics.mCompositionBounds = ParentLayerRect(0, 0, 24, 24);
|
||||
metrics.SetCompositionBounds(ParentLayerRect(0, 0, 24, 24));
|
||||
metrics.SetDisplayPort(CSSRect(-1, -1, 6, 6));
|
||||
metrics.SetScrollOffset(CSSPoint(10, 10));
|
||||
metrics.SetScrollableRect(CSSRect(0, 0, 50, 50));
|
||||
|
@ -1866,8 +1866,8 @@ protected:
|
|||
FrameMetrics metrics;
|
||||
metrics.SetScrollId(aScrollId);
|
||||
IntRect layerBound = aLayer->GetVisibleRegion().GetBounds();
|
||||
metrics.mCompositionBounds = ParentLayerRect(layerBound.x, layerBound.y,
|
||||
layerBound.width, layerBound.height);
|
||||
metrics.SetCompositionBounds(ParentLayerRect(layerBound.x, layerBound.y,
|
||||
layerBound.width, layerBound.height));
|
||||
metrics.SetScrollableRect(aScrollableRect);
|
||||
metrics.SetScrollOffset(CSSPoint(0, 0));
|
||||
aLayer->SetFrameMetrics(metrics);
|
||||
|
|
|
@ -2909,10 +2909,10 @@ CalculateFrameMetricsForDisplayPort(nsIScrollableFrame* aScrollFrame) {
|
|||
} else {
|
||||
compBoundsScale = cumulativeResolution * layerToParentLayerScale;
|
||||
}
|
||||
metrics.mCompositionBounds
|
||||
= LayoutDeviceRect::FromAppUnits(nsRect(nsPoint(0, 0), compositionSize),
|
||||
metrics.SetCompositionBounds(
|
||||
LayoutDeviceRect::FromAppUnits(nsRect(nsPoint(0, 0), compositionSize),
|
||||
presContext->AppUnitsPerDevPixel())
|
||||
* compBoundsScale;
|
||||
* compBoundsScale);
|
||||
|
||||
metrics.SetRootCompositionSize(
|
||||
nsLayoutUtils::CalculateRootCompositionSize(frame, false, metrics));
|
||||
|
@ -7720,7 +7720,7 @@ nsLayoutUtils::CalculateRootCompositionSize(nsIFrame* aFrame,
|
|||
{
|
||||
|
||||
if (aIsRootContentDocRootScrollFrame) {
|
||||
return ViewAs<LayerPixel>(aMetrics.mCompositionBounds.Size(),
|
||||
return ViewAs<LayerPixel>(aMetrics.GetCompositionBounds().Size(),
|
||||
PixelCastJustification::ParentLayerToLayerForRootComposition)
|
||||
* LayerToScreenScale(1.0f)
|
||||
/ aMetrics.DisplayportPixelsPerCSSPixel();
|
||||
|
@ -8271,7 +8271,6 @@ nsLayoutUtils::ComputeFrameMetrics(nsIFrame* aForFrame,
|
|||
ParentLayerRect frameBounds = LayoutDeviceRect::FromAppUnits(compositionBounds, auPerDevPixel)
|
||||
* metrics.GetCumulativeResolution()
|
||||
* layerToParentLayerScale;
|
||||
metrics.mCompositionBounds = frameBounds;
|
||||
|
||||
// For the root scroll frame of the root content document (RCD-RSF), the above calculation
|
||||
// will yield the size of the viewport frame as the composition bounds, which
|
||||
|
@ -8285,7 +8284,7 @@ nsLayoutUtils::ComputeFrameMetrics(nsIFrame* aForFrame,
|
|||
bool isRootContentDocRootScrollFrame = isRootScrollFrame
|
||||
&& presContext->IsRootContentDocument();
|
||||
if (isRootContentDocRootScrollFrame) {
|
||||
UpdateCompositionBoundsForRCDRSF(metrics.mCompositionBounds, presContext,
|
||||
UpdateCompositionBoundsForRCDRSF(frameBounds, presContext,
|
||||
compositionBounds, true, metrics.GetCumulativeResolution());
|
||||
}
|
||||
|
||||
|
@ -8294,9 +8293,11 @@ nsLayoutUtils::ComputeFrameMetrics(nsIFrame* aForFrame,
|
|||
nsMargin sizes = scrollableFrame->GetActualScrollbarSizes();
|
||||
// Scrollbars are not subject to scaling, so CSS pixels = layer pixels for them.
|
||||
ParentLayerMargin boundMargins = CSSMargin::FromAppUnits(sizes) * CSSToParentLayerScale(1.0f);
|
||||
metrics.mCompositionBounds.Deflate(boundMargins);
|
||||
frameBounds.Deflate(boundMargins);
|
||||
}
|
||||
|
||||
metrics.SetCompositionBounds(frameBounds);
|
||||
|
||||
metrics.SetRootCompositionSize(
|
||||
nsLayoutUtils::CalculateRootCompositionSize(aScrollFrame ? aScrollFrame : aForFrame,
|
||||
isRootContentDocRootScrollFrame, metrics));
|
||||
|
|
Загрузка…
Ссылка в новой задаче