Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / web / WebViewImpl.cpp
index 4b8b5cc..4c709a0 100644 (file)
@@ -483,6 +483,9 @@ void WebViewImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEvent& ev
 
     PageWidgetEventHandler::handleMouseDown(mainFrame, event);
 
+    if (event.button == WebMouseEvent::ButtonLeft && m_mouseCaptureNode)
+        m_mouseCaptureGestureToken = mainFrame.eventHandler().takeLastMouseDownGestureToken();
+
     if (m_selectPopup && m_selectPopup == selectPopup) {
         // That click triggered a select popup which is the same as the one that
         // was showing before the click.  It means the user clicked the select
@@ -865,7 +868,10 @@ void WebViewImpl::getSelectionRootBounds(WebRect& bounds) const
                 && toHTMLInputElement(*shadowHost).isText())))
         root = shadowHost;
 
-    IntRect boundingBox = root->pixelSnappedBoundingBox();
+    IntRect boundingBox = isHTMLHtmlElement(root)
+        ? IntRect(IntPoint(0, 0), root->document().frame()->view()->contentsSize())
+        : root->pixelSnappedBoundingBox();
+
     boundingBox = root->document().frame()->view()->contentsToWindow(boundingBox);
     boundingBox.scale(pageScaleFactor());
     bounds = boundingBox;
@@ -1812,6 +1818,8 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
         if (inputEvent.type == WebInputEvent::MouseUp)
             mouseCaptureLost();
 
+        OwnPtr<UserGestureIndicator> gestureIndicator;
+
         AtomicString eventType;
         switch (inputEvent.type) {
         case WebInputEvent::MouseMove:
@@ -1822,9 +1830,12 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
             break;
         case WebInputEvent::MouseDown:
             eventType = EventTypeNames::mousedown;
+            gestureIndicator = adoptPtr(new UserGestureIndicator(DefinitelyProcessingNewUserGesture));
+            m_mouseCaptureGestureToken = gestureIndicator->currentToken();
             break;
         case WebInputEvent::MouseUp:
             eventType = EventTypeNames::mouseup;
+            gestureIndicator = adoptPtr(new UserGestureIndicator(m_mouseCaptureGestureToken.release()));
             break;
         default:
             ASSERT_NOT_REACHED();