Bug 1914154 - Fix how we deal with APZ scrollbar activity. r=hiro
For the vertical tab bar, probably due to how it re-implements scrolling[1], we get multiple eTransformBegin state changes, but a single eTransformEnd. That ends up with a permanently-positive activity counter, which leaves the scrollbar visible. There might be an underlying APZ bug here, not sure if mismatched events are expected, but it seems other handlers deal with this mostly correctly, and the fix on layout's end is rather trivial, too, so this seems worth doing. [1]: https://searchfox.org/mozilla-central/rev/26a98a7ba56f315df146512c43449412f0592942/toolkit/content/widgets/arrowscrollbox.js#640-718 Differential Revision: https://phabricator.services.mozilla.com/D222431
This commit is contained in:
@@ -497,7 +497,6 @@ void APZEventState::ProcessAPZStateChange(ViewID aViewId,
|
||||
nsLayoutUtils::FindScrollContainerFrameFor(aViewId);
|
||||
if (sf) {
|
||||
sf->SetTransformingByAPZ(true);
|
||||
sf->ScrollbarActivityStarted();
|
||||
}
|
||||
|
||||
nsIContent* content = nsLayoutUtils::FindContentFor(aViewId);
|
||||
@@ -514,7 +513,6 @@ void APZEventState::ProcessAPZStateChange(ViewID aViewId,
|
||||
nsLayoutUtils::FindScrollContainerFrameFor(aViewId);
|
||||
if (sf) {
|
||||
sf->SetTransformingByAPZ(false);
|
||||
sf->ScrollbarActivityStopped();
|
||||
}
|
||||
|
||||
nsIContent* content = nsLayoutUtils::FindContentFor(aViewId);
|
||||
|
||||
@@ -2296,12 +2296,18 @@ void ScrollContainerFrame::AsyncScrollCallback(ScrollContainerFrame* aInstance,
|
||||
}
|
||||
|
||||
void ScrollContainerFrame::SetTransformingByAPZ(bool aTransforming) {
|
||||
if (mTransformingByAPZ && !aTransforming) {
|
||||
PostScrollEndEvent();
|
||||
if (mTransformingByAPZ == aTransforming) {
|
||||
return;
|
||||
}
|
||||
mTransformingByAPZ = aTransforming;
|
||||
if (!mozilla::css::TextOverflow::HasClippedTextOverflow(this) ||
|
||||
mozilla::css::TextOverflow::HasBlockEllipsis(mScrolledFrame)) {
|
||||
if (aTransforming) {
|
||||
ScrollbarActivityStarted();
|
||||
} else {
|
||||
ScrollbarActivityStopped();
|
||||
PostScrollEndEvent();
|
||||
}
|
||||
if (!css::TextOverflow::HasClippedTextOverflow(this) ||
|
||||
css::TextOverflow::HasBlockEllipsis(mScrolledFrame)) {
|
||||
// If the block has some overflow marker stuff we should kick off a paint
|
||||
// because we have special behaviour for it when APZ scrolling is active.
|
||||
SchedulePaint();
|
||||
|
||||
@@ -96,6 +96,8 @@ ScrollbarActivity::HandleEvent(dom::Event* aEvent) {
|
||||
nsAutoString type;
|
||||
aEvent->GetType(type);
|
||||
|
||||
auto* targetContent =
|
||||
nsIContent::FromEventTargetOrNull(aEvent->GetOriginalTarget());
|
||||
if (type.EqualsLiteral("mousemove")) {
|
||||
// Mouse motions anywhere in the scrollable frame should keep the
|
||||
// scrollbars visible, but we have to be careful as content descendants of
|
||||
@@ -105,8 +107,6 @@ ScrollbarActivity::HandleEvent(dom::Event* aEvent) {
|
||||
nsIFrame* scrollFrame = do_QueryFrame(mScrollableFrame);
|
||||
MOZ_ASSERT(scrollFrame);
|
||||
ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(scrollFrame);
|
||||
nsCOMPtr<nsIContent> targetContent =
|
||||
do_QueryInterface(aEvent->GetOriginalTarget());
|
||||
nsIFrame* targetFrame =
|
||||
targetContent ? targetContent->GetPrimaryFrame() : nullptr;
|
||||
if ((scrollContainerFrame &&
|
||||
@@ -120,9 +120,6 @@ ScrollbarActivity::HandleEvent(dom::Event* aEvent) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> targetContent =
|
||||
do_QueryInterface(aEvent->GetOriginalTarget());
|
||||
|
||||
HandleEventForScrollbar(type, targetContent, GetHorizontalScrollbar(),
|
||||
&mHScrollbarHovered);
|
||||
HandleEventForScrollbar(type, targetContent, GetVerticalScrollbar(),
|
||||
|
||||
Reference in New Issue
Block a user