Title: [125133] trunk/Source/WebCore
- Revision
- 125133
- Author
- [email protected]
- Date
- 2012-08-08 18:11:35 -0700 (Wed, 08 Aug 2012)
Log Message
EventDispatcher::dispatchSimulatedClick should not reuse the same EventDispatcher instance.
https://bugs.webkit.org/show_bug.cgi?id=93452
Reviewed by Dimitri Glazkov.
This is a follow up patch after r124975. There is yet another
place where the same EventDispatcher instance is reused across
event dispatching.
In addition to that, in order to simulate a real click, we must
different dispatchers because we must recalculate event ancestors
each time. Current implementation wrongly freezes event ancestors
at the first event dispatching.
No new tests, no change in functionality.
* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchSimulatedClick):
(WebCore::EventDispatcher::EventDispatcher):
(WebCore::EventDispatcher::dispatchEvent):
* dom/EventDispatcher.h:
(EventDispatcher):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (125132 => 125133)
--- trunk/Source/WebCore/ChangeLog 2012-08-09 01:10:01 UTC (rev 125132)
+++ trunk/Source/WebCore/ChangeLog 2012-08-09 01:11:35 UTC (rev 125133)
@@ -1,3 +1,28 @@
+2012-08-08 Hayato Ito <[email protected]>
+
+ EventDispatcher::dispatchSimulatedClick should not reuse the same EventDispatcher instance.
+ https://bugs.webkit.org/show_bug.cgi?id=93452
+
+ Reviewed by Dimitri Glazkov.
+
+ This is a follow up patch after r124975. There is yet another
+ place where the same EventDispatcher instance is reused across
+ event dispatching.
+
+ In addition to that, in order to simulate a real click, we must
+ different dispatchers because we must recalculate event ancestors
+ each time. Current implementation wrongly freezes event ancestors
+ at the first event dispatching.
+
+ No new tests, no change in functionality.
+
+ * dom/EventDispatcher.cpp:
+ (WebCore::EventDispatcher::dispatchSimulatedClick):
+ (WebCore::EventDispatcher::EventDispatcher):
+ (WebCore::EventDispatcher::dispatchEvent):
+ * dom/EventDispatcher.h:
+ (EventDispatcher):
+
2012-08-08 Jae Hyun Park <[email protected]>
writeHelperGetString in V8HTMLDocument uses += to concatenate strings
Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (125132 => 125133)
--- trunk/Source/WebCore/dom/EventDispatcher.cpp 2012-08-09 01:10:01 UTC (rev 125132)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp 2012-08-09 01:11:35 UTC (rev 125133)
@@ -163,8 +163,6 @@
if (node->disabled())
return;
- EventDispatcher dispatcher(node);
-
if (!gNodesDispatchingSimulatedClicks)
gNodesDispatchingSimulatedClicks = new HashSet<Node*>;
else if (gNodesDispatchingSimulatedClicks->contains(node))
@@ -174,14 +172,14 @@
// send mousedown and mouseup before the click, if requested
if (sendMouseEvents)
- dispatcher.dispatchEvent(SimulatedMouseEvent::create(eventNames().mousedownEvent, node->document()->defaultView(), underlyingEvent));
+ EventDispatcher(node).dispatchEvent(SimulatedMouseEvent::create(eventNames().mousedownEvent, node->document()->defaultView(), underlyingEvent));
node->setActive(true, showPressedLook);
if (sendMouseEvents)
- dispatcher.dispatchEvent(SimulatedMouseEvent::create(eventNames().mouseupEvent, node->document()->defaultView(), underlyingEvent));
+ EventDispatcher(node).dispatchEvent(SimulatedMouseEvent::create(eventNames().mouseupEvent, node->document()->defaultView(), underlyingEvent));
node->setActive(false);
// always send click
- dispatcher.dispatchEvent(SimulatedMouseEvent::create(eventNames().clickEvent, node->document()->defaultView(), underlyingEvent));
+ EventDispatcher(node).dispatchEvent(SimulatedMouseEvent::create(eventNames().clickEvent, node->document()->defaultView(), underlyingEvent));
gNodesDispatchingSimulatedClicks->remove(node);
}
@@ -202,6 +200,9 @@
EventDispatcher::EventDispatcher(Node* node)
: m_node(node)
, m_ancestorsInitialized(false)
+#ifndef NDEBUG
+ , m_eventDispatched(false)
+#endif
{
ASSERT(node);
m_view = node->document()->view();
@@ -239,6 +240,10 @@
bool EventDispatcher::dispatchEvent(PassRefPtr<Event> prpEvent)
{
+#ifndef NDEBUG
+ ASSERT(!m_eventDispatched);
+ m_eventDispatched = true;
+#endif
RefPtr<Event> event = prpEvent;
ChildNodesLazySnapshot::takeChildNodesLazySnapshot();
Modified: trunk/Source/WebCore/dom/EventDispatcher.h (125132 => 125133)
--- trunk/Source/WebCore/dom/EventDispatcher.h 2012-08-09 01:10:01 UTC (rev 125132)
+++ trunk/Source/WebCore/dom/EventDispatcher.h 2012-08-09 01:11:35 UTC (rev 125133)
@@ -96,6 +96,9 @@
RefPtr<Node> m_node;
RefPtr<FrameView> m_view;
bool m_ancestorsInitialized;
+#ifndef NDEBUG
+ bool m_eventDispatched;
+#endif
};
inline Node* EventDispatcher::node() const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes