зеркало из https://github.com/mozilla/gecko-dev.git
Back out three patches from bug 1228407 on a CLOSED TREE for causing various mochitest failures. r=backout
--HG-- extra : commitid : 7gaWjh5Noye
This commit is contained in:
Родитель
9227b3237b
Коммит
9491a614c4
|
@ -797,12 +797,6 @@ public:
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetDestination(const nsPoint& aNewDestination) {
|
||||
mXAxisModel.SetDestination(static_cast<int32_t>(aNewDestination.x));
|
||||
mYAxisModel.SetDestination(static_cast<int32_t>(aNewDestination.y));
|
||||
}
|
||||
|
||||
private:
|
||||
AsyncPanZoomController& mApzc;
|
||||
AxisPhysicsMSDModel mXAxisModel, mYAxisModel;
|
||||
|
@ -3229,22 +3223,20 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
|||
ToString(mFrameMetrics.GetScrollOffset()).c_str(),
|
||||
ToString(aLayerMetrics.GetScrollOffset()).c_str());
|
||||
|
||||
// Send an acknowledgement with the new scroll generation so that any
|
||||
// repaint requests later in this function go through.
|
||||
// Because of the scroll generation update, any inflight paint requests are
|
||||
// going to be ignored by layout, and so mLastDispatchedPaintMetrics
|
||||
// becomes incorrect for the purposes of calculating the LD transform. To
|
||||
// correct this we need to update mLastDispatchedPaintMetrics to be the
|
||||
// last thing we know was painted by Gecko.
|
||||
mFrameMetrics.CopyScrollInfoFrom(aLayerMetrics);
|
||||
AcknowledgeScrollUpdate();
|
||||
mLastDispatchedPaintMetrics = aLayerMetrics;
|
||||
|
||||
// Cancel the animation (which might also trigger a repaint request)
|
||||
// after we update the scroll offset above. Otherwise we can be left
|
||||
// in a state where things are out of sync.
|
||||
CancelAnimation();
|
||||
|
||||
// Because of the scroll offset update, any inflight paint requests are
|
||||
// going to be ignored by layout, and so mLastDispatchedPaintMetrics
|
||||
// becomes incorrect for the purposes of calculating the LD transform. To
|
||||
// correct this we need to update mLastDispatchedPaintMetrics to be the
|
||||
// last thing we know was painted by Gecko.
|
||||
mLastDispatchedPaintMetrics = aLayerMetrics;
|
||||
|
||||
// Since the scroll offset has changed, we need to recompute the
|
||||
// displayport margins and send them to layout. Otherwise there might be
|
||||
// scenarios where for example we scroll from the top of a page (where the
|
||||
|
@ -3261,26 +3253,34 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
|||
// thread. This flag will be reset by the main thread when it receives
|
||||
// the scroll update acknowledgement.
|
||||
|
||||
APZC_LOG("%p smooth scrolling from %s to %s in state %d\n", this,
|
||||
APZC_LOG("%p smooth scrolling from %s to %s\n", this,
|
||||
Stringify(mFrameMetrics.GetScrollOffset()).c_str(),
|
||||
Stringify(aLayerMetrics.GetSmoothScrollOffset()).c_str(),
|
||||
mState);
|
||||
Stringify(aLayerMetrics.GetSmoothScrollOffset()).c_str());
|
||||
|
||||
// See comment on the similar code in the |if (scrollOffsetUpdated)| block
|
||||
// above.
|
||||
CancelAnimation();
|
||||
|
||||
// It's important to not send repaint requests between this
|
||||
// CopySmoothScrollInfo call and the sending of the scroll update
|
||||
// acknowledgement below, otherwise that repaint request will get rejected
|
||||
// on the main thread but mLastPaintRequestMetrics will have the new scroll
|
||||
// generation; this would leave the main thread out of date.
|
||||
mFrameMetrics.CopySmoothScrollInfoFrom(aLayerMetrics);
|
||||
AcknowledgeScrollUpdate();
|
||||
mLastDispatchedPaintMetrics = aLayerMetrics;
|
||||
StartSmoothScroll(ScrollSource::DOM);
|
||||
|
||||
if (mState == SMOOTH_SCROLL && mAnimation) {
|
||||
APZC_LOG("%p updating destination on existing animation\n", this);
|
||||
RefPtr<SmoothScrollAnimation> animation(
|
||||
static_cast<SmoothScrollAnimation*>(mAnimation.get()));
|
||||
animation->SetDestination(
|
||||
CSSPoint::ToAppUnits(aLayerMetrics.GetSmoothScrollOffset()));
|
||||
} else {
|
||||
CancelAnimation();
|
||||
StartSmoothScroll(ScrollSource::DOM);
|
||||
scrollOffsetUpdated = true; // Ensure that AcknowledgeScrollUpdate is called
|
||||
}
|
||||
|
||||
if (scrollOffsetUpdated) {
|
||||
// Once layout issues a scroll offset update, it becomes impervious to
|
||||
// scroll offset updates from APZ until we acknowledge the update it sent.
|
||||
// This prevents APZ updates from clobbering scroll updates from other
|
||||
// more "legitimate" sources like content scripts.
|
||||
RefPtr<GeckoContentController> controller = GetGeckoContentController();
|
||||
if (controller) {
|
||||
APZC_LOG("%p sending scroll update acknowledgement with gen %u\n", this, aLayerMetrics.GetScrollGeneration());
|
||||
controller->AcknowledgeScrollUpdate(aLayerMetrics.GetScrollId(),
|
||||
aLayerMetrics.GetScrollGeneration());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3290,21 +3290,6 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
|||
UpdateSharedCompositorFrameMetrics();
|
||||
}
|
||||
|
||||
void
|
||||
AsyncPanZoomController::AcknowledgeScrollUpdate() const
|
||||
{
|
||||
// Once layout issues a scroll offset update, it becomes impervious to
|
||||
// scroll offset updates from APZ until we acknowledge the update it sent.
|
||||
// This prevents APZ updates from clobbering scroll updates from other
|
||||
// more "legitimate" sources like content scripts.
|
||||
RefPtr<GeckoContentController> controller = GetGeckoContentController();
|
||||
if (controller) {
|
||||
APZC_LOG("%p sending scroll update acknowledgement with gen %u\n", this, mFrameMetrics.GetScrollGeneration());
|
||||
controller->AcknowledgeScrollUpdate(mFrameMetrics.GetScrollId(),
|
||||
mFrameMetrics.GetScrollGeneration());
|
||||
}
|
||||
}
|
||||
|
||||
const FrameMetrics& AsyncPanZoomController::GetFrameMetrics() const {
|
||||
mMonitor.AssertCurrentThreadIn();
|
||||
return mFrameMetrics;
|
||||
|
|
|
@ -829,6 +829,11 @@ private:
|
|||
|
||||
PanGestureBlockState* CurrentPanGestureBlock();
|
||||
|
||||
/* ===================================================================
|
||||
* The functions and members in this section are used to manage
|
||||
* pan gestures.
|
||||
*/
|
||||
|
||||
private:
|
||||
/* ===================================================================
|
||||
* The functions and members in this section are used to manage
|
||||
|
@ -884,8 +889,6 @@ private:
|
|||
// Returns whether overscroll is allowed during an event.
|
||||
bool AllowScrollHandoffInCurrentBlock() const;
|
||||
|
||||
void AcknowledgeScrollUpdate() const;
|
||||
|
||||
/* ===================================================================
|
||||
* The functions and members in this section are used to make ancestor chains
|
||||
* out of APZC instances. These chains can only be walked or manipulated
|
||||
|
|
|
@ -2121,30 +2121,10 @@ ScrollFrameHelper::ScrollToWithOrigin(nsPoint aScrollPosition,
|
|||
}
|
||||
|
||||
if (nsLayoutUtils::AsyncPanZoomEnabled(mOuter)) {
|
||||
if (mApzSmoothScrollDestination == mDestination &&
|
||||
mScrollGeneration == sScrollGenerationCounter) {
|
||||
// If we already sent APZ a smooth-scroll request to this
|
||||
// destination with this generation (i.e. it was the last request
|
||||
// we sent), then don't send another one because it is redundant.
|
||||
// This is to avoid a scenario where pages do repeated scrollBy
|
||||
// calls, incrementing the generation counter, and blocking APZ from
|
||||
// syncing the scroll offset back to the main thread.
|
||||
// Note that if we get two smooth-scroll requests to the same
|
||||
// destination with some other scroll in between, mDestination will
|
||||
// get reset and so we shouldn't have the problem where this check
|
||||
// discards a legitimate smooth-scroll.
|
||||
// Note: if there are two separate scrollframes both getting smooth
|
||||
// scrolled at the same time, sScrollGenerationCounter can get
|
||||
// incremented and this early-exit won't get taken. Bug 1231177 is
|
||||
// on file for this.
|
||||
return;
|
||||
}
|
||||
|
||||
// The animation will be handled in the compositor, pass the
|
||||
// information needed to start the animation and skip the main-thread
|
||||
// animation for this scroll.
|
||||
mLastSmoothScrollOrigin = aOrigin;
|
||||
mApzSmoothScrollDestination = mDestination;
|
||||
mScrollGeneration = ++sScrollGenerationCounter;
|
||||
|
||||
if (!nsLayoutUtils::GetDisplayPort(mOuter->GetContent())) {
|
||||
|
|
|
@ -432,7 +432,6 @@ public:
|
|||
nsTArray<nsIScrollPositionListener*> mListeners;
|
||||
nsIAtom* mLastScrollOrigin;
|
||||
nsIAtom* mLastSmoothScrollOrigin;
|
||||
nsPoint mApzSmoothScrollDestination;
|
||||
uint32_t mScrollGeneration;
|
||||
nsRect mScrollPort;
|
||||
// Where we're currently scrolling to, if we're scrolling asynchronously.
|
||||
|
|
Загрузка…
Ссылка в новой задаче