Changeset 101619 in webkit


Ignore:
Timestamp:
Nov 30, 2011 11:20:59 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@google.com> on 2011-11-30
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.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    • Property svn:executable deleted
    r101617 r101619  
     12011-11-30  Jeremy Apthorp  <jeremya@google.com>
     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
    1112011-11-30  Hayato Ito  <hayato@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    • Property svn:executable deleted
    r101612 r101619  
     12011-11-30  Jeremy Apthorp  <jeremya@google.com>
     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-11-30  Hans Muller  <hmuller@adobe.com>
    218
  • trunk/Source/WebCore/page/EventHandler.cpp

    r101416 r101619  
    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

    r101333 r101619  
    39523952        // We are clearing the :active chain because the mouse has been released.
    39533953        for (RenderObject* curr = activeNode->renderer(); curr; curr = curr->parent()) {
    3954             if (curr->node() && !curr->isText())
     3954            if (curr->node() && !curr->isText()) {
     3955                curr->node()->setActive(false);
    39553956                curr->node()->clearInActiveChain();
     3957            }
    39563958        }
    39573959        doc->setActiveNode(0);
     
    39693971        }
    39703972    }
     3973    // If the mouse has just been pressed, set :active on the chain. Those (and only those)
     3974    // nodes should remain :active until the mouse is released.
     3975    bool allowActiveChanges = !activeNode && doc->activeNode();
    39713976
    39723977    // If the mouse is down and if this is a mouse move event, we want to restrict changes in
     
    40114016    size_t removeCount = nodesToRemoveFromChain.size();
    40124017    for (size_t i = 0; i < removeCount; ++i) {
    4013         nodesToRemoveFromChain[i]->setActive(false);
    40144018        nodesToRemoveFromChain[i]->setHovered(false);
    40154019    }
     
    40174021    size_t addCount = nodesToAddToChain.size();
    40184022    for (size_t i = 0; i < addCount; ++i) {
    4019         nodesToAddToChain[i]->setActive(request.active());
     4023        if (allowActiveChanges)
     4024            nodesToAddToChain[i]->setActive(true);
    40204025        nodesToAddToChain[i]->setHovered(true);
    40214026    }
Note: See TracChangeset for help on using the changeset viewer.