Bug 1426728 - Don't cache the event target of pointer events when they are generated from touch. r=smaug.
authorStone Shih <sshih@mozilla.com>
Fri, 22 Dec 2017 12:27:05 +0800
changeset 449426 786c0c3f6975d73397a7a596939ddc92046a057f
parent 449425 0d6b0f5ffc8f3da1aa6ddd98bbd0102aeb744091
child 449427 06d4983f64feb093c676943db31584b3febb4fc6
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1426728
milestone59.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 1426728 - Don't cache the event target of pointer events when they are generated from touch. r=smaug. The event targets of touch events are not necessarily to be the same as their corresponding pointer events. So we don't have to cache the event target of pointer events when they are generated from touch. MozReview-Commit-ID: 9Gd6ion7NXf
dom/events/PointerEventHandler.cpp
layout/base/PresShell.cpp
layout/base/PresShell.h
layout/base/nsIPresShell.h
--- a/dom/events/PointerEventHandler.cpp
+++ b/dom/events/PointerEventHandler.cpp
@@ -577,26 +577,25 @@ PointerEventHandler::DispatchPointerFrom
         nsIFrame* frame = content->GetPrimaryFrame();
         shell = PresShell::GetShellForEventTarget(frame, content);
         if (!shell) {
           continue;
         }
 
         PreHandlePointerEventsPreventDefault(&event, aEvent);
         shell->HandleEventWithTarget(&event, frame, content, aStatus, true,
-                                     aTargetContent);
+                                     nullptr);
         PostHandlePointerEventsPreventDefault(&event, aEvent);
       } else {
         // We didn't hit test for other touch events. Spec doesn't mention that
         // all pointer events should be dispatched to the same target as their
         // corresponding touch events. Call PresShell::HandleEvent so that we do
         // hit test for pointer events.
         PreHandlePointerEventsPreventDefault(&event, aEvent);
-        shell->HandleEvent(aFrame, &event, aDontRetargetEvents, aStatus,
-                           aTargetContent);
+        shell->HandleEvent(aFrame, &event, aDontRetargetEvents, aStatus);
         PostHandlePointerEventsPreventDefault(&event, aEvent);
       }
     }
   }
 }
 
 /* static */ uint16_t
 PointerEventHandler::GetPointerType(uint32_t aPointerId)
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -6888,18 +6888,17 @@ PresShell::GetShellForTouchEvent(WidgetG
   }
   return shell;
 }
 
 nsresult
 PresShell::HandleEvent(nsIFrame* aFrame,
                        WidgetGUIEvent* aEvent,
                        bool aDontRetargetEvents,
-                       nsEventStatus* aEventStatus,
-                       nsIContent** aTargetContent)
+                       nsEventStatus* aEventStatus)
 {
 #ifdef MOZ_TASK_TRACER
   Maybe<AutoSourceEvent> taskTracerEvent;
   if (MOZ_UNLIKELY(IsStartLogging())) {
     // Make touch events, mouse events and hardware key events to be
     // the source events of TaskTracer, and originate the rest
     // correlation tasks from here.
     SourceEventType type = SourceEventType::Unknown;
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -229,18 +229,17 @@ public:
 
   //nsIViewObserver interface
 
   virtual void Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
                      uint32_t aFlags) override;
   virtual nsresult HandleEvent(nsIFrame* aFrame,
                                mozilla::WidgetGUIEvent* aEvent,
                                bool aDontRetargetEvents,
-                               nsEventStatus* aEventStatus,
-                               nsIContent** aTargetContent = nullptr) override;
+                               nsEventStatus* aEventStatus) override;
   virtual nsresult HandleDOMEventWithTarget(
                                  nsIContent* aTargetContent,
                                  mozilla::WidgetEvent* aEvent,
                                  nsEventStatus* aStatus) override;
   virtual nsresult HandleDOMEventWithTarget(nsIContent* aTargetContent,
                                                         nsIDOMEvent* aEvent,
                                                         nsEventStatus* aStatus) override;
   virtual bool ShouldIgnoreInvalidation() override;
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -1441,18 +1441,17 @@ public:
     /* Sync-decode images. */
     PAINT_SYNC_DECODE_IMAGES = 0x04
   };
   virtual void Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
                      uint32_t aFlags) = 0;
   virtual nsresult HandleEvent(nsIFrame* aFrame,
                                mozilla::WidgetGUIEvent* aEvent,
                                bool aDontRetargetEvents,
-                               nsEventStatus* aEventStatus,
-                               nsIContent** aTargetContent = nullptr) = 0;
+                               nsEventStatus* aEventStatus) = 0;
   virtual bool ShouldIgnoreInvalidation() = 0;
   /**
    * Notify that we're going to call Paint with PAINT_LAYERS
    * on the pres shell for a widget (which might not be this one, since
    * WillPaint is called on all presshells in the same toplevel window as the
    * painted widget). This is issued at a time when it's safe to modify
    * widget geometry.
    */