Modified: tags/Safari-602.1.27.0.1/Source/WebCore/ChangeLog (199318 => 199319)
--- tags/Safari-602.1.27.0.1/Source/WebCore/ChangeLog 2016-04-11 23:16:01 UTC (rev 199318)
+++ tags/Safari-602.1.27.0.1/Source/WebCore/ChangeLog 2016-04-11 23:16:31 UTC (rev 199319)
@@ -1,3 +1,22 @@
+2016-04-11 Babak Shafiei <[email protected]>
+
+ Merge r199317.
+
+ 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-06 Babak Shafiei <[email protected]>
Merge r199130.
Modified: tags/Safari-602.1.27.0.1/Source/WebCore/page/EventHandler.cpp (199318 => 199319)
--- tags/Safari-602.1.27.0.1/Source/WebCore/page/EventHandler.cpp 2016-04-11 23:16:01 UTC (rev 199318)
+++ tags/Safari-602.1.27.0.1/Source/WebCore/page/EventHandler.cpp 2016-04-11 23:16:31 UTC (rev 199319)
@@ -737,22 +737,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)
@@ -778,7 +762,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;
@@ -826,14 +816,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)
{
@@ -878,7 +860,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
@@ -888,6 +870,9 @@
if (!renderView)
return false;
+ if (event.button() != LeftButton || event.clickCount() != 1)
+ return false;
+
FrameView* view = m_frame.view();
if (!view)
return false;
@@ -896,15 +881,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);
}
@@ -1597,6 +1577,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) {