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

Unified Diff: Source/web/WebViewImpl.cpp

Issue 23187005: [DevTools] Use device metrics emulation implemented in content. (Closed) Base URL: svn://svn.chromium.org/blink/trunk/
Patch Set: Another rebase Created 7 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 | « Source/web/WebViewImpl.h ('k') | public/web/WebViewClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index c0ec80d75148b9d2714f4e268510af5b4358fd19..de04fb106873d5b0effc1e140708bb5af77e6fe3 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -413,6 +413,8 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
, m_contextMenuAllowed(false)
, m_doingDragAndDrop(false)
, m_ignoreInputEvents(false)
+ , m_compositorDeviceScaleFactorOverride(0)
+ , m_rootLayerScale(1)
, m_suppressNextKeypressEvent(false)
, m_imeAcceptEvents(true)
, m_operationsAllowed(WebDragOperationNone)
@@ -1723,13 +1725,11 @@ void WebViewImpl::resize(const WebSize& newSize)
WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate();
if (agentPrivate)
agentPrivate->webViewResized(newSize);
- if (!agentPrivate || !agentPrivate->metricsOverridden()) {
- WebFrameImpl* webFrame = mainFrameImpl();
- if (webFrame->frameView()) {
- webFrame->frameView()->resize(m_size);
- if (m_pinchViewports)
- m_pinchViewports->setViewportSize(m_size);
- }
+ WebFrameImpl* webFrame = mainFrameImpl();
+ if (webFrame->frameView()) {
+ webFrame->frameView()->resize(m_size);
+ if (m_pinchViewports)
+ m_pinchViewports->setViewportSize(m_size);
}
if (settings()->viewportEnabled() && !m_fixedLayoutSizeLock) {
@@ -2923,7 +2923,7 @@ void WebViewImpl::setDeviceScaleFactor(float scaleFactor)
page()->setDeviceScaleFactor(scaleFactor);
if (m_layerTreeView)
- m_layerTreeView->setDeviceScaleFactor(scaleFactor);
+ updateLayerTreeDeviceScaleFactor();
}
bool WebViewImpl::isFixedLayoutModeEnabled() const
@@ -3482,10 +3482,17 @@ void WebViewImpl::setInspectorSetting(const WebString& key,
void WebViewImpl::setCompositorDeviceScaleFactorOverride(float deviceScaleFactor)
{
+ m_compositorDeviceScaleFactorOverride = deviceScaleFactor;
+ if (page() && m_layerTreeView)
+ updateLayerTreeDeviceScaleFactor();
}
void WebViewImpl::setRootLayerScaleTransform(float rootLayerScale)
{
+ m_rootLayerScale = rootLayerScale;
+ if (mainFrameImpl())
+ mainFrameImpl()->setInputEventsScaleFactorForEmulation(m_rootLayerScale);
+ updateRootLayerTransform();
}
WebDevToolsAgent* WebViewImpl::devToolsAgent()
@@ -3890,6 +3897,8 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
setIsAcceleratedCompositingActive(layer);
+ updateRootLayerTransform();
+
if (m_layerTreeView) {
if (m_rootLayer) {
m_layerTreeView->setRootLayer(*m_rootLayer);
@@ -4012,7 +4021,7 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
bool visible = page()->visibilityState() == PageVisibilityStateVisible;
m_layerTreeView->setVisible(visible);
- m_layerTreeView->setDeviceScaleFactor(page()->deviceScaleFactor());
+ updateLayerTreeDeviceScaleFactor();
m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageScaleFactor(), maximumPageScaleFactor());
m_layerTreeView->setBackgroundColor(backgroundColor());
m_layerTreeView->setHasTransparentBackground(isTransparent());
@@ -4097,6 +4106,24 @@ void WebViewImpl::updateLayerTreeViewport()
m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageScaleFactor(), maximumPageScaleFactor());
}
+void WebViewImpl::updateLayerTreeDeviceScaleFactor()
+{
+ ASSERT(page());
+ ASSERT(m_layerTreeView);
+
+ float deviceScaleFactor = m_compositorDeviceScaleFactorOverride ? m_compositorDeviceScaleFactorOverride : page()->deviceScaleFactor();
+ m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor);
+}
+
+void WebViewImpl::updateRootLayerTransform()
+{
+ if (m_rootGraphicsLayer) {
+ WebCore::TransformationMatrix transform;
+ transform = transform.scale(m_rootLayerScale);
+ m_rootGraphicsLayer->setChildrenTransform(transform);
+ }
+}
+
void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex)
{
if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestionsCount())
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | public/web/WebViewClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698