-
danakj@chromium.org authored
https://bugs.webkit.org/show_bug.cgi?id=86051 Reviewed by James Robinson. Source/Platform: * chromium/public/WebLayerTreeView.h: (WebKit::WebLayerTreeView::Settings::Settings): (Settings): Source/WebCore: On initialization, give the defaultDeviceScaleFactor to the compositor to have it scale all output from WebCore's layout size to physical pixels. This allows us to scale up to high-dpi devices without using fixed-layout, so we can leave the WebCore frame size in layout pixels, while drawing the frame into a larger physical pixel size. CCLayerTreeHost becomes aware of the deviceScaleFactor and scales all output by this factor by scaling the viewport and all drawing transforms. Anything that works in physical pixels (content space), uses the deviceViewportSize() in place of the viewportSize(), since when deviceScaleFactor != 1 in CCLayerTreeHost, the WebCore viewport is no longer physical pixels. Scroll positions are in layout pixels, and must be scaled to/from content space within the compositor. Unit tests: CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers * platform/graphics/chromium/LayerRendererChromium.h: (LayerRendererChromiumClient): (WebCore::LayerRendererChromium::viewportSize): (WebCore::LayerRendererChromium::viewportWidth): (WebCore::LayerRendererChromium::viewportHeight): (LayerRendererChromium): * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: (WebCore::CCLayerTreeHost::initializeLayerRenderer): (WebCore::CCLayerTreeHost::setViewportSize): (WebCore::CCLayerTreeHost::updateLayers): (WebCore::CCLayerTreeHost::paintLayerContents): * platform/graphics/chromium/cc/CCLayerTreeHost.h: (WebCore::CCSettings::CCSettings): (CCSettings): (CCLayerTreeHost): (WebCore::CCLayerTreeHost::deviceViewportSize): * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: (WebCore::CCLayerTreeHostImpl::calculateRenderSurfaceLayerList): (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): (WebCore::CCLayerTreeHostImpl::setViewportSize): (WebCore::CCLayerTreeHostImpl::updateMaxScrollPosition): (WebCore::CCLayerTreeHostImpl::scrollBegin): (WebCore::CCLayerTreeHostImpl::computePinchZoomDeltas): * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: (WebCore::CCLayerTreeHostImpl::viewportSize): (CCLayerTreeHostImpl): Source/WebKit/chromium: Add the applyDefaultDeviceScaleInCompositor setting. When enabled, we apply the scale factor during compositing instead of applying it through the pageScaleFactor. NonCompositedContentHost is the GraphicLayerClient for the GraphicsLayer containing the document's body. It needs to report the page/device scale that should be used when scaling the contents of the GraphicsLayer, and when changes occur to them such that its contentsSize or contentsScale is affected. Store the deviceScaleFactor being used in the compositor. The remainder of the deviceScaleFactor() is being applied to the pageScale. * public/WebSettings.h: * src/NonCompositedContentHost.cpp: (WebKit::NonCompositedContentHost::NonCompositedContentHost): (WebKit::NonCompositedContentHost::setViewport): * src/NonCompositedContentHost.h: (NonCompositedContentHost): * src/WebLayerTreeView.cpp: (WebKit::WebLayerTreeView::Settings::operator CCSettings): * src/WebSettingsImpl.cpp: (WebKit::WebSettingsImpl::setApplyDefaultDeviceScaleFactorInCompositor): (WebKit): * src/WebSettingsImpl.h: (WebSettingsImpl): (WebKit::WebSettingsImpl::applyDefaultDeviceScaleFactorInCompositor): * src/WebViewImpl.cpp: (WebKit::WebViewImpl::WebViewImpl): (WebKit::WebViewImpl::setPageScaleFactor): (WebKit::WebViewImpl::setDeviceScaleFactor): (WebKit::WebViewImpl::enableFixedLayoutMode): (WebKit::WebViewImpl::computePageScaleFactorLimits): (WebKit::WebViewImpl::setIsAcceleratedCompositingActive): (WebKit::WebViewImpl::updateLayerTreeViewport): * src/WebViewImpl.h: * tests/CCLayerTreeHostTest.cpp: (MockLayerTreeHostImpl): (WTF::MockLayerTreeHost::createLayerTreeHostImpl): (CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers): (WTF::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers): (WTF::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::beginTest): (WTF::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::commitCompleteOnCCThread): (WTF::CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers::afterTest): (WTF): (WTF::TEST_F): * tests/LayerRendererChromiumTest.cpp: * tests/WebFrameTest.cpp: (WebKit::TEST_F): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117535 268f45cc-cd09-0410-ab3c-d52691b4dbfc
e06f9e4b