mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 780397: Convert FrameMetrics.mViewportScrollOffset from nsIntPoint to gfx::Point r=roc
This commit is contained in:
parent
b48d86899d
commit
b018fea56e
@ -328,12 +328,6 @@ nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
|
|||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRect lastDisplayPort;
|
|
||||||
if (nsLayoutUtils::GetDisplayPort(content, &lastDisplayPort) &&
|
|
||||||
displayport.IsEqualInterior(lastDisplayPort)) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
content->SetProperty(nsGkAtoms::DisplayPort, new nsRect(displayport),
|
content->SetProperty(nsGkAtoms::DisplayPort, new nsRect(displayport),
|
||||||
DestroyNsRect);
|
DestroyNsRect);
|
||||||
|
|
||||||
|
@ -127,6 +127,11 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||||||
*
|
*
|
||||||
* The caller of this method must have UniversalXPConnect
|
* The caller of this method must have UniversalXPConnect
|
||||||
* privileges.
|
* privileges.
|
||||||
|
*
|
||||||
|
* Calling this will always force a recomposite, so it should be
|
||||||
|
* avoided if at all possible. Client code should do checks before
|
||||||
|
* calling this so that duplicate sets are not made with the same
|
||||||
|
* displayport.
|
||||||
*/
|
*/
|
||||||
void setDisplayPortForElement(in float aXPx, in float aYPx,
|
void setDisplayPortForElement(in float aXPx, in float aYPx,
|
||||||
in float aWidthPx, in float aHeightPx,
|
in float aWidthPx, in float aHeightPx,
|
||||||
|
@ -726,8 +726,8 @@ TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsCString data;
|
nsCString data;
|
||||||
data += nsPrintfCString("{ \"x\" : %d", aFrameMetrics.mViewportScrollOffset.x);
|
data += nsPrintfCString("{ \"x\" : %d", NS_lround(aFrameMetrics.mViewportScrollOffset.x));
|
||||||
data += nsPrintfCString(", \"y\" : %d", aFrameMetrics.mViewportScrollOffset.y);
|
data += nsPrintfCString(", \"y\" : %d", NS_lround(aFrameMetrics.mViewportScrollOffset.y));
|
||||||
// We don't treat the x and y scales any differently for this
|
// We don't treat the x and y scales any differently for this
|
||||||
// semi-platform-specific code.
|
// semi-platform-specific code.
|
||||||
data += nsPrintfCString(", \"zoom\" : %f", aFrameMetrics.mResolution.width);
|
data += nsPrintfCString(", \"zoom\" : %f", aFrameMetrics.mResolution.width);
|
||||||
|
@ -71,7 +71,7 @@ public:
|
|||||||
// These are all in layer coordinate space.
|
// These are all in layer coordinate space.
|
||||||
nsIntRect mViewport;
|
nsIntRect mViewport;
|
||||||
nsIntRect mContentRect;
|
nsIntRect mContentRect;
|
||||||
nsIntPoint mViewportScrollOffset;
|
gfx::Point mViewportScrollOffset;
|
||||||
nsIntRect mDisplayPort;
|
nsIntRect mDisplayPort;
|
||||||
ViewID mScrollId;
|
ViewID mScrollId;
|
||||||
|
|
||||||
|
@ -123,6 +123,15 @@ AppendToString(nsACString& s, const nsIntPoint& p,
|
|||||||
return s += sfx;
|
return s += sfx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsACString&
|
||||||
|
AppendToString(nsACString& s, const Point& p,
|
||||||
|
const char* pfx="", const char* sfx="")
|
||||||
|
{
|
||||||
|
s += pfx;
|
||||||
|
s += nsPrintfCString("(x=%f, y=%f)", p.x, p.y);
|
||||||
|
return s += sfx;
|
||||||
|
}
|
||||||
|
|
||||||
nsACString&
|
nsACString&
|
||||||
AppendToString(nsACString& s, const nsIntRect& r,
|
AppendToString(nsACString& s, const nsIntRect& r,
|
||||||
const char* pfx="", const char* sfx="")
|
const char* pfx="", const char* sfx="")
|
||||||
|
@ -425,7 +425,7 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
|
|||||||
float scale = mFrameMetrics.mResolution.width;
|
float scale = mFrameMetrics.mResolution.width;
|
||||||
|
|
||||||
nsIntPoint focusPoint = aEvent.mFocusPoint;
|
nsIntPoint focusPoint = aEvent.mFocusPoint;
|
||||||
PRInt32 xFocusChange = (mLastZoomFocus.x - focusPoint.x) / scale, yFocusChange = (mLastZoomFocus.y - focusPoint.y) / scale;
|
float xFocusChange = (mLastZoomFocus.x - focusPoint.x) / scale, yFocusChange = (mLastZoomFocus.y - focusPoint.y) / scale;
|
||||||
// If displacing by the change in focus point will take us off page bounds,
|
// If displacing by the change in focus point will take us off page bounds,
|
||||||
// then reduce the displacement such that it doesn't.
|
// then reduce the displacement such that it doesn't.
|
||||||
if (mX.DisplacementWillOverscroll(xFocusChange) != Axis::OVERSCROLL_NONE) {
|
if (mX.DisplacementWillOverscroll(xFocusChange) != Axis::OVERSCROLL_NONE) {
|
||||||
@ -434,12 +434,12 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
|
|||||||
if (mY.DisplacementWillOverscroll(yFocusChange) != Axis::OVERSCROLL_NONE) {
|
if (mY.DisplacementWillOverscroll(yFocusChange) != Axis::OVERSCROLL_NONE) {
|
||||||
yFocusChange -= mY.DisplacementWillOverscrollAmount(yFocusChange);
|
yFocusChange -= mY.DisplacementWillOverscrollAmount(yFocusChange);
|
||||||
}
|
}
|
||||||
ScrollBy(nsIntPoint(xFocusChange, yFocusChange));
|
ScrollBy(gfx::Point(xFocusChange, yFocusChange));
|
||||||
|
|
||||||
// When we zoom in with focus, we can zoom too much towards the boundaries
|
// When we zoom in with focus, we can zoom too much towards the boundaries
|
||||||
// that we actually go over them. These are the needed displacements along
|
// that we actually go over them. These are the needed displacements along
|
||||||
// either axis such that we don't overscroll the boundaries when zooming.
|
// either axis such that we don't overscroll the boundaries when zooming.
|
||||||
PRInt32 neededDisplacementX = 0, neededDisplacementY = 0;
|
float neededDisplacementX = 0, neededDisplacementY = 0;
|
||||||
|
|
||||||
// Only do the scaling if we won't go over 8x zoom in or out.
|
// Only do the scaling if we won't go over 8x zoom in or out.
|
||||||
bool doScale = (scale < MAX_ZOOM && spanRatio > 1.0f) || (scale > MIN_ZOOM && spanRatio < 1.0f);
|
bool doScale = (scale < MAX_ZOOM && spanRatio > 1.0f) || (scale > MIN_ZOOM && spanRatio < 1.0f);
|
||||||
@ -491,7 +491,7 @@ nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
|
|||||||
focusPoint);
|
focusPoint);
|
||||||
|
|
||||||
if (neededDisplacementX != 0 || neededDisplacementY != 0) {
|
if (neededDisplacementX != 0 || neededDisplacementY != 0) {
|
||||||
ScrollBy(nsIntPoint(neededDisplacementX, neededDisplacementY));
|
ScrollBy(gfx::Point(neededDisplacementX, neededDisplacementY));
|
||||||
}
|
}
|
||||||
|
|
||||||
ScheduleComposite();
|
ScheduleComposite();
|
||||||
@ -614,7 +614,7 @@ void AsyncPanZoomController::TrackTouch(const MultiTouchInput& aEvent) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollBy(nsIntPoint(xDisplacement, yDisplacement));
|
ScrollBy(gfx::Point(xDisplacement, yDisplacement));
|
||||||
ScheduleComposite();
|
ScheduleComposite();
|
||||||
|
|
||||||
RequestContentRepaint();
|
RequestContentRepaint();
|
||||||
@ -643,7 +643,7 @@ bool AsyncPanZoomController::DoFling(const TimeDuration& aDelta) {
|
|||||||
// larger swipe should move you a shorter distance.
|
// larger swipe should move you a shorter distance.
|
||||||
float inverseScale = 1 / mFrameMetrics.mResolution.width;
|
float inverseScale = 1 / mFrameMetrics.mResolution.width;
|
||||||
|
|
||||||
ScrollBy(nsIntPoint(
|
ScrollBy(gfx::Point(
|
||||||
mX.GetDisplacementForDuration(inverseScale, aDelta),
|
mX.GetDisplacementForDuration(inverseScale, aDelta),
|
||||||
mY.GetDisplacementForDuration(inverseScale, aDelta)
|
mY.GetDisplacementForDuration(inverseScale, aDelta)
|
||||||
));
|
));
|
||||||
@ -660,8 +660,8 @@ void AsyncPanZoomController::SetCompositorParent(CompositorParent* aCompositorPa
|
|||||||
mCompositorParent = aCompositorParent;
|
mCompositorParent = aCompositorParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncPanZoomController::ScrollBy(const nsIntPoint& aOffset) {
|
void AsyncPanZoomController::ScrollBy(const gfx::Point& aOffset) {
|
||||||
nsIntPoint newOffset(mFrameMetrics.mViewportScrollOffset.x + aOffset.x,
|
gfx::Point newOffset(mFrameMetrics.mViewportScrollOffset.x + aOffset.x,
|
||||||
mFrameMetrics.mViewportScrollOffset.y + aOffset.y);
|
mFrameMetrics.mViewportScrollOffset.y + aOffset.y);
|
||||||
FrameMetrics metrics(mFrameMetrics);
|
FrameMetrics metrics(mFrameMetrics);
|
||||||
metrics.mViewportScrollOffset = newOffset;
|
metrics.mViewportScrollOffset = newOffset;
|
||||||
@ -697,10 +697,10 @@ void AsyncPanZoomController::ScaleWithFocus(float aScale, const nsIntPoint& aFoc
|
|||||||
// current CSS page rect (which is unchanged since it's not affected by zoom).
|
// current CSS page rect (which is unchanged since it's not affected by zoom).
|
||||||
SetPageRect(mFrameMetrics.mCSSContentRect);
|
SetPageRect(mFrameMetrics.mCSSContentRect);
|
||||||
|
|
||||||
nsIntPoint scrollOffset = metrics.mViewportScrollOffset;
|
gfx::Point scrollOffset = metrics.mViewportScrollOffset;
|
||||||
|
|
||||||
scrollOffset.x += NS_lround(float(aFocus.x) * (scaleFactor - 1.0f) / oldScale);
|
scrollOffset.x += float(aFocus.x) * (scaleFactor - 1.0f) / oldScale;
|
||||||
scrollOffset.y += NS_lround(float(aFocus.y) * (scaleFactor - 1.0f) / oldScale);
|
scrollOffset.y += float(aFocus.y) * (scaleFactor - 1.0f) / oldScale;
|
||||||
|
|
||||||
metrics.mViewportScrollOffset = scrollOffset;
|
metrics.mViewportScrollOffset = scrollOffset;
|
||||||
|
|
||||||
@ -729,7 +729,7 @@ const nsIntRect AsyncPanZoomController::CalculatePendingDisplayPort() {
|
|||||||
nsIntRect viewport = mFrameMetrics.mViewport;
|
nsIntRect viewport = mFrameMetrics.mViewport;
|
||||||
viewport.ScaleRoundIn(1 / scale);
|
viewport.ScaleRoundIn(1 / scale);
|
||||||
|
|
||||||
nsIntPoint scrollOffset = mFrameMetrics.mViewportScrollOffset;
|
gfx::Point scrollOffset = mFrameMetrics.mViewportScrollOffset;
|
||||||
gfx::Point velocity = GetVelocityVector();
|
gfx::Point velocity = GetVelocityVector();
|
||||||
|
|
||||||
// The displayport is relative to the current scroll offset. Here's a little
|
// The displayport is relative to the current scroll offset. Here's a little
|
||||||
@ -806,14 +806,30 @@ void AsyncPanZoomController::ScheduleComposite() {
|
|||||||
void AsyncPanZoomController::RequestContentRepaint() {
|
void AsyncPanZoomController::RequestContentRepaint() {
|
||||||
mFrameMetrics.mDisplayPort = CalculatePendingDisplayPort();
|
mFrameMetrics.mDisplayPort = CalculatePendingDisplayPort();
|
||||||
|
|
||||||
|
gfx::Point oldScrollOffset = mLastPaintRequestMetrics.mViewportScrollOffset,
|
||||||
|
newScrollOffset = mFrameMetrics.mViewportScrollOffset;
|
||||||
|
|
||||||
// If we're trying to paint what we already think is painted, discard this
|
// If we're trying to paint what we already think is painted, discard this
|
||||||
// request since it's a pointless paint.
|
// request since it's a pointless paint.
|
||||||
nsIntRect oldDisplayPort = mLastPaintRequestMetrics.mDisplayPort,
|
nsRect oldDisplayPort = nsRect(
|
||||||
newDisplayPort = mFrameMetrics.mDisplayPort;
|
mLastPaintRequestMetrics.mDisplayPort.x,
|
||||||
oldDisplayPort.MoveBy(mLastPaintRequestMetrics.mViewportScrollOffset);
|
mLastPaintRequestMetrics.mDisplayPort.y,
|
||||||
newDisplayPort.MoveBy(mFrameMetrics.mViewportScrollOffset);
|
mLastPaintRequestMetrics.mDisplayPort.width,
|
||||||
|
mLastPaintRequestMetrics.mDisplayPort.height);
|
||||||
|
|
||||||
if (oldDisplayPort.IsEqualEdges(newDisplayPort) &&
|
gfx::Rect newDisplayPort = gfx::Rect(
|
||||||
|
mFrameMetrics.mDisplayPort.x,
|
||||||
|
mFrameMetrics.mDisplayPort.y,
|
||||||
|
mFrameMetrics.mDisplayPort.width,
|
||||||
|
mFrameMetrics.mDisplayPort.height);
|
||||||
|
|
||||||
|
oldDisplayPort.MoveBy(oldScrollOffset.x, oldScrollOffset.y);
|
||||||
|
newDisplayPort.MoveBy(newScrollOffset.x, newScrollOffset.y);
|
||||||
|
|
||||||
|
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 &&
|
||||||
mFrameMetrics.mResolution.width == mLastPaintRequestMetrics.mResolution.width) {
|
mFrameMetrics.mResolution.width == mLastPaintRequestMetrics.mResolution.width) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -843,8 +859,8 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
|
|||||||
float rootScaleX = currentTransform.GetXScale(),
|
float rootScaleX = currentTransform.GetXScale(),
|
||||||
rootScaleY = currentTransform.GetYScale();
|
rootScaleY = currentTransform.GetYScale();
|
||||||
|
|
||||||
nsIntPoint metricsScrollOffset(0, 0);
|
gfx::Point metricsScrollOffset(0, 0);
|
||||||
nsIntPoint scrollOffset;
|
gfx::Point scrollOffset;
|
||||||
float localScaleX, localScaleY;
|
float localScaleX, localScaleY;
|
||||||
const FrameMetrics& frame = aLayer->GetFrameMetrics();
|
const FrameMetrics& frame = aLayer->GetFrameMetrics();
|
||||||
{
|
{
|
||||||
@ -868,7 +884,7 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
|
|||||||
mEndZoomToMetrics.mResolution.width * sampledPosition +
|
mEndZoomToMetrics.mResolution.width * sampledPosition +
|
||||||
mStartZoomToMetrics.mResolution.width * (1 - sampledPosition);
|
mStartZoomToMetrics.mResolution.width * (1 - sampledPosition);
|
||||||
|
|
||||||
mFrameMetrics.mViewportScrollOffset = nsIntPoint(
|
mFrameMetrics.mViewportScrollOffset = gfx::Point(
|
||||||
mEndZoomToMetrics.mViewportScrollOffset.x * sampledPosition +
|
mEndZoomToMetrics.mViewportScrollOffset.x * sampledPosition +
|
||||||
mStartZoomToMetrics.mViewportScrollOffset.x * (1 - sampledPosition),
|
mStartZoomToMetrics.mViewportScrollOffset.x * (1 - sampledPosition),
|
||||||
mEndZoomToMetrics.mViewportScrollOffset.y * sampledPosition +
|
mEndZoomToMetrics.mViewportScrollOffset.y * sampledPosition +
|
||||||
@ -903,8 +919,8 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsIntPoint scrollCompensation(
|
nsIntPoint scrollCompensation(
|
||||||
(scrollOffset.x / rootScaleX - metricsScrollOffset.x) * localScaleX,
|
NS_lround((scrollOffset.x / rootScaleX - metricsScrollOffset.x) * localScaleX),
|
||||||
(scrollOffset.y / rootScaleY - metricsScrollOffset.y) * localScaleY);
|
NS_lround((scrollOffset.y / rootScaleY - metricsScrollOffset.y) * localScaleY));
|
||||||
|
|
||||||
ViewTransform treeTransform(-scrollCompensation, localScaleX, localScaleY);
|
ViewTransform treeTransform(-scrollCompensation, localScaleX, localScaleY);
|
||||||
*aNewTransform = gfx3DMatrix(treeTransform) * currentTransform;
|
*aNewTransform = gfx3DMatrix(treeTransform) * currentTransform;
|
||||||
@ -979,7 +995,6 @@ void AsyncPanZoomController::CancelDefaultPanZoom() {
|
|||||||
|
|
||||||
void AsyncPanZoomController::ZoomToRect(const gfxRect& aRect) {
|
void AsyncPanZoomController::ZoomToRect(const gfxRect& aRect) {
|
||||||
gfx::Rect zoomToRect(gfx::Rect(aRect.x, aRect.y, aRect.width, aRect.height));
|
gfx::Rect zoomToRect(gfx::Rect(aRect.x, aRect.y, aRect.width, aRect.height));
|
||||||
gfx::Rect cssPageRect = mFrameMetrics.mCSSContentRect;
|
|
||||||
|
|
||||||
SetState(ANIMATING_ZOOM);
|
SetState(ANIMATING_ZOOM);
|
||||||
|
|
||||||
@ -987,13 +1002,15 @@ void AsyncPanZoomController::ZoomToRect(const gfxRect& aRect) {
|
|||||||
MonitorAutoLock mon(mMonitor);
|
MonitorAutoLock mon(mMonitor);
|
||||||
|
|
||||||
nsIntRect viewport = mFrameMetrics.mViewport;
|
nsIntRect viewport = mFrameMetrics.mViewport;
|
||||||
|
gfx::Rect cssPageRect = mFrameMetrics.mCSSContentRect;
|
||||||
|
gfx::Point scrollOffset = mFrameMetrics.mViewportScrollOffset;
|
||||||
|
|
||||||
// If the rect is empty, treat it as a request to zoom out to the full page
|
// If the rect is empty, treat it as a request to zoom out to the full page
|
||||||
// size.
|
// size.
|
||||||
if (zoomToRect.IsEmpty()) {
|
if (zoomToRect.IsEmpty()) {
|
||||||
nsIntRect cssViewport = viewport;
|
nsIntRect cssViewport = viewport;
|
||||||
cssViewport.ScaleRoundIn(1 / mFrameMetrics.mResolution.width);
|
cssViewport.ScaleRoundIn(1 / mFrameMetrics.mResolution.width);
|
||||||
cssViewport.MoveBy(mFrameMetrics.mViewportScrollOffset);
|
cssViewport.MoveBy(nsIntPoint(NS_lround(scrollOffset.x), NS_lround(scrollOffset.y)));
|
||||||
|
|
||||||
float y = mFrameMetrics.mViewportScrollOffset.y;
|
float y = mFrameMetrics.mViewportScrollOffset.y;
|
||||||
float newHeight = cssViewport.height * cssPageRect.width / cssViewport.width;
|
float newHeight = cssViewport.height * cssPageRect.width / cssViewport.width;
|
||||||
@ -1043,7 +1060,7 @@ void AsyncPanZoomController::ZoomToRect(const gfxRect& aRect) {
|
|||||||
|
|
||||||
mStartZoomToMetrics = mFrameMetrics;
|
mStartZoomToMetrics = mFrameMetrics;
|
||||||
mEndZoomToMetrics.mViewportScrollOffset =
|
mEndZoomToMetrics.mViewportScrollOffset =
|
||||||
nsIntPoint(NS_lround(zoomToRect.x), NS_lround(zoomToRect.y));
|
gfx::Point(zoomToRect.x, zoomToRect.y);
|
||||||
|
|
||||||
mAnimationStartTime = TimeStamp::Now();
|
mAnimationStartTime = TimeStamp::Now();
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ protected:
|
|||||||
/**
|
/**
|
||||||
* Scrolls the viewport by an X,Y offset.
|
* Scrolls the viewport by an X,Y offset.
|
||||||
*/
|
*/
|
||||||
void ScrollBy(const nsIntPoint& aOffset);
|
void ScrollBy(const gfx::Point& aOffset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scales the viewport by an amount (note that it multiplies this scale in to
|
* Scales the viewport by an amount (note that it multiplies this scale in to
|
||||||
|
@ -94,10 +94,10 @@ void Axis::StartTouch(PRInt32 aPos) {
|
|||||||
mLockPanning = false;
|
mLockPanning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 Axis::GetDisplacementForDuration(float aScale, const TimeDuration& aDelta) {
|
float Axis::GetDisplacementForDuration(float aScale, const TimeDuration& aDelta) {
|
||||||
float velocityFactor = powf(ACCELERATION_MULTIPLIER,
|
float velocityFactor = powf(ACCELERATION_MULTIPLIER,
|
||||||
NS_MAX(0, (mAcceleration - 4) * 3));
|
NS_MAX(0, (mAcceleration - 4) * 3));
|
||||||
PRInt32 displacement = NS_lround(mVelocity * aScale * aDelta.ToMilliseconds() * velocityFactor);
|
float displacement = mVelocity * aScale * aDelta.ToMilliseconds() * velocityFactor;
|
||||||
// If this displacement will cause an overscroll, throttle it. Can potentially
|
// If this displacement will cause an overscroll, throttle it. Can potentially
|
||||||
// bring it to 0 even if the velocity is high.
|
// bring it to 0 even if the velocity is high.
|
||||||
if (DisplacementWillOverscroll(displacement) != OVERSCROLL_NONE) {
|
if (DisplacementWillOverscroll(displacement) != OVERSCROLL_NONE) {
|
||||||
@ -158,7 +158,7 @@ Axis::Overscroll Axis::GetOverscroll() {
|
|||||||
return OVERSCROLL_NONE;
|
return OVERSCROLL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 Axis::GetExcess() {
|
float Axis::GetExcess() {
|
||||||
switch (GetOverscroll()) {
|
switch (GetOverscroll()) {
|
||||||
case OVERSCROLL_MINUS: return GetOrigin() - GetPageStart();
|
case OVERSCROLL_MINUS: return GetOrigin() - GetPageStart();
|
||||||
case OVERSCROLL_PLUS: return GetViewportEnd() - GetPageEnd();
|
case OVERSCROLL_PLUS: return GetViewportEnd() - GetPageEnd();
|
||||||
@ -186,7 +186,7 @@ Axis::Overscroll Axis::DisplacementWillOverscroll(PRInt32 aDisplacement) {
|
|||||||
return OVERSCROLL_NONE;
|
return OVERSCROLL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 Axis::DisplacementWillOverscrollAmount(PRInt32 aDisplacement) {
|
float Axis::DisplacementWillOverscrollAmount(PRInt32 aDisplacement) {
|
||||||
switch (DisplacementWillOverscroll(aDisplacement)) {
|
switch (DisplacementWillOverscroll(aDisplacement)) {
|
||||||
case OVERSCROLL_MINUS: return (GetOrigin() + aDisplacement) - GetPageStart();
|
case OVERSCROLL_MINUS: return (GetOrigin() + aDisplacement) - GetPageStart();
|
||||||
case OVERSCROLL_PLUS: return (GetViewportEnd() + aDisplacement) - GetPageEnd();
|
case OVERSCROLL_PLUS: return (GetViewportEnd() + aDisplacement) - GetPageEnd();
|
||||||
@ -197,11 +197,11 @@ PRInt32 Axis::DisplacementWillOverscrollAmount(PRInt32 aDisplacement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Axis::Overscroll Axis::ScaleWillOverscroll(float aScale, PRInt32 aFocus) {
|
Axis::Overscroll Axis::ScaleWillOverscroll(float aScale, PRInt32 aFocus) {
|
||||||
PRInt32 originAfterScale = NS_lround((GetOrigin() + aFocus) * aScale - aFocus);
|
float originAfterScale = (GetOrigin() + aFocus) * aScale - aFocus;
|
||||||
|
|
||||||
bool both = ScaleWillOverscrollBothSides(aScale);
|
bool both = ScaleWillOverscrollBothSides(aScale);
|
||||||
bool minus = originAfterScale < NS_lround(GetPageStart() * aScale);
|
bool minus = originAfterScale < GetPageStart() * aScale;
|
||||||
bool plus = (originAfterScale + GetViewportLength()) > NS_lround(GetPageEnd() * aScale);
|
bool plus = (originAfterScale + GetViewportLength()) > GetPageEnd() * aScale;
|
||||||
|
|
||||||
if ((minus && plus) || both) {
|
if ((minus && plus) || both) {
|
||||||
return OVERSCROLL_BOTH;
|
return OVERSCROLL_BOTH;
|
||||||
@ -215,11 +215,11 @@ Axis::Overscroll Axis::ScaleWillOverscroll(float aScale, PRInt32 aFocus) {
|
|||||||
return OVERSCROLL_NONE;
|
return OVERSCROLL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 Axis::ScaleWillOverscrollAmount(float aScale, PRInt32 aFocus) {
|
float Axis::ScaleWillOverscrollAmount(float aScale, PRInt32 aFocus) {
|
||||||
PRInt32 originAfterScale = NS_lround((GetOrigin() + aFocus) * aScale - aFocus);
|
float originAfterScale = (GetOrigin() + aFocus) * aScale - aFocus;
|
||||||
switch (ScaleWillOverscroll(aScale, aFocus)) {
|
switch (ScaleWillOverscroll(aScale, aFocus)) {
|
||||||
case OVERSCROLL_MINUS: return originAfterScale - NS_lround(GetPageStart() * aScale);
|
case OVERSCROLL_MINUS: return originAfterScale - GetPageStart() * aScale;
|
||||||
case OVERSCROLL_PLUS: return (originAfterScale + GetViewportLength()) - NS_lround(GetPageEnd() * aScale);
|
case OVERSCROLL_PLUS: return (originAfterScale + GetViewportLength()) - GetPageEnd() * aScale;
|
||||||
// Don't handle OVERSCROLL_BOTH. Client code is expected to deal with it.
|
// Don't handle OVERSCROLL_BOTH. Client code is expected to deal with it.
|
||||||
default: return 0;
|
default: return 0;
|
||||||
}
|
}
|
||||||
@ -229,32 +229,32 @@ float Axis::GetVelocity() {
|
|||||||
return mVelocity;
|
return mVelocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 Axis::GetViewportEnd() {
|
float Axis::GetViewportEnd() {
|
||||||
return GetOrigin() + GetViewportLength();
|
return GetOrigin() + GetViewportLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 Axis::GetPageEnd() {
|
float Axis::GetPageEnd() {
|
||||||
return GetPageStart() + GetPageLength();
|
return GetPageStart() + GetPageLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 Axis::GetOrigin() {
|
float Axis::GetOrigin() {
|
||||||
nsIntPoint origin = mAsyncPanZoomController->GetFrameMetrics().mViewportScrollOffset;
|
gfx::Point origin = mAsyncPanZoomController->GetFrameMetrics().mViewportScrollOffset;
|
||||||
return GetPointOffset(origin);
|
return GetPointOffset(origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 Axis::GetViewportLength() {
|
float Axis::GetViewportLength() {
|
||||||
nsIntRect viewport = mAsyncPanZoomController->GetFrameMetrics().mViewport;
|
nsIntRect viewport = mAsyncPanZoomController->GetFrameMetrics().mViewport;
|
||||||
gfx::Rect scaledViewport = gfx::Rect(viewport.x, viewport.y, viewport.width, viewport.height);
|
gfx::Rect scaledViewport = gfx::Rect(viewport.x, viewport.y, viewport.width, viewport.height);
|
||||||
scaledViewport.ScaleRoundIn(1 / mAsyncPanZoomController->GetFrameMetrics().mResolution.width);
|
scaledViewport.ScaleRoundIn(1 / mAsyncPanZoomController->GetFrameMetrics().mResolution.width);
|
||||||
return GetRectLength(scaledViewport);
|
return GetRectLength(scaledViewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 Axis::GetPageStart() {
|
float Axis::GetPageStart() {
|
||||||
gfx::Rect pageRect = mAsyncPanZoomController->GetFrameMetrics().mCSSContentRect;
|
gfx::Rect pageRect = mAsyncPanZoomController->GetFrameMetrics().mCSSContentRect;
|
||||||
return GetRectOffset(pageRect);
|
return GetRectOffset(pageRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 Axis::GetPageLength() {
|
float Axis::GetPageLength() {
|
||||||
gfx::Rect pageRect = mAsyncPanZoomController->GetFrameMetrics().mCSSContentRect;
|
gfx::Rect pageRect = mAsyncPanZoomController->GetFrameMetrics().mCSSContentRect;
|
||||||
return GetRectLength(pageRect);
|
return GetRectLength(pageRect);
|
||||||
}
|
}
|
||||||
@ -280,19 +280,19 @@ AxisX::AxisX(AsyncPanZoomController* aAsyncPanZoomController)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 AxisX::GetPointOffset(const nsIntPoint& aPoint)
|
float AxisX::GetPointOffset(const gfx::Point& aPoint)
|
||||||
{
|
{
|
||||||
return aPoint.x;
|
return aPoint.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 AxisX::GetRectLength(const gfx::Rect& aRect)
|
float AxisX::GetRectLength(const gfx::Rect& aRect)
|
||||||
{
|
{
|
||||||
return NS_lround(aRect.width);
|
return aRect.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 AxisX::GetRectOffset(const gfx::Rect& aRect)
|
float AxisX::GetRectOffset(const gfx::Rect& aRect)
|
||||||
{
|
{
|
||||||
return NS_lround(aRect.x);
|
return aRect.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
AxisY::AxisY(AsyncPanZoomController* aAsyncPanZoomController)
|
AxisY::AxisY(AsyncPanZoomController* aAsyncPanZoomController)
|
||||||
@ -301,19 +301,19 @@ AxisY::AxisY(AsyncPanZoomController* aAsyncPanZoomController)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 AxisY::GetPointOffset(const nsIntPoint& aPoint)
|
float AxisY::GetPointOffset(const gfx::Point& aPoint)
|
||||||
{
|
{
|
||||||
return aPoint.y;
|
return aPoint.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 AxisY::GetRectLength(const gfx::Rect& aRect)
|
float AxisY::GetRectLength(const gfx::Rect& aRect)
|
||||||
{
|
{
|
||||||
return NS_lround(aRect.height);
|
return aRect.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 AxisY::GetRectOffset(const gfx::Rect& aRect)
|
float AxisY::GetRectOffset(const gfx::Rect& aRect)
|
||||||
{
|
{
|
||||||
return NS_lround(aRect.y);
|
return aRect.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public:
|
|||||||
* apply a displacement that takes you to the boundary of the page, then call
|
* apply a displacement that takes you to the boundary of the page, then call
|
||||||
* it again. The result will be different in this case.
|
* it again. The result will be different in this case.
|
||||||
*/
|
*/
|
||||||
PRInt32 GetDisplacementForDuration(float aScale, const TimeDuration& aDelta);
|
float GetDisplacementForDuration(float aScale, const TimeDuration& aDelta);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the distance between the starting position of the touch supplied in
|
* Gets the distance between the starting position of the touch supplied in
|
||||||
@ -114,7 +114,7 @@ public:
|
|||||||
* in both directions, this returns 0; it assumes that you check
|
* in both directions, this returns 0; it assumes that you check
|
||||||
* GetOverscroll() first.
|
* GetOverscroll() first.
|
||||||
*/
|
*/
|
||||||
PRInt32 GetExcess();
|
float GetExcess();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the raw velocity of this axis at this moment.
|
* Gets the raw velocity of this axis at this moment.
|
||||||
@ -132,7 +132,7 @@ public:
|
|||||||
* If a displacement will overscroll the axis, this returns the amount and in
|
* If a displacement will overscroll the axis, this returns the amount and in
|
||||||
* what direction. Similar to getExcess() but takes a displacement to apply.
|
* what direction. Similar to getExcess() but takes a displacement to apply.
|
||||||
*/
|
*/
|
||||||
PRInt32 DisplacementWillOverscrollAmount(PRInt32 aDisplacement);
|
float DisplacementWillOverscrollAmount(PRInt32 aDisplacement);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the overscroll state of the axis given a scaling of the page. That is
|
* Gets the overscroll state of the axis given a scaling of the page. That is
|
||||||
@ -153,7 +153,7 @@ public:
|
|||||||
* scroll offset in such a way that it remains in the same place on the page
|
* scroll offset in such a way that it remains in the same place on the page
|
||||||
* relative.
|
* relative.
|
||||||
*/
|
*/
|
||||||
PRInt32 ScaleWillOverscrollAmount(float aScale, PRInt32 aFocus);
|
float ScaleWillOverscrollAmount(float aScale, PRInt32 aFocus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if an axis will overscroll in both directions by computing the
|
* Checks if an axis will overscroll in both directions by computing the
|
||||||
@ -164,16 +164,16 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool ScaleWillOverscrollBothSides(float aScale);
|
bool ScaleWillOverscrollBothSides(float aScale);
|
||||||
|
|
||||||
PRInt32 GetOrigin();
|
float GetOrigin();
|
||||||
PRInt32 GetViewportLength();
|
float GetViewportLength();
|
||||||
PRInt32 GetPageStart();
|
float GetPageStart();
|
||||||
PRInt32 GetPageLength();
|
float GetPageLength();
|
||||||
PRInt32 GetViewportEnd();
|
float GetViewportEnd();
|
||||||
PRInt32 GetPageEnd();
|
float GetPageEnd();
|
||||||
|
|
||||||
virtual PRInt32 GetPointOffset(const nsIntPoint& aPoint) = 0;
|
virtual float GetPointOffset(const gfx::Point& aPoint) = 0;
|
||||||
virtual PRInt32 GetRectLength(const gfx::Rect& aRect) = 0;
|
virtual float GetRectLength(const gfx::Rect& aRect) = 0;
|
||||||
virtual PRInt32 GetRectOffset(const gfx::Rect& aRect) = 0;
|
virtual float GetRectOffset(const gfx::Rect& aRect) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PRInt32 mPos;
|
PRInt32 mPos;
|
||||||
@ -192,17 +192,17 @@ protected:
|
|||||||
class AxisX : public Axis {
|
class AxisX : public Axis {
|
||||||
public:
|
public:
|
||||||
AxisX(AsyncPanZoomController* mAsyncPanZoomController);
|
AxisX(AsyncPanZoomController* mAsyncPanZoomController);
|
||||||
virtual PRInt32 GetPointOffset(const nsIntPoint& aPoint);
|
virtual float GetPointOffset(const gfx::Point& aPoint);
|
||||||
virtual PRInt32 GetRectLength(const gfx::Rect& aRect);
|
virtual float GetRectLength(const gfx::Rect& aRect);
|
||||||
virtual PRInt32 GetRectOffset(const gfx::Rect& aRect);
|
virtual float GetRectOffset(const gfx::Rect& aRect);
|
||||||
};
|
};
|
||||||
|
|
||||||
class AxisY : public Axis {
|
class AxisY : public Axis {
|
||||||
public:
|
public:
|
||||||
AxisY(AsyncPanZoomController* mAsyncPanZoomController);
|
AxisY(AsyncPanZoomController* mAsyncPanZoomController);
|
||||||
virtual PRInt32 GetPointOffset(const nsIntPoint& aPoint);
|
virtual float GetPointOffset(const gfx::Point& aPoint);
|
||||||
virtual PRInt32 GetRectLength(const gfx::Rect& aRect);
|
virtual float GetRectLength(const gfx::Rect& aRect);
|
||||||
virtual PRInt32 GetRectOffset(const gfx::Rect& aRect);
|
virtual float GetRectOffset(const gfx::Rect& aRect);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -761,7 +761,9 @@ CompositorParent::TransformShadowTree(TimeStamp aCurrentFrame)
|
|||||||
|
|
||||||
if (mIsFirstPaint) {
|
if (mIsFirstPaint) {
|
||||||
mContentRect = metrics.mContentRect;
|
mContentRect = metrics.mContentRect;
|
||||||
SetFirstPaintViewport(metrics.mViewportScrollOffset,
|
const gfx::Point& scrollOffset = metrics.mViewportScrollOffset;
|
||||||
|
SetFirstPaintViewport(nsIntPoint(NS_lround(scrollOffset.x),
|
||||||
|
NS_lround(scrollOffset.y)),
|
||||||
1/rootScaleX,
|
1/rootScaleX,
|
||||||
mContentRect,
|
mContentRect,
|
||||||
metrics.mCSSContentRect);
|
metrics.mCSSContentRect);
|
||||||
@ -775,9 +777,9 @@ CompositorParent::TransformShadowTree(TimeStamp aCurrentFrame)
|
|||||||
// notifications, so that Java can take these into account in its response.
|
// notifications, so that Java can take these into account in its response.
|
||||||
// Calculate the absolute display port to send to Java
|
// Calculate the absolute display port to send to Java
|
||||||
nsIntRect displayPort = metrics.mDisplayPort;
|
nsIntRect displayPort = metrics.mDisplayPort;
|
||||||
nsIntPoint scrollOffset = metrics.mViewportScrollOffset;
|
gfx::Point scrollOffset = metrics.mViewportScrollOffset;
|
||||||
displayPort.x += scrollOffset.x;
|
displayPort.x += NS_lround(scrollOffset.x);
|
||||||
displayPort.y += scrollOffset.y;
|
displayPort.y += NS_lround(scrollOffset.y);
|
||||||
|
|
||||||
SyncViewportInfo(displayPort, 1/rootScaleX, mLayersUpdated,
|
SyncViewportInfo(displayPort, 1/rootScaleX, mLayersUpdated,
|
||||||
mScrollOffset, mXScale, mYScale);
|
mScrollOffset, mXScale, mYScale);
|
||||||
@ -794,7 +796,8 @@ CompositorParent::TransformShadowTree(TimeStamp aCurrentFrame)
|
|||||||
|
|
||||||
nsIntPoint metricsScrollOffset(0, 0);
|
nsIntPoint metricsScrollOffset(0, 0);
|
||||||
if (metrics.IsScrollable()) {
|
if (metrics.IsScrollable()) {
|
||||||
metricsScrollOffset = metrics.mViewportScrollOffset;
|
metricsScrollOffset =
|
||||||
|
nsIntPoint(NS_lround(scrollOffset.x), NS_lround(scrollOffset.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntPoint scrollCompensation(
|
nsIntPoint scrollCompensation(
|
||||||
|
@ -220,7 +220,9 @@ ReusableTileStoreOGL::DrawTiles(TiledThebesLayerOGL* aLayer,
|
|||||||
TransformBounds(gfxRect(parentMetrics.mDisplayPort));
|
TransformBounds(gfxRect(parentMetrics.mDisplayPort));
|
||||||
const FrameMetrics& metrics = scrollableLayer->GetFrameMetrics();
|
const FrameMetrics& metrics = scrollableLayer->GetFrameMetrics();
|
||||||
const nsIntSize& contentSize = metrics.mContentRect.Size();
|
const nsIntSize& contentSize = metrics.mContentRect.Size();
|
||||||
const nsIntPoint& contentOrigin = metrics.mContentRect.TopLeft() - metrics.mViewportScrollOffset;
|
const gfx::Point& scrollOffset = metrics.mViewportScrollOffset;
|
||||||
|
const nsIntPoint& contentOrigin = metrics.mContentRect.TopLeft() -
|
||||||
|
nsIntPoint(NS_lround(scrollOffset.x), NS_lround(scrollOffset.y));
|
||||||
gfxRect contentRect = gfxRect(contentOrigin.x, contentOrigin.y,
|
gfxRect contentRect = gfxRect(contentOrigin.x, contentOrigin.y,
|
||||||
contentSize.width, contentSize.height);
|
contentSize.width, contentSize.height);
|
||||||
contentBounds = scrollableLayer->GetEffectiveTransform().TransformBounds(contentRect);
|
contentBounds = scrollableLayer->GetEffectiveTransform().TransformBounds(contentRect);
|
||||||
|
@ -762,6 +762,24 @@ struct ParamTraits<nsIntSize>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct ParamTraits<mozilla::gfx::Point>
|
||||||
|
{
|
||||||
|
typedef mozilla::gfx::Point paramType;
|
||||||
|
|
||||||
|
static void Write(Message* msg, const paramType& param)
|
||||||
|
{
|
||||||
|
WriteParam(msg, param.x);
|
||||||
|
WriteParam(msg, param.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
||||||
|
{
|
||||||
|
return (ReadParam(msg, iter, &result->x) &&
|
||||||
|
ReadParam(msg, iter, &result->y));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct ParamTraits<mozilla::gfx::Size>
|
struct ParamTraits<mozilla::gfx::Size>
|
||||||
{
|
{
|
||||||
|
@ -591,8 +591,10 @@ static void RecordFrameMetrics(nsIFrame* aForFrame,
|
|||||||
nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.height));
|
nsPresContext::AppUnitsToFloatCSSPixels(contentBounds.height));
|
||||||
metrics.mContentRect = contentBounds.ScaleToNearestPixels(
|
metrics.mContentRect = contentBounds.ScaleToNearestPixels(
|
||||||
aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel);
|
aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel);
|
||||||
metrics.mViewportScrollOffset = scrollableFrame->GetScrollPosition().ScaleToNearestPixels(
|
nsPoint scrollPosition = scrollableFrame->GetScrollPosition();
|
||||||
aContainerParameters.mXScale, aContainerParameters.mYScale, auPerDevPixel);
|
metrics.mViewportScrollOffset = mozilla::gfx::Point(
|
||||||
|
NSAppUnitsToDoublePixels(scrollPosition.x, auPerDevPixel) * aContainerParameters.mXScale,
|
||||||
|
NSAppUnitsToDoublePixels(scrollPosition.y, auPerDevPixel) * aContainerParameters.mYScale);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nsRect contentBounds = aForFrame->GetRect();
|
nsRect contentBounds = aForFrame->GetRect();
|
||||||
|
@ -158,7 +158,9 @@ ComputeShadowTreeTransform(nsIFrame* aContainerFrame,
|
|||||||
nsIntPoint scrollOffset =
|
nsIntPoint scrollOffset =
|
||||||
aConfig.mScrollOffset.ToNearestPixels(auPerDevPixel);
|
aConfig.mScrollOffset.ToNearestPixels(auPerDevPixel);
|
||||||
// metricsScrollOffset is in layer coordinates.
|
// metricsScrollOffset is in layer coordinates.
|
||||||
nsIntPoint metricsScrollOffset = aMetrics->mViewportScrollOffset;
|
gfx::Point metricsScrollOffset = aMetrics->mViewportScrollOffset;
|
||||||
|
nsIntPoint roundedMetricsScrollOffset =
|
||||||
|
nsIntPoint(NS_lround(metricsScrollOffset.x), NS_lround(metricsScrollOffset.y));
|
||||||
|
|
||||||
if (aRootFrameLoader->AsyncScrollEnabled() && !aMetrics->mDisplayPort.IsEmpty()) {
|
if (aRootFrameLoader->AsyncScrollEnabled() && !aMetrics->mDisplayPort.IsEmpty()) {
|
||||||
// Only use asynchronous scrolling if it is enabled and there is a
|
// Only use asynchronous scrolling if it is enabled and there is a
|
||||||
@ -166,8 +168,8 @@ ComputeShadowTreeTransform(nsIFrame* aContainerFrame,
|
|||||||
// synchronously scrolled for identifying a scroll area before it is
|
// synchronously scrolled for identifying a scroll area before it is
|
||||||
// being actively scrolled.
|
// being actively scrolled.
|
||||||
nsIntPoint scrollCompensation(
|
nsIntPoint scrollCompensation(
|
||||||
(scrollOffset.x / aTempScaleX - metricsScrollOffset.x) * aConfig.mXScale,
|
(scrollOffset.x / aTempScaleX - roundedMetricsScrollOffset.x) * aConfig.mXScale,
|
||||||
(scrollOffset.y / aTempScaleY - metricsScrollOffset.y) * aConfig.mYScale);
|
(scrollOffset.y / aTempScaleY - roundedMetricsScrollOffset.y) * aConfig.mYScale);
|
||||||
|
|
||||||
return ViewTransform(-scrollCompensation, aConfig.mXScale, aConfig.mYScale);
|
return ViewTransform(-scrollCompensation, aConfig.mXScale, aConfig.mYScale);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2338,11 +2338,24 @@ Tab.prototype = {
|
|||||||
aDisplayPort = this._dirtiestHackEverToWorkAroundGeckoRounding(aDisplayPort, geckoScrollX, geckoScrollY);
|
aDisplayPort = this._dirtiestHackEverToWorkAroundGeckoRounding(aDisplayPort, geckoScrollX, geckoScrollY);
|
||||||
|
|
||||||
cwu = this.browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
cwu = this.browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||||
cwu.setDisplayPortForElement((aDisplayPort.left / resolution) - geckoScrollX,
|
|
||||||
(aDisplayPort.top / resolution) - geckoScrollY,
|
let displayPort = {
|
||||||
(aDisplayPort.right - aDisplayPort.left) / resolution,
|
x: (aDisplayPort.left / resolution) - geckoScrollX,
|
||||||
(aDisplayPort.bottom - aDisplayPort.top) / resolution,
|
y: (aDisplayPort.top / resolution) - geckoScrollY,
|
||||||
element);
|
width: (aDisplayPort.right - aDisplayPort.left) / resolution,
|
||||||
|
height: (aDisplayPort.bottom - aDisplayPort.top) / resolution
|
||||||
|
};
|
||||||
|
|
||||||
|
let epsilon = 0.001;
|
||||||
|
if (this._oldDisplayPort == null ||
|
||||||
|
Math.abs(displayPort.x - this._oldDisplayPort.x) > epsilon ||
|
||||||
|
Math.abs(displayPort.y - this._oldDisplayPort.y) > epsilon ||
|
||||||
|
Math.abs(displayPort.width - this._oldDisplayPort.width) > epsilon ||
|
||||||
|
Math.abs(displayPort.height - this._oldDisplayPort.height) > epsilon) {
|
||||||
|
cwu.setDisplayPortForElement(displayPort.x, displayPort.y, displayPort.width, displayPort.height, element);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._oldDisplayPort = displayPort;
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user