2011-04-10 Alice Boxhall <aboxhall@chromium.org>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Apr 2011 02:21:40 +0000 (02:21 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Apr 2011 02:21:40 +0000 (02:21 +0000)
        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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83414 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h

index 3ba10e4..d91035b 100644 (file)
@@ -1,3 +1,21 @@
+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:
+
 2011-04-10  Kent Tamura  <tkent@chromium.org>
 
         Unreviewed, rolling out r83353.
index 21dcff0..c393e1f 100644 (file)
@@ -566,9 +566,10 @@ bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e
         HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active);
         HitTestResult result(m_mouseDownPos);
         m_frame->document()->renderView()->layer()->hitTest(request, result);
-        updateSelectionForMouseDrag(result.innerNode(), result.localPoint());
+
+        updateSelectionForMouseDrag(result);
     }
-    updateSelectionForMouseDrag(targetNode, event.localPoint());
+    updateSelectionForMouseDrag(event.hitTestResult());
     return true;
 }
     
@@ -618,25 +619,26 @@ void EventHandler::updateSelectionForMouseDrag()
                            HitTestRequest::MouseMove);
     HitTestResult result(view->windowToContents(m_currentMousePosition));
     layer->hitTest(request, result);
-    updateSelectionForMouseDrag(result.innerNode(), result.localPoint());
+    updateSelectionForMouseDrag(result);
 }
 
-void EventHandler::updateSelectionForMouseDrag(Node* targetNode, const IntPoint& localPoint)
+void EventHandler::updateSelectionForMouseDrag(const HitTestResult& hitTestResult)
 {
     if (!m_mouseDownMayStartSelect)
         return;
 
-    if (!targetNode)
+    Node* target = targetNode(hitTestResult);
+    if (!target)
         return;
 
-    if (!canMouseDragExtendSelect(targetNode))
+    if (!canMouseDragExtendSelect(target))
         return;
 
-    RenderObject* targetRenderer = targetNode->renderer();
+    RenderObject* targetRenderer = target->renderer();
     if (!targetRenderer)
         return;
 
-    VisiblePosition targetPosition(targetRenderer->positionForPoint(localPoint));
+    VisiblePosition targetPosition = targetRenderer->positionForPoint(hitTestResult.localPoint());
 
     // Don't modify the selection if we're not on a node.
     if (targetPosition.isNull())
@@ -652,7 +654,7 @@ void EventHandler::updateSelectionForMouseDrag(Node* targetNode, const IntPoint&
     if (Node* selectionBaseNode = newSelection.base().deprecatedNode())
         if (RenderObject* selectionBaseRenderer = selectionBaseNode->renderer())
             if (selectionBaseRenderer->isSVGText())
-                if (targetNode->renderer()->containingBlock() != selectionBaseRenderer->containingBlock())
+                if (target->renderer()->containingBlock() != selectionBaseRenderer->containingBlock())
                     return;
 #endif
 
index 867c894..490ff85 100644 (file)
@@ -360,7 +360,7 @@ private:
 #endif
 
 #if ENABLE(DRAG_SUPPORT)
-    void updateSelectionForMouseDrag(Node* targetNode, const IntPoint& localPoint);
+    void updateSelectionForMouseDrag(const HitTestResult&);
 #endif
 
     void updateLastScrollbarUnderMouse(Scrollbar*, bool);