Changeset 102632 in webkit


Ignore:
Timestamp:
Dec 12, 2011 3:51:03 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

When the mouse is dragged out of an :active element, it should lose :hover.
https://bugs.webkit.org/show_bug.cgi?id=57206

Patch by Jeremy Apthorp <jeremya@chromium.org> on 2011-12-12
Reviewed by Ryosuke Niwa.

Source/WebCore:

Test: fast/css/hover-active-drag.html

  • page/EventHandler.cpp:

(WebCore::EventHandler::handleMouseMoveEvent): Don't mark mouse-drag hit tests read-only, since they no longer are.
(WebCore::EventHandler::dragSourceEndedAt): Send a hit test request when the mouse goes up after a drag, so
RenderLayer has a chance to update the hover/active status.

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::updateHoverActiveState): Only allow the :active state to change on mouse down or mouse up.

LayoutTests:

  • fast/css/hover-active-drag-expected.txt: Added.
  • fast/css/hover-active-drag.html: Added.
  • platform/mac/fast/css/hover-active-drag-expected.txt: Removed.
  • platform/chromium/fast/css/hover-active-drag-expected.txt: Removed.
Location:
trunk
Files:
1 added
1 deleted
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r102630 r102632  
     12011-12-12  Jeremy Apthorp  <jeremya@chromium.org>
     2
     3        When the mouse is dragged out of an :active element, it should lose :hover.
     4        https://bugs.webkit.org/show_bug.cgi?id=57206
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * fast/css/hover-active-drag-expected.txt: Added.
     9        * fast/css/hover-active-drag.html: Added.
     10        * platform/mac/fast/css/hover-active-drag-expected.txt: Removed.
     11        * platform/chromium/fast/css/hover-active-drag-expected.txt: Removed.
     12
    1132011-12-12  Kenneth Russell  <kbr@google.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r102628 r102632  
     12011-12-12  Jeremy Apthorp  <jeremya@chromium.org>
     2
     3        When the mouse is dragged out of an :active element, it should lose :hover.
     4        https://bugs.webkit.org/show_bug.cgi?id=57206
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Test: fast/css/hover-active-drag.html
     9
     10        * page/EventHandler.cpp:
     11        (WebCore::EventHandler::handleMouseMoveEvent): Don't mark mouse-drag hit tests read-only, since they no longer are.
     12        (WebCore::EventHandler::dragSourceEndedAt): Send a hit test request when the mouse goes up after a drag, so
     13        RenderLayer has a chance to update the hover/active status.
     14        * rendering/RenderLayer.cpp:
     15        (WebCore::RenderLayer::updateHoverActiveState): Only allow the :active state to change on mouse down or mouse up.
     16
    1172011-12-12  Kenneth Russell  <kbr@google.com>
    218
  • trunk/Source/WebCore/page/EventHandler.cpp

    r102425 r102632  
    16131613        return m_lastScrollbarUnderMouse->mouseMoved(mouseEvent);
    16141614
    1615     // Mouse events should be treated as "read-only" in prepareMouseEvent if the mouse is
    1616     // pressed and we are allowed to select OR if we're updating only scrollbars. This
    1617     // means that :hover and :active freeze in the state they were in, rather than updating
    1618     // for nodes the mouse moves over while you hold the mouse down (in the mouse pressed case)
    1619     // or while the window is not key (as in the onlyUpdateScrollbars case).
    16201615    HitTestRequest::HitTestRequestType hitType = HitTestRequest::MouseMove;
    1621     if ((m_mousePressed && m_mouseDownMayStartSelect) || onlyUpdateScrollbars)
    1622         hitType |= HitTestRequest::ReadOnly;
    16231616    if (m_mousePressed)
    16241617        hitType |= HitTestRequest::Active;
     
    27622755void EventHandler::dragSourceEndedAt(const PlatformMouseEvent& event, DragOperation operation)
    27632756{
     2757    // Send a hit test request so that RenderLayer gets a chance to update the :hover and :active pseudoclasses.
     2758    HitTestRequest request(HitTestRequest::MouseUp);
     2759    prepareMouseEvent(request, event);
     2760
    27642761    if (dragState().m_dragSrc && dragState().shouldDispatchEvents()) {
    27652762        dragState().m_dragClipboard->setDestinationOperation(operation);
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r102425 r102632  
    39793979        // We are clearing the :active chain because the mouse has been released.
    39803980        for (RenderObject* curr = activeNode->renderer(); curr; curr = curr->parent()) {
    3981             if (curr->node() && !curr->isText())
     3981            if (curr->node() && !curr->isText()) {
     3982                curr->node()->setActive(false);
    39823983                curr->node()->clearInActiveChain();
     3984            }
    39833985        }
    39843986        doc->setActiveNode(0);
     
    39963998        }
    39973999    }
     4000    // If the mouse has just been pressed, set :active on the chain. Those (and only those)
     4001    // nodes should remain :active until the mouse is released.
     4002    bool allowActiveChanges = !activeNode && doc->activeNode();
    39984003
    39994004    // If the mouse is down and if this is a mouse move event, we want to restrict changes in
     
    40384043    size_t removeCount = nodesToRemoveFromChain.size();
    40394044    for (size_t i = 0; i < removeCount; ++i) {
    4040         nodesToRemoveFromChain[i]->setActive(false);
    40414045        nodesToRemoveFromChain[i]->setHovered(false);
    40424046    }
     
    40444048    size_t addCount = nodesToAddToChain.size();
    40454049    for (size_t i = 0; i < addCount; ++i) {
    4046         nodesToAddToChain[i]->setActive(request.active());
     4050        if (allowActiveChanges)
     4051            nodesToAddToChain[i]->setActive(true);
    40474052        nodesToAddToChain[i]->setHovered(true);
    40484053    }
Note: See TracChangeset for help on using the changeset viewer.