Backed out changesets 4cd69faa8bc0 and 54252e150439 (bug 976963) for B2G mochitest failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 03 Jul 2014 13:31:31 -0400
changeset 192157 558b30253cbea563d8ba23cc2a93cf950e4845d4
parent 192156 3002e020045020102cc3b369ab08e94da923db46
child 192158 fb7bb4b37e0f214b0fd27a815906386ea7a8554d
push id45764
push userryanvm@gmail.com
push dateThu, 03 Jul 2014 17:31:37 +0000
treeherdermozilla-inbound@558b30253cbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs976963
milestone33.0a1
backs out4cd69faa8bc0839267747271f09d742988ab186e
54252e1504396a29613ee3ca2ac2bffbc0c898d5
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
Backed out changesets 4cd69faa8bc0 and 54252e150439 (bug 976963) for B2G mochitest failures.
dom/events/EventStateManager.cpp
layout/base/nsPresShell.cpp
layout/base/tests/bug976963_inner.html
layout/base/tests/mochitest.ini
layout/base/tests/test_bug976963.html
widget/MouseEvents.h
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -3843,80 +3843,73 @@ EventStateManager::NotifyMouseOut(Widget
 }
 
 void
 EventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
                                    nsIContent* aContent)
 {
   NS_ASSERTION(aContent, "Mouse must be over something");
 
-  // If pointer capture is set, we should suppress pointerover/pointerenter events
-  // for all elements except element which have pointer capture.
-  bool dispatch = !aMouseEvent->retargetedByPointerCapture;
-
   OverOutElementsWrapper* wrapper = GetWrapperByEventID(aMouseEvent);
 
-  if (wrapper->mLastOverElement == aContent && dispatch)
+  if (wrapper->mLastOverElement == aContent)
     return;
 
   // Before firing mouseover, check for recursion
   if (aContent == wrapper->mFirstOverEventElement)
     return;
 
   // Check to see if we're a subdocument and if so update the parent
   // document's ESM state to indicate that the mouse is over the
   // content associated with our subdocument.
   EnsureDocument(mPresContext);
-  if (nsIDocument *parentDoc = mDocument->GetParentDocument()) {
-    if (nsIContent *docContent = parentDoc->FindContentForSubDocument(mDocument)) {
-      if (nsIPresShell *parentShell = parentDoc->GetShell()) {
+  nsIDocument *parentDoc = mDocument->GetParentDocument();
+  if (parentDoc) {
+    nsIContent *docContent = parentDoc->FindContentForSubDocument(mDocument);
+    if (docContent) {
+      nsIPresShell *parentShell = parentDoc->GetShell();
+      if (parentShell) {
         EventStateManager* parentESM =
           parentShell->GetPresContext()->EventStateManager();
         parentESM->NotifyMouseOver(aMouseEvent, docContent);
       }
     }
   }
   // Firing the DOM event in the parent document could cause all kinds
   // of havoc.  Reverify and take care.
-  if (wrapper->mLastOverElement == aContent && dispatch)
+  if (wrapper->mLastOverElement == aContent)
     return;
 
   // Remember mLastOverElement as the related content for the
   // DispatchMouseOrPointerEvent() call below, since NotifyMouseOut() resets it, bug 298477.
   nsCOMPtr<nsIContent> lastOverElement = wrapper->mLastOverElement;
 
   bool isPointer = aMouseEvent->eventStructType == NS_POINTER_EVENT;
-  
-  Maybe<EnterLeaveDispatcher> enterDispatcher;
-  if (dispatch) {
-    enterDispatcher.construct(this, aContent, lastOverElement, aMouseEvent,
-                              isPointer ? NS_POINTER_ENTER : NS_MOUSEENTER);
-  }
+  EnterLeaveDispatcher enterDispatcher(this, aContent, lastOverElement,
+                                       aMouseEvent,
+                                       isPointer ? NS_POINTER_ENTER :
+                                                   NS_MOUSEENTER);
 
   NotifyMouseOut(aMouseEvent, aContent);
 
   // Store the first mouseOver event we fire and don't refire mouseOver
   // to that element while the first mouseOver is still ongoing.
   wrapper->mFirstOverEventElement = aContent;
 
   if (!isPointer) {
     SetContentState(aContent, NS_EVENT_STATE_HOVER);
   }
 
-  if (dispatch) {
-    // Fire mouseover
-    wrapper->mLastOverFrame = 
-      DispatchMouseOrPointerEvent(aMouseEvent,
-                                  isPointer ? NS_POINTER_OVER : NS_MOUSE_ENTER_SYNTH,
-                                  aContent, lastOverElement);
-    wrapper->mLastOverElement = aContent;
-  } else {
-    wrapper->mLastOverFrame = nullptr;
-    wrapper->mLastOverElement = nullptr;
-  }
+  // Fire mouseover
+  wrapper->mLastOverFrame =
+    DispatchMouseOrPointerEvent(aMouseEvent,
+                                isPointer ? NS_POINTER_OVER :
+                                            NS_MOUSE_ENTER_SYNTH,
+                                aContent, lastOverElement);
+  wrapper->mLastOverElement = aContent;
 
   // Turn recursion protection back off
   wrapper->mFirstOverEventElement = nullptr;
 }
 
 // Returns the center point of the window's inner content area.
 // This is in widget coordinates, i.e. relative to the widget's top
 // left corner, not in screen coordinates, the same units that
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -7166,19 +7166,16 @@ PresShell::HandleEvent(nsIFrame* aFrame,
     if (aEvent->eventStructType == NS_POINTER_EVENT &&
         aEvent->message != NS_POINTER_DOWN) {
       if (WidgetPointerEvent* pointerEvent = aEvent->AsPointerEvent()) {
         uint32_t pointerId = pointerEvent->pointerId;
         nsIContent* pointerCapturingContent = GetPointerCapturingContent(pointerId);
 
         if (pointerCapturingContent) {
           if (nsIFrame* capturingFrame = pointerCapturingContent->GetPrimaryFrame()) {
-            // If pointer capture is set, we should suppress pointerover/pointerenter events
-            // for all elements except element which have pointer capture. (Code in EventStateManager)
-            pointerEvent->retargetedByPointerCapture = (frame != capturingFrame);
             frame = capturingFrame;
           }
 
           if (pointerEvent->message == NS_POINTER_UP ||
               pointerEvent->message == NS_POINTER_CANCEL) {
             // Implicitly releasing capture for given pointer.
             // LOST_POINTER_CAPTURE should be send after NS_POINTER_UP or NS_POINTER_CANCEL.
             releasePointerCaptureCaller.SetTarget(pointerId, pointerCapturingContent);
deleted file mode 100644
--- a/layout/base/tests/bug976963_inner.html
+++ /dev/null
@@ -1,243 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=976963
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 976963</title>
-  <meta name="author" content="Maksim Lebedev" />
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <style>
-    div#listener {
-      background: yellow;
-      position: absolute;
-      top: -100px;
-    }
-    div#middler {
-      background: yellow;
-      margin: 10px;
-    }
-    div#target {
-      background: yellow;
-    }
-  </style>
-  <script type="application/javascript">
-    /** Test for Bug 976963 **/
-    var All_Pointer_Events = ["pointerover",        "pointerenter",
-                              "pointermove",
-                              "pointerdown",        "pointerup",
-                              "pointerout",         "pointerleave",
-                              "pointercancel",
-                              "gotpointercapture",  "lostpointercapture"];
-
-    function on_event(object, event, callback) {
-      object.addEventListener(event, callback, false);
-    }
-    function ok(check, msg) {
-      parent.ok(check, msg);
-    }
-    function is(a, b, msg) {
-      parent.is(a, b, msg);
-    }
-
-    var listener = undefined;
-    var middler = undefined;
-    var target = undefined;
-
-    var test_ListenerGotCapture = 0;
-    var test_ListenerUnwanted = 0;
-    var test_ListenerLostCapture = 0;
-    var test_ListenerAfterCapture = 0;
-    var test_MiddlerGotCapture = 0;
-    var test_MiddlerOver = 0;
-    var test_MiddlerLeave = 0;
-    var test_MiddlerUp = 0;
-    var test_MiddlerLostCapture = 0;
-    var test_TargetDown = 0;
-    var test_TargetUnwanted = 0;
-    var test_TargetUp = 0;
-
-    var captured_event = undefined;
-    var f_gotPointerCapture = false;
-    var f_lostPointerCapture = false;
-    var f_gotMiddlerPointerCapture = false;
-
-    function listenerEventHandler(event) {
-      logger("Listener: " + event.type + ". Captured_event: " + captured_event);
-      if(test_ListenerLostCapture)
-        test_ListenerAfterCapture++;
-      if (event.type == "gotpointercapture") {
-        f_gotPointerCapture = true;
-        test_ListenerGotCapture++;
-      }
-      else if (event.type == "lostpointercapture") {
-        f_lostPointerCapture = true;
-        f_gotPointerCapture = false;
-        test_ListenerLostCapture++;
-      }
-      else if (event.type == "pointermove") {
-        ok(captured_event && captured_event.pointerId == event.pointerId, "Listener: equals pointerId for lostpointercapture event");
-        if (f_gotPointerCapture) {
-          // on first event received for capture, release capture
-          logger("Listener call release");
-          ok(!!listener, "Listener should be live!");
-          ok(typeof(listener.releasePointerCapture) == "function", "Listener should have a function releasePointerCapture");
-          listener.releasePointerCapture(event.pointerId);
-        }
-        else {
-          logger("Listener.ASSERT: " + event.type);
-          test_ListenerUnwanted++;
-          // if any other events are received after releaseCapture, then the test fails
-          ok(false, event.target.id + "-" + event.type + " should be handled by target element handler");
-        }
-      }
-      else {
-        test_ListenerUnwanted++;
-        logger("Listener.ASSERT: " + event.type);
-        ok(false, event.type + "should be never handled by listener");
-      }
-    }
-
-    function middlerEventHandler(event) {
-      logger("Middler: " + event.type + ". Captured_event: " + captured_event);
-      if (event.type == "gotpointercapture") {
-        test_MiddlerGotCapture++;
-        f_gotMiddlerPointerCapture = true;
-        ok(captured_event && captured_event.pointerId == event.pointerId, "Middler: equals pointerId for gotpointercapture event");
-      }
-      else if (event.type == "pointerover") {
-        test_MiddlerOver++;
-        ok(captured_event && captured_event.pointerId == event.pointerId, "Middler: equals pointerId for pointerover event");
-      }
-      else if (event.type == "pointerleave") {
-        test_MiddlerLeave++;
-        ok(captured_event && captured_event.pointerId == event.pointerId, "Middler: equals pointerId for pointerleave event");
-        ok(!!listener, "Listener should be live!");
-        ok(typeof(listener.setPointerCapture) == "function", "Listener should have a function setPointerCapture");
-        listener.setPointerCapture(event.pointerId);
-      }
-      else if (event.type == "lostpointercapture") {
-        test_MiddlerLostCapture++;
-        f_gotMiddlerPointerCapture = false;
-        ok(captured_event && captured_event.pointerId == event.pointerId, "Middler: equals pointerId for lostpointercapture event");
-      }
-      else if (event.type == "pointerup" ) {
-        test_MiddlerUp++;
-      }
-    }
-  
-    function targetEventHandler(event) {
-      logger("Target: " + event.type + ". Captured_event: " + captured_event);
-      if (f_gotPointerCapture || f_gotMiddlerPointerCapture) {
-        if (event.type != "pointerout" && event.type != "pointerleave") {
-          logger("Target.ASSERT: " + event.type + " " + event.pointerId);
-          test_TargetUnwanted++;
-          ok(false, "The Target element should not have received any events while capture is active. Event recieved:" + event.type + ".  ");
-        }
-      }
-      if (event.type == "pointerdown") {
-        logger("Target.pointerdown 1: " + captured_event);
-        test_TargetDown++;
-        captured_event = event;
-        ok(!!middler, "Middler should be live!");
-        ok(typeof(middler.setPointerCapture) == "function", "Middler should have a function setPointerCapture");
-        middler.setPointerCapture(event.pointerId);
-        logger("Target.pointerdown 2: " + captured_event);
-      }
-      else if (event.type == "pointerup") {
-        ok(f_lostPointerCapture, "Target should have received pointerup");
-        ok(captured_event && captured_event.pointerId == event.pointerId, "Target: equals pointerId for lostpointercapture event");
-        test_TargetUp++; // complete test
-      }
-    }
-
-    function colorerHandler(event) {
-      if(event.type == "pointerover")
-        event.target.style.background = "red";
-      else if(event.type == "pointerout")
-        event.target.style.background = "yellow";
-    }
-    
-    function setEventHandlers() {
-      listener = document.getElementById("listener");
-      middler = document.getElementById("middler");
-      target = document.getElementById("target");
-      target.style["touchAction"] = "none";
-
-      // target and listener - handle all events
-      for (var i = 0; i < All_Pointer_Events.length; i++) {
-        on_event(target,    All_Pointer_Events[i], targetEventHandler);
-        on_event(listener,  All_Pointer_Events[i], listenerEventHandler);
-        on_event(middler,   All_Pointer_Events[i], middlerEventHandler);
-        on_event(target,    All_Pointer_Events[i], colorerHandler);
-        on_event(middler,   All_Pointer_Events[i], colorerHandler);
-      }
-    }
-
-    function prepareTest() {
-      SimpleTest.waitForExplicitFinish();
-      SpecialPowers.pushPrefEnv({
-        "set": [
-          ["dom.w3c_pointer_events.enabled", true]
-        ]
-      }, executeTest);
-    }    
-    
-    function executeTest()
-    {
-      logger("executeTest");
-      setEventHandlers();
-      document.body.offsetLeft;
-      var rect = target.getBoundingClientRect();
-      synthesizePointer(target,  rect.width/2, rect.height/2, {type: "pointermove"});
-      synthesizePointer(target,  rect.width/2, rect.height/2, {type: "pointerdown"});
-      synthesizePointer(target,  rect.width/3, rect.height/3, {type: "pointermove"});
-      synthesizePointer(middler, rect.width/2, rect.height/2, {type: "pointermove"});
-      synthesizePointer(target,  rect.width/2, rect.height/2, {type: "pointermove"});
-      synthesizePointer(middler, rect.width/2, rect.height/2, {type: "pointermove"});
-      synthesizePointer(target,  rect.width/2, rect.height/2, {type: "pointermove"});
-      synthesizePointer(target,  rect.width/2, rect.height/2, {type: "pointerup"});
-      finishTest();
-    }
-
-    function finishTest() {
-      setTimeout(function() {
-        is(test_ListenerGotCapture, 1, "Listener should receive gotpointercapture event");
-        is(test_ListenerUnwanted, 0, "Listener should not receive any unwanted events");
-        is(test_ListenerLostCapture, 1, "Listener should receive lostpointercapture event");
-        is(test_ListenerAfterCapture, 0, "Listener should not receive any events after release pointer capture");
-        is(test_MiddlerGotCapture, 1, "Middler should receive gotpointercapture event");
-        is(test_MiddlerOver, 1, "Middler should receive pointerover event");
-        is(test_MiddlerLeave, 1, "Middler should receive pointerleave event");
-        is(test_MiddlerUp, 0, "Middler should not receive pointerup event");
-        is(test_MiddlerLostCapture, 1, "Middler should receive lostpointercapture event");
-        is(test_TargetDown, 1, "Target should receive pointerdown event");
-        is(test_TargetUnwanted, 0, "Target should not receive any event while pointer capture is active");
-        is(test_TargetUp, 1, "Target should receive pointerup event");
-        logger("finishTest");
-        parent.finishTest();
-      }, 1000);
-    }
-
-    function logger(message) {
-      console.log(message);
-      var log = document.getElementById('log');
-      log.innerHTML = message + "<br>" + log.innerHTML;
-    }
-  </script>
-</head>
-<body onload="prepareTest()">
-  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=976963">Mozilla Bug 976963</a>
-  <p id="display"></p>
-  <div id="content" style="display: none">
-  </div>
-  <div id="listener">div id=listener</div>
-  <div id="middler">div id=middler</div>
-  <div id="target">div id=target</div>
-  <pre id="log">
-  </pre>
-</body>
-</html>
--- a/layout/base/tests/mochitest.ini
+++ b/layout/base/tests/mochitest.ini
@@ -204,18 +204,16 @@ skip-if = (buildapp == 'b2g' && toolkit 
 [test_bug842853.html]
 [test_bug842853-2.html]
 [test_bug849219.html]
 [test_bug851485.html]
 [test_bug851445.html]
 support-files = bug851445_helper.html
 [test_bug970964.html]
 support-files = bug970964_inner.html
-[test_bug976963.html]
-support-files = bug976963_inner.html
 [test_emulateMedium.html]
 [test_getClientRects_emptytext.html]
 [test_bug858459.html]
 skip-if = toolkit == "gonk" || buildapp == 'b2g' #Bug 931116, b2g desktop specific, initial triage
 
 # Tests for bugs 441782, 467672 and 570378 do not pass reliably on Windows,
 # because of bug 469208.
 [test_bug332655-1.html]
deleted file mode 100644
--- a/layout/base/tests/test_bug976963.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=976963
--->
-  <head>
-    <meta charset="utf-8">
-    <meta name="author" content="Maksim Lebedev" />
-    <title>Test for Bug 976963</title>
-    <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-    <script type="text/javascript">
-      function prepareTest() {
-        SimpleTest.waitForExplicitFinish();
-        SpecialPowers.pushPrefEnv({
-          "set": [
-            ["dom.w3c_pointer_events.enabled", true]
-          ]
-        }, startTest);
-      }
-      function startTest() {
-        var iframe = document.getElementById("testFrame");
-        iframe.src = "bug976963_inner.html";
-      }
-      function finishTest() {
-        SimpleTest.finish();
-      }
-    </script>
-  </head>
-  <body onload="prepareTest()">
-    <iframe id="testFrame" height="700" width="700"></iframe>
-  </body>
-</html>
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -42,28 +42,25 @@ namespace dom {
 
 class WidgetPointerHelper
 {
 public:
   bool convertToPointer;
   uint32_t pointerId;
   uint32_t tiltX;
   uint32_t tiltY;
-  bool retargetedByPointerCapture;
 
-  WidgetPointerHelper() : convertToPointer(true), pointerId(0), tiltX(0), tiltY(0),
-                          retargetedByPointerCapture(false) {}
+  WidgetPointerHelper() : convertToPointer(true), pointerId(0), tiltX(0), tiltY(0) {}
 
   void AssignPointerHelperData(const WidgetPointerHelper& aEvent)
   {
     convertToPointer = aEvent.convertToPointer;
     pointerId = aEvent.pointerId;
     tiltX = aEvent.tiltX;
     tiltY = aEvent.tiltY;
-    retargetedByPointerCapture = aEvent.retargetedByPointerCapture;
   }
 };
 
 /******************************************************************************
  * mozilla::WidgetMouseEventBase
  ******************************************************************************/
 
 class WidgetMouseEventBase : public WidgetInputEvent