Title: [134995] trunk/Source/WebCore
Revision
134995
Author
jon...@apple.com
Date
2012-11-16 13:39:26 -0800 (Fri, 16 Nov 2012)

Log Message

Simulated events instances do not all have the same underlying event
https://bugs.webkit.org/show_bug.cgi?id=102468
<rdar://problem/12716331>

Reviewed by Alexey Proskuryakov.

The PassRefPtr with the underlying event is included as an argument for the mouse
down, up, and click events. But the PassRefPtr loses its underlying pointer after
the first simulated mouse down event because it gets assigned to that event's
private m_underlyingEvent variable. We therefore send NULL to the other events.

The fix is for this and related functions to pass the raw pointer.

A layout test is not possible to put together because the call sites that use simulated
events with an underlying event do not send mouse events, and those that send mouse
events have a NULL underlying event.

* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchSimulatedClick): Require passing in the raw pointer.
* dom/EventDispatcher.h:
* dom/Node.cpp:
(WebCore::Node::dispatchSimulatedClick): Ditto.
* dom/Node.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (134994 => 134995)


--- trunk/Source/WebCore/ChangeLog	2012-11-16 21:33:36 UTC (rev 134994)
+++ trunk/Source/WebCore/ChangeLog	2012-11-16 21:39:26 UTC (rev 134995)
@@ -1,3 +1,29 @@
+2012-11-16  Jon Lee  <jon...@apple.com>
+
+        Simulated events instances do not all have the same underlying event
+        https://bugs.webkit.org/show_bug.cgi?id=102468
+        <rdar://problem/12716331>
+
+        Reviewed by Alexey Proskuryakov.
+
+        The PassRefPtr with the underlying event is included as an argument for the mouse
+        down, up, and click events. But the PassRefPtr loses its underlying pointer after
+        the first simulated mouse down event because it gets assigned to that event's
+        private m_underlyingEvent variable. We therefore send NULL to the other events.
+
+        The fix is for this and related functions to pass the raw pointer.
+
+        A layout test is not possible to put together because the call sites that use simulated
+        events with an underlying event do not send mouse events, and those that send mouse
+        events have a NULL underlying event.
+
+        * dom/EventDispatcher.cpp:
+        (WebCore::EventDispatcher::dispatchSimulatedClick): Require passing in the raw pointer.
+        * dom/EventDispatcher.h:
+        * dom/Node.cpp:
+        (WebCore::Node::dispatchSimulatedClick): Ditto.
+        * dom/Node.h:
+
 2012-11-16  Patrick Gansterer  <par...@webkit.org>
 
         Build fix for WinCE after r134936.

Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (134994 => 134995)


--- trunk/Source/WebCore/dom/EventDispatcher.cpp	2012-11-16 21:33:36 UTC (rev 134994)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp	2012-11-16 21:39:26 UTC (rev 134995)
@@ -208,7 +208,7 @@
     ScopedEventQueue::instance()->enqueueEventDispatchMediator(mediator);
 }
 
-void EventDispatcher::dispatchSimulatedClick(Node* node, PassRefPtr<Event> underlyingEvent, bool sendMouseEvents, bool showPressedLook)
+void EventDispatcher::dispatchSimulatedClick(Node* node, Event* underlyingEvent, bool sendMouseEvents, bool showPressedLook)
 {
     if (node->disabled())
         return;

Modified: trunk/Source/WebCore/dom/EventDispatcher.h (134994 => 134995)


--- trunk/Source/WebCore/dom/EventDispatcher.h	2012-11-16 21:33:36 UTC (rev 134994)
+++ trunk/Source/WebCore/dom/EventDispatcher.h	2012-11-16 21:39:26 UTC (rev 134995)
@@ -72,7 +72,7 @@
     static bool dispatchEvent(Node*, PassRefPtr<EventDispatchMediator>);
     static void dispatchScopedEvent(Node*, PassRefPtr<EventDispatchMediator>);
 
-    static void dispatchSimulatedClick(Node*, PassRefPtr<Event> underlyingEvent, bool sendMouseEvents, bool showPressedLook);
+    static void dispatchSimulatedClick(Node*, Event* underlyingEvent, bool sendMouseEvents, bool showPressedLook);
 
     bool dispatchEvent(PassRefPtr<Event>);
     void adjustRelatedTarget(Event*, PassRefPtr<EventTarget> prpRelatedTarget);

Modified: trunk/Source/WebCore/dom/Node.cpp (134994 => 134995)


--- trunk/Source/WebCore/dom/Node.cpp	2012-11-16 21:33:36 UTC (rev 134994)
+++ trunk/Source/WebCore/dom/Node.cpp	2012-11-16 21:39:26 UTC (rev 134995)
@@ -2614,9 +2614,9 @@
 }
 #endif
 
-void Node::dispatchSimulatedClick(PassRefPtr<Event> event, bool sendMouseEvents, bool showPressedLook)
+void Node::dispatchSimulatedClick(Event* underlyingEvent, bool sendMouseEvents, bool showPressedLook)
 {
-    EventDispatcher::dispatchSimulatedClick(this, event, sendMouseEvents, showPressedLook);
+    EventDispatcher::dispatchSimulatedClick(this, underlyingEvent, sendMouseEvents, showPressedLook);
 }
 
 bool Node::dispatchBeforeLoadEvent(const String& sourceURL)

Modified: trunk/Source/WebCore/dom/Node.h (134994 => 134995)


--- trunk/Source/WebCore/dom/Node.h	2012-11-16 21:33:36 UTC (rev 134994)
+++ trunk/Source/WebCore/dom/Node.h	2012-11-16 21:39:26 UTC (rev 134995)
@@ -640,7 +640,7 @@
 #if ENABLE(GESTURE_EVENTS)
     bool dispatchGestureEvent(const PlatformGestureEvent&);
 #endif
-    void dispatchSimulatedClick(PassRefPtr<Event> underlyingEvent, bool sendMouseEvents = false, bool showPressedLook = true);
+    void dispatchSimulatedClick(Event* underlyingEvent, bool sendMouseEvents = false, bool showPressedLook = true);
     bool dispatchBeforeLoadEvent(const String& sourceURL);
 
     virtual void dispatchFocusEvent(PassRefPtr<Node> oldFocusedNode);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to