Bug 1341992 - Only do hit-testing with the ignore-root-scroll-frame flag on zoomable platforms. r?tnikkel draft
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 24 May 2017 16:23:03 -0400
changeset 583955 a4def7b1b01ccf5ae36bf6f86e5e8e7f7ba7241d
parent 583913 cb321835e07108b6aa4c91b7fd5a1fee5ee0b68f
child 630260 7fd91432d7d74168472b7c235b32af6826e4a189
push id60608
push userkgupta@mozilla.com
push dateWed, 24 May 2017 20:23:36 +0000
reviewerstnikkel
bugs1341992
milestone55.0a1
Bug 1341992 - Only do hit-testing with the ignore-root-scroll-frame flag on zoomable platforms. r?tnikkel The ignore-root-scroll-frame flag is generally needed on Fennec, or possibly other zoom-enabled platforms, when we have them. It allows hit-testing things outside the main thread's notion of what is visible, because that might occur when the user zooms out. For largely historical reasons, we are passing this flag around in other scenarios, such as when doing hit-tests for touch events, because in the past touch events and zooming only happened on Fennec, so it didn't matter. Now that we have touch events enabled on other platforms, such as Windows, we need to make the distinction clearer. MozReview-Commit-ID: BlHjtjFYgzv
layout/base/PresShell.cpp
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -7472,17 +7472,22 @@ PresShell::HandleEvent(nsIFrame* aFrame,
     // capturing and retargeting the event because the captured frame will
     // be used instead below. Also keep using the root frame if we're dealing
     // with a window-level mouse exit event since we want to start sending
     // mouse out events at the root EventStateManager.
     if (!captureRetarget && !isWindowLevelMouseExit) {
       nsPoint eventPoint;
       uint32_t flags = 0;
       if (aEvent->mMessage == eTouchStart) {
-        flags |= INPUT_IGNORE_ROOT_SCROLL_FRAME;
+        if (gfxPrefs::APZAllowZooming()) {
+          // 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).
+          flags |= INPUT_IGNORE_ROOT_SCROLL_FRAME;
+        }
         WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
         // if this is a continuing session, ensure that all these events are
         // in the same document by taking the target of the events already in
         // the capture list
         nsCOMPtr<nsIContent> anyTarget;
         if (touchEvent->mTouches.Length() > 1) {
           anyTarget = TouchManager::GetAnyCapturedTouchTarget();
         }