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

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

Issue 1358173008: Add UMA stats for pinch-zoom behavior on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 61415694f4d5d39f367c63a79100f175cb3f770c..bab81ff7fa15459ea539cc74428bb9501a48fc1e 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -799,16 +799,18 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event)
// Don't trigger a disambiguation popup when screencasting, since it's implemented outside of
// compositor pipeline and is not being screencasted itself. This leads to bad user experience.
WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl();
+ VisualViewport& visualViewport = page()->frameHost().visualViewport();
bool screencastEnabled = devTools && devTools->screencastEnabled();
- if (event.data.tap.width > 0 && !shouldDisableDesktopWorkarounds() && !screencastEnabled) {
- IntRect boundingBox(page()->frameHost().visualViewport().viewportToRootFrame(IntRect(
+ if (event.data.tap.width > 0 && !visualViewport.shouldDisableDesktopWorkarounds() && !screencastEnabled) {
+ IntRect boundingBox(visualViewport.viewportToRootFrame(IntRect(
event.x - event.data.tap.width / 2,
event.y - event.data.tap.height / 2,
event.data.tap.width,
event.data.tap.height)));
- // FIXME: We shouldn't pass details of the VisualViewport offset to render_view_impl.
- WebSize visualViewportOffset = flooredIntSize(page()->frameHost().visualViewport().location());
+ // TODO(bokan): We shouldn't pass details of the VisualViewport offset to render_view_impl.
+ // crbug.com/459591
+ WebSize visualViewportOffset = flooredIntSize(visualViewport.location());
if (m_webSettings->multiTargetTapNotificationEnabled()) {
Vector<IntRect> goodTargets;
@@ -2072,6 +2074,8 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent)
autofillClient->firstUserGestureObserved();
}
+ page()->frameHost().visualViewport().startTrackingPinchStats();
+
TRACE_EVENT1("input", "WebViewImpl::handleInputEvent", "type", inputTypeToName(inputEvent.type).ascii());
// If we've started a drag and drop operation, ignore input events until
// we're done.
@@ -2867,7 +2871,7 @@ bool WebViewImpl::scrollFocusedNodeIntoRect(const WebRect& rectInViewport)
element->document().updateLayoutIgnorePendingStylesheets();
bool zoomInToLegibleScale = m_webSettings->autoZoomFocusedNodeToLegibleScale()
- && !shouldDisableDesktopWorkarounds();
+ && !page()->frameHost().visualViewport().shouldDisableDesktopWorkarounds();
if (zoomInToLegibleScale) {
// When deciding whether to zoom in on a focused text box, we should decide not to
@@ -4264,8 +4268,10 @@ void WebViewImpl::applyViewportDeltas(
visualViewportOffset.move(visualViewportDelta.width, visualViewportDelta.height);
setPageScaleFactorAndLocation(pageScaleFactor() * pageScaleDelta, visualViewportOffset);
- if (pageScaleDelta != 1)
+ if (pageScaleDelta != 1) {
m_doubleTapZoomPending = false;
+ page()->frameHost().visualViewport().userDidChangeScale();
+ }
m_elasticOverscroll += elasticOverscrollDelta;
frameView->didUpdateElasticOverscroll();
@@ -4432,25 +4438,6 @@ void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event)
eventType);
}
-bool WebViewImpl::shouldDisableDesktopWorkarounds()
-{
- if (!settings()->viewportEnabled())
- return false;
-
- // A document is considered adapted to small screen UAs if one of these holds:
- // 1. The author specified viewport has a constrained width that is equal to
- // the initial viewport width.
- // 2. The author has disabled viewport zoom.
-
- const PageScaleConstraints& constraints = pageScaleConstraintsSet().pageDefinedConstraints();
-
- if (!mainFrameImpl() || !mainFrameImpl()->frameView())
- return false;
-
- return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
- || (constraints.minimumScale == constraints.maximumScale && constraints.minimumScale != -1);
-}
-
void WebViewImpl::forceNextWebGLContextCreationToFail()
{
WebGLRenderingContext::forceNextWebGLContextCreationToFail();
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698