Changeset 83414 in webkit


Ignore:
Timestamp:
Apr 10, 2011 7:21:40 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-04-10 Alice Boxhall <aboxhall@chromium.org>

Reviewed by Ryosuke Niwa.

Change EventHandler::updateSelectionForMouseDrag to take a HitTestResult only.
https://bugs.webkit.org/show_bug.cgi?id=57923

Change EventHandler::updateSelectionForMouseDrag to take a HitTestResult
rather than a Node* and an IntPoint&, as the selection may actually not
extend into the Node found by the HitTest.

No new tests. Refactoring only.

  • page/EventHandler.cpp: (WebCore::EventHandler::handleMouseDraggedEvent): (WebCore::EventHandler::updateSelectionForMouseDrag):
  • page/EventHandler.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83412 r83414  
     12011-04-10  Alice Boxhall  <aboxhall@chromium.org>
     2
     3        Reviewed by Ryosuke Niwa.
     4
     5        Change EventHandler::updateSelectionForMouseDrag to take a HitTestResult only.
     6        https://bugs.webkit.org/show_bug.cgi?id=57923
     7
     8        Change EventHandler::updateSelectionForMouseDrag to take a HitTestResult
     9        rather than a Node* and an IntPoint&, as the selection may actually not
     10        extend into the Node found by the HitTest.
     11
     12        No new tests. Refactoring only.
     13
     14        * page/EventHandler.cpp:
     15        (WebCore::EventHandler::handleMouseDraggedEvent):
     16        (WebCore::EventHandler::updateSelectionForMouseDrag):
     17        * page/EventHandler.h:
     18
    1192011-04-10  Kent Tamura  <tkent@chromium.org>
    220
  • trunk/Source/WebCore/page/EventHandler.cpp

    r83312 r83414  
    567567        HitTestResult result(m_mouseDownPos);
    568568        m_frame->document()->renderView()->layer()->hitTest(request, result);
    569         updateSelectionForMouseDrag(result.innerNode(), result.localPoint());
    570     }
    571     updateSelectionForMouseDrag(targetNode, event.localPoint());
     569
     570        updateSelectionForMouseDrag(result);
     571    }
     572    updateSelectionForMouseDrag(event.hitTestResult());
    572573    return true;
    573574}
     
    619620    HitTestResult result(view->windowToContents(m_currentMousePosition));
    620621    layer->hitTest(request, result);
    621     updateSelectionForMouseDrag(result.innerNode(), result.localPoint());
    622 }
    623 
    624 void EventHandler::updateSelectionForMouseDrag(Node* targetNode, const IntPoint& localPoint)
     622    updateSelectionForMouseDrag(result);
     623}
     624
     625void EventHandler::updateSelectionForMouseDrag(const HitTestResult& hitTestResult)
    625626{
    626627    if (!m_mouseDownMayStartSelect)
    627628        return;
    628629
    629     if (!targetNode)
     630    Node* target = targetNode(hitTestResult);
     631    if (!target)
    630632        return;
    631633
    632     if (!canMouseDragExtendSelect(targetNode))
     634    if (!canMouseDragExtendSelect(target))
    633635        return;
    634636
    635     RenderObject* targetRenderer = targetNode->renderer();
     637    RenderObject* targetRenderer = target->renderer();
    636638    if (!targetRenderer)
    637639        return;
    638640
    639     VisiblePosition targetPosition(targetRenderer->positionForPoint(localPoint));
     641    VisiblePosition targetPosition = targetRenderer->positionForPoint(hitTestResult.localPoint());
    640642
    641643    // Don't modify the selection if we're not on a node.
     
    653655        if (RenderObject* selectionBaseRenderer = selectionBaseNode->renderer())
    654656            if (selectionBaseRenderer->isSVGText())
    655                 if (targetNode->renderer()->containingBlock() != selectionBaseRenderer->containingBlock())
     657                if (target->renderer()->containingBlock() != selectionBaseRenderer->containingBlock())
    656658                    return;
    657659#endif
  • trunk/Source/WebCore/page/EventHandler.h

    r83153 r83414  
    361361
    362362#if ENABLE(DRAG_SUPPORT)
    363     void updateSelectionForMouseDrag(Node* targetNode, const IntPoint& localPoint);
     363    void updateSelectionForMouseDrag(const HitTestResult&);
    364364#endif
    365365
Note: See TracChangeset for help on using the changeset viewer.