Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Unified Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 1528153004: Look Up on Force Touch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/WebViewImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index 15774cf8a0acde13a189a2c3778095c341313f73..42346de941a7ccfd067d7dc8d5f5c716e8e59834 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -43,6 +43,7 @@
#include "core/editing/Editor.h"
#include "core/editing/FrameSelection.h"
#include "core/editing/InputMethodController.h"
+#include "core/editing/SelectionController.h"
#include "core/editing/iterators/TextIterator.h"
#include "core/editing/markers/DocumentMarkerController.h"
#include "core/editing/serializers/HTMLInterchange.h"
@@ -111,6 +112,7 @@
#include "platform/UserGestureIndicator.h"
#include "platform/exported/WebActiveGestureAnimation.h"
#include "platform/fonts/FontCache.h"
+#include "platform/geometry/LayoutPoint.h"
#include "platform/graphics/Color.h"
#include "platform/graphics/FirstPaintInvalidationTracking.h"
#include "platform/graphics/GraphicsContext.h"
@@ -2256,6 +2258,28 @@ WebInputEventResult WebViewImpl::handleInputEvent(const WebInputEvent& inputEven
return WebInputEventResult::NotHandled;
}
+bool WebViewImpl::selectWordIfAnyAtCoordinates(float x, float y)
+{
+ IntPoint position(x, y);
+
+ // Find the right target frame. See issue 1186900.
Rick Byers 2015/12/21 16:31:09 This comment seems to used elsewhere in android-sp
spqchan 2016/01/06 22:52:31 I removed it but I'm a bit confused by what you me
+ HitTestResult result = hitTestResultForRootFramePos(position);
+ Frame* targetFrame;
+ if (result.innerNodeOrImageMapImage())
+ targetFrame = result.innerNodeOrImageMapImage()->document().frame();
+ else
+ targetFrame = m_page->focusController().focusedOrMainFrame();
+
+ if (!targetFrame->isLocalFrame())
+ return false;
+
+ LocalFrame* localFrame = toLocalFrame(targetFrame);
+
+ LayoutPoint positionInContents = mainFrameImpl()->frameView()->rootFrameToContents(position);
+
+ return localFrame->eventHandler().selectionController().selectWordAtPositionIfAny(flooredIntPoint(positionInContents));
+}
+
void WebViewImpl::setCursorVisibilityState(bool isVisible)
{
if (m_page)

Powered by Google App Engine
This is Rietveld 408576698