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

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

Issue 2237433004: Adds DevTools commands for forced viewport override. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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: 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 271807746f22e34e871e1ab137be4e0e14724c52..63f8ce28a5e93d55ed8b3b7fbbe5f9077c856229 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -111,6 +111,7 @@
#include "platform/UserGestureIndicator.h"
#include "platform/exported/WebActiveGestureAnimation.h"
#include "platform/fonts/FontCache.h"
+#include "platform/geometry/FloatRect.h"
#include "platform/graphics/Color.h"
#include "platform/graphics/CompositorMutatorClient.h"
#include "platform/graphics/FirstPaintInvalidationTracking.h"
@@ -420,7 +421,6 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebPageVisibilityState visibilit
, m_doingDragAndDrop(false)
, m_ignoreInputEvents(false)
, m_compositorDeviceScaleFactorOverride(0)
- , m_rootLayerScale(1)
, m_suppressNextKeypressEvent(false)
, m_imeAcceptEvents(true)
, m_operationsAllowed(WebDragOperationNone)
@@ -3865,14 +3865,11 @@ void WebViewImpl::setCompositorDeviceScaleFactorOverride(float deviceScaleFactor
updateLayerTreeDeviceScaleFactor();
}
-void WebViewImpl::setRootLayerTransform(const WebSize& rootLayerOffset, float rootLayerScale)
+void WebViewImpl::setRootLayerTransform(const TransformationMatrix& transform)
{
- if (m_rootLayerScale == rootLayerScale && m_rootLayerOffset == rootLayerOffset)
+ if (transform == m_rootLayerTransform)
return;
- m_rootLayerScale = rootLayerScale;
- m_rootLayerOffset = rootLayerOffset;
- if (mainFrameImpl())
- mainFrameImpl()->setInputEventsTransformForEmulation(m_rootLayerOffset, m_rootLayerScale);
+ m_rootLayerTransform = transform;
updateRootLayerTransform();
}
@@ -4110,6 +4107,12 @@ void WebViewImpl::pageScaleFactorChanged()
pageScaleConstraintsSet().setNeedsReset(false);
updateLayerTreeViewport();
m_client->pageScaleFactorChanged();
+ m_devToolsEmulator->mainFrameScrollOrScaleChanged();
+}
+
+void WebViewImpl::mainFrameScrollOffsetChanged()
+{
+ m_devToolsEmulator->mainFrameScrollOrScaleChanged();
}
bool WebViewImpl::useExternalPopupMenus()
@@ -4438,12 +4441,8 @@ void WebViewImpl::updateLayerTreeDeviceScaleFactor()
void WebViewImpl::updateRootLayerTransform()
{
- if (m_visualViewportContainerLayer) {
- TransformationMatrix transform;
- transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height);
- transform = transform.scale(m_rootLayerScale);
- m_visualViewportContainerLayer->setTransform(transform);
- }
+ if (m_visualViewportContainerLayer)
+ m_visualViewportContainerLayer->setTransform(m_rootLayerTransform);
}
bool WebViewImpl::detectContentOnTouch(const GestureEventWithHitTestResults& targetedEvent)

Powered by Google App Engine
This is Rietveld 408576698