Bug 1315862 Part1: Stop dispatching pointer events in the system group. r=masayuki,smaug
authorStone Shih <sshih@mozilla.com>
Fri, 11 Nov 2016 18:02:37 +0800
changeset 370264 038de5add834684bcb9cfe709df3a5868f7e54b7
parent 370263 7535abf9e298beec1d0de5c40f02377f2504f3d2
child 370265 d5a2a49e72d87c2ecb8b2fad64ca30b9e81b8996
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki, smaug
bugs1315862
milestone53.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 1315862 Part1: Stop dispatching pointer events in the system group. r=masayuki,smaug MozReview-Commit-ID: 8Xqp3bxlRFt
dom/events/EventDispatcher.cpp
widget/BasicEvents.h
widget/WidgetEventImpl.cpp
--- a/dom/events/EventDispatcher.cpp
+++ b/dom/events/EventDispatcher.cpp
@@ -402,17 +402,18 @@ EventTargetChainItem::HandleEventTargetC
       }
       if (aVisitor.mEvent->mFlags.mInSystemGroup) {
         item.PostHandleEvent(aVisitor);
       }
     }
   }
   aVisitor.mEvent->mFlags.mInBubblingPhase = false;
 
-  if (!aVisitor.mEvent->mFlags.mInSystemGroup) {
+  if (!aVisitor.mEvent->mFlags.mInSystemGroup &&
+      aVisitor.mEvent->IsAllowedToDispatchInSystemGroup()) {
     // Dispatch to the system event group.  Make sure to clear the
     // STOP_DISPATCH flag since this resets for each event group.
     aVisitor.mEvent->mFlags.mPropagationStopped = false;
     aVisitor.mEvent->mFlags.mImmediatePropagationStopped = false;
 
     // Setting back the original target of the event.
     aVisitor.mEvent->mTarget = aVisitor.mEvent->mOriginalTarget;
 
--- a/widget/BasicEvents.h
+++ b/widget/BasicEvents.h
@@ -549,16 +549,20 @@ public:
    * the last focused window.
    */
   bool IsTargetedAtFocusedContent() const;
   /**
    * Whether the event should cause a DOM event.
    */
   bool IsAllowedToDispatchDOMEvent() const;
   /**
+   * Whether the event should be dispatched in system group.
+   */
+  bool IsAllowedToDispatchInSystemGroup() const;
+  /**
    * Initialize mComposed
    */
   void SetDefaultComposed()
   {
     switch (mClass) {
       case eCompositionEventClass:
         mFlags.mComposed = mMessage == eCompositionStart ||
                            mMessage == eCompositionUpdate ||
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -411,16 +411,25 @@ WidgetEvent::IsAllowedToDispatchDOMEvent
     case eContentCommandEventClass:
       return false;
 
     default:
       return true;
   }
 }
 
+bool
+WidgetEvent::IsAllowedToDispatchInSystemGroup() const
+{
+  // We don't expect to implement default behaviors with pointer events because
+  // if we do, prevent default on mouse events can't prevent default behaviors
+  // anymore.
+  return mClass != ePointerEventClass;
+}
+
 /******************************************************************************
  * mozilla::WidgetInputEvent
  ******************************************************************************/
 
 /* static */
 Modifier
 WidgetInputEvent::GetModifier(const nsAString& aDOMKeyName)
 {