Changeset 173025 in webkit


Ignore:
Timestamp:
Aug 27, 2014, 3:25:33 PM (10 years ago)
Author:
Simon Fraser
Message:

Some EventHandler naming cleanup
https://bugs.webkit.org/show_bug.cgi?id=136303

Reviewed by Beth Dakin.

Rename "mev" variables to "mouseEvent".

No behavior change.

  • page/EventHandler.cpp:

(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleMouseDoubleClickEvent):
(WebCore::EventHandler::handleMouseMoveEvent):
(WebCore::EventHandler::handleMouseReleaseEvent):
(WebCore::EventHandler::updateDragAndDrop):
(WebCore::EventHandler::prepareMouseEvent):
(WebCore::EventHandler::sendContextMenuEvent):
(WebCore::EventHandler::passMousePressEventToScrollbar):
(WebCore::EventHandler::dispatchSyntheticTouchEventIfEnabled):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r173024 r173025  
     12014-08-27  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Some EventHandler naming cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=136303
     5
     6        Reviewed by Beth Dakin.
     7       
     8        Rename "mev" variables to "mouseEvent".
     9       
     10        No behavior change.
     11
     12        * page/EventHandler.cpp:
     13        (WebCore::EventHandler::handleMousePressEvent):
     14        (WebCore::EventHandler::handleMouseDoubleClickEvent):
     15        (WebCore::EventHandler::handleMouseMoveEvent):
     16        (WebCore::EventHandler::handleMouseReleaseEvent):
     17        (WebCore::EventHandler::updateDragAndDrop):
     18        (WebCore::EventHandler::prepareMouseEvent):
     19        (WebCore::EventHandler::sendContextMenuEvent):
     20        (WebCore::EventHandler::passMousePressEventToScrollbar):
     21        (WebCore::EventHandler::dispatchSyntheticTouchEventIfEnabled):
     22
    1232014-08-27  Simon Fraser  <simon.fraser@apple.com>
    224
  • trunk/Source/WebCore/page/EventHandler.cpp

    r173024 r173025  
    16881688    // when we dispatch the event.
    16891689    LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, plaformMouseEvent.position());
    1690     MouseEventWithHitTestResults mev = m_frame.document()->prepareMouseEvent(request, documentPoint, plaformMouseEvent);
    1691 
    1692     if (!mev.targetNode()) {
     1690    MouseEventWithHitTestResults mouseEvent = m_frame.document()->prepareMouseEvent(request, documentPoint, plaformMouseEvent);
     1691
     1692    if (!mouseEvent.targetNode()) {
    16931693        invalidateClick();
    16941694        return false;
    16951695    }
    16961696
    1697     m_mousePressNode = mev.targetNode();
    1698 
    1699     RefPtr<Frame> subframe = subframeForHitTestResult(mev);
    1700     if (subframe && passMousePressEventToSubframe(mev, subframe.get())) {
     1697    m_mousePressNode = mouseEvent.targetNode();
     1698
     1699    RefPtr<Frame> subframe = subframeForHitTestResult(mouseEvent);
     1700    if (subframe && passMousePressEventToSubframe(mouseEvent, subframe.get())) {
    17011701        // Start capturing future events for this frame.  We only do this if we didn't clear
    17021702        // the m_mousePressed flag, which may happen if an AppKit widget entered a modal event loop.
     
    17241724
    17251725    m_clickCount = plaformMouseEvent.clickCount();
    1726     m_clickNode = mev.targetNode();
     1726    m_clickNode = mouseEvent.targetNode();
    17271727
    17281728    if (!m_clickNode) {
     
    17451745    m_frame.selection().setCaretBlinkingSuspended(true);
    17461746
    1747     bool swallowEvent = !dispatchMouseEvent(eventNames().mousedownEvent, mev.targetNode(), true, m_clickCount, plaformMouseEvent, true);
    1748     m_capturesDragging = !swallowEvent || mev.scrollbar();
     1747    bool swallowEvent = !dispatchMouseEvent(eventNames().mousedownEvent, mouseEvent.targetNode(), true, m_clickCount, plaformMouseEvent, true);
     1748    m_capturesDragging = !swallowEvent || mouseEvent.scrollbar();
    17491749
    17501750    // If the hit testing originally determined the event was in a scrollbar, refetch the MouseEventWithHitTestResults
    17511751    // in case the scrollbar widget was destroyed when the mouse event was handled.
    1752     if (mev.scrollbar()) {
    1753         const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMouse.get();
     1752    if (mouseEvent.scrollbar()) {
     1753        const bool wasLastScrollBar = mouseEvent.scrollbar() == m_lastScrollbarUnderMouse.get();
    17541754        HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
    1755         mev = m_frame.document()->prepareMouseEvent(request, documentPoint, plaformMouseEvent);
    1756         if (wasLastScrollBar && mev.scrollbar() != m_lastScrollbarUnderMouse.get())
     1755        mouseEvent = m_frame.document()->prepareMouseEvent(request, documentPoint, plaformMouseEvent);
     1756        if (wasLastScrollBar && mouseEvent.scrollbar() != m_lastScrollbarUnderMouse.get())
    17571757            m_lastScrollbarUnderMouse = nullptr;
    17581758    }
     
    17601760    if (swallowEvent) {
    17611761        // scrollbars should get events anyway, even disabled controls might be scrollable
    1762         Scrollbar* scrollbar = mev.scrollbar();
     1762        Scrollbar* scrollbar = mouseEvent.scrollbar();
    17631763
    17641764        updateLastScrollbarUnderMouse(scrollbar, true);
    17651765
    17661766        if (scrollbar)
    1767             passMousePressEventToScrollbar(mev, scrollbar);
     1767            passMousePressEventToScrollbar(mouseEvent, scrollbar);
    17681768    } else {
    17691769        // Refetch the event target node if it currently is the shadow node inside an <input> element.
     
    17711771        // we'd like to EventHandler::handleMousePressEvent to pass the event to the widget and thus the
    17721772        // event target node can't still be the shadow node.
    1773         if (mev.targetNode()->isShadowRoot() && isHTMLInputElement(toShadowRoot(mev.targetNode())->hostElement())) {
     1773        if (mouseEvent.targetNode()->isShadowRoot() && isHTMLInputElement(toShadowRoot(mouseEvent.targetNode())->hostElement())) {
    17741774            HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
    1775             mev = m_frame.document()->prepareMouseEvent(request, documentPoint, plaformMouseEvent);
     1775            mouseEvent = m_frame.document()->prepareMouseEvent(request, documentPoint, plaformMouseEvent);
    17761776        }
    17771777
     
    17791779        Scrollbar* scrollbar = view ? view->scrollbarAtPoint(plaformMouseEvent.position()) : 0;
    17801780        if (!scrollbar)
    1781             scrollbar = mev.scrollbar();
     1781            scrollbar = mouseEvent.scrollbar();
    17821782
    17831783        updateLastScrollbarUnderMouse(scrollbar, true);
    17841784
    1785         if (scrollbar && passMousePressEventToScrollbar(mev, scrollbar))
     1785        if (scrollbar && passMousePressEventToScrollbar(mouseEvent, scrollbar))
    17861786            swallowEvent = true;
    17871787        else
    1788             swallowEvent = handleMousePressEvent(mev);
     1788            swallowEvent = handleMousePressEvent(mouseEvent);
    17891789    }
    17901790
     
    18061806
    18071807    HitTestRequest request(HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
    1808     MouseEventWithHitTestResults mev = prepareMouseEvent(request, plaformMouseEvent);
    1809     Frame* subframe = subframeForHitTestResult(mev);
     1808    MouseEventWithHitTestResults mouseEvent = prepareMouseEvent(request, plaformMouseEvent);
     1809    Frame* subframe = subframeForHitTestResult(mouseEvent);
    18101810    if (m_eventHandlerWillResetCapturingMouseEventsElement)
    18111811        m_capturingMouseEventsElement = nullptr;
    1812     if (subframe && passMousePressEventToSubframe(mev, subframe))
     1812    if (subframe && passMousePressEventToSubframe(mouseEvent, subframe))
    18131813        return true;
    18141814
    18151815    m_clickCount = plaformMouseEvent.clickCount();
    1816     bool swallowMouseUpEvent = !dispatchMouseEvent(eventNames().mouseupEvent, mev.targetNode(), true, m_clickCount, plaformMouseEvent, false);
    1817 
    1818     bool swallowClickEvent = plaformMouseEvent.button() != RightButton && mev.targetNode() == m_clickNode && !dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, plaformMouseEvent, true);
     1816    bool swallowMouseUpEvent = !dispatchMouseEvent(eventNames().mouseupEvent, mouseEvent.targetNode(), true, m_clickCount, plaformMouseEvent, false);
     1817
     1818    bool swallowClickEvent = plaformMouseEvent.button() != RightButton && mouseEvent.targetNode() == m_clickNode && !dispatchMouseEvent(eventNames().clickEvent, mouseEvent.targetNode(), true, m_clickCount, plaformMouseEvent, true);
    18191819
    18201820    if (m_lastScrollbarUnderMouse)
    18211821        swallowMouseUpEvent = m_lastScrollbarUnderMouse->mouseUp(plaformMouseEvent);
    18221822
    1823     bool swallowMouseReleaseEvent = !swallowMouseUpEvent && handleMouseReleaseEvent(mev);
     1823    bool swallowMouseReleaseEvent = !swallowMouseUpEvent && handleMouseReleaseEvent(mouseEvent);
    18241824
    18251825    invalidateClick();
     
    19361936#endif
    19371937    HitTestRequest request(hitType);
    1938     MouseEventWithHitTestResults mev = prepareMouseEvent(request, plaformMouseEvent);
     1938    MouseEventWithHitTestResults mouseEvent = prepareMouseEvent(request, plaformMouseEvent);
    19391939    if (hoveredNode)
    1940         *hoveredNode = mev.hitTestResult();
     1940        *hoveredNode = mouseEvent.hitTestResult();
    19411941
    19421942    if (m_resizeLayer && m_resizeLayer->inResizeMode())
    19431943        m_resizeLayer->resize(plaformMouseEvent, m_offsetFromResizeCorner);
    19441944    else {
    1945         Scrollbar* scrollbar = mev.scrollbar();
     1945        Scrollbar* scrollbar = mouseEvent.scrollbar();
    19461946        updateLastScrollbarUnderMouse(scrollbar, !m_mousePressed);
    19471947
     
    19561956
    19571957    bool swallowEvent = false;
    1958     RefPtr<Frame> newSubframe = m_capturingMouseEventsElement.get() ? subframeForTargetNode(m_capturingMouseEventsElement.get()) : subframeForHitTestResult(mev);
     1958    RefPtr<Frame> newSubframe = m_capturingMouseEventsElement.get() ? subframeForTargetNode(m_capturingMouseEventsElement.get()) : subframeForHitTestResult(mouseEvent);
    19591959 
    19601960    // 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.
    19611961    if (m_lastMouseMoveEventSubframe && m_lastMouseMoveEventSubframe->tree().isDescendantOf(&m_frame) && m_lastMouseMoveEventSubframe != newSubframe)
    1962         passMouseMoveEventToSubframe(mev, m_lastMouseMoveEventSubframe.get());
     1962        passMouseMoveEventToSubframe(mouseEvent, m_lastMouseMoveEventSubframe.get());
    19631963
    19641964    if (newSubframe) {
    19651965        // Update over/out state before passing the event to the subframe.
    1966         updateMouseEventTargetNode(mev.targetNode(), plaformMouseEvent, true);
     1966        updateMouseEventTargetNode(mouseEvent.targetNode(), plaformMouseEvent, true);
    19671967       
    19681968        // Event dispatch in updateMouseEventTargetNode may have caused the subframe of the target
    19691969        // node to be detached from its FrameView, in which case the event should not be passed.
    19701970        if (newSubframe->view())
    1971             swallowEvent |= passMouseMoveEventToSubframe(mev, newSubframe.get(), hoveredNode);
     1971            swallowEvent |= passMouseMoveEventToSubframe(mouseEvent, newSubframe.get(), hoveredNode);
    19721972#if ENABLE(CURSOR_SUPPORT)
    19731973    } else {
    19741974        if (FrameView* view = m_frame.view()) {
    1975             OptionalCursor optionalCursor = selectCursor(mev.hitTestResult(), plaformMouseEvent.shiftKey());
     1975            OptionalCursor optionalCursor = selectCursor(mouseEvent.hitTestResult(), plaformMouseEvent.shiftKey());
    19761976            if (optionalCursor.isCursorChange()) {
    19771977                m_currentMouseCursor = optionalCursor.cursor();
     
    19871987        return true;
    19881988   
    1989     swallowEvent = !dispatchMouseEvent(eventNames().mousemoveEvent, mev.targetNode(), false, 0, plaformMouseEvent, true);
     1989    swallowEvent = !dispatchMouseEvent(eventNames().mousemoveEvent, mouseEvent.targetNode(), false, 0, plaformMouseEvent, true);
    19901990#if ENABLE(DRAG_SUPPORT)
    19911991    if (!swallowEvent)
    1992         swallowEvent = handleMouseDraggedEvent(mev);
     1992        swallowEvent = handleMouseDraggedEvent(mouseEvent);
    19931993#endif // ENABLE(DRAG_SUPPORT)
    19941994
     
    20652065
    20662066    HitTestRequest request(HitTestRequest::Release | HitTestRequest::DisallowShadowContent);
    2067     MouseEventWithHitTestResults mev = prepareMouseEvent(request, plaformMouseEvent);
    2068     Frame* subframe = m_capturingMouseEventsElement.get() ? subframeForTargetNode(m_capturingMouseEventsElement.get()) : subframeForHitTestResult(mev);
     2067    MouseEventWithHitTestResults mouseEvent = prepareMouseEvent(request, plaformMouseEvent);
     2068    Frame* subframe = m_capturingMouseEventsElement.get() ? subframeForTargetNode(m_capturingMouseEventsElement.get()) : subframeForHitTestResult(mouseEvent);
    20692069    if (m_eventHandlerWillResetCapturingMouseEventsElement)
    20702070        m_capturingMouseEventsElement = nullptr;
    2071     if (subframe && passMouseReleaseEventToSubframe(mev, subframe))
     2071    if (subframe && passMouseReleaseEventToSubframe(mouseEvent, subframe))
    20722072        return true;
    20732073
    2074     bool swallowMouseUpEvent = !dispatchMouseEvent(eventNames().mouseupEvent, mev.targetNode(), true, m_clickCount, plaformMouseEvent, false);
     2074    bool swallowMouseUpEvent = !dispatchMouseEvent(eventNames().mouseupEvent, mouseEvent.targetNode(), true, m_clickCount, plaformMouseEvent, false);
    20752075
    20762076    bool contextMenuEvent = plaformMouseEvent.button() == RightButton;
    20772077
    2078     bool swallowClickEvent = m_clickCount > 0 && !contextMenuEvent && mouseIsReleasedOnPressedElement(mev.targetNode(), m_clickNode.get()) && !dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, plaformMouseEvent, true);
     2078    bool swallowClickEvent = m_clickCount > 0 && !contextMenuEvent && mouseIsReleasedOnPressedElement(mouseEvent.targetNode(), m_clickNode.get()) && !dispatchMouseEvent(eventNames().clickEvent, mouseEvent.targetNode(), true, m_clickCount, plaformMouseEvent, true);
    20792079
    20802080    if (m_resizeLayer) {
     
    20852085    bool swallowMouseReleaseEvent = false;
    20862086    if (!swallowMouseUpEvent)
    2087         swallowMouseReleaseEvent = handleMouseReleaseEvent(mev);
     2087        swallowMouseReleaseEvent = handleMouseReleaseEvent(mouseEvent);
    20882088
    20892089    invalidateClick();
     
    22452245
    22462246    HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::DisallowShadowContent);
    2247     MouseEventWithHitTestResults mev = prepareMouseEvent(request, event);
     2247    MouseEventWithHitTestResults mouseEvent = prepareMouseEvent(request, event);
    22482248
    22492249    RefPtr<Element> newTarget;
    2250     if (Node* targetNode = mev.targetNode()) {
     2250    if (Node* targetNode = mouseEvent.targetNode()) {
    22512251        // Drag events should never go to non-element nodes (following IE, and proper mouseover/out dispatch)
    22522252        if (!targetNode->isElementNode())
     
    23562356}
    23572357
    2358 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestRequest& request, const PlatformMouseEvent& mev)
     2358MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestRequest& request, const PlatformMouseEvent& mouseEvent)
    23592359{
    23602360    ASSERT(m_frame.document());
    2361     return m_frame.document()->prepareMouseEvent(request, documentPointForWindowPoint(m_frame, mev.position()), mev);
     2361    return m_frame.document()->prepareMouseEvent(request, documentPointForWindowPoint(m_frame, mouseEvent.position()), mouseEvent);
    23622362}
    23632363
     
    27922792    LayoutPoint viewportPos = v->windowToContents(event.position());
    27932793    HitTestRequest request(HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
    2794     MouseEventWithHitTestResults mev = doc->prepareMouseEvent(request, viewportPos, event);
     2794    MouseEventWithHitTestResults mouseEvent = doc->prepareMouseEvent(request, viewportPos, event);
    27952795
    27962796    if (m_frame.editor().behavior().shouldSelectOnContextualMenuClick()
    27972797        && !m_frame.selection().contains(viewportPos)
    2798         && !mev.scrollbar()
     2798        && !mouseEvent.scrollbar()
    27992799        // FIXME: In the editable case, word selection sometimes selects content that isn't underneath the mouse.
    28002800        // If the selection is non-editable, we do word selection to make it easier to use the contextual menu items
    28012801        // available for text selections.  But only if we're above text.
    2802         && (m_frame.selection().selection().isContentEditable() || (mev.targetNode() && mev.targetNode()->isTextNode()))) {
     2802        && (m_frame.selection().selection().isContentEditable() || (mouseEvent.targetNode() && mouseEvent.targetNode()->isTextNode()))) {
    28032803        m_mouseDownMayStartSelect = true; // context menu events are always allowed to perform a selection
    2804         selectClosestWordOrLinkFromMouseEvent(mev);
    2805     }
    2806 
    2807     swallowEvent = !dispatchMouseEvent(eventNames().contextmenuEvent, mev.targetNode(), true, 0, event, false);
     2804        selectClosestWordOrLinkFromMouseEvent(mouseEvent);
     2805    }
     2806
     2807    swallowEvent = !dispatchMouseEvent(eventNames().contextmenuEvent, mouseEvent.targetNode(), true, 0, event, false);
    28082808   
    28092809    return swallowEvent;
     
    37173717}
    37183718
    3719 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mev, Scrollbar* scrollbar)
     3719bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mouseEvent, Scrollbar* scrollbar)
    37203720{
    37213721    if (!scrollbar || !scrollbar->enabled())
    37223722        return false;
    37233723    setFrameWasScrolledByUser();
    3724     return scrollbar->mouseDown(mev.event());
     3724    return scrollbar->mouseDown(mouseEvent.event());
    37253725}
    37263726
     
    39953995
    39963996    HitTestRequest request(HitTestRequest::Active | HitTestRequest::DisallowShadowContent);
    3997     MouseEventWithHitTestResults mev = prepareMouseEvent(request, plaformMouseEvent);
    3998     if (mev.scrollbar() || subframeForHitTestResult(mev))
     3997    MouseEventWithHitTestResults mouseEvent = prepareMouseEvent(request, plaformMouseEvent);
     3998    if (mouseEvent.scrollbar() || subframeForHitTestResult(mouseEvent))
    39993999        return false;
    40004000
Note: See TracChangeset for help on using the changeset viewer.