Bug 1556556 - Remove many uses of IgnoreRootScrollFrame. r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D68913
This commit is contained in:
Botond Ballo 2020-04-28 02:25:51 +00:00
Родитель 480ee775c9
Коммит b11a399d42
10 изменённых файлов: 7 добавлений и 69 удалений

Просмотреть файл

@ -536,17 +536,7 @@ Accessible* Accessible::ChildAtPoint(int32_t aX, int32_t aY,
offset += presContext->PresShell()->GetVisualViewportOffset() -
presContext->PresShell()->GetLayoutViewportOffset();
EnumSet<nsLayoutUtils::FrameForPointOption> options = {
#ifdef MOZ_WIDGET_ANDROID
// This is needed in Android to ignore the clipping of the scroll frame
// when zoomed in. May regress something on other platforms, so
// keeping it Android-exclusive for now.
nsLayoutUtils::FrameForPointOption::IgnoreRootScrollFrame
#endif
};
nsIFrame* foundFrame =
nsLayoutUtils::GetFrameForPoint(startFrame, offset, options);
nsIFrame* foundFrame = nsLayoutUtils::GetFrameForPoint(startFrame, offset);
nsIContent* content = nullptr;
if (!foundFrame || !(content = foundFrame->GetContent()))

Просмотреть файл

@ -62,17 +62,6 @@ APZEventResult APZInputBridge::ReceiveInputEvent(WidgetInputEvent& aEvent) {
UpdateWheelTransaction(mouseEvent.mRefPoint, mouseEvent.mMessage);
}
// If zooming is enabled, mark the mouse event as "ignore root
// scroll frame". This ensures that the main-thread hit test the
// mouse event undergoes (in PositionedEventTargeting.cpp) uses
// the IGNORE_ROOT_SCROLL_FRAME flag, which is needed for correct
// hit testing in a zoomed-in or zoomed-out state.
// FIXME: bug 1525793 -- this may need to handle zooming or not on a
// per-document basis.
if (StaticPrefs::apz_allow_zooming()) {
mouseEvent.mIgnoreRootScrollFrame = true;
}
if (WillHandleMouseEvent(mouseEvent)) {
MouseInput input(mouseEvent);
input.mOrigin =

Просмотреть файл

@ -475,7 +475,6 @@ nsEventStatus APZCCallbackHelper::DispatchSynthesizedMouseEvent(
if (aMsg == eMouseLongTap) {
event.mFlags.mOnlyChromeDispatch = true;
}
event.mIgnoreRootScrollFrame = true;
if (aMsg != eMouseMove) {
event.mClickCount = aClickCount;
}
@ -568,17 +567,7 @@ static bool PrepareForSetTargetAPZCNotification(
ScrollableLayerGuid guid(aLayersId, 0, ScrollableLayerGuid::NULL_SCROLL_ID);
nsPoint point = nsLayoutUtils::GetEventCoordinatesRelativeTo(
aWidget, aRefPoint, aRootFrame);
EnumSet<FrameForPointOption> options;
if (nsLayoutUtils::AllowZoomingForDocument(
aRootFrame->PresShell()->GetDocument())) {
// If zooming is enabled, we need IgnoreRootScrollFrame for correct
// hit testing. Otherwise, don't use it because it interferes with
// hit testing for some purposes such as scrollbar dragging (this will
// need to be fixed before enabling zooming by default on desktop).
options += FrameForPointOption::IgnoreRootScrollFrame;
}
nsIFrame* target =
nsLayoutUtils::GetFrameForPoint(aRootFrame, point, options);
nsIFrame* target = nsLayoutUtils::GetFrameForPoint(aRootFrame, point);
nsIScrollableFrame* scrollAncestor =
target ? nsLayoutUtils::GetAsyncScrollableAncestorFrame(target)
: aRootFrame->PresShell()->GetRootScrollFrameAsScrollable();

Просмотреть файл

@ -42,8 +42,7 @@ static already_AddRefed<dom::Element> ElementFromPoint(
}
nsIFrame* frame = nsLayoutUtils::GetFrameForPoint(
rootFrame, CSSPoint::ToAppUnits(aPoint),
{FrameForPointOption::IgnorePaintSuppression,
FrameForPointOption::IgnoreRootScrollFrame});
{FrameForPointOption::IgnorePaintSuppression});
while (frame && (!frame->GetContent() ||
frame->GetContent()->IsInAnonymousSubtree())) {
frame = nsLayoutUtils::GetParentOrPlaceholderFor(frame);

Просмотреть файл

@ -57,9 +57,7 @@ TouchBehaviorFlags TouchActionHelper::GetAllowedTouchBehavior(
nsPoint relativePoint =
nsLayoutUtils::GetEventCoordinatesRelativeTo(aWidget, aPoint, aRootFrame);
nsIFrame* target = nsLayoutUtils::GetFrameForPoint(
aRootFrame, relativePoint,
nsLayoutUtils::FrameForPointOption::IgnoreRootScrollFrame);
nsIFrame* target = nsLayoutUtils::GetFrameForPoint(aRootFrame, relativePoint);
if (!target) {
return behavior;
}

Просмотреть файл

@ -519,11 +519,6 @@ static EnumSet<nsLayoutUtils::FrameForPointOption> GetHitTestOptions() {
EnumSet<nsLayoutUtils::FrameForPointOption> options = {
nsLayoutUtils::FrameForPointOption::IgnorePaintSuppression,
nsLayoutUtils::FrameForPointOption::IgnoreCrossDoc};
#ifdef MOZ_WIDGET_ANDROID
// On Android, we need IgnoreRootScrollFrame for correct hit testing when
// zoomed in or out.
options += nsLayoutUtils::FrameForPointOption::IgnoreRootScrollFrame;
#endif
return options;
}

Просмотреть файл

@ -109,15 +109,6 @@ nsIFrame* TouchManager::SetupTarget(WidgetTouchEvent* aEvent,
return aFrame;
}
uint32_t flags = 0;
// Setting this flag will skip the scrollbars on the root frame from
// participating in hit-testing, and we only want that to happen on
// zoomable platforms (for now).
dom::Document* doc = aFrame->PresContext()->Document();
if (nsLayoutUtils::AllowZoomingForDocument(doc)) {
flags |= INPUT_IGNORE_ROOT_SCROLL_FRAME;
}
nsIFrame* target = aFrame;
for (int32_t i = aEvent->mTouches.Length(); i;) {
--i;
@ -128,7 +119,7 @@ nsIFrame* TouchManager::SetupTarget(WidgetTouchEvent* aEvent,
// find the target for this touch
nsPoint eventPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(
aEvent, touch->mRefPoint, aFrame);
target = FindFrameTargetedByInputEvent(aEvent, aFrame, eventPoint, flags);
target = FindFrameTargetedByInputEvent(aEvent, aFrame, eventPoint);
if (target) {
nsCOMPtr<nsIContent> targetContent;
target->GetContentForEvent(aEvent, getter_AddRefs(targetContent));

Просмотреть файл

@ -394,7 +394,6 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsRect visible;
nsRect dirty;
bool ignoreViewportScrolling = false;
nsIFrame* savedIgnoreScrollFrame = nullptr;
if (subdocRootFrame) {
// get the dirty rect relative to the root frame of the subdoc
visible = aBuilder->GetVisibleRect() + GetOffsetToCrossDoc(subdocRootFrame);
@ -403,10 +402,8 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
visible = visible.ScaleToOtherAppUnitsRoundOut(parentAPD, subdocAPD);
dirty = dirty.ScaleToOtherAppUnitsRoundOut(parentAPD, subdocAPD);
if (nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame()) {
nsIScrollableFrame* rootScrollableFrame =
presShell->GetRootScrollFrameAsScrollable();
MOZ_ASSERT(rootScrollableFrame);
if (nsIScrollableFrame* rootScrollableFrame =
presShell->GetRootScrollFrameAsScrollable()) {
// Use a copy, so the rects don't get modified.
nsRect copyOfDirty = dirty;
nsRect copyOfVisible = visible;
@ -416,10 +413,6 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
/* aSetBase = */ true);
ignoreViewportScrolling = presShell->IgnoringViewportScrolling();
if (ignoreViewportScrolling) {
savedIgnoreScrollFrame = aBuilder->GetIgnoreScrollFrame();
aBuilder->SetIgnoreScrollFrame(rootScrollFrame);
}
}
aBuilder->EnterPresShell(subdocRootFrame, pointerEventsNone);
@ -514,10 +507,6 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (subdocRootFrame) {
aBuilder->LeavePresShell(subdocRootFrame, &childItems);
if (ignoreViewportScrolling) {
aBuilder->SetIgnoreScrollFrame(savedIgnoreScrollFrame);
}
}
// Generate a resolution and/or zoom item if needed. If one or both of those

Просмотреть файл

@ -421,7 +421,6 @@ WidgetMouseEvent MouseInput::ToWidgetMouseEvent(nsIWidget* aWidget) const {
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
event.mClickCount = clickCount;
event.mInputSource = mInputSource;
event.mIgnoreRootScrollFrame = true;
event.mFocusSequenceNumber = mFocusSequenceNumber;
return event;

Просмотреть файл

@ -2097,7 +2097,6 @@ void nsWindow::DispatchHitTest(const WidgetTouchEvent& aEvent) {
WidgetMouseEvent hittest(true, eMouseHitTest, this,
WidgetMouseEvent::eReal);
hittest.mRefPoint = aEvent.mTouches[0]->mRefPoint;
hittest.mIgnoreRootScrollFrame = true;
hittest.mInputSource = MouseEvent_Binding::MOZ_SOURCE_TOUCH;
nsEventStatus status;
DispatchEvent(&hittest, status);