Backed out 2 changesets (bug 1650502) for failing android at test_frame_reconstruction.html on a CLOSED TREE

Backed out changeset 9b300d20df23 (bug 1650502)
Backed out changeset 1e87d4186672 (bug 1650502)
This commit is contained in:
Andreea Pavel 2020-08-01 02:54:36 +03:00
parent 742a9ce46c
commit cae88d4491
9 changed files with 46 additions and 100 deletions

View File

@ -57,12 +57,10 @@ struct RepaintRequest {
mPaintRequestTime(),
mScrollUpdateType(eNone),
mIsRootContent(false),
mIsAnimationInProgress(false),
mIsScrollInfoLayer(false) {}
RepaintRequest(const FrameMetrics& aOther,
const ScrollOffsetUpdateType aScrollUpdateType,
bool aIsAnimationInProgress)
const ScrollOffsetUpdateType aScrollUpdateType)
: mScrollId(aOther.GetScrollId()),
mPresShellResolution(aOther.GetPresShellResolution()),
mCompositionBounds(aOther.GetCompositionBounds()),
@ -78,7 +76,6 @@ struct RepaintRequest {
mPaintRequestTime(aOther.GetPaintRequestTime()),
mScrollUpdateType(aScrollUpdateType),
mIsRootContent(aOther.IsRootContent()),
mIsAnimationInProgress(aIsAnimationInProgress),
mIsScrollInfoLayer(aOther.IsScrollInfoLayer()) {}
// Default copy ctor and operator= are fine
@ -100,7 +97,6 @@ struct RepaintRequest {
mPaintRequestTime == aOther.mPaintRequestTime &&
mScrollUpdateType == aOther.mScrollUpdateType &&
mIsRootContent == aOther.mIsRootContent &&
mIsAnimationInProgress == aOther.mIsAnimationInProgress &&
mIsScrollInfoLayer == aOther.mIsScrollInfoLayer;
}
@ -151,8 +147,6 @@ struct RepaintRequest {
return mDevPixelsPerCSSPixel;
}
bool IsAnimationInProgress() const { return mIsAnimationInProgress; }
bool IsRootContent() const { return mIsRootContent; }
const CSSPoint& GetScrollOffset() const { return mScrollOffset; }
@ -186,10 +180,6 @@ struct RepaintRequest {
bool IsScrollInfoLayer() const { return mIsScrollInfoLayer; }
protected:
void SetIsAnimationInProgress(bool aInProgress) {
mIsAnimationInProgress = aInProgress;
}
void SetIsRootContent(bool aIsRootContent) {
mIsRootContent = aIsRootContent;
}
@ -290,9 +280,6 @@ struct RepaintRequest {
// Whether or not this is the root scroll frame for the root content document.
bool mIsRootContent : 1;
// Whether or not we are in the middle of a scroll animation.
bool mIsAnimationInProgress : 1;
// True if this scroll frame is a scroll info layer. A scroll info layer is
// not layerized and its content cannot be truly async-scrolled, but its
// metrics are still sent to and updated by the compositor, with the updates

View File

@ -3982,8 +3982,7 @@ void AsyncPanZoomController::RequestContentRepaint(
}
MOZ_ASSERT(controller->IsRepaintThread());
const bool isAnimationInProgress = !!mAnimation;
RepaintRequest request(aFrameMetrics, aUpdateType, isAnimationInProgress);
RepaintRequest request(aFrameMetrics, aUpdateType);
// If we're trying to paint what we already think is painted, discard this
// request since it's a pointless paint.
@ -3999,9 +3998,7 @@ void AsyncPanZoomController::RequestContentRepaint(
request.GetScrollGeneration() ==
mLastPaintRequestMetrics.GetScrollGeneration() &&
request.GetScrollUpdateType() ==
mLastPaintRequestMetrics.GetScrollUpdateType() &&
request.IsAnimationInProgress() ==
mLastPaintRequestMetrics.IsAnimationInProgress()) {
mLastPaintRequestMetrics.GetScrollUpdateType()) {
return;
}
@ -4041,7 +4038,7 @@ bool AsyncPanZoomController::UpdateAnimation(
// However we only want to do one animation step per composition so we need
// to deduplicate these calls first.
if (mLastSampleTime == aSampleTime) {
return !!mAnimation;
return (mAnimation != nullptr);
}
// We're at a new timestamp, so advance to the next sample in the deque, if
@ -4886,6 +4883,7 @@ FrameMetrics& AsyncPanZoomController::Metrics() {
const FrameMetrics& AsyncPanZoomController::Metrics() const {
mRecursiveMutex.AssertCurrentThreadIn();
return mScrollMetadata.GetMetrics();
;
}
bool AsyncPanZoomController::UpdateRootFrameMetricsIfChanged(

View File

@ -164,8 +164,7 @@ static ScreenMargin ScrollFrame(nsIContent* aContent,
nsIScrollableFrame* sf =
nsLayoutUtils::FindScrollableFrameFor(aRequest.GetScrollId());
if (sf) {
sf->ResetScrollInfoIfNeeded(aRequest.GetScrollGeneration(),
aRequest.IsAnimationInProgress());
sf->ResetScrollInfoIfGeneration(aRequest.GetScrollGeneration());
sf->SetScrollableByAPZ(!aRequest.IsScrollInfoLayer());
if (sf->IsRootScrollFrameOfDocument()) {
if (!APZCCallbackHelper::IsScrollInProgress(sf)) {
@ -835,10 +834,10 @@ void APZCCallbackHelper::NotifyFlushComplete(PresShell* aPresShell) {
/* static */
bool APZCCallbackHelper::IsScrollInProgress(nsIScrollableFrame* aFrame) {
using IncludeApzAnimation = nsIScrollableFrame::IncludeApzAnimation;
return aFrame->IsScrollAnimating(IncludeApzAnimation::No) ||
nsLayoutUtils::CanScrollOriginClobberApz(aFrame->LastScrollOrigin());
return aFrame->IsProcessingAsyncScroll() ||
nsLayoutUtils::CanScrollOriginClobberApz(aFrame->LastScrollOrigin()) ||
aFrame->LastSmoothScrollOrigin() != ScrollOrigin::None ||
aFrame->GetRelativeOffset().isSome();
}
/* static */

View File

@ -179,11 +179,8 @@ class APZCCallbackHelper {
ScreenPoint aScrollDelta);
/*
* Check if the scrollable frame is currently in the middle of a main thread
* async or smooth scroll, or has already requested some other apz scroll that
* hasn't been acknowledged by apz.
*
* We want to discard apz updates to the main-thread scroll offset if this is
* Check if the scrollable frame is currently in the middle of an async
* or smooth scroll. We want to discard certain scroll input if this is
* true to prevent clobbering higher priority origins.
*/
static bool IsScrollInProgress(nsIScrollableFrame* aFrame);

View File

@ -278,7 +278,6 @@ struct ParamTraits<mozilla::layers::RepaintRequest>
WriteParam(aMsg, aParam.mPaintRequestTime);
WriteParam(aMsg, aParam.mScrollUpdateType);
WriteParam(aMsg, aParam.mIsRootContent);
WriteParam(aMsg, aParam.mIsAnimationInProgress);
WriteParam(aMsg, aParam.mIsScrollInfoLayer);
}
@ -300,8 +299,6 @@ struct ParamTraits<mozilla::layers::RepaintRequest>
ReadParam(aMsg, aIter, &aResult->mScrollUpdateType) &&
ReadBoolForBitfield(aMsg, aIter, aResult,
&paramType::SetIsRootContent) &&
ReadBoolForBitfield(aMsg, aIter, aResult,
&paramType::SetIsAnimationInProgress) &&
ReadBoolForBitfield(aMsg, aIter, aResult,
&paramType::SetIsScrollInfoLayer));
}

View File

@ -418,17 +418,19 @@ void ScrollAnchorContainer::ApplyAdjustments() {
if (!mAnchorNode || mAnchorNodeIsDirty || mDisabled ||
mScrollFrame->HasPendingScrollRestoration() ||
mScrollFrame->IsProcessingScrollEvent() ||
mScrollFrame->IsScrollAnimating() ||
mScrollFrame->IsProcessingAsyncScroll() ||
mScrollFrame->mApzSmoothScrollDestination.isSome() ||
mScrollFrame->GetScrollPosition() == nsPoint()) {
ANCHOR_LOG(
"Ignoring post-reflow (anchor=%p, dirty=%d, disabled=%d, "
"pendingRestoration=%d, scrollevent=%d, animating=%d, "
"zeroScrollPos=%d pendingSuppression=%d, "
"pendingRestoration=%d, scrollevent=%d, asyncScroll=%d, "
"apzSmoothDestination=%d, zeroScrollPos=%d pendingSuppression=%d, "
"container=%p).\n",
mAnchorNode, mAnchorNodeIsDirty, mDisabled,
mScrollFrame->HasPendingScrollRestoration(),
mScrollFrame->IsProcessingScrollEvent(),
mScrollFrame->IsScrollAnimating(),
mScrollFrame->IsProcessingAsyncScroll(),
mScrollFrame->mApzSmoothScrollDestination.isSome(),
mScrollFrame->GetScrollPosition() == nsPoint(),
mSuppressAnchorAdjustment, this);
if (mSuppressAnchorAdjustment) {

View File

@ -2185,7 +2185,6 @@ ScrollFrameHelper::ScrollFrameHelper(nsContainerFrame* aOuter, bool aIsRoot)
mIsUsingMinimumScaleSize(false),
mMinimumScaleSizeChanged(false),
mProcessingScrollEvent(false),
mApzAnimationInProgress(false),
mVelocityQueue(aOuter->PresContext()) {
if (LookAndFeel::GetInt(LookAndFeel::IntID::UseOverlayScrollbars) != 0) {
mScrollbarActivity = new ScrollbarActivity(do_QueryFrame(aOuter));
@ -6186,7 +6185,8 @@ bool ScrollFrameHelper::ReflowFinished() {
// do anything.
nsPoint currentScrollPos = GetScrollPosition();
ScrollToImpl(currentScrollPos, nsRect(currentScrollPos, nsSize(0, 0)));
if (!IsScrollAnimating()) {
if (!mAsyncScroll && !mAsyncSmoothMSDScroll &&
!mApzSmoothScrollDestination) {
// We need to have mDestination track the current scroll position,
// in case it falls outside the new reflow area. mDestination is used
// by ScrollBy as its starting position.
@ -6826,16 +6826,6 @@ nscoord ScrollFrameHelper::GetCoordAttribute(nsIFrame* aBox, nsAtom* aAtom,
return aDefaultValue;
}
bool ScrollFrameHelper::IsScrollAnimating(
IncludeApzAnimation aIncludeApz) const {
if (aIncludeApz == IncludeApzAnimation::Yes && IsApzAnimationInProgress()) {
return true;
}
return mAsyncScroll || mAsyncSmoothMSDScroll ||
LastSmoothScrollOrigin() != ScrollOrigin::None ||
mRelativeOffset.isSome();
}
UniquePtr<PresState> ScrollFrameHelper::SaveState() const {
nsIScrollbarMediator* mediator = do_QueryFrame(GetScrolledFrame());
if (mediator) {
@ -6845,8 +6835,10 @@ UniquePtr<PresState> ScrollFrameHelper::SaveState() const {
// Don't store a scroll state if we never have been scrolled or restored
// a previous scroll state, and we're not in the middle of a smooth scroll.
bool isScrollAnimating = IsScrollAnimating();
if (!mHasBeenScrolled && !mDidHistoryRestore && !isScrollAnimating) {
bool isInSmoothScroll = IsProcessingAsyncScroll() ||
mLastSmoothScrollOrigin != ScrollOrigin::None ||
mRelativeOffset.isSome();
if (!mHasBeenScrolled && !mDidHistoryRestore && !isInSmoothScroll) {
return nullptr;
}
@ -6864,7 +6856,7 @@ UniquePtr<PresState> ScrollFrameHelper::SaveState() const {
// effectively dropping it. Note that the mRestorePos will override the
// smooth scroll destination if both are present.
nsPoint pt = GetLogicalVisualViewportOffset();
if (isScrollAnimating) {
if (isInSmoothScroll) {
pt = mDestination;
allowScrollOriginDowngrade = false;
}

View File

@ -376,6 +376,9 @@ class ScrollFrameHelper : public nsIReflowCallback {
return mWillBuildScrollableLayer;
}
bool IsMaybeScrollingActive() const;
bool IsProcessingAsyncScroll() const {
return mAsyncScroll != nullptr || mAsyncSmoothMSDScroll != nullptr;
}
void ResetScrollPositionForLayerPixelAlignment() {
mScrollPosForLayerPixelAlignment = GetScrollPosition();
}
@ -460,22 +463,13 @@ class ScrollFrameHelper : public nsIReflowCallback {
ScrollOrigin LastSmoothScrollOrigin() const {
return mLastSmoothScrollOrigin;
}
bool IsApzAnimationInProgress() const { return mApzAnimationInProgress; }
uint32_t CurrentScrollGeneration() const { return mScrollGeneration; }
nsPoint LastScrollDestination() const { return mDestination; }
using IncludeApzAnimation = nsIScrollableFrame::IncludeApzAnimation;
bool IsScrollAnimating(IncludeApzAnimation = IncludeApzAnimation::Yes) const;
void ResetScrollInfoIfNeeded(uint32_t aGeneration,
bool aApzAnimationInProgress) {
void ResetScrollInfoIfGeneration(uint32_t aGeneration) {
if (aGeneration == mScrollGeneration) {
mLastScrollOrigin = ScrollOrigin::NotSpecified;
mLastSmoothScrollOrigin = ScrollOrigin::None;
}
// We can reset this regardless of scroll generation, as this is only set
// here, as a response to APZ requesting a repaint.
mApzAnimationInProgress = aApzAnimationInProgress;
}
Maybe<nsPoint> GetRelativeOffset() const { return mRelativeOffset; }
bool WantAsyncScroll() const;
@ -711,13 +705,6 @@ class ScrollFrameHelper : public nsIReflowCallback {
// True if we're processing an scroll event.
bool mProcessingScrollEvent : 1;
// Whether an APZ animation is in progress. Note that this is only set to true
// when repainted via APZ, which means that there may be a request for an APZ
// animation in flight for example, while this is still false. In order to
// answer "is an APZ animation in the process of starting or in progress" you
// need to check both mLastSmoothScrollOrigin and this bit.
bool mApzAnimationInProgress : 1;
mozilla::layout::ScrollVelocityQueue mVelocityQueue;
protected:
@ -1031,6 +1018,9 @@ class nsHTMLScrollFrame : public nsContainerFrame,
bool IsMaybeAsynchronouslyScrolled() final {
return mHelper.IsMaybeAsynchronouslyScrolled();
}
bool IsProcessingAsyncScroll() final {
return mHelper.IsProcessingAsyncScroll();
}
void ResetScrollPositionForLayerPixelAlignment() final {
mHelper.ResetScrollPositionForLayerPixelAlignment();
}
@ -1047,18 +1037,14 @@ class nsHTMLScrollFrame : public nsContainerFrame,
ScrollOrigin LastSmoothScrollOrigin() final {
return mHelper.LastSmoothScrollOrigin();
}
bool IsScrollAnimating(IncludeApzAnimation aIncludeApz) final {
return mHelper.IsScrollAnimating(aIncludeApz);
}
uint32_t CurrentScrollGeneration() final {
return mHelper.CurrentScrollGeneration();
}
nsPoint LastScrollDestination() final {
return mHelper.LastScrollDestination();
}
void ResetScrollInfoIfNeeded(uint32_t aGeneration,
bool aApzAnimationInProgress) final {
mHelper.ResetScrollInfoIfNeeded(aGeneration, aApzAnimationInProgress);
void ResetScrollInfoIfGeneration(uint32_t aGeneration) final {
mHelper.ResetScrollInfoIfGeneration(aGeneration);
}
Maybe<nsPoint> GetRelativeOffset() const final {
return mHelper.GetRelativeOffset();
@ -1507,6 +1493,9 @@ class nsXULScrollFrame final : public nsBoxFrame,
bool IsMaybeAsynchronouslyScrolled() final {
return mHelper.IsMaybeAsynchronouslyScrolled();
}
bool IsProcessingAsyncScroll() final {
return mHelper.IsProcessingAsyncScroll();
}
void ResetScrollPositionForLayerPixelAlignment() final {
mHelper.ResetScrollPositionForLayerPixelAlignment();
}
@ -1523,18 +1512,14 @@ class nsXULScrollFrame final : public nsBoxFrame,
ScrollOrigin LastSmoothScrollOrigin() final {
return mHelper.LastSmoothScrollOrigin();
}
bool IsScrollAnimating(IncludeApzAnimation aIncludeApz) final {
return mHelper.IsScrollAnimating(aIncludeApz);
}
uint32_t CurrentScrollGeneration() final {
return mHelper.CurrentScrollGeneration();
}
nsPoint LastScrollDestination() final {
return mHelper.LastScrollDestination();
}
void ResetScrollInfoIfNeeded(uint32_t aGeneration,
bool aApzAnimationInProgress) final {
mHelper.ResetScrollInfoIfNeeded(aGeneration, aApzAnimationInProgress);
void ResetScrollInfoIfGeneration(uint32_t aGeneration) final {
mHelper.ResetScrollInfoIfGeneration(aGeneration);
}
Maybe<nsPoint> GetRelativeOffset() const final {
return mHelper.GetRelativeOffset();

View File

@ -379,6 +379,11 @@ class nsIScrollableFrame : public nsIScrollbarMediator {
* which means that it can be called during display list building.
*/
virtual bool IsMaybeScrollingActive() const = 0;
/**
* Returns true if the scrollframe is currently processing an async
* or smooth scroll.
*/
virtual bool IsProcessingAsyncScroll() = 0;
/**
* Call this when the layer(s) induced by active scrolling are being
* completely redrawn.
@ -430,19 +435,6 @@ class nsIScrollableFrame : public nsIScrollbarMediator {
* compositor, this is set to nullptr to clear the smooth scroll.
*/
virtual ScrollOrigin LastSmoothScrollOrigin() = 0;
/**
* Returns whether there's an async scroll going on.
*
* The argument allows a subtle distinction that's needed for APZ. When
* `IncludeApzAnimation::No` is given, ongoing APZ animations that have
* already been synced to the main thread are not included, which is needed so
* that APZ can keep syncing the scroll offset properly.
*/
enum class IncludeApzAnimation : bool { No, Yes };
virtual bool IsScrollAnimating(
IncludeApzAnimation = IncludeApzAnimation::Yes) = 0;
/**
* Returns the current generation counter for the scroll. This counter
* increments every time the scroll position is set.
@ -456,12 +448,9 @@ class nsIScrollableFrame : public nsIScrollbarMediator {
/**
* Clears the "origin of last scroll" property stored in this frame, if
* the generation counter passed in matches the current scroll generation
* counter, and clears the "origin of last smooth scroll" property if the
* generation counter matches. It also resets whether there's an ongoing apz
* animation.
* counter.
*/
virtual void ResetScrollInfoIfNeeded(uint32_t aGeneration,
bool aApzAnimationInProgress) = 0;
virtual void ResetScrollInfoIfGeneration(uint32_t aGeneration) = 0;
/**
* Relative scrolling offset to be requested of apz.
*/