Commit 6fcecbbd authored by akling@apple.com's avatar akling@apple.com

Move mouse event dispatch from Node to Element.

<https://webkit.org/b/122203>

Reviewed by Anders Carlsson.

We never dispatch mouse events on text or other non-element nodes,
so move the related logic to using Element.

Node::dispatchMouseEvent() moves to Element. I also changed the
relatedTarget argument to be an Element* since the related target
is never a Node either.

Most of this patch is *Node -> *Element renames in EventHandler.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156761 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2ab68261
2013-10-01 Andreas Kling <akling@apple.com>
Move mouse event dispatch from Node to Element.
<https://webkit.org/b/122203>
Reviewed by Anders Carlsson.
We never dispatch mouse events on text or other non-element nodes,
so move the related logic to using Element.
Node::dispatchMouseEvent() moves to Element. I also changed the
relatedTarget argument to be an Element* since the related target
is never a Node either.
Most of this patch is *Node -> *Element renames in EventHandler.
2013-10-01 Gyuyoung Kim <gyuyoung.kim@samsung.com>
Generate toCSSFooValue for CSS child values
......@@ -185,7 +185,7 @@ __ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_11LayoutPointEjRKNS_10Layo
__ZN7WebCore12EventHandler21handleMousePressEventERKNS_18PlatformMouseEventE
__ZN7WebCore12EventHandler23handleMouseReleaseEventERKNS_18PlatformMouseEventE
__ZN7WebCore12EventHandler24logicalScrollRecursivelyENS_22ScrollLogicalDirectionENS_17ScrollGranularityEPNS_4NodeE
__ZN7WebCore12EventHandler27setCapturingMouseEventsNodeEN3WTF10PassRefPtrINS_4NodeEEE
__ZN7WebCore12EventHandler30setCapturingMouseEventsElementEN3WTF10PassRefPtrINS_7ElementEEE
__ZN7WebCore12EventHandler31passMouseMovedEventToScrollbarsERKNS_18PlatformMouseEventE
__ZN7WebCore12EventHandler33sendFakeEventsAfterWidgetTrackingEP7NSEvent
__ZN7WebCore12EventHandler8keyEventERKNS_21PlatformKeyboardEventE
......
......@@ -240,6 +240,11 @@ bool Element::shouldUseInputMethod()
return isContentEditable(UserSelectAllIsAlwaysNonEditable);
}
bool Element::dispatchMouseEvent(const PlatformMouseEvent& event, const AtomicString& eventType, int detail, Element* relatedTarget)
{
return EventDispatcher::dispatchEvent(this, MouseEventDispatchMediator::create(MouseEvent::create(eventType, document().defaultView(), event, detail, relatedTarget)));
}
bool Element::dispatchWheelEvent(const PlatformWheelEvent& event)
{
return EventDispatcher::dispatchEvent(this, WheelEventDispatchMediator::create(event, document().defaultView()));
......
......@@ -43,6 +43,8 @@ class ElementRareData;
class HTMLDocument;
class IntSize;
class Locale;
class PlatformKeyboardEvent;
class PlatformMouseEvent;
class PlatformWheelEvent;
class PseudoElement;
class RenderRegion;
......@@ -532,6 +534,7 @@ public:
IntSize savedLayerScrollOffset() const;
void setSavedLayerScrollOffset(const IntSize&);
bool dispatchMouseEvent(const PlatformMouseEvent&, const AtomicString& eventType, int clickCount = 0, Element* relatedTarget = nullptr);
bool dispatchWheelEvent(const PlatformWheelEvent&);
bool dispatchKeyEvent(const PlatformKeyboardEvent&);
void dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEventOptions = SendNoEvents, SimulatedClickVisualOptions = ShowPressedLook);
......
......@@ -2110,12 +2110,6 @@ bool Node::dispatchDOMActivateEvent(int detail, PassRefPtr<Event> underlyingEven
return event->defaultHandled();
}
bool Node::dispatchMouseEvent(const PlatformMouseEvent& event, const AtomicString& eventType,
int detail, Node* relatedTarget)
{
return EventDispatcher::dispatchEvent(this, MouseEventDispatchMediator::create(MouseEvent::create(eventType, document().defaultView(), event, detail, relatedTarget)));
}
#if ENABLE(GESTURE_EVENTS)
bool Node::dispatchGestureEvent(const PlatformGestureEvent& event)
{
......
......@@ -70,8 +70,6 @@ class NameNodeList;
class NodeList;
class NodeListsNodeData;
class NodeRareData;
class PlatformKeyboardEvent;
class PlatformMouseEvent;
class QualifiedName;
class RadioNodeList;
class RegisteredEventListener;
......@@ -543,7 +541,6 @@ public:
void dispatchSubtreeModifiedEvent();
bool dispatchDOMActivateEvent(int detail, PassRefPtr<Event> underlyingEvent);
bool dispatchMouseEvent(const PlatformMouseEvent&, const AtomicString& eventType, int clickCount = 0, Node* relatedTarget = 0);
#if ENABLE(GESTURE_EVENTS)
bool dispatchGestureEvent(const PlatformGestureEvent&);
#endif
......
......@@ -96,7 +96,7 @@ void HTMLPlugInElement::willDetachRenderers()
if (m_isCapturingMouseEvents) {
if (Frame* frame = document().frame())
frame->eventHandler().setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsElement(nullptr);
m_isCapturingMouseEvents = false;
}
......
......@@ -110,7 +110,7 @@ void MediaControlPanelElement::startDrag(const LayoutPoint& eventLocation)
m_lastDragEventLocation = eventLocation;
frame->eventHandler().setCapturingMouseEventsNode(this);
frame->eventHandler().setCapturingMouseEventsElement(this);
m_isBeingDragged = true;
}
......@@ -137,7 +137,7 @@ void MediaControlPanelElement::endDrag()
if (!frame)
return;
frame->eventHandler().setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsElement(nullptr);
}
void MediaControlPanelElement::startTimer()
......
......@@ -321,7 +321,7 @@ void SliderThumbElement::setPositionFromPoint(const LayoutPoint& absolutePoint)
void SliderThumbElement::startDragging()
{
if (Frame* frame = document().frame()) {
frame->eventHandler().setCapturingMouseEventsNode(this);
frame->eventHandler().setCapturingMouseEventsElement(this);
m_inDragMode = true;
}
}
......@@ -332,7 +332,7 @@ void SliderThumbElement::stopDragging()
return;
if (Frame* frame = document().frame())
frame->eventHandler().setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsElement(nullptr);
m_inDragMode = false;
if (renderer())
renderer()->setNeedsLayout(true);
......@@ -398,7 +398,7 @@ void SliderThumbElement::willDetachRenderers()
{
if (m_inDragMode) {
if (Frame* frame = document().frame())
frame->eventHandler().setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsElement(nullptr);
}
}
......
......@@ -120,7 +120,7 @@ void SpinButtonElement::defaultEventHandler(Event* event)
if (box->pixelSnappedBorderBoxRect().contains(local)) {
if (!m_capturing) {
if (Frame* frame = document().frame()) {
frame->eventHandler().setCapturingMouseEventsNode(this);
frame->eventHandler().setCapturingMouseEventsElement(this);
m_capturing = true;
if (Page* page = document().page())
page->chrome().registerPopupOpeningObserver(this);
......@@ -196,7 +196,7 @@ void SpinButtonElement::releaseCapture()
stopRepeatingTimer();
if (m_capturing) {
if (Frame* frame = document().frame()) {
frame->eventHandler().setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsElement(nullptr);
m_capturing = false;
if (Page* page = document().page())
page->chrome().unregisterPopupOpeningObserver(this);
......
......@@ -201,7 +201,7 @@ void SearchFieldCancelButtonElement::willDetachRenderers()
{
if (m_capturing) {
if (Frame* frame = document().frame())
frame->eventHandler().setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsElement(nullptr);
}
}
......@@ -218,7 +218,7 @@ void SearchFieldCancelButtonElement::defaultEventHandler(Event* event)
if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
if (renderer() && renderer()->visibleToHitTesting()) {
if (Frame* frame = document().frame()) {
frame->eventHandler().setCapturingMouseEventsNode(this);
frame->eventHandler().setCapturingMouseEventsElement(this);
m_capturing = true;
}
}
......@@ -229,7 +229,7 @@ void SearchFieldCancelButtonElement::defaultEventHandler(Event* event)
if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
if (m_capturing) {
if (Frame* frame = document().frame()) {
frame->eventHandler().setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsElement(nullptr);
m_capturing = false;
}
if (hovered()) {
......@@ -305,7 +305,7 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
if (renderer() && renderer()->visibleToHitTesting()) {
if (Frame* frame = document().frame()) {
frame->eventHandler().setCapturingMouseEventsNode(this);
frame->eventHandler().setCapturingMouseEventsElement(this);
m_capturing = true;
}
}
......@@ -318,7 +318,7 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
if (m_capturing && renderer() && renderer()->visibleToHitTesting()) {
if (Frame* frame = document().frame()) {
frame->eventHandler().setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsElement(nullptr);
m_capturing = false;
}
}
......@@ -416,7 +416,7 @@ void InputFieldSpeechButtonElement::willDetachRenderers()
{
if (m_capturing) {
if (Frame* frame = document().frame())
frame->eventHandler().setCapturingMouseEventsNode(0);
frame->eventHandler().setCapturingMouseEventsElement(nullptr);
}
if (m_listenerId) {
......
......@@ -333,7 +333,7 @@ EventHandler::EventHandler(Frame& frame)
, m_svgPan(false)
#endif
, m_resizeLayer(0)
, m_eventHandlerWillResetCapturingMouseEventsNode(0)
, m_eventHandlerWillResetCapturingMouseEventsElement(nullptr)
, m_clickCount(0)
, m_mousePositionIsUnknown(true)
, m_mouseDownTimestamp(0)
......@@ -388,8 +388,8 @@ void EventHandler::clear()
cancelAutoHideCursorTimer();
#endif
m_resizeLayer = 0;
m_nodeUnderMouse = 0;
m_lastNodeUnderMouse = 0;
m_elementUnderMouse = nullptr;
m_lastElementUnderMouse = nullptr;
#if ENABLE(SVG)
m_instanceUnderMouse = 0;
m_lastInstanceUnderMouse = 0;
......@@ -409,7 +409,7 @@ void EventHandler::clear()
m_mousePressNode = 0;
m_mousePressed = false;
m_capturesDragging = false;
m_capturingMouseEventsNode = 0;
m_capturingMouseEventsElement = nullptr;
m_latchedWheelEventElement = nullptr;
m_previousWheelScrolledElement = nullptr;
#if ENABLE(TOUCH_EVENTS)
......@@ -1377,7 +1377,7 @@ OptionalCursor EventHandler::selectCursor(const HitTestResult& result, bool shif
&& !m_mouseDownMayStartDrag
#endif
&& m_frame.selection().isCaretOrRange()
&& !m_capturingMouseEventsNode) {
&& !m_capturingMouseEventsElement) {
return iBeam;
}
......@@ -1555,8 +1555,8 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
// the m_mousePressed flag, which may happen if an AppKit widget entered a modal event loop.
m_capturesDragging = subframe->eventHandler().capturesDragging();
if (m_mousePressed && m_capturesDragging) {
m_capturingMouseEventsNode = mev.targetNode();
m_eventHandlerWillResetCapturingMouseEventsNode = true;
m_capturingMouseEventsElement = subframe->ownerElement();
m_eventHandlerWillResetCapturingMouseEventsElement = true;
}
invalidateClick();
return true;
......@@ -1655,8 +1655,8 @@ bool EventHandler::handleMouseDoubleClickEvent(const PlatformMouseEvent& mouseEv
HitTestRequest request(HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent);
Frame* subframe = subframeForHitTestResult(mev);
if (m_eventHandlerWillResetCapturingMouseEventsNode)
m_capturingMouseEventsNode = 0;
if (m_eventHandlerWillResetCapturingMouseEventsElement)
m_capturingMouseEventsElement = nullptr;
if (subframe && passMousePressEventToSubframe(mev, subframe))
return true;
......@@ -1791,7 +1791,7 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, Hi
}
bool swallowEvent = false;
RefPtr<Frame> newSubframe = m_capturingMouseEventsNode.get() ? subframeForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev);
RefPtr<Frame> newSubframe = m_capturingMouseEventsElement.get() ? subframeForTargetNode(m_capturingMouseEventsElement.get()) : subframeForHitTestResult(mev);
// We want mouseouts to happen first, from the inside out. First send a move event to the last subframe so that it will fire mouseouts.
if (m_lastMouseMoveEventSubframe && m_lastMouseMoveEventSubframe->tree().isDescendantOf(&m_frame) && m_lastMouseMoveEventSubframe != newSubframe)
......@@ -1896,14 +1896,14 @@ bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
m_lastScrollbarUnderMouse->mouseUp(mouseEvent);
bool cancelable = true;
bool setUnder = false;
return !dispatchMouseEvent(eventNames().mouseupEvent, m_lastNodeUnderMouse.get(), cancelable, m_clickCount, mouseEvent, setUnder);
return !dispatchMouseEvent(eventNames().mouseupEvent, m_lastElementUnderMouse.get(), cancelable, m_clickCount, mouseEvent, setUnder);
}
HitTestRequest request(HitTestRequest::Release | HitTestRequest::DisallowShadowContent);
MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent);
Frame* subframe = m_capturingMouseEventsNode.get() ? subframeForTargetNode(m_capturingMouseEventsNode.get()) : subframeForHitTestResult(mev);
if (m_eventHandlerWillResetCapturingMouseEventsNode)
m_capturingMouseEventsNode = 0;
Frame* subframe = m_capturingMouseEventsElement.get() ? subframeForTargetNode(m_capturingMouseEventsElement.get()) : subframeForHitTestResult(mev);
if (m_eventHandlerWillResetCapturingMouseEventsElement)
m_capturingMouseEventsElement = nullptr;
if (subframe && passMouseReleaseEventToSubframe(mev, subframe))
return true;
......@@ -2189,7 +2189,7 @@ void EventHandler::clearDragState()
{
stopAutoscrollTimer();
m_dragTarget = 0;
m_capturingMouseEventsNode = 0;
m_capturingMouseEventsElement = nullptr;
m_shouldOnlyFireDragOverEvent = false;
#if PLATFORM(MAC)
m_sendingEventToSubview = false;
......@@ -2197,10 +2197,10 @@ void EventHandler::clearDragState()
}
#endif // ENABLE(DRAG_SUPPORT)
void EventHandler::setCapturingMouseEventsNode(PassRefPtr<Node> n)
void EventHandler::setCapturingMouseEventsElement(PassRefPtr<Element> element)
{
m_capturingMouseEventsNode = n;
m_eventHandlerWillResetCapturingMouseEventsNode = false;
m_capturingMouseEventsElement = element;
m_eventHandlerWillResetCapturingMouseEventsElement = false;
}
MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestRequest& request, const PlatformMouseEvent& mev)
......@@ -2229,19 +2229,22 @@ static inline SVGElementInstance* instanceAssociatedWithShadowTreeElement(Node*
void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMouseEvent& mouseEvent, bool fireMouseOverOut)
{
Node* result = targetNode;
Element* targetElement = nullptr;
// If we're capturing, we always go right to that node.
if (m_capturingMouseEventsNode)
result = m_capturingMouseEventsNode.get();
else {
// If the target node is a text node, dispatch on the parent node - rdar://4196646
if (result && result->isTextNode())
result = result->parentOrShadowHostElement();
// If we're capturing, we always go right to that element.
if (m_capturingMouseEventsElement)
targetElement = m_capturingMouseEventsElement.get();
else if (targetNode) {
// If the target node is a non-element, dispatch on the parent. <rdar://problem/4196646>
if (!targetNode->isElementNode())
targetElement = targetNode->parentOrShadowHostElement();
else
targetElement = toElement(targetNode);
}
m_nodeUnderMouse = result;
m_elementUnderMouse = targetElement;
#if ENABLE(SVG)
m_instanceUnderMouse = instanceAssociatedWithShadowTreeElement(result);
m_instanceUnderMouse = instanceAssociatedWithShadowTreeElement(targetElement);
// <use> shadow tree elements may have been recloned, update node under mouse in any case
if (m_lastInstanceUnderMouse) {
......@@ -2264,10 +2267,10 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
continue;
SVGElement* shadowTreeElement = instance->shadowTreeElement();
if (!shadowTreeElement->inDocument() || m_lastNodeUnderMouse == shadowTreeElement)
if (!shadowTreeElement->inDocument() || m_lastElementUnderMouse == shadowTreeElement)
continue;
m_lastNodeUnderMouse = shadowTreeElement;
m_lastElementUnderMouse = shadowTreeElement;
m_lastInstanceUnderMouse = instance;
break;
}
......@@ -2277,19 +2280,19 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
// Fire mouseout/mouseover if the mouse has shifted to a different node.
if (fireMouseOverOut) {
RenderLayer* layerForLastNode = layerForNode(m_lastNodeUnderMouse.get());
RenderLayer* layerForNodeUnderMouse = layerForNode(m_nodeUnderMouse.get());
RenderLayer* layerForLastNode = layerForNode(m_lastElementUnderMouse.get());
RenderLayer* layerForNodeUnderMouse = layerForNode(m_elementUnderMouse.get());
Page* page = m_frame.page();
if (m_lastNodeUnderMouse && (!m_nodeUnderMouse || &m_nodeUnderMouse->document() != m_frame.document())) {
if (m_lastElementUnderMouse && (!m_elementUnderMouse || &m_elementUnderMouse->document() != m_frame.document())) {
// The mouse has moved between frames.
if (Frame* frame = m_lastNodeUnderMouse->document().frame()) {
if (Frame* frame = m_lastElementUnderMouse->document().frame()) {
if (FrameView* frameView = frame->view())
frameView->mouseExitedContentArea();
}
} else if (page && (layerForLastNode && (!layerForNodeUnderMouse || layerForNodeUnderMouse != layerForLastNode))) {
// The mouse has moved between layers.
if (Frame* frame = m_lastNodeUnderMouse->document().frame()) {
if (Frame* frame = m_lastElementUnderMouse->document().frame()) {
if (FrameView* frameView = frame->view()) {
if (frameView->containsScrollableArea(layerForLastNode))
layerForLastNode->mouseExitedContentArea();
......@@ -2297,15 +2300,15 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
}
}
if (m_nodeUnderMouse && (!m_lastNodeUnderMouse || &m_lastNodeUnderMouse->document() != m_frame.document())) {
if (m_elementUnderMouse && (!m_lastElementUnderMouse || &m_lastElementUnderMouse->document() != m_frame.document())) {
// The mouse has moved between frames.
if (Frame* frame = m_nodeUnderMouse->document().frame()) {
if (Frame* frame = m_elementUnderMouse->document().frame()) {
if (FrameView* frameView = frame->view())
frameView->mouseEnteredContentArea();
}
} else if (page && (layerForNodeUnderMouse && (!layerForLastNode || layerForNodeUnderMouse != layerForLastNode))) {
// The mouse has moved between layers.
if (Frame* frame = m_nodeUnderMouse->document().frame()) {
if (Frame* frame = m_elementUnderMouse->document().frame()) {
if (FrameView* frameView = frame->view()) {
if (frameView->containsScrollableArea(layerForNodeUnderMouse))
layerForNodeUnderMouse->mouseEnteredContentArea();
......@@ -2313,25 +2316,25 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
}
}
if (m_lastNodeUnderMouse && &m_lastNodeUnderMouse->document() != m_frame.document()) {
m_lastNodeUnderMouse = 0;
if (m_lastElementUnderMouse && &m_lastElementUnderMouse->document() != m_frame.document()) {
m_lastElementUnderMouse = nullptr;
m_lastScrollbarUnderMouse = 0;
#if ENABLE(SVG)
m_lastInstanceUnderMouse = 0;
#endif
}
if (m_lastNodeUnderMouse != m_nodeUnderMouse) {
if (m_lastElementUnderMouse != m_elementUnderMouse) {
// send mouseout event to the old node
if (m_lastNodeUnderMouse)
m_lastNodeUnderMouse->dispatchMouseEvent(mouseEvent, eventNames().mouseoutEvent, 0, m_nodeUnderMouse.get());
if (m_lastElementUnderMouse)
m_lastElementUnderMouse->dispatchMouseEvent(mouseEvent, eventNames().mouseoutEvent, 0, m_elementUnderMouse.get());
// send mouseover event to the new node
if (m_nodeUnderMouse)
m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, eventNames().mouseoverEvent, 0, m_lastNodeUnderMouse.get());
if (m_elementUnderMouse)
m_elementUnderMouse->dispatchMouseEvent(mouseEvent, eventNames().mouseoverEvent, 0, m_lastElementUnderMouse.get());
}
m_lastNodeUnderMouse = m_nodeUnderMouse;
m_lastElementUnderMouse = m_elementUnderMouse;
#if ENABLE(SVG)
m_lastInstanceUnderMouse = instanceAssociatedWithShadowTreeElement(m_nodeUnderMouse.get());
m_lastInstanceUnderMouse = instanceAssociatedWithShadowTreeElement(m_elementUnderMouse.get());
#endif
}
}
......@@ -2345,8 +2348,8 @@ bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe
bool swallowEvent = false;
if (m_nodeUnderMouse)
swallowEvent = !(m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, eventType, clickCount));
if (m_elementUnderMouse)
swallowEvent = !(m_elementUnderMouse->dispatchMouseEvent(mouseEvent, eventType, clickCount));
if (!swallowEvent && eventType == eventNames().mousedownEvent) {
......@@ -2363,11 +2366,7 @@ bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe
// is expected by some sites that rely on onChange handlers running
// from form fields before the button click is processed.
Element* element;
if (m_nodeUnderMouse)
element = m_nodeUnderMouse->isElementNode() ? toElement(m_nodeUnderMouse.get()) : m_nodeUnderMouse->parentOrShadowHostElement();
else
element = 0;
Element* element = m_elementUnderMouse.get();
// Walk up the DOM tree to search for an element to focus.
while (element) {
......
......@@ -138,7 +138,7 @@ public:
bool mousePressed() const { return m_mousePressed; }
void setMousePressed(bool pressed) { m_mousePressed = pressed; }
void setCapturingMouseEventsNode(PassRefPtr<Node>); // A caller is responsible for resetting capturing node to 0.
void setCapturingMouseEventsElement(PassRefPtr<Element>); // A caller is responsible for resetting capturing element to 0.
#if ENABLE(DRAG_SUPPORT)
bool updateDragAndDrop(const PlatformMouseEvent&, Clipboard*);
......@@ -448,11 +448,11 @@ private:
RenderLayer* m_resizeLayer;
RefPtr<Node> m_capturingMouseEventsNode;
bool m_eventHandlerWillResetCapturingMouseEventsNode;
RefPtr<Element> m_capturingMouseEventsElement;
bool m_eventHandlerWillResetCapturingMouseEventsElement;
RefPtr<Node> m_nodeUnderMouse;
RefPtr<Node> m_lastNodeUnderMouse;
RefPtr<Element> m_elementUnderMouse;
RefPtr<Element> m_lastElementUnderMouse;
RefPtr<Frame> m_lastMouseMoveEventSubframe;
RefPtr<Scrollbar> m_lastScrollbarUnderMouse;
Cursor m_currentMouseCursor;
......
......@@ -615,7 +615,7 @@ void RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent(Event* event)
if (event->type() == eventNames().mousedownEvent && static_cast<MouseEvent*>(event)->button() == LeftButton) {
m_mouseDownWasInUnavailablePluginIndicator = isInUnavailablePluginIndicator(mouseEvent);
if (m_mouseDownWasInUnavailablePluginIndicator) {
frame().eventHandler().setCapturingMouseEventsNode(&element);
frame().eventHandler().setCapturingMouseEventsElement(&element);
element.setIsCapturingMouseEvents(true);
setUnavailablePluginIndicatorIsPressed(true);
}
......@@ -623,7 +623,7 @@ void RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent(Event* event)
}
if (event->type() == eventNames().mouseupEvent && static_cast<MouseEvent*>(event)->button() == LeftButton) {
if (m_unavailablePluginIndicatorIsPressed) {
frame().eventHandler().setCapturingMouseEventsNode(0);
frame().eventHandler().setCapturingMouseEventsElement(nullptr);
element.setIsCapturingMouseEvents(false);
setUnavailablePluginIndicatorIsPressed(false);
}
......
......@@ -883,9 +883,9 @@ void PluginView::handleEvent(Event* event)
// FIXME: Clicking in a scroll bar should not change focus.
if (currentEvent->type() == WebEvent::MouseDown) {
focusPluginElement();
frame()->eventHandler().setCapturingMouseEventsNode(m_pluginElement.get());
frame()->eventHandler().setCapturingMouseEventsElement(m_pluginElement.get());
} else if (currentEvent->type() == WebEvent::MouseUp)
frame()->eventHandler().setCapturingMouseEventsNode(0);
frame()->eventHandler().setCapturingMouseEventsElement(nullptr);
didHandleEvent = m_plugin->handleMouseEvent(static_cast<const WebMouseEvent&>(*currentEvent));
if (event->type() != eventNames().mousemoveEvent)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment