Diff
Modified: trunk/Source/WebCore/ChangeLog (143243 => 143244)
--- trunk/Source/WebCore/ChangeLog 2013-02-18 19:01:23 UTC (rev 143243)
+++ trunk/Source/WebCore/ChangeLog 2013-02-18 19:07:50 UTC (rev 143244)
@@ -1,3 +1,38 @@
+2013-02-18 Sheriff Bot <webkit.review....@gmail.com>
+
+ Unreviewed, rolling out r143145.
+ http://trac.webkit.org/changeset/143145
+ https://bugs.webkit.org/show_bug.cgi?id=110143
+
+ Causes frequent crashes. (Requested by eric_carlson on
+ #webkit).
+
+ * dom/EventDispatchMediator.cpp:
+ (WebCore::EventDispatchMediator::dispatchEvent):
+ * dom/EventDispatcher.cpp:
+ (WebCore::EventDispatcher::dispatchEvent):
+ (WebCore::EventDispatcher::EventDispatcher):
+ (WebCore::EventDispatcher::ensureEventPath):
+ (WebCore::EventDispatcher::dispatchSimulatedClick):
+ (WebCore::EventDispatcher::dispatchEventPreProcess):
+ (WebCore::EventDispatcher::dispatchEventAtCapturing):
+ (WebCore::EventDispatcher::dispatchEventAtTarget):
+ (WebCore::EventDispatcher::dispatchEventAtBubbling):
+ (WebCore::EventDispatcher::dispatchEventPostProcess):
+ * dom/EventDispatcher.h:
+ (EventDispatcher):
+ (WebCore::EventDispatcher::node):
+ (WebCore):
+ * dom/FocusEvent.cpp:
+ (WebCore::FocusEventDispatchMediator::dispatchEvent):
+ (WebCore::BlurEventDispatchMediator::dispatchEvent):
+ (WebCore::FocusInEventDispatchMediator::dispatchEvent):
+ (WebCore::FocusOutEventDispatchMediator::dispatchEvent):
+ * dom/GestureEvent.cpp:
+ (WebCore::GestureEventDispatchMediator::dispatchEvent):
+ * dom/MouseEvent.cpp:
+ (WebCore::MouseEventDispatchMediator::dispatchEvent):
+
2013-02-18 Christophe Dumez <ch.du...@sisa.samsung.com>
[Soup] Free cookies explicitly in loops instead of using GOwnPtr
Modified: trunk/Source/WebCore/dom/EventDispatchMediator.cpp (143243 => 143244)
--- trunk/Source/WebCore/dom/EventDispatchMediator.cpp 2013-02-18 19:01:23 UTC (rev 143243)
+++ trunk/Source/WebCore/dom/EventDispatchMediator.cpp 2013-02-18 19:07:50 UTC (rev 143244)
@@ -50,8 +50,7 @@
bool EventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
{
- ASSERT(m_event.get() == dispatcher->event());
- return dispatcher->dispatch();
+ return dispatcher->dispatchEvent(m_event.get());
}
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (143243 => 143244)
--- trunk/Source/WebCore/dom/EventDispatcher.cpp 2013-02-18 19:01:23 UTC (rev 143243)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp 2013-02-18 19:07:50 UTC (rev 143244)
@@ -51,30 +51,27 @@
{
ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
- EventDispatcher dispatcher(node, mediator->event());
+ EventDispatcher dispatcher(node);
return mediator->dispatchEvent(&dispatcher);
}
-EventDispatcher::EventDispatcher(Node* node, PassRefPtr<Event> event)
+EventDispatcher::EventDispatcher(Node* node)
: m_node(node)
- , m_event(event)
, m_eventPathInitialized(false)
#ifndef NDEBUG
, m_eventDispatched(false)
#endif
{
ASSERT(node);
- ASSERT(m_event.get());
- ASSERT(!m_event->type().isNull()); // _javascript_ code can create an event with an empty name, but not null.
m_view = node->document()->view();
}
-EventPath& EventDispatcher::ensureEventPath()
+EventPath& EventDispatcher::ensureEventPath(Event* event)
{
if (m_eventPathInitialized)
return m_eventPath;
m_eventPathInitialized = true;
- EventRetargeter::calculateEventPath(m_node.get(), m_event.get(), m_eventPath);
+ EventRetargeter::calculateEventPath(m_node.get(), event, m_eventPath);
return m_eventPath;
}
@@ -98,138 +95,140 @@
gNodesDispatchingSimulatedClicks->add(node);
if (mouseEventOptions == SendMouseOverUpDownEvents)
- EventDispatcher(node, SimulatedMouseEvent::create(eventNames().mouseoverEvent, node->document()->defaultView(), underlyingEvent)).dispatch();
+ EventDispatcher(node).dispatchEvent(SimulatedMouseEvent::create(eventNames().mouseoverEvent, node->document()->defaultView(), underlyingEvent));
if (mouseEventOptions != SendNoEvents)
- EventDispatcher(node, SimulatedMouseEvent::create(eventNames().mousedownEvent, node->document()->defaultView(), underlyingEvent)).dispatch();
+ EventDispatcher(node).dispatchEvent(SimulatedMouseEvent::create(eventNames().mousedownEvent, node->document()->defaultView(), underlyingEvent));
node->setActive(true, visualOptions == ShowPressedLook);
if (mouseEventOptions != SendNoEvents)
- EventDispatcher(node, SimulatedMouseEvent::create(eventNames().mouseupEvent, node->document()->defaultView(), underlyingEvent)).dispatch();
+ EventDispatcher(node).dispatchEvent(SimulatedMouseEvent::create(eventNames().mouseupEvent, node->document()->defaultView(), underlyingEvent));
node->setActive(false);
// always send click
- EventDispatcher(node, SimulatedMouseEvent::create(eventNames().clickEvent, node->document()->defaultView(), underlyingEvent)).dispatch();
+ EventDispatcher(node).dispatchEvent(SimulatedMouseEvent::create(eventNames().clickEvent, node->document()->defaultView(), underlyingEvent));
gNodesDispatchingSimulatedClicks->remove(node);
}
-bool EventDispatcher::dispatch()
+bool EventDispatcher::dispatchEvent(PassRefPtr<Event> prpEvent)
{
#ifndef NDEBUG
ASSERT(!m_eventDispatched);
m_eventDispatched = true;
#endif
+ RefPtr<Event> event = prpEvent;
ChildNodesLazySnapshot::takeChildNodesLazySnapshot();
- m_event->setTarget(EventRetargeter::eventTargetRespectingTargetRules(m_node.get()));
+ event->setTarget(EventRetargeter::eventTargetRespectingTargetRules(m_node.get()));
ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
- ASSERT(m_event->target());
- ensureEventPath();
- WindowEventContext windowEventContext(m_event.get(), m_node.get(), topEventContext());
- InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEvent(m_node->document(), *m_event, windowEventContext.window(), m_node.get(), m_eventPath);
+ ASSERT(event->target());
+ ASSERT(!event->type().isNull()); // _javascript_ code can create an event with an empty name, but not null.
+ ensureEventPath(event.get());
+ WindowEventContext windowEventContext(event.get(), m_node.get(), topEventContext());
+ InspectorInstrumentationCookie cookie = InspectorInstrumentation::willDispatchEvent(m_node->document(), *event, windowEventContext.window(), m_node.get(), m_eventPath);
void* preDispatchEventHandlerResult;
- if (dispatchEventPreProcess(preDispatchEventHandlerResult) == ContinueDispatching)
- if (dispatchEventAtCapturing(windowEventContext) == ContinueDispatching)
- if (dispatchEventAtTarget() == ContinueDispatching)
- dispatchEventAtBubbling(windowEventContext);
- dispatchEventPostProcess(preDispatchEventHandlerResult);
+ if (dispatchEventPreProcess(event, preDispatchEventHandlerResult) == ContinueDispatching)
+ if (dispatchEventAtCapturing(event, windowEventContext) == ContinueDispatching)
+ if (dispatchEventAtTarget(event) == ContinueDispatching)
+ dispatchEventAtBubbling(event, windowEventContext);
+ dispatchEventPostProcess(event, preDispatchEventHandlerResult);
// Ensure that after event dispatch, the event's target object is the
// outermost shadow DOM boundary.
- m_event->setTarget(windowEventContext.target());
- m_event->setCurrentTarget(0);
+ event->setTarget(windowEventContext.target());
+ event->setCurrentTarget(0);
InspectorInstrumentation::didDispatchEvent(cookie);
- return !m_event->defaultPrevented();
+ return !event->defaultPrevented();
}
-inline EventDispatchContinuation EventDispatcher::dispatchEventPreProcess(void*& preDispatchEventHandlerResult)
+inline EventDispatchContinuation EventDispatcher::dispatchEventPreProcess(PassRefPtr<Event> event, void*& preDispatchEventHandlerResult)
{
// Give the target node a chance to do some work before DOM event handlers get a crack.
- preDispatchEventHandlerResult = m_node->preDispatchEventHandler(m_event.get());
- return (m_eventPath.isEmpty() || m_event->propagationStopped()) ? DoneDispatching : ContinueDispatching;
+ preDispatchEventHandlerResult = m_node->preDispatchEventHandler(event.get());
+ return (m_eventPath.isEmpty() || event->propagationStopped()) ? DoneDispatching : ContinueDispatching;
}
-inline EventDispatchContinuation EventDispatcher::dispatchEventAtCapturing(WindowEventContext& windowEventContext)
+inline EventDispatchContinuation EventDispatcher::dispatchEventAtCapturing(PassRefPtr<Event> event, WindowEventContext& windowEventContext)
{
// Trigger capturing event handlers, starting at the top and working our way down.
- m_event->setEventPhase(Event::CAPTURING_PHASE);
+ event->setEventPhase(Event::CAPTURING_PHASE);
- if (windowEventContext.handleLocalEvents(m_event.get()) && m_event->propagationStopped())
+ if (windowEventContext.handleLocalEvents(event.get()) && event->propagationStopped())
return DoneDispatching;
for (size_t i = m_eventPath.size() - 1; i > 0; --i) {
const EventContext& eventContext = *m_eventPath[i];
if (eventContext.currentTargetSameAsTarget()) {
- if (m_event->bubbles())
+ if (event->bubbles())
continue;
- m_event->setEventPhase(Event::AT_TARGET);
+ event->setEventPhase(Event::AT_TARGET);
} else
- m_event->setEventPhase(Event::CAPTURING_PHASE);
- eventContext.handleLocalEvents(m_event.get());
- if (m_event->propagationStopped())
+ event->setEventPhase(Event::CAPTURING_PHASE);
+ eventContext.handleLocalEvents(event.get());
+ if (event->propagationStopped())
return DoneDispatching;
}
return ContinueDispatching;
}
-inline EventDispatchContinuation EventDispatcher::dispatchEventAtTarget()
+inline EventDispatchContinuation EventDispatcher::dispatchEventAtTarget(PassRefPtr<Event> event)
{
- m_event->setEventPhase(Event::AT_TARGET);
- m_eventPath[0]->handleLocalEvents(m_event.get());
- return m_event->propagationStopped() ? DoneDispatching : ContinueDispatching;
+ event->setEventPhase(Event::AT_TARGET);
+ m_eventPath[0]->handleLocalEvents(event.get());
+ return event->propagationStopped() ? DoneDispatching : ContinueDispatching;
}
-inline EventDispatchContinuation EventDispatcher::dispatchEventAtBubbling(WindowEventContext& windowContext)
+inline EventDispatchContinuation EventDispatcher::dispatchEventAtBubbling(PassRefPtr<Event> event, WindowEventContext& windowContext)
{
- if (m_event->bubbles() && !m_event->cancelBubble()) {
+ if (event->bubbles() && !event->cancelBubble()) {
// Trigger bubbling event handlers, starting at the bottom and working our way up.
- m_event->setEventPhase(Event::BUBBLING_PHASE);
+ event->setEventPhase(Event::BUBBLING_PHASE);
size_t size = m_eventPath.size();
for (size_t i = 1; i < size; ++i) {
const EventContext& eventContext = *m_eventPath[i];
if (eventContext.currentTargetSameAsTarget())
- m_event->setEventPhase(Event::AT_TARGET);
+ event->setEventPhase(Event::AT_TARGET);
else
- m_event->setEventPhase(Event::BUBBLING_PHASE);
- eventContext.handleLocalEvents(m_event.get());
- if (m_event->propagationStopped() || m_event->cancelBubble())
+ event->setEventPhase(Event::BUBBLING_PHASE);
+ eventContext.handleLocalEvents(event.get());
+ if (event->propagationStopped() || event->cancelBubble())
return DoneDispatching;
}
- windowContext.handleLocalEvents(m_event.get());
+ windowContext.handleLocalEvents(event.get());
}
return ContinueDispatching;
}
-inline void EventDispatcher::dispatchEventPostProcess(void* preDispatchEventHandlerResult)
+inline void EventDispatcher::dispatchEventPostProcess(PassRefPtr<Event> event, void* preDispatchEventHandlerResult)
{
- m_event->setTarget(EventRetargeter::eventTargetRespectingTargetRules(m_node.get()));
- m_event->setCurrentTarget(0);
- m_event->setEventPhase(0);
+ event->setTarget(EventRetargeter::eventTargetRespectingTargetRules(m_node.get()));
+ event->setCurrentTarget(0);
+ event->setEventPhase(0);
// Pass the data from the preDispatchEventHandler to the postDispatchEventHandler.
- m_node->postDispatchEventHandler(m_event.get(), preDispatchEventHandlerResult);
+ m_node->postDispatchEventHandler(event.get(), preDispatchEventHandlerResult);
// Call default event handlers. While the DOM does have a concept of preventing
// default handling, the detail of which handlers are called is an internal
// implementation detail and not part of the DOM.
- if (!m_event->defaultPrevented() && !m_event->defaultHandled()) {
+ if (!event->defaultPrevented() && !event->defaultHandled()) {
// Non-bubbling events call only one default event handler, the one for the target.
- m_node->defaultEventHandler(m_event.get());
- ASSERT(!m_event->defaultPrevented());
- if (m_event->defaultHandled())
+ m_node->defaultEventHandler(event.get());
+ ASSERT(!event->defaultPrevented());
+ if (event->defaultHandled())
return;
// For bubbling events, call default event handlers on the same targets in the
// same order as the bubbling phase.
- if (m_event->bubbles()) {
+ if (event->bubbles()) {
size_t size = m_eventPath.size();
for (size_t i = 1; i < size; ++i) {
- m_eventPath[i]->node()->defaultEventHandler(m_event.get());
- ASSERT(!m_event->defaultPrevented());
- if (m_event->defaultHandled())
+ m_eventPath[i]->node()->defaultEventHandler(event.get());
+ ASSERT(!event->defaultPrevented());
+ if (event->defaultHandled())
return;
}
}
Modified: trunk/Source/WebCore/dom/EventDispatcher.h (143243 => 143244)
--- trunk/Source/WebCore/dom/EventDispatcher.h 2013-02-18 19:01:23 UTC (rev 143243)
+++ trunk/Source/WebCore/dom/EventDispatcher.h 2013-02-18 19:07:50 UTC (rev 143244)
@@ -30,7 +30,6 @@
#include "SimulatedClickOptions.h"
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
@@ -58,24 +57,22 @@
static void dispatchSimulatedClick(Node*, Event* underlyingEvent, SimulatedClickMouseEventOptions, SimulatedClickVisualOptions);
- bool dispatch();
- Node* node() const { return m_node.get(); }
- Event* event() const { return m_event.get(); }
- EventPath& ensureEventPath();
+ bool dispatchEvent(PassRefPtr<Event>);
+ Node* node() const;
+ EventPath& ensureEventPath(Event*);
private:
- EventDispatcher(Node*, PassRefPtr<Event>);
+ EventDispatcher(Node*);
const EventContext* topEventContext();
- EventDispatchContinuation dispatchEventPreProcess(void*& preDispatchEventHandlerResult);
- EventDispatchContinuation dispatchEventAtCapturing(WindowEventContext&);
- EventDispatchContinuation dispatchEventAtTarget();
- EventDispatchContinuation dispatchEventAtBubbling(WindowEventContext&);
- void dispatchEventPostProcess(void* preDispatchEventHandlerResult);
+ EventDispatchContinuation dispatchEventPreProcess(PassRefPtr<Event>, void*& preDispatchEventHandlerResult);
+ EventDispatchContinuation dispatchEventAtCapturing(PassRefPtr<Event>, WindowEventContext&);
+ EventDispatchContinuation dispatchEventAtTarget(PassRefPtr<Event>);
+ EventDispatchContinuation dispatchEventAtBubbling(PassRefPtr<Event>, WindowEventContext&);
+ void dispatchEventPostProcess(PassRefPtr<Event>, void* preDispatchEventHandlerResult);
EventPath m_eventPath;
RefPtr<Node> m_node;
- RefPtr<Event> m_event;
RefPtr<FrameView> m_view;
bool m_eventPathInitialized;
#ifndef NDEBUG
@@ -83,6 +80,11 @@
#endif
};
+inline Node* EventDispatcher::node() const
+{
+ return m_node.get();
}
+}
+
#endif
Modified: trunk/Source/WebCore/dom/FocusEvent.cpp (143243 => 143244)
--- trunk/Source/WebCore/dom/FocusEvent.cpp 2013-02-18 19:01:23 UTC (rev 143243)
+++ trunk/Source/WebCore/dom/FocusEvent.cpp 2013-02-18 19:07:50 UTC (rev 143244)
@@ -77,7 +77,7 @@
bool FocusEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
{
- EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath());
+ EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath(event()));
return EventDispatchMediator::dispatchEvent(dispatcher);
}
@@ -93,7 +93,7 @@
bool BlurEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
{
- EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath());
+ EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath(event()));
return EventDispatchMediator::dispatchEvent(dispatcher);
}
@@ -109,7 +109,7 @@
bool FocusInEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
{
- EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath());
+ EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath(event()));
return EventDispatchMediator::dispatchEvent(dispatcher);
}
@@ -125,7 +125,7 @@
bool FocusOutEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
{
- EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath());
+ EventRetargeter::adjustForFocusEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath(event()));
return EventDispatchMediator::dispatchEvent(dispatcher);
}
Modified: trunk/Source/WebCore/dom/GestureEvent.cpp (143243 => 143244)
--- trunk/Source/WebCore/dom/GestureEvent.cpp 2013-02-18 19:01:23 UTC (rev 143243)
+++ trunk/Source/WebCore/dom/GestureEvent.cpp 2013-02-18 19:07:50 UTC (rev 143244)
@@ -122,7 +122,7 @@
if (dispatcher->node()->disabled())
return true;
- dispatcher->dispatch();
+ dispatcher->dispatchEvent(event());
ASSERT(!event()->defaultPrevented());
return event()->defaultHandled() || event()->defaultPrevented();
}
Modified: trunk/Source/WebCore/dom/MouseEvent.cpp (143243 => 143244)
--- trunk/Source/WebCore/dom/MouseEvent.cpp 2013-02-18 19:01:23 UTC (rev 143243)
+++ trunk/Source/WebCore/dom/MouseEvent.cpp 2013-02-18 19:07:50 UTC (rev 143244)
@@ -262,8 +262,8 @@
bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
{
if (isSyntheticMouseEvent()) {
- EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath());
- return dispatcher->dispatch();
+ EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath(event()));
+ return dispatcher->dispatchEvent(event());
}
if (dispatcher->node()->disabled()) // Don't even send DOM events for disabled controls..
@@ -275,9 +275,9 @@
ASSERT(!event()->target() || event()->target() != event()->relatedTarget());
EventTarget* relatedTarget = event()->relatedTarget();
- EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath());
+ EventRetargeter::adjustForMouseEvent(dispatcher->node(), *event(), dispatcher->ensureEventPath(event()));
- dispatcher->dispatch();
+ dispatcher->dispatchEvent(event());
bool swallowEvent = event()->defaultHandled() || event()->defaultPrevented();
if (event()->type() != eventNames().clickEvent || event()->detail() != 2)