| Index: Source/web/WebViewImpl.cpp
|
| diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
|
| index 9b391cec8c9f0540418c969ed2b2ad10b806c74f..17b82f3e552ee9a03ebc1ac008631ad65193d7bd 100644
|
| --- a/Source/web/WebViewImpl.cpp
|
| +++ b/Source/web/WebViewImpl.cpp
|
| @@ -399,6 +399,8 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
|
| , m_contextMenuAllowed(false)
|
| , m_doingDragAndDrop(false)
|
| , m_ignoreInputEvents(false)
|
| + , m_emulatedDeviceScaleFactor(0)
|
| + , m_rootLayerScale(0)
|
| , m_suppressNextKeypressEvent(false)
|
| , m_imeAcceptEvents(true)
|
| , m_operationsAllowed(WebDragOperationNone)
|
| @@ -1712,13 +1714,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) {
|
| @@ -2912,7 +2912,7 @@ void WebViewImpl::setDeviceScaleFactor(float scaleFactor)
|
| page()->setDeviceScaleFactor(scaleFactor);
|
|
|
| if (m_layerTreeView)
|
| - m_layerTreeView->setDeviceScaleFactor(scaleFactor);
|
| + updateLayerTreeDeviceScaleFactor();
|
| }
|
|
|
| bool WebViewImpl::isFixedLayoutModeEnabled() const
|
| @@ -3762,6 +3762,17 @@ void WebViewImpl::setIgnoreInputEvents(bool newValue)
|
| m_ignoreInputEvents = newValue;
|
| }
|
|
|
| +void WebViewImpl::setDeviceEmulationParameters(bool enabled, float deviceScaleFactor, float rootLayerScale)
|
| +{
|
| + m_emulatedDeviceScaleFactor = enabled ? deviceScaleFactor : 0;
|
| + m_rootLayerScale = enabled ? rootLayerScale : 0;
|
| + if (mainFrameImpl())
|
| + mainFrameImpl()->setInputEventsScaleFactorForEmulation(enabled ? rootLayerScale : 1);
|
| + if (page() && m_layerTreeView)
|
| + updateLayerTreeDeviceScaleFactor();
|
| + updateRootLayerTransform();
|
| +}
|
| +
|
| void WebViewImpl::addPageOverlay(WebPageOverlay* overlay, int zOrder)
|
| {
|
| if (!m_pageOverlays)
|
| @@ -3872,6 +3883,8 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
|
|
|
| setIsAcceleratedCompositingActive(layer);
|
|
|
| + updateRootLayerTransform();
|
| +
|
| if (m_layerTreeView) {
|
| if (m_rootLayer) {
|
| m_layerTreeView->setRootLayer(*m_rootLayer);
|
| @@ -3994,7 +4007,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());
|
| @@ -4079,6 +4092,25 @@ void WebViewImpl::updateLayerTreeViewport()
|
| m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageScaleFactor(), maximumPageScaleFactor());
|
| }
|
|
|
| +void WebViewImpl::updateLayerTreeDeviceScaleFactor()
|
| +{
|
| + ASSERT(page());
|
| + ASSERT(m_layerTreeView);
|
| +
|
| + float deviceScaleFactor = m_emulatedDeviceScaleFactor ? m_emulatedDeviceScaleFactor : page()->deviceScaleFactor();
|
| + m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor);
|
| +}
|
| +
|
| +void WebViewImpl::updateRootLayerTransform()
|
| +{
|
| + if (m_rootGraphicsLayer) {
|
| + WebCore::TransformationMatrix transform;
|
| + if (m_rootLayerScale)
|
| + transform = transform.scale(m_rootLayerScale);
|
| + m_rootGraphicsLayer->setTransform(transform);
|
| + }
|
| +}
|
| +
|
| void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex)
|
| {
|
| if (m_autofillPopupClient && listIndex < m_autofillPopupClient->getSuggestionsCount())
|
|
|