Title: [199317] trunk/Source/WebCore
Revision
199317
Author
[email protected]
Date
2016-04-11 16:13:22 -0700 (Mon, 11 Apr 2016)

Log Message

Unreviewed, rolling out r198909.
https://bugs.webkit.org/show_bug.cgi?id=156479

made double-click-and-drag on text drag instead of
highlighting (Requested by alexchristensen_ on #webkit).

Reverted changeset:

"eventMayStartDrag() does not check for shiftKey or
isOverLink"
https://bugs.webkit.org/show_bug.cgi?id=155746
http://trac.webkit.org/changeset/198909

Patch by Commit Queue <[email protected]> on 2016-04-11

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (199316 => 199317)


--- trunk/Source/WebCore/ChangeLog	2016-04-11 23:00:02 UTC (rev 199316)
+++ trunk/Source/WebCore/ChangeLog	2016-04-11 23:13:22 UTC (rev 199317)
@@ -1,3 +1,18 @@
+2016-04-11  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r198909.
+        https://bugs.webkit.org/show_bug.cgi?id=156479
+
+        made double-click-and-drag on text drag instead of
+        highlighting (Requested by alexchristensen_ on #webkit).
+
+        Reverted changeset:
+
+        "eventMayStartDrag() does not check for shiftKey or
+        isOverLink"
+        https://bugs.webkit.org/show_bug.cgi?id=155746
+        http://trac.webkit.org/changeset/198909
+
 2016-04-11  Chris Dumez  <[email protected]>
 
         [WebIDL] Add support for [ImplementedAs] for EventHandler attributes

Modified: trunk/Source/WebCore/page/EventHandler.cpp (199316 => 199317)


--- trunk/Source/WebCore/page/EventHandler.cpp	2016-04-11 23:00:02 UTC (rev 199316)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2016-04-11 23:13:22 UTC (rev 199317)
@@ -735,22 +735,6 @@
     return node->canStartSelection() || Position::nodeIsUserSelectAll(node);
 }
 
-#if ENABLE(DRAG_SUPPORT)
-static bool isSingleMouseDownOnLinkOrImage(const MouseEventWithHitTestResults& event)
-{
-    auto& platformEvent = event.event();
-    if (platformEvent.type() != PlatformEvent::MousePressed || platformEvent.button() != LeftButton || platformEvent.clickCount() != 1)
-        return false;
-
-    return event.isOverLink() || event.hitTestResult().image();
-}
-
-static bool eventMayStartDragInternal(const MouseEventWithHitTestResults& event)
-{
-    return !event.event().shiftKey() || isSingleMouseDownOnLinkOrImage(event);
-}
-#endif
-
 bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& event)
 {
 #if ENABLE(DRAG_SUPPORT)
@@ -776,7 +760,13 @@
     m_mouseDownMayStartSelect = canMouseDownStartSelect(event.targetNode()) && !event.scrollbar();
     
 #if ENABLE(DRAG_SUPPORT)
-    m_mouseDownMayStartDrag = eventMayStartDragInternal(event);
+    // Careful that the drag starting logic stays in sync with eventMayStartDrag()
+    // FIXME: eventMayStartDrag() does not check for shift key press, link or image event targets.
+    // Bug: https://bugs.webkit.org/show_bug.cgi?id=155390
+
+    // Single mouse down on links or images can always trigger drag-n-drop.
+    bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult().image();
+    m_mouseDownMayStartDrag = singleClick && (!event.event().shiftKey() || isMouseDownOnLinkOrImage);
 #endif
 
     m_mouseDownWasSingleClickInSelection = false;
@@ -824,14 +814,6 @@
     return swallowEvent;
 }
 
-static LayoutPoint documentPointForWindowPoint(Frame& frame, const IntPoint& windowPoint)
-{
-    FrameView* view = frame.view();
-    // FIXME: Is it really OK to use the wrong coordinates here when view is 0?
-    // Historically the code would just crash; this is clearly no worse than that.
-    return view ? view->windowToContents(windowPoint) : windowPoint;
-}
-
 #if ENABLE(DRAG_SUPPORT)
 bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& event)
 {
@@ -876,7 +858,7 @@
     updateSelectionForMouseDrag(event.hitTestResult());
     return true;
 }
-
+    
 bool EventHandler::eventMayStartDrag(const PlatformMouseEvent& event) const
 {
     // This is a pre-flight check of whether the event might lead to a drag being started.  Be careful
@@ -886,6 +868,9 @@
     if (!renderView)
         return false;
 
+    if (event.button() != LeftButton || event.clickCount() != 1)
+        return false;
+
     FrameView* view = m_frame.view();
     if (!view)
         return false;
@@ -894,15 +879,10 @@
     if (!page)
         return false;
 
-    HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::DisallowShadowContent);
-    LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, event.position());
-    MouseEventWithHitTestResults mouseEvent = m_frame.document()->prepareMouseEvent(request, documentPoint, event);
-    if (!eventMayStartDragInternal(mouseEvent))
-        return false;
-
     updateDragSourceActionsAllowed();
-
-    HitTestResult result = mouseEvent.hitTestResult();
+    HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::DisallowShadowContent);
+    HitTestResult result(view->windowToContents(event.position()));
+    renderView->hitTest(request, result);
     DragState state;
     return result.innerElement() && page->dragController().draggableElement(&m_frame, result.innerElement(), result.roundedPointInInnerNodeFrame(), state);
 }
@@ -1595,6 +1575,14 @@
 }
 #endif
 
+static LayoutPoint documentPointForWindowPoint(Frame& frame, const IntPoint& windowPoint)
+{
+    FrameView* view = frame.view();
+    // FIXME: Is it really OK to use the wrong coordinates here when view is 0?
+    // Historically the code would just crash; this is clearly no worse than that.
+    return view ? view->windowToContents(windowPoint) : windowPoint;
+}
+
 static Scrollbar* scrollbarForMouseEvent(const MouseEventWithHitTestResults& mouseEvent, FrameView* view)
 {
     if (view) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to