зеркало из https://github.com/mozilla/gecko-dev.git
Bug 980493 - Transition FrameMetrics::mScrollOffset to use a getter/setter. r=kats
This commit is contained in:
Родитель
50520fcec3
Коммит
fb8f0cf40a
|
@ -330,7 +330,7 @@ TabChild::InitializeRootMetrics()
|
|||
// This is the root layer, so the cumulative resolution is the same
|
||||
// as the resolution.
|
||||
mLastRootMetrics.mResolution = mLastRootMetrics.mCumulativeResolution / LayoutDeviceToParentLayerScale(1);
|
||||
mLastRootMetrics.mScrollOffset = CSSPoint(0, 0);
|
||||
mLastRootMetrics.SetScrollOffset(CSSPoint(0, 0));
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1526,8 +1526,8 @@ TabChild::ProcessUpdateFrame(const FrameMetrics& aFrameMetrics)
|
|||
// for other functions it performs, such as double tap handling.
|
||||
// Note, %f must not be used because it is locale specific!
|
||||
nsCString data;
|
||||
data.AppendPrintf("{ \"x\" : %d", NS_lround(newMetrics.mScrollOffset.x));
|
||||
data.AppendPrintf(", \"y\" : %d", NS_lround(newMetrics.mScrollOffset.y));
|
||||
data.AppendPrintf("{ \"x\" : %d", NS_lround(newMetrics.GetScrollOffset().x));
|
||||
data.AppendPrintf(", \"y\" : %d", NS_lround(newMetrics.GetScrollOffset().y));
|
||||
data.AppendLiteral(", \"viewport\" : ");
|
||||
data.AppendLiteral("{ \"width\" : ");
|
||||
data.AppendFloat(newMetrics.mViewport.width);
|
||||
|
|
|
@ -71,7 +71,6 @@ public:
|
|||
, mDisplayPort(0, 0, 0, 0)
|
||||
, mCriticalDisplayPort(0, 0, 0, 0)
|
||||
, mViewport(0, 0, 0, 0)
|
||||
, mScrollOffset(0, 0)
|
||||
, mScrollId(NULL_SCROLL_ID)
|
||||
, mScrollableRect(0, 0, 0, 0)
|
||||
, mResolution(1)
|
||||
|
@ -83,6 +82,7 @@ public:
|
|||
, mMayHaveTouchListeners(false)
|
||||
, mIsRoot(false)
|
||||
, mHasScrollgrab(false)
|
||||
, mScrollOffset(0, 0)
|
||||
, mUpdateScrollOffset(false)
|
||||
, mScrollGeneration(0)
|
||||
{}
|
||||
|
@ -97,7 +97,6 @@ public:
|
|||
mDisplayPort.IsEqualEdges(aOther.mDisplayPort) &&
|
||||
mCriticalDisplayPort.IsEqualEdges(aOther.mCriticalDisplayPort) &&
|
||||
mViewport.IsEqualEdges(aOther.mViewport) &&
|
||||
mScrollOffset == aOther.mScrollOffset &&
|
||||
mScrollId == aOther.mScrollId &&
|
||||
mScrollableRect.IsEqualEdges(aOther.mScrollableRect) &&
|
||||
mResolution == aOther.mResolution &&
|
||||
|
@ -106,6 +105,7 @@ public:
|
|||
mMayHaveTouchListeners == aOther.mMayHaveTouchListeners &&
|
||||
mPresShellId == aOther.mPresShellId &&
|
||||
mIsRoot == aOther.mIsRoot &&
|
||||
mScrollOffset == aOther.mScrollOffset &&
|
||||
mHasScrollgrab == aOther.mHasScrollgrab &&
|
||||
mUpdateScrollOffset == aOther.mUpdateScrollOffset;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public:
|
|||
|
||||
LayerPoint GetScrollOffsetInLayerPixels() const
|
||||
{
|
||||
return mScrollOffset * LayersPixelsPerCSSPixel();
|
||||
return GetScrollOffset() * LayersPixelsPerCSSPixel();
|
||||
}
|
||||
|
||||
LayoutDeviceToParentLayerScale GetParentResolution() const
|
||||
|
@ -194,6 +194,11 @@ public:
|
|||
return gfx::RoundedIn(mCompositionBounds / GetZoomToParent());
|
||||
}
|
||||
|
||||
void ScrollBy(const CSSPoint& aPoint)
|
||||
{
|
||||
mScrollOffset += aPoint;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// The following metrics are all in widget space/device pixels.
|
||||
//
|
||||
|
@ -258,23 +263,6 @@ public:
|
|||
// meaningless and invalid.
|
||||
CSSRect mViewport;
|
||||
|
||||
// The position of the top-left of the CSS viewport, relative to the document
|
||||
// (or the document relative to the viewport, if that helps understand it).
|
||||
//
|
||||
// Thus it is relative to the document. It is in the same coordinate space as
|
||||
// |mScrollableRect|, but a different coordinate space than |mViewport| and
|
||||
// |mDisplayPort|.
|
||||
//
|
||||
// It is required that the rect:
|
||||
// { x = mScrollOffset.x, y = mScrollOffset.y,
|
||||
// width = mCompositionBounds.x / mResolution.scale,
|
||||
// height = mCompositionBounds.y / mResolution.scale }
|
||||
// Be within |mScrollableRect|.
|
||||
//
|
||||
// This is valid for any layer, but is always relative to this frame and
|
||||
// not any parents, regardless of parent transforms.
|
||||
CSSPoint mScrollOffset;
|
||||
|
||||
// A unique ID assigned to each scrollable frame.
|
||||
ViewID mScrollId;
|
||||
|
||||
|
@ -340,6 +328,16 @@ public:
|
|||
bool mHasScrollgrab;
|
||||
|
||||
public:
|
||||
void SetScrollOffset(const CSSPoint& aScrollOffset)
|
||||
{
|
||||
mScrollOffset = aScrollOffset;
|
||||
}
|
||||
|
||||
const CSSPoint& GetScrollOffset() const
|
||||
{
|
||||
return mScrollOffset;
|
||||
}
|
||||
|
||||
void SetScrollOffsetUpdated(uint32_t aScrollGeneration)
|
||||
{
|
||||
mUpdateScrollOffset = true;
|
||||
|
@ -370,6 +368,23 @@ private:
|
|||
// New fields from now on should be made private and old fields should
|
||||
// be refactored to be private.
|
||||
|
||||
// The position of the top-left of the CSS viewport, relative to the document
|
||||
// (or the document relative to the viewport, if that helps understand it).
|
||||
//
|
||||
// Thus it is relative to the document. It is in the same coordinate space as
|
||||
// |mScrollableRect|, but a different coordinate space than |mViewport| and
|
||||
// |mDisplayPort|.
|
||||
//
|
||||
// It is required that the rect:
|
||||
// { x = mScrollOffset.x, y = mScrollOffset.y,
|
||||
// width = mCompositionBounds.x / mResolution.scale,
|
||||
// height = mCompositionBounds.y / mResolution.scale }
|
||||
// Be within |mScrollableRect|.
|
||||
//
|
||||
// This is valid for any layer, but is always relative to this frame and
|
||||
// not any parents, regardless of parent transforms.
|
||||
CSSPoint mScrollOffset;
|
||||
|
||||
// Whether mScrollOffset was updated by something other than the APZ code, and
|
||||
// if the APZC receiving this metrics should update its local copy.
|
||||
bool mUpdateScrollOffset;
|
||||
|
|
|
@ -118,7 +118,7 @@ AppendToString(nsACString& s, const FrameMetrics& m,
|
|||
{
|
||||
s += pfx;
|
||||
AppendToString(s, m.mViewport, "{ viewport=");
|
||||
AppendToString(s, m.mScrollOffset, " viewportScroll=");
|
||||
AppendToString(s, m.GetScrollOffset(), " viewportScroll=");
|
||||
AppendToString(s, m.mDisplayPort, " displayport=");
|
||||
AppendToString(s, m.mScrollableRect, " scrollableRect=");
|
||||
AppendToString(s, m.mScrollId, " scrollId=", " }");
|
||||
|
|
|
@ -549,7 +549,7 @@ ClientLayerManager::ProgressiveUpdateCallback(bool aHasPendingNewThebesContent,
|
|||
const CSSRect& metricsDisplayPort =
|
||||
(aDrawingCritical && !metrics.mCriticalDisplayPort.IsEmpty()) ?
|
||||
metrics.mCriticalDisplayPort : metrics.mDisplayPort;
|
||||
LayerRect displayPort = (metricsDisplayPort + metrics.mScrollOffset) * paintScale;
|
||||
LayerRect displayPort = (metricsDisplayPort + metrics.GetScrollOffset()) * paintScale;
|
||||
|
||||
return AndroidBridge::Bridge()->ProgressiveUpdateCallback(
|
||||
aHasPendingNewThebesContent, displayPort, paintScale.scale, aDrawingCritical,
|
||||
|
|
|
@ -129,7 +129,7 @@ ClientTiledThebesLayer::BeginPaint()
|
|||
Layer* primaryScrollable = ClientManager()->GetPrimaryScrollableLayer();
|
||||
if (primaryScrollable) {
|
||||
const FrameMetrics& metrics = primaryScrollable->AsContainerLayer()->GetFrameMetrics();
|
||||
mPaintData.mScrollOffset = metrics.mScrollOffset * metrics.mZoom;
|
||||
mPaintData.mScrollOffset = metrics.GetScrollOffset() * metrics.mZoom;
|
||||
mPaintData.mCompositionBounds =
|
||||
ApplyParentLayerToLayoutTransform(mPaintData.mTransformParentLayerToLayout,
|
||||
ParentLayerRect(metrics.mCompositionBounds));
|
||||
|
|
|
@ -341,7 +341,7 @@ SimpleClientTiledThebesLayer::BeginPaint()
|
|||
Layer* primaryScrollable = ClientManager()->GetPrimaryScrollableLayer();
|
||||
if (primaryScrollable) {
|
||||
const FrameMetrics& metrics = primaryScrollable->AsContainerLayer()->GetFrameMetrics();
|
||||
mPaintData.mScrollOffset = metrics.mScrollOffset * metrics.mZoom;
|
||||
mPaintData.mScrollOffset = metrics.GetScrollOffset() * metrics.mZoom;
|
||||
mPaintData.mCompositionBounds =
|
||||
ApplyParentLayerToLayoutTransform(mPaintData.mTransformParentLayerToLayout,
|
||||
ParentLayerRect(metrics.mCompositionBounds));
|
||||
|
|
|
@ -186,8 +186,8 @@ SharedFrameMetricsHelper::UpdateFromCompositorFrameMetrics(
|
|||
// display-port. If we abort updating when we shouldn't, we can end up
|
||||
// with blank regions on the screen and we open up the risk of entering
|
||||
// an endless updating cycle.
|
||||
if (fabsf(contentMetrics.mScrollOffset.x - compositorMetrics.mScrollOffset.x) <= 2 &&
|
||||
fabsf(contentMetrics.mScrollOffset.y - compositorMetrics.mScrollOffset.y) <= 2 &&
|
||||
if (fabsf(contentMetrics.GetScrollOffset().x - compositorMetrics.GetScrollOffset().x) <= 2 &&
|
||||
fabsf(contentMetrics.GetScrollOffset().y - compositorMetrics.GetScrollOffset().y) <= 2 &&
|
||||
fabsf(contentMetrics.mDisplayPort.x - compositorMetrics.mDisplayPort.x) <= 2 &&
|
||||
fabsf(contentMetrics.mDisplayPort.y - compositorMetrics.mDisplayPort.y) <= 2 &&
|
||||
fabsf(contentMetrics.mDisplayPort.width - compositorMetrics.mDisplayPort.width) <= 2 &&
|
||||
|
@ -241,7 +241,7 @@ bool
|
|||
SharedFrameMetricsHelper::AboutToCheckerboard(const FrameMetrics& aContentMetrics,
|
||||
const FrameMetrics& aCompositorMetrics)
|
||||
{
|
||||
return !aContentMetrics.mDisplayPort.Contains(CSSRect(aCompositorMetrics.CalculateCompositedRectInCssPixels()) - aCompositorMetrics.mScrollOffset);
|
||||
return !aContentMetrics.mDisplayPort.Contains(CSSRect(aCompositorMetrics.CalculateCompositedRectInCssPixels()) - aCompositorMetrics.GetScrollOffset());
|
||||
}
|
||||
|
||||
ClientTiledLayerBuffer::ClientTiledLayerBuffer(ClientTiledThebesLayer* aThebesLayer,
|
||||
|
|
|
@ -662,7 +662,7 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
|||
|
||||
CSSToLayerScale geckoZoom = metrics.LayersPixelsPerCSSPixel();
|
||||
|
||||
LayerIntPoint scrollOffsetLayerPixels = RoundedToInt(metrics.mScrollOffset * geckoZoom);
|
||||
LayerIntPoint scrollOffsetLayerPixels = RoundedToInt(metrics.GetScrollOffset() * geckoZoom);
|
||||
|
||||
if (mIsFirstPaint) {
|
||||
mContentRect = metrics.mScrollableRect;
|
||||
|
@ -694,7 +694,7 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
|||
// however, we can assume there is no async zooming in progress and so the following statement
|
||||
// works fine.
|
||||
CSSToScreenScale userZoom(metrics.mDevPixelsPerCSSPixel * metrics.mCumulativeResolution * LayerToScreenScale(1));
|
||||
ScreenPoint userScroll = metrics.mScrollOffset * userZoom;
|
||||
ScreenPoint userScroll = metrics.GetScrollOffset() * userZoom;
|
||||
SyncViewportInfo(displayPort, geckoZoom, mLayersUpdated,
|
||||
userScroll, userZoom, fixedLayerMargins,
|
||||
offset);
|
||||
|
@ -713,7 +713,7 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
|||
|
||||
LayerPoint geckoScroll(0, 0);
|
||||
if (metrics.IsScrollable()) {
|
||||
geckoScroll = metrics.mScrollOffset * geckoZoom;
|
||||
geckoScroll = metrics.GetScrollOffset() * geckoZoom;
|
||||
}
|
||||
|
||||
LayerPoint translation = (userScroll / zoomAdjust) - geckoScroll;
|
||||
|
|
|
@ -686,8 +686,8 @@ LayerManagerComposite::ComputeRenderIntegrity()
|
|||
|
||||
// Clip the screen rect to the document bounds
|
||||
gfxRect documentBounds =
|
||||
transform.TransformBounds(gfxRect(metrics.mScrollableRect.x - metrics.mScrollOffset.x,
|
||||
metrics.mScrollableRect.y - metrics.mScrollOffset.y,
|
||||
transform.TransformBounds(gfxRect(metrics.mScrollableRect.x - metrics.GetScrollOffset().x,
|
||||
metrics.mScrollableRect.y - metrics.GetScrollOffset().y,
|
||||
metrics.mScrollableRect.width,
|
||||
metrics.mScrollableRect.height));
|
||||
documentBounds.RoundOut();
|
||||
|
|
|
@ -1286,10 +1286,10 @@ bool FlingAnimation::Sample(FrameMetrics& aFrameMetrics,
|
|||
// the same swipe should move you a shorter distance).
|
||||
CSSPoint cssOffset = offset / aFrameMetrics.mZoom;
|
||||
CSSPoint overscroll;
|
||||
aFrameMetrics.mScrollOffset += CSSPoint(
|
||||
aFrameMetrics.ScrollBy(CSSPoint(
|
||||
mApzc.mX.AdjustDisplacement(cssOffset.x, overscroll.x),
|
||||
mApzc.mY.AdjustDisplacement(cssOffset.y, overscroll.y)
|
||||
);
|
||||
));
|
||||
|
||||
// If the fling has caused us to reach the end of our scroll range, hand
|
||||
// off the fling to the next APZC in the overscroll handoff chain.
|
||||
|
@ -1351,7 +1351,7 @@ void AsyncPanZoomController::SetCrossProcessCompositorParent(PCompositorParent*
|
|||
}
|
||||
|
||||
void AsyncPanZoomController::ScrollBy(const CSSPoint& aOffset) {
|
||||
mFrameMetrics.mScrollOffset += aOffset;
|
||||
mFrameMetrics.ScrollBy(aOffset);
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::ScaleWithFocus(float aScale,
|
||||
|
@ -1361,7 +1361,7 @@ void AsyncPanZoomController::ScaleWithFocus(float aScale,
|
|||
// at the same position on the screen before and after the change in zoom. The below code
|
||||
// accomplishes this; see https://bugzilla.mozilla.org/show_bug.cgi?id=923431#c6 for an
|
||||
// in-depth explanation of how.
|
||||
mFrameMetrics.mScrollOffset = (mFrameMetrics.mScrollOffset + aFocus) - (aFocus / aScale);
|
||||
mFrameMetrics.SetScrollOffset((mFrameMetrics.GetScrollOffset() + aFocus) - (aFocus / aScale));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1415,7 +1415,7 @@ const CSSRect AsyncPanZoomController::CalculatePendingDisplayPort(
|
|||
{
|
||||
CSSRect compositionBounds(aFrameMetrics.CalculateCompositedRectInCssPixels());
|
||||
CSSPoint velocity = aVelocity / aFrameMetrics.mZoom;
|
||||
CSSPoint scrollOffset = aFrameMetrics.mScrollOffset;
|
||||
CSSPoint scrollOffset = aFrameMetrics.GetScrollOffset();
|
||||
CSSRect scrollableRect = aFrameMetrics.GetExpandedScrollableRect();
|
||||
|
||||
// Calculate the displayport size based on how fast we're moving along each axis.
|
||||
|
@ -1472,18 +1472,18 @@ void AsyncPanZoomController::RequestContentRepaint(FrameMetrics& aFrameMetrics)
|
|||
// If we're trying to paint what we already think is painted, discard this
|
||||
// request since it's a pointless paint.
|
||||
CSSRect oldDisplayPort = mLastPaintRequestMetrics.mDisplayPort
|
||||
+ mLastPaintRequestMetrics.mScrollOffset;
|
||||
+ mLastPaintRequestMetrics.GetScrollOffset();
|
||||
CSSRect newDisplayPort = aFrameMetrics.mDisplayPort
|
||||
+ aFrameMetrics.mScrollOffset;
|
||||
+ aFrameMetrics.GetScrollOffset();
|
||||
|
||||
if (fabsf(oldDisplayPort.x - newDisplayPort.x) < EPSILON &&
|
||||
fabsf(oldDisplayPort.y - newDisplayPort.y) < EPSILON &&
|
||||
fabsf(oldDisplayPort.width - newDisplayPort.width) < EPSILON &&
|
||||
fabsf(oldDisplayPort.height - newDisplayPort.height) < EPSILON &&
|
||||
fabsf(mLastPaintRequestMetrics.mScrollOffset.x -
|
||||
aFrameMetrics.mScrollOffset.x) < EPSILON &&
|
||||
fabsf(mLastPaintRequestMetrics.mScrollOffset.y -
|
||||
aFrameMetrics.mScrollOffset.y) < EPSILON &&
|
||||
fabsf(mLastPaintRequestMetrics.GetScrollOffset().x -
|
||||
aFrameMetrics.GetScrollOffset().x) < EPSILON &&
|
||||
fabsf(mLastPaintRequestMetrics.GetScrollOffset().y -
|
||||
aFrameMetrics.GetScrollOffset().y) < EPSILON &&
|
||||
aFrameMetrics.mZoom == mLastPaintRequestMetrics.mZoom &&
|
||||
fabsf(aFrameMetrics.mViewport.width - mLastPaintRequestMetrics.mViewport.width) < EPSILON &&
|
||||
fabsf(aFrameMetrics.mViewport.height - mLastPaintRequestMetrics.mViewport.height) < EPSILON) {
|
||||
|
@ -1509,7 +1509,7 @@ AsyncPanZoomController::DispatchRepaintRequest(const FrameMetrics& aFrameMetrics
|
|||
APZC_LOG_FM(aFrameMetrics, "%p requesting content repaint", this);
|
||||
|
||||
LogRendertraceRect(GetGuid(), "requested displayport", "yellow",
|
||||
aFrameMetrics.mDisplayPort + aFrameMetrics.mScrollOffset);
|
||||
aFrameMetrics.mDisplayPort + aFrameMetrics.GetScrollOffset());
|
||||
|
||||
controller->RequestContentRepaint(aFrameMetrics);
|
||||
mLastDispatchedPaintMetrics = aFrameMetrics;
|
||||
|
@ -1533,7 +1533,7 @@ bool ZoomAnimation::Sample(FrameMetrics& aFrameMetrics,
|
|||
|
||||
if (animPosition >= 1.0) {
|
||||
aFrameMetrics.mZoom = mEndZoom;
|
||||
aFrameMetrics.mScrollOffset = mEndOffset;
|
||||
aFrameMetrics.SetScrollOffset(mEndOffset);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1547,10 +1547,10 @@ bool ZoomAnimation::Sample(FrameMetrics& aFrameMetrics,
|
|||
(sampledPosition / mEndZoom.scale +
|
||||
(1 - sampledPosition) / mStartZoom.scale));
|
||||
|
||||
aFrameMetrics.mScrollOffset = CSSPoint::FromUnknownPoint(gfx::Point(
|
||||
aFrameMetrics.SetScrollOffset(CSSPoint::FromUnknownPoint(gfx::Point(
|
||||
mEndOffset.x * sampledPosition + mStartOffset.x * (1 - sampledPosition),
|
||||
mEndOffset.y * sampledPosition + mStartOffset.y * (1 - sampledPosition)
|
||||
));
|
||||
)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1591,14 +1591,14 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
|
|||
|
||||
requestAnimationFrame = UpdateAnimation(aSampleTime);
|
||||
|
||||
aScrollOffset = mFrameMetrics.mScrollOffset * mFrameMetrics.mZoom;
|
||||
aScrollOffset = mFrameMetrics.GetScrollOffset() * mFrameMetrics.mZoom;
|
||||
*aNewTransform = GetCurrentAsyncTransform();
|
||||
|
||||
LogRendertraceRect(GetGuid(), "viewport", "red",
|
||||
CSSRect(mFrameMetrics.mScrollOffset,
|
||||
CSSRect(mFrameMetrics.GetScrollOffset(),
|
||||
ParentLayerSize(mFrameMetrics.mCompositionBounds.Size()) / mFrameMetrics.GetZoomToParent()));
|
||||
|
||||
mCurrentAsyncScrollOffset = mFrameMetrics.mScrollOffset;
|
||||
mCurrentAsyncScrollOffset = mFrameMetrics.GetScrollOffset();
|
||||
}
|
||||
|
||||
// Execute tasks queued up by mAnimation's Sample() (called by
|
||||
|
@ -1642,10 +1642,10 @@ ViewTransform AsyncPanZoomController::GetCurrentAsyncTransform() {
|
|||
|
||||
CSSPoint lastPaintScrollOffset;
|
||||
if (mLastContentPaintMetrics.IsScrollable()) {
|
||||
lastPaintScrollOffset = mLastContentPaintMetrics.mScrollOffset;
|
||||
lastPaintScrollOffset = mLastContentPaintMetrics.GetScrollOffset();
|
||||
}
|
||||
|
||||
CSSPoint currentScrollOffset = mFrameMetrics.mScrollOffset +
|
||||
CSSPoint currentScrollOffset = mFrameMetrics.GetScrollOffset() +
|
||||
mTestAsyncScrollOffset;
|
||||
|
||||
// If checkerboarding has been disallowed, clamp the scroll position to stay
|
||||
|
@ -1684,7 +1684,7 @@ gfx3DMatrix AsyncPanZoomController::GetNontransientAsyncTransform() {
|
|||
|
||||
gfx3DMatrix AsyncPanZoomController::GetTransformToLastDispatchedPaint() {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
LayerPoint scrollChange = (mLastContentPaintMetrics.mScrollOffset - mLastDispatchedPaintMetrics.mScrollOffset)
|
||||
LayerPoint scrollChange = (mLastContentPaintMetrics.GetScrollOffset() - mLastDispatchedPaintMetrics.GetScrollOffset())
|
||||
* mLastContentPaintMetrics.LayersPixelsPerCSSPixel();
|
||||
float zoomChange = mLastContentPaintMetrics.mZoom.scale / mLastDispatchedPaintMetrics.mZoom.scale;
|
||||
return gfx3DMatrix::Translation(scrollChange.x, scrollChange.y, 0) *
|
||||
|
@ -1703,7 +1703,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
|||
|
||||
LogRendertraceRect(GetGuid(), "page", "brown", aLayerMetrics.mScrollableRect);
|
||||
LogRendertraceRect(GetGuid(), "painted displayport", "green",
|
||||
aLayerMetrics.mDisplayPort + aLayerMetrics.mScrollOffset);
|
||||
aLayerMetrics.mDisplayPort + aLayerMetrics.GetScrollOffset());
|
||||
|
||||
mPaintThrottler.TaskComplete(GetFrameTime());
|
||||
bool needContentRepaint = false;
|
||||
|
@ -1760,7 +1760,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
|||
mFrameMetrics.mScrollOffset.x, mFrameMetrics.mScrollOffset.y,
|
||||
aLayerMetrics.mScrollOffset.x, aLayerMetrics.mScrollOffset.y);
|
||||
|
||||
mFrameMetrics.mScrollOffset = aLayerMetrics.mScrollOffset;
|
||||
mFrameMetrics.SetScrollOffset(aLayerMetrics.GetScrollOffset());
|
||||
|
||||
// Because of the scroll offset update, any inflight paint requests are
|
||||
// going to be ignored by layout, and so mLastDispatchedPaintMetrics
|
||||
|
@ -1807,7 +1807,7 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect) {
|
|||
|
||||
ParentLayerIntRect compositionBounds = mFrameMetrics.mCompositionBounds;
|
||||
CSSRect cssPageRect = mFrameMetrics.mScrollableRect;
|
||||
CSSPoint scrollOffset = mFrameMetrics.mScrollOffset;
|
||||
CSSPoint scrollOffset = mFrameMetrics.GetScrollOffset();
|
||||
CSSToParentLayerScale currentZoom = mFrameMetrics.GetZoomToParent();
|
||||
CSSToParentLayerScale targetZoom;
|
||||
|
||||
|
@ -1867,16 +1867,16 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect) {
|
|||
aRect.x = aRect.x > 0 ? aRect.x : 0;
|
||||
}
|
||||
|
||||
endZoomToMetrics.mScrollOffset = aRect.TopLeft();
|
||||
endZoomToMetrics.SetScrollOffset(aRect.TopLeft());
|
||||
endZoomToMetrics.mDisplayPort =
|
||||
CalculatePendingDisplayPort(endZoomToMetrics,
|
||||
ScreenPoint(0,0),
|
||||
0);
|
||||
|
||||
StartAnimation(new ZoomAnimation(
|
||||
mFrameMetrics.mScrollOffset,
|
||||
mFrameMetrics.GetScrollOffset(),
|
||||
mFrameMetrics.mZoom,
|
||||
endZoomToMetrics.mScrollOffset,
|
||||
endZoomToMetrics.GetScrollOffset(),
|
||||
endZoomToMetrics.mZoom));
|
||||
|
||||
// Schedule a repaint now, so the new displayport will be painted before the
|
||||
|
|
|
@ -267,7 +267,7 @@ float Axis::GetPageEnd() {
|
|||
}
|
||||
|
||||
float Axis::GetOrigin() {
|
||||
CSSPoint origin = mAsyncPanZoomController->GetFrameMetrics().mScrollOffset;
|
||||
CSSPoint origin = mAsyncPanZoomController->GetFrameMetrics().GetScrollOffset();
|
||||
return GetPointOffset(origin);
|
||||
}
|
||||
|
||||
|
|
|
@ -349,7 +349,7 @@ TEST(AsyncPanZoomController, Pinch) {
|
|||
fm.mViewport = CSSRect(0, 0, 980, 480);
|
||||
fm.mCompositionBounds = ParentLayerIntRect(200, 200, 100, 200);
|
||||
fm.mScrollableRect = CSSRect(0, 0, 980, 1000);
|
||||
fm.mScrollOffset = CSSPoint(300, 300);
|
||||
fm.SetScrollOffset(CSSPoint(300, 300));
|
||||
fm.mZoom = CSSToScreenScale(2.0);
|
||||
apzc->SetFrameMetrics(fm);
|
||||
apzc->UpdateZoomConstraints(ZoomConstraints(true, true, CSSToScreenScale(0.25), CSSToScreenScale(4.0)));
|
||||
|
@ -363,13 +363,13 @@ TEST(AsyncPanZoomController, Pinch) {
|
|||
// the visible area of the document in CSS pixels is now x=305 y=310 w=40 h=80
|
||||
fm = apzc->GetFrameMetrics();
|
||||
EXPECT_EQ(fm.mZoom.scale, 2.5f);
|
||||
EXPECT_EQ(fm.mScrollOffset.x, 305);
|
||||
EXPECT_EQ(fm.mScrollOffset.y, 310);
|
||||
EXPECT_EQ(fm.GetScrollOffset().x, 305);
|
||||
EXPECT_EQ(fm.GetScrollOffset().y, 310);
|
||||
|
||||
// part 2 of the test, move to the top-right corner of the page and pinch and
|
||||
// make sure we stay in the correct spot
|
||||
fm.mZoom = CSSToScreenScale(2.0);
|
||||
fm.mScrollOffset = CSSPoint(930, 5);
|
||||
fm.SetScrollOffset(CSSPoint(930, 5));
|
||||
apzc->SetFrameMetrics(fm);
|
||||
// the visible area of the document in CSS pixels is x=930 y=5 w=50 h=100
|
||||
|
||||
|
@ -378,8 +378,8 @@ TEST(AsyncPanZoomController, Pinch) {
|
|||
// the visible area of the document in CSS pixels is now x=880 y=0 w=100 h=200
|
||||
fm = apzc->GetFrameMetrics();
|
||||
EXPECT_EQ(fm.mZoom.scale, 1.0f);
|
||||
EXPECT_EQ(fm.mScrollOffset.x, 880);
|
||||
EXPECT_EQ(fm.mScrollOffset.y, 0);
|
||||
EXPECT_EQ(fm.GetScrollOffset().x, 880);
|
||||
EXPECT_EQ(fm.GetScrollOffset().y, 0);
|
||||
|
||||
apzc->Destroy();
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ TEST(AsyncPanZoomController, PinchWithTouchActionNone) {
|
|||
fm.mViewport = CSSRect(0, 0, 980, 480);
|
||||
fm.mCompositionBounds = ParentLayerIntRect(200, 200, 100, 200);
|
||||
fm.mScrollableRect = CSSRect(0, 0, 980, 1000);
|
||||
fm.mScrollOffset = CSSPoint(300, 300);
|
||||
fm.SetScrollOffset(CSSPoint(300, 300));
|
||||
fm.mZoom = CSSToScreenScale(2.0);
|
||||
apzc->SetFrameMetrics(fm);
|
||||
// the visible area of the document in CSS pixels is x=300 y=300 w=50 h=100
|
||||
|
@ -414,8 +414,8 @@ TEST(AsyncPanZoomController, PinchWithTouchActionNone) {
|
|||
// apzc ignore pinch gestures.
|
||||
fm = apzc->GetFrameMetrics();
|
||||
EXPECT_EQ(fm.mZoom.scale, 2.0f);
|
||||
EXPECT_EQ(fm.mScrollOffset.x, 300);
|
||||
EXPECT_EQ(fm.mScrollOffset.y, 300);
|
||||
EXPECT_EQ(fm.GetScrollOffset().x, 300);
|
||||
EXPECT_EQ(fm.GetScrollOffset().y, 300);
|
||||
}
|
||||
|
||||
TEST(AsyncPanZoomController, Overzoom) {
|
||||
|
@ -426,7 +426,7 @@ TEST(AsyncPanZoomController, Overzoom) {
|
|||
fm.mViewport = CSSRect(0, 0, 100, 100);
|
||||
fm.mCompositionBounds = ParentLayerIntRect(0, 0, 100, 100);
|
||||
fm.mScrollableRect = CSSRect(0, 0, 125, 150);
|
||||
fm.mScrollOffset = CSSPoint(10, 0);
|
||||
fm.SetScrollOffset(CSSPoint(10, 0));
|
||||
fm.mZoom = CSSToScreenScale(1.0);
|
||||
apzc->SetFrameMetrics(fm);
|
||||
apzc->UpdateZoomConstraints(ZoomConstraints(true, true, CSSToScreenScale(0.25), CSSToScreenScale(4.0)));
|
||||
|
@ -441,8 +441,8 @@ TEST(AsyncPanZoomController, Overzoom) {
|
|||
EXPECT_EQ(fm.mZoom.scale, 0.8f);
|
||||
// bug 936721 - PGO builds introduce rounding error so
|
||||
// use a fuzzy match instead
|
||||
EXPECT_LT(abs(fm.mScrollOffset.x), 1e-5);
|
||||
EXPECT_LT(abs(fm.mScrollOffset.y), 1e-5);
|
||||
EXPECT_LT(abs(fm.GetScrollOffset().x), 1e-5);
|
||||
EXPECT_LT(abs(fm.GetScrollOffset().y), 1e-5);
|
||||
}
|
||||
|
||||
TEST(AsyncPanZoomController, SimpleTransform) {
|
||||
|
@ -505,7 +505,7 @@ TEST(AsyncPanZoomController, ComplexTransform) {
|
|||
metrics.mCompositionBounds = ParentLayerIntRect(0, 0, 24, 24);
|
||||
metrics.mDisplayPort = CSSRect(-1, -1, 6, 6);
|
||||
metrics.mViewport = CSSRect(0, 0, 4, 4);
|
||||
metrics.mScrollOffset = CSSPoint(10, 10);
|
||||
metrics.SetScrollOffset(CSSPoint(10, 10));
|
||||
metrics.mScrollableRect = CSSRect(0, 0, 50, 50);
|
||||
metrics.mCumulativeResolution = LayoutDeviceToLayerScale(2);
|
||||
metrics.mResolution = ParentLayerToLayerScale(2);
|
||||
|
@ -539,13 +539,13 @@ TEST(AsyncPanZoomController, ComplexTransform) {
|
|||
EXPECT_EQ(ScreenPoint(60, 60), pointOut);
|
||||
|
||||
// do an async scroll by 5 pixels and check the transform
|
||||
metrics.mScrollOffset += CSSPoint(5, 0);
|
||||
metrics.ScrollBy(CSSPoint(5, 0));
|
||||
apzc->SetFrameMetrics(metrics);
|
||||
apzc->SampleContentTransformForFrame(testStartTime, &viewTransformOut, pointOut);
|
||||
EXPECT_EQ(ViewTransform(LayerPoint(-30, 0), ParentLayerToScreenScale(2)), viewTransformOut);
|
||||
EXPECT_EQ(ScreenPoint(90, 60), pointOut);
|
||||
|
||||
childMetrics.mScrollOffset += CSSPoint(5, 0);
|
||||
childMetrics.ScrollBy(CSSPoint(5, 0));
|
||||
childApzc->SetFrameMetrics(childMetrics);
|
||||
childApzc->SampleContentTransformForFrame(testStartTime, &viewTransformOut, pointOut);
|
||||
EXPECT_EQ(ViewTransform(LayerPoint(-30, 0), ParentLayerToScreenScale(2)), viewTransformOut);
|
||||
|
@ -932,7 +932,7 @@ SetScrollableFrameMetrics(Layer* aLayer, FrameMetrics::ViewID aScrollId,
|
|||
metrics.mCompositionBounds = ParentLayerIntRect(layerBound.x, layerBound.y,
|
||||
layerBound.width, layerBound.height);
|
||||
metrics.mScrollableRect = aScrollableRect;
|
||||
metrics.mScrollOffset = CSSPoint(0, 0);
|
||||
metrics.SetScrollOffset(CSSPoint(0, 0));
|
||||
container->SetFrameMetrics(metrics);
|
||||
}
|
||||
|
||||
|
|
|
@ -682,7 +682,7 @@ static void RecordFrameMetrics(nsIFrame* aForFrame,
|
|||
contentBounds.width += scrollableFrame->GetScrollPortRect().width;
|
||||
contentBounds.height += scrollableFrame->GetScrollPortRect().height;
|
||||
metrics.mScrollableRect = CSSRect::FromAppUnits(contentBounds);
|
||||
metrics.mScrollOffset = CSSPoint::FromAppUnits(scrollPosition);
|
||||
metrics.SetScrollOffset(CSSPoint::FromAppUnits(scrollPosition));
|
||||
|
||||
// If the frame was scrolled since the last layers update, and by
|
||||
// something other than the APZ code, we want to tell the APZ to update
|
||||
|
|
|
@ -422,8 +422,8 @@ BuildViewMap(ViewMap& oldContentViews, ViewMap& newContentViews,
|
|||
// The default scale is 1, so no need to propagate scale down.
|
||||
ViewConfig config;
|
||||
config.mScrollOffset = nsPoint(
|
||||
NSIntPixelsToAppUnits(metrics.mScrollOffset.x, auPerCSSPixel) * aXScale,
|
||||
NSIntPixelsToAppUnits(metrics.mScrollOffset.y, auPerCSSPixel) * aYScale);
|
||||
NSIntPixelsToAppUnits(metrics.GetScrollOffset().x, auPerCSSPixel) * aXScale,
|
||||
NSIntPixelsToAppUnits(metrics.GetScrollOffset().y, auPerCSSPixel) * aYScale);
|
||||
view = new nsContentView(aFrameLoader, scrollId, metrics.mIsRoot, config);
|
||||
view->mParentScaleX = aAccConfigXScale;
|
||||
view->mParentScaleY = aAccConfigYScale;
|
||||
|
|
|
@ -1881,7 +1881,7 @@ AndroidBridge::RequestContentRepaint(const mozilla::layers::FrameMetrics& aFrame
|
|||
ALOG_BRIDGE("AndroidBridge::RequestContentRepaint");
|
||||
|
||||
CSSToScreenScale resolution = aFrameMetrics.mZoom;
|
||||
ScreenRect dp = (aFrameMetrics.mDisplayPort + aFrameMetrics.mScrollOffset) * resolution;
|
||||
ScreenRect dp = (aFrameMetrics.mDisplayPort + aFrameMetrics.GetScrollOffset()) * resolution;
|
||||
|
||||
mNativePanZoomController->RequestContentRepaintWrapper(dp.x, dp.y, dp.width, dp.height, resolution.scale);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ MaybeAlignAndClampDisplayPort(mozilla::layers::FrameMetrics& aFrameMetrics,
|
|||
// Correct the display-port by the difference between the requested scroll
|
||||
// offset and the resulting scroll offset after setting the requested value.
|
||||
CSSRect& displayPort = aFrameMetrics.mDisplayPort;
|
||||
displayPort += aFrameMetrics.mScrollOffset - aActualScrollOffset;
|
||||
displayPort += aFrameMetrics.GetScrollOffset() - aActualScrollOffset;
|
||||
|
||||
// Expand the display port to the next tile boundaries, if tiled thebes layers
|
||||
// are enabled.
|
||||
|
@ -162,7 +162,7 @@ APZCCallbackHelper::UpdateRootFrame(nsIDOMWindowUtils* aUtils,
|
|||
// Scroll the window to the desired spot
|
||||
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aMetrics.mScrollId);
|
||||
bool scrollUpdated = false;
|
||||
CSSPoint actualScrollOffset = ScrollFrameTo(sf, aMetrics.mScrollOffset, scrollUpdated);
|
||||
CSSPoint actualScrollOffset = ScrollFrameTo(sf, aMetrics.GetScrollOffset(), scrollUpdated);
|
||||
|
||||
if (!scrollUpdated) {
|
||||
// For whatever reason we couldn't update the scroll offset on the scroll frame,
|
||||
|
@ -179,7 +179,7 @@ APZCCallbackHelper::UpdateRootFrame(nsIDOMWindowUtils* aUtils,
|
|||
// enabled), and clamp it to the scrollable rect.
|
||||
MaybeAlignAndClampDisplayPort(aMetrics, actualScrollOffset);
|
||||
|
||||
aMetrics.mScrollOffset = actualScrollOffset;
|
||||
aMetrics.SetScrollOffset(actualScrollOffset);
|
||||
|
||||
// The mZoom variable on the frame metrics stores the CSS-to-screen scale for this
|
||||
// frame. This scale includes all of the (cumulative) resolutions set on the presShells
|
||||
|
@ -232,7 +232,7 @@ APZCCallbackHelper::UpdateSubFrame(nsIContent* aContent,
|
|||
|
||||
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aMetrics.mScrollId);
|
||||
bool scrollUpdated = false;
|
||||
CSSPoint actualScrollOffset = ScrollFrameTo(sf, aMetrics.mScrollOffset, scrollUpdated);
|
||||
CSSPoint actualScrollOffset = ScrollFrameTo(sf, aMetrics.GetScrollOffset(), scrollUpdated);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aContent);
|
||||
if (element) {
|
||||
|
@ -247,7 +247,7 @@ APZCCallbackHelper::UpdateSubFrame(nsIContent* aContent,
|
|||
element, 0);
|
||||
}
|
||||
|
||||
aMetrics.mScrollOffset = actualScrollOffset;
|
||||
aMetrics.SetScrollOffset(actualScrollOffset);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMWindowUtils>
|
||||
|
@ -338,7 +338,7 @@ APZCCallbackHelper::UpdateCallbackTransform(const FrameMetrics& aApzcMetrics, co
|
|||
if (!content) {
|
||||
return;
|
||||
}
|
||||
CSSPoint scrollDelta = aApzcMetrics.mScrollOffset - aActualMetrics.mScrollOffset;
|
||||
CSSPoint scrollDelta = aApzcMetrics.GetScrollOffset() - aActualMetrics.GetScrollOffset();
|
||||
content->SetProperty(nsGkAtoms::apzCallbackTransform, new CSSPoint(scrollDelta), DestroyCSSPoint);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче