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

Unified Diff: Source/web/WebViewImpl.cpp

Issue 584893004: Use the pinch viewport offset for tap disambiguation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added a unit test. Created 6 years, 3 months 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: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index 32ea4c39b4ab1fa813e1725558d86faaaeec4bb4..fb1319408e8750fa7a8b241af09a204a79d513ed 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -713,20 +713,31 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event)
// Don't trigger a disambiguation popup on sites designed for mobile devices.
// Instead, assume that the page has been designed with big enough buttons and links.
if (event.data.tap.width > 0 && !shouldDisableDesktopWorkarounds()) {
- // FIXME: didTapMultipleTargets should just take a rect instead of
- // an event.
WebGestureEvent scaledEvent = event;
scaledEvent.x = event.x / pageScaleFactor();
scaledEvent.y = event.y / pageScaleFactor();
scaledEvent.data.tap.width = event.data.tap.width / pageScaleFactor();
scaledEvent.data.tap.height = event.data.tap.height / pageScaleFactor();
- IntRect boundingBox(scaledEvent.x - scaledEvent.data.tap.width / 2, scaledEvent.y - scaledEvent.data.tap.height / 2, scaledEvent.data.tap.width, scaledEvent.data.tap.height);
+ IntRect boundingBox(
+ scaledEvent.x - scaledEvent.data.tap.width / 2,
+ scaledEvent.y - scaledEvent.data.tap.height / 2,
+ scaledEvent.data.tap.width,
+ scaledEvent.data.tap.height);
+
+ WebSize pinchViewportOffset = pinchVirtualViewportEnabled() ?
+ flooredIntSize(page()->frameHost().pinchViewport().location()) : IntSize();
+
+ // Keep bounding box relative to the main frame.
+ boundingBox.move(pinchViewportOffset);
+
Vector<IntRect> goodTargets;
WillBeHeapVector<RawPtrWillBeMember<Node> > highlightNodes;
findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), goodTargets, highlightNodes);
// FIXME: replace touch adjustment code when numberOfGoodTargets == 1?
// Single candidate case is currently handled by: https://bugs.webkit.org/show_bug.cgi?id=85101
- if (goodTargets.size() >= 2 && m_client && m_client->didTapMultipleTargets(scaledEvent, goodTargets)) {
+ if (goodTargets.size() >= 2 && m_client
+ && m_client->didTapMultipleTargets(pinchViewportOffset, boundingBox, goodTargets)) {
+
enableTapHighlights(highlightNodes);
for (size_t i = 0; i < m_linkHighlights.size(); ++i)
m_linkHighlights[i]->startHighlightAnimationIfNeeded();

Powered by Google App Engine
This is Rietveld 408576698