Bug 1346632 - On desktop platforms, do not ignore the root scroll frame when hit-testing in PrepareForSetTargetAPZCNotification. r=kats
authorBotond Ballo <botond@mozilla.com>
Wed, 15 Mar 2017 17:52:13 -0400
changeset 348443 70f18aee1eff89be3fee64945ae3896f5b2995e5
parent 348442 ee95a66bea56e9b7044abab6f12b12257cb6b4b0
child 348444 d921a7db8025a3f10879bb6a3c33ac054a745ea9
push id39171
push userbballo@mozilla.com
push dateMon, 20 Mar 2017 18:12:33 +0000
treeherderautoland@d921a7db8025 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1346632
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1346632 - On desktop platforms, do not ignore the root scroll frame when hit-testing in PrepareForSetTargetAPZCNotification. r=kats Doing so produces incorrect hit testing results in some scenarios, e.g. when dragging the scrollbar on certain pages. MozReview-Commit-ID: AA0nu042U00
gfx/layers/apz/util/APZCCallbackHelper.cpp
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -623,18 +623,25 @@ PrepareForSetTargetAPZCNotification(nsIW
                                     const ScrollableLayerGuid& aGuid,
                                     nsIFrame* aRootFrame,
                                     const LayoutDeviceIntPoint& aRefPoint,
                                     nsTArray<ScrollableLayerGuid>* aTargets)
 {
   ScrollableLayerGuid guid(aGuid.mLayersId, 0, FrameMetrics::NULL_SCROLL_ID);
   nsPoint point =
     nsLayoutUtils::GetEventCoordinatesRelativeTo(aWidget, aRefPoint, aRootFrame);
+  uint32_t flags = 0;
+#ifdef MOZ_WIDGET_ANDROID
+  // On Android, we need IGNORE_ROOT_SCROLL_FRAME for correct hit testing
+  // when zoomed out. On desktop, don't use it because it interferes with
+  // hit testing for some purposes such as scrollbar dragging.
+  flags = nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME;
+#endif
   nsIFrame* target =
-    nsLayoutUtils::GetFrameForPoint(aRootFrame, point, nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME);
+    nsLayoutUtils::GetFrameForPoint(aRootFrame, point, flags);
   nsIScrollableFrame* scrollAncestor = target
     ? nsLayoutUtils::GetAsyncScrollableAncestorFrame(target)
     : aRootFrame->PresContext()->PresShell()->GetRootScrollFrameAsScrollable();
 
   // Assuming that if there's no scrollAncestor, there's already a displayPort.
   nsCOMPtr<dom::Element> dpElement = scrollAncestor
     ? GetDisplayportElementFor(scrollAncestor)
     : GetRootDocumentElementFor(aWidget);