[EFL][Qt][WK2] We should consider a page scale factor in WebCore instead of our own...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2013 22:27:52 +0000 (22:27 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2013 22:27:52 +0000 (22:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=105978

Patch by Huang Dongsung <luxtella@company100.net> on 2013-01-30
Reviewed by Simon Fraser.

Currently, PageViewportController sends a page scale factor to Coordinated
Graphics System regardless of the page scale factor in WebCore. This patch makes
Coordinated Graphics System use the page scale factor in WebCore to match other
ports.

When it is needed to change a page scale, PageViewportController sends the scale
to Page in Web Process via WebPageProxy::scalePage. When the page scale in
WebCore is changed, CoordinatedGraphicsLayer gets notified via
deviceOrPageScaleFactorChanged callback. CoordinatedGraphicsLayer uses the page
scale factor like previous our own scale factor.

We set true to applyDeviceScaleFactorInCompositor and
ApplyPageScaleFactorInCompositor in Settings like chromium, because
TiledBackingStore that is a backing store of each GraphicsLayer applies the
scale to our raster graphics engines instead of applying the scale to the local
transform of each render object.

Thank Kenneth Rohde Christiansen for implementing the base patch of this patch.

No new tests. Covered by existing tests.

* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewLegacyPrivate::updateViewportSize):
* UIProcess/API/qt/raw/qrawwebview.cpp:
(QRawWebView::setSize):
* UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp:
(WebKit::CoordinatedLayerTreeHostProxy::CoordinatedLayerTreeHostProxy):
(WebKit::CoordinatedLayerTreeHostProxy::setVisibleContentsRect):
    Does not receive a pageScaleFactor argument because
    PageViewportController sends a page scale factor to Page.
    However, this method still receives a scroll position because we
    enable delegates scrolling.
* UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h:
(CoordinatedLayerTreeHostProxy):
* UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::setVisibleContentsRect):
* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::setVisibleContentsRect):
* UIProcess/DrawingAreaProxyImpl.h:
* UIProcess/PageViewportController.cpp:
(WebKit::PageViewportController::didRenderFrame):
(WebKit::PageViewportController::didChangeContentsVisibility):
(WebKit::PageViewportController::syncVisibleContents):
(WebKit::PageViewportController::applyScaleAfterRenderingContents):
(WebKit::PageViewportController::applyPositionAfterRenderingContents):
* UIProcess/efl/PageClientLegacyImpl.cpp:
(WebKit::PageClientLegacyImpl::updateViewportSize):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
(WebCore::CoordinatedGraphicsLayer::deviceOrPageScaleFactorChanged):
(WebCore::CoordinatedGraphicsLayer::effectiveContentsScale):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h:
(CoordinatedGraphicsLayer):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
(WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
(WebKit::CoordinatedLayerTreeHost::createGraphicsLayer):
(WebKit::CoordinatedLayerTreeHost::deviceScaleFactor):
(WebKit):
(WebKit::CoordinatedLayerTreeHost::pageScaleFactor):
(WebKit::CoordinatedLayerTreeHost::setVisibleContentsRect):
(WebKit::CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
(CoordinatedLayerTreeHost):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setUseFixedLayout):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141310 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp
Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h
Source/WebKit2/UIProcess/DrawingAreaProxy.h
Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
Source/WebKit2/UIProcess/PageViewportController.cpp
Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.messages.in
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 45cfb90e60a60683b510c86b981ca9fe3d153a8f..ce24c8ce860f1b7a25c987ffe3b1ca981d65e96c 100644 (file)
@@ -1,3 +1,77 @@
+2013-01-30  Huang Dongsung  <luxtella@company100.net>
+
+        [EFL][Qt][WK2] We should consider a page scale factor in WebCore instead of our own scale factor.
+        https://bugs.webkit.org/show_bug.cgi?id=105978
+
+        Reviewed by Simon Fraser.
+
+        Currently, PageViewportController sends a page scale factor to Coordinated
+        Graphics System regardless of the page scale factor in WebCore. This patch makes
+        Coordinated Graphics System use the page scale factor in WebCore to match other
+        ports.
+
+        When it is needed to change a page scale, PageViewportController sends the scale
+        to Page in Web Process via WebPageProxy::scalePage. When the page scale in
+        WebCore is changed, CoordinatedGraphicsLayer gets notified via
+        deviceOrPageScaleFactorChanged callback. CoordinatedGraphicsLayer uses the page
+        scale factor like previous our own scale factor.
+
+        We set true to applyDeviceScaleFactorInCompositor and
+        ApplyPageScaleFactorInCompositor in Settings like chromium, because
+        TiledBackingStore that is a backing store of each GraphicsLayer applies the
+        scale to our raster graphics engines instead of applying the scale to the local
+        transform of each render object.
+
+        Thank Kenneth Rohde Christiansen for implementing the base patch of this patch.
+
+        No new tests. Covered by existing tests.
+
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewLegacyPrivate::updateViewportSize):
+        * UIProcess/API/qt/raw/qrawwebview.cpp:
+        (QRawWebView::setSize):
+        * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp:
+        (WebKit::CoordinatedLayerTreeHostProxy::CoordinatedLayerTreeHostProxy):
+        (WebKit::CoordinatedLayerTreeHostProxy::setVisibleContentsRect):
+            Does not receive a pageScaleFactor argument because
+            PageViewportController sends a page scale factor to Page.
+            However, this method still receives a scroll position because we
+            enable delegates scrolling.
+        * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h:
+        (CoordinatedLayerTreeHostProxy):
+        * UIProcess/DrawingAreaProxy.h:
+        (WebKit::DrawingAreaProxy::setVisibleContentsRect):
+        * UIProcess/DrawingAreaProxyImpl.cpp:
+        (WebKit::DrawingAreaProxyImpl::setVisibleContentsRect):
+        * UIProcess/DrawingAreaProxyImpl.h:
+        * UIProcess/PageViewportController.cpp:
+        (WebKit::PageViewportController::didRenderFrame):
+        (WebKit::PageViewportController::didChangeContentsVisibility):
+        (WebKit::PageViewportController::syncVisibleContents):
+        (WebKit::PageViewportController::applyScaleAfterRenderingContents):
+        (WebKit::PageViewportController::applyPositionAfterRenderingContents):
+        * UIProcess/efl/PageClientLegacyImpl.cpp:
+        (WebKit::PageClientLegacyImpl::updateViewportSize):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
+        (WebCore::CoordinatedGraphicsLayer::deviceOrPageScaleFactorChanged):
+        (WebCore::CoordinatedGraphicsLayer::effectiveContentsScale):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h:
+        (CoordinatedGraphicsLayer):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
+        (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
+        (WebKit::CoordinatedLayerTreeHost::createGraphicsLayer):
+        (WebKit::CoordinatedLayerTreeHost::deviceScaleFactor):
+        (WebKit):
+        (WebKit::CoordinatedLayerTreeHost::pageScaleFactor):
+        (WebKit::CoordinatedLayerTreeHost::setVisibleContentsRect):
+        (WebKit::CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
+        (CoordinatedLayerTreeHost):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.messages.in:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setUseFixedLayout):
+
 2013-01-30  Zoltan Arvai  <zarvai@inf.u-szeged.hu>
 
         [Qt] Fix Win build after r141177
index 156deedf0211183ce13e4bbb38c75682a0d9b97c..6f532c2582a414391ca3f4788890814b81e645e5 100644 (file)
@@ -846,7 +846,7 @@ void QQuickWebViewLegacyPrivate::updateViewportSize()
     webPageProxy->drawingArea()->setSize(viewportSize.toSize(), IntSize());
     // The backing store scale factor should already be set to the device pixel ratio
     // of the underlying window, thus we set the effective scale to 1 here.
-    webPageProxy->drawingArea()->setVisibleContentsRect(FloatRect(FloatPoint(), FloatSize(viewportSize)), 1, FloatPoint());
+    webPageProxy->drawingArea()->setVisibleContentsRect(FloatRect(FloatPoint(), FloatSize(viewportSize)), FloatPoint());
 }
 
 qreal QQuickWebViewLegacyPrivate::zoomFactor() const
index 2dd45d0effe9e0f3ffbad3649d30e9576fbf9dc3..361f74dab851ad898ed39d277a7a6f479b259731 100644 (file)
@@ -355,7 +355,7 @@ void QRawWebView::setSize(const QSize& size)
     d->m_size = size;
 
     drawingArea->setSize(d->m_size, WebCore::IntSize());
-    drawingArea->setVisibleContentsRect(WebCore::IntRect(WebCore::IntPoint(), d->m_size), 1 /*scale*/, WebCore::FloatPoint());
+    drawingArea->setVisibleContentsRect(WebCore::IntRect(WebCore::IntPoint(), d->m_size), WebCore::FloatPoint());
 }
 
 WKPageRef QRawWebView::pageRef()
index bdd13961c406c6f0b75710e6a363e8ab8497918a..62186c258f829d868cbf6f5665e58db2ba2b6d37 100644 (file)
@@ -41,7 +41,6 @@ using namespace WebCore;
 CoordinatedLayerTreeHostProxy::CoordinatedLayerTreeHostProxy(DrawingAreaProxy* drawingAreaProxy)
     : m_drawingAreaProxy(drawingAreaProxy)
     , m_renderer(adoptRef(new LayerTreeRenderer(this)))
-    , m_lastSentScale(0)
 {
 }
 
@@ -55,11 +54,6 @@ void CoordinatedLayerTreeHostProxy::updateViewport()
     m_drawingAreaProxy->updateViewport();
 }
 
-float CoordinatedLayerTreeHostProxy::deviceScaleFactor() const
-{
-    return m_drawingAreaProxy->page()->deviceScaleFactor();
-}
-
 void CoordinatedLayerTreeHostProxy::dispatchUpdate(const Function<void()>& function)
 {
     m_renderer->appendUpdate(function);
@@ -185,19 +179,16 @@ void CoordinatedLayerTreeHostProxy::setAnimationsLocked(bool locked)
     dispatchUpdate(bind(&LayerTreeRenderer::setAnimationsLocked, m_renderer.get(), locked));
 }
 
-void CoordinatedLayerTreeHostProxy::setVisibleContentsRect(const FloatRect& rect, float pageScaleFactor, const FloatPoint& trajectoryVector)
+void CoordinatedLayerTreeHostProxy::setVisibleContentsRect(const FloatRect& rect, const FloatPoint& trajectoryVector)
 {
     // Inform the renderer to adjust viewport-fixed layers.
     dispatchUpdate(bind(&LayerTreeRenderer::setVisibleContentsRect, m_renderer.get(), rect));
 
-    const float effectiveScale = deviceScaleFactor() * pageScaleFactor;
-
-    if (rect == m_lastSentVisibleRect && effectiveScale == m_lastSentScale && trajectoryVector == m_lastSentTrajectoryVector)
+    if (rect == m_lastSentVisibleRect && trajectoryVector == m_lastSentTrajectoryVector)
         return;
 
-    m_drawingAreaProxy->page()->process()->send(Messages::CoordinatedLayerTreeHost::SetVisibleContentsRect(rect, effectiveScale, trajectoryVector), m_drawingAreaProxy->page()->pageID());
+    m_drawingAreaProxy->page()->process()->send(Messages::CoordinatedLayerTreeHost::SetVisibleContentsRect(rect, trajectoryVector), m_drawingAreaProxy->page()->pageID());
     m_lastSentVisibleRect = rect;
-    m_lastSentScale = effectiveScale;
     m_lastSentTrajectoryVector = trajectoryVector;
 }
 
index 4c5ce4a7e7b999f14884586513c193845401ce32..166898f6fafcb3198375df3f14aa6bcc5b34cac2 100644 (file)
@@ -65,7 +65,7 @@ public:
     void deleteCompositingLayers(const Vector<CoordinatedLayerID>&);
     void setRootCompositingLayer(CoordinatedLayerID);
     void setContentsSize(const WebCore::FloatSize&);
-    void setVisibleContentsRect(const WebCore::FloatRect&, float pageScaleFactor, const WebCore::FloatPoint& trajectoryVector);
+    void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint& trajectoryVector);
     void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect);
     void createTileForLayer(CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&);
     void updateTileForLayer(CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&);
@@ -96,15 +96,12 @@ public:
 #endif
     void setBackgroundColor(const WebCore::Color&);
 
-    float deviceScaleFactor() const;
-
 protected:
     void dispatchUpdate(const Function<void()>&);
 
     DrawingAreaProxy* m_drawingAreaProxy;
     RefPtr<LayerTreeRenderer> m_renderer;
     WebCore::FloatRect m_lastSentVisibleRect;
-    float m_lastSentScale;
     WebCore::FloatPoint m_lastSentTrajectoryVector;
     typedef HashMap<uint32_t /* atlasID */, RefPtr<CoordinatedSurface> > SurfaceMap;
     SurfaceMap m_surfaces;
index 1eb181951b0bebd081587c9acc84b7a245e3c459..bad6384de86be04f9f1f756097efa85757179476 100644 (file)
@@ -86,7 +86,7 @@ public:
     virtual WebCore::IntRect viewportVisibleRect() const { return contentsRect(); }
     virtual WebCore::IntRect contentsRect() const;
     CoordinatedLayerTreeHostProxy* coordinatedLayerTreeHostProxy() const { return m_coordinatedLayerTreeHostProxy.get(); }
-    virtual void setVisibleContentsRect(const WebCore::FloatRect& /* visibleContentsRect */, float /* scale */, const WebCore::FloatPoint& /* trajectoryVector */) { }
+    virtual void setVisibleContentsRect(const WebCore::FloatRect& /* visibleContentsRect */, const WebCore::FloatPoint& /* trajectoryVector */) { }
     virtual void didReceiveCoordinatedLayerTreeHostProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
 
     WebPageProxy* page() { return m_webPageProxy; }
index 65f1b9eb945c6111e2efe3f34b1d8051fd00bef3..1834f9d0a23c0c420bdfcfb216dd014aaf00e469 100644 (file)
@@ -376,10 +376,10 @@ void DrawingAreaProxyImpl::didReceiveCoordinatedLayerTreeHostProxyMessage(CoreIP
         m_coordinatedLayerTreeHostProxy->didReceiveCoordinatedLayerTreeHostProxyMessage(connection, messageID, decoder);
 }
 
-void DrawingAreaProxyImpl::setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, float scale, const WebCore::FloatPoint& trajectoryVector)
+void DrawingAreaProxyImpl::setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, const WebCore::FloatPoint& trajectoryVector)
 {
     if (m_coordinatedLayerTreeHostProxy)
-        m_coordinatedLayerTreeHostProxy->setVisibleContentsRect(visibleContentsRect, scale, trajectoryVector);
+        m_coordinatedLayerTreeHostProxy->setVisibleContentsRect(visibleContentsRect, trajectoryVector);
 }
 
 #endif
index 6ced207b4cc698b7d2a5c3f6a2b7da3cbbb21fcc..4ae60231aa29123b2d75658722d57cd38f198b30 100644 (file)
@@ -83,7 +83,7 @@ private:
     void exitAcceleratedCompositingMode();
     void updateAcceleratedCompositingMode(const LayerTreeContext&);
 #if USE(COORDINATED_GRAPHICS)
-    virtual void setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, float scale, const WebCore::FloatPoint& trajectory);
+    virtual void setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, const WebCore::FloatPoint& trajectory) OVERRIDE;
     void didReceiveCoordinatedLayerTreeHostProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
 #endif
 #else
index f71c03c033abe1c522e6d1fc0ba4e346d95455b1..6fa94a3920003f564cebd602755c3c7d86b0aaff 100644 (file)
@@ -197,6 +197,8 @@ void PageViewportController::didRenderFrame(const IntSize& contentsSize, const I
         FloatPoint currentDiscretePos = roundedIntPoint(m_contentsPosition);
         FloatPoint pixelAlignedPos = pixelAlignedFloatPoint(currentDiscretePos);
         m_contentsPosition = boundContentsPosition(pixelAlignedPos);
+
+        m_webPageProxy->scalePage(m_pageScaleFactor, roundedIntPoint(m_contentsPosition));
     }
 
     // There might be rendered frames not covering our requested position yet, wait for it.
@@ -258,7 +260,7 @@ void PageViewportController::didChangeContentsVisibility(const FloatPoint& posit
     if (!m_pendingPositionChange)
         m_contentsPosition = position;
     if (!m_pendingScaleChange)
-        m_pageScaleFactor = scale;
+        applyScaleAfterRenderingContents(scale);
 
     syncVisibleContents(trajectoryVector);
 }
@@ -271,7 +273,7 @@ void PageViewportController::syncVisibleContents(const FloatPoint& trajectoryVec
 
     FloatRect visibleContentsRect(boundContentsPosition(m_contentsPosition), visibleContentsSize());
     visibleContentsRect.intersect(FloatRect(FloatPoint::zero(), m_contentsSize));
-    drawingArea->setVisibleContentsRect(visibleContentsRect, m_pageScaleFactor, trajectoryVector);
+    drawingArea->setVisibleContentsRect(visibleContentsRect, trajectoryVector);
 
     m_client->didChangeVisibleContents();
 }
@@ -326,6 +328,9 @@ void PageViewportController::resumeContent()
 
 void PageViewportController::applyScaleAfterRenderingContents(float scale)
 {
+    if (m_pageScaleFactor == scale)
+        return;
+
     m_pageScaleFactor = scale;
     m_pendingScaleChange = true;
     syncVisibleContents();
@@ -333,6 +338,9 @@ void PageViewportController::applyScaleAfterRenderingContents(float scale)
 
 void PageViewportController::applyPositionAfterRenderingContents(const FloatPoint& pos)
 {
+    if (m_contentsPosition == pos)
+        return;
+
     m_contentsPosition = pos;
     m_pendingPositionChange = true;
     syncVisibleContents();
index eb07263e8e8d91852cd1ce66279b1247e0ef5b13..95831a25e45868d3af90aa7bb957d44ccb6269bc 100644 (file)
@@ -50,7 +50,7 @@ void PageClientLegacyImpl::didCommitLoad()
 void PageClientLegacyImpl::updateViewportSize()
 {
 #if USE(TILED_BACKING_STORE)
-    m_view->page()->drawingArea()->setVisibleContentsRect(IntRect(roundedIntPoint(m_view->pagePosition()), m_view->size()), m_view->pageScaleFactor(), FloatPoint());
+    m_view->page()->drawingArea()->setVisibleContentsRect(IntRect(roundedIntPoint(m_view->pagePosition()), m_view->size()), FloatPoint());
 #endif
 }
 
index 94e06164b15dfc3792f528e2d802c3fc66e095d9..c3d78b18f1b08798e65a5918a4f204203af10054 100644 (file)
@@ -123,7 +123,6 @@ CoordinatedGraphicsLayer::CoordinatedGraphicsLayer(GraphicsLayerClient* client)
     , m_pendingCanvasOperation(None)
 #endif
     , m_coordinator(0)
-    , m_contentsScale(1)
     , m_compositedNativeImagePtr(0)
     , m_canvasPlatformLayer(0)
     , m_animationStartedTimer(this, &CoordinatedGraphicsLayer::animationStartedTimerFired)
@@ -698,16 +697,15 @@ void CoordinatedGraphicsLayer::setVisibleContentRectTrajectoryVector(const Float
     setNeedsVisibleRectAdjustment();
 }
 
-void CoordinatedGraphicsLayer::setContentsScale(float scale)
+void CoordinatedGraphicsLayer::deviceOrPageScaleFactorChanged()
 {
-    m_contentsScale = scale;
     if (shouldHaveBackingStore())
         m_pendingContentsScaleAdjustment = true;
 }
 
 float CoordinatedGraphicsLayer::effectiveContentsScale()
 {
-    return selfOrAncestorHaveNonAffineTransforms() ? 1 : m_contentsScale;
+    return selfOrAncestorHaveNonAffineTransforms() ? 1 : deviceScaleFactor() * pageScaleFactor();
 }
 
 void CoordinatedGraphicsLayer::adjustContentsScale()
index 28cef3295ee615648a7892a552926f131de7b933..dcfeeb02ded89ab90757934033f0c77bc3cec248 100644 (file)
@@ -123,6 +123,7 @@ public:
     virtual void setNeedsDisplay() OVERRIDE;
     virtual void setNeedsDisplayInRect(const FloatRect&) OVERRIDE;
     virtual void setContentsNeedsDisplay() OVERRIDE;
+    virtual void deviceOrPageScaleFactorChanged() OVERRIDE;
     virtual void flushCompositingState(const FloatRect&) OVERRIDE;
     virtual void flushCompositingStateForThisLayerOnly() OVERRIDE;
 #if ENABLE(CSS_FILTERS)
@@ -137,7 +138,6 @@ public:
     FloatPoint computePositionRelativeToBase();
     void computePixelAlignment(FloatPoint& position, FloatSize&, FloatPoint3D& anchorPoint, FloatSize& alignmentOffset);
 
-    void setContentsScale(float);
     void setVisibleContentRectTrajectoryVector(const FloatPoint&);
 
     void setRootLayer(bool);
@@ -252,7 +252,6 @@ private:
     WebKit::CoordinatedGraphicsLayerClient* m_coordinator;
     OwnPtr<TiledBackingStore> m_mainBackingStore;
     OwnPtr<TiledBackingStore> m_previousBackingStore;
-    float m_contentsScale;
 
     RefPtr<Image> m_compositedImage;
     NativeImagePtr m_compositedNativeImagePtr;
index 2eaf865a444274092d8bfaa973e047027074860a..ca3756adc95290e54beddbabd81be6c61b8eb1a1 100644 (file)
@@ -87,7 +87,6 @@ CoordinatedLayerTreeHost::CoordinatedLayerTreeHost(WebPage* webPage)
     , m_isFlushingLayerChanges(false)
     , m_waitingForUIProcess(true)
     , m_isSuspended(false)
-    , m_contentsScale(1)
     , m_shouldSendScrollPositionUpdate(true)
     , m_shouldSyncFrame(false)
     , m_didInitializeRootCompositingLayer(false)
@@ -682,12 +681,21 @@ PassOwnPtr<GraphicsLayer> CoordinatedLayerTreeHost::createGraphicsLayer(Graphics
     layer->setCoordinator(this);
     m_registeredLayers.add(layer);
     m_layersToCreate.append(layer->id());
-    layer->setContentsScale(m_contentsScale);
     layer->setNeedsVisibleRectAdjustment();
     scheduleLayerFlush();
     return adoptPtr(layer);
 }
 
+float CoordinatedLayerTreeHost::deviceScaleFactor() const
+{
+    return m_webPage->deviceScaleFactor();
+}
+
+float CoordinatedLayerTreeHost::pageScaleFactor() const
+{
+    return m_webPage->pageScaleFactor();
+}
+
 bool LayerTreeHost::supportsAcceleratedCompositing()
 {
     return true;
@@ -754,24 +762,18 @@ void CoordinatedLayerTreeHost::setLayerAnimations(CoordinatedLayerID layerID, co
     m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::SetLayerAnimations(layerID, activeAnimations));
 }
 
-void CoordinatedLayerTreeHost::setVisibleContentsRect(const FloatRect& rect, float scale, const FloatPoint& trajectoryVector)
+void CoordinatedLayerTreeHost::setVisibleContentsRect(const FloatRect& rect, const FloatPoint& trajectoryVector)
 {
-    bool contentsRectDidChange = rect != m_visibleContentsRect;
-    bool contentsScaleDidChange = scale != m_contentsScale;
-
     // A zero trajectoryVector indicates that tiles all around the viewport are requested.
     toCoordinatedGraphicsLayer(m_nonCompositedContentLayer.get())->setVisibleContentRectTrajectoryVector(trajectoryVector);
 
-    if (contentsRectDidChange || contentsScaleDidChange) {
+    bool contentsRectDidChange = rect != m_visibleContentsRect;
+    if (contentsRectDidChange) {
         m_visibleContentsRect = rect;
-        m_contentsScale = scale;
 
         HashSet<WebCore::CoordinatedGraphicsLayer*>::iterator end = m_registeredLayers.end();
         for (HashSet<WebCore::CoordinatedGraphicsLayer*>::iterator it = m_registeredLayers.begin(); it != end; ++it) {
-            if (contentsScaleDidChange)
-                (*it)->setContentsScale(scale);
-            if (contentsRectDidChange)
-                (*it)->setNeedsVisibleRectAdjustment();
+            (*it)->setNeedsVisibleRectAdjustment();
         }
     }
 
@@ -786,6 +788,14 @@ void CoordinatedLayerTreeHost::setVisibleContentsRect(const FloatRect& rect, flo
         m_shouldSendScrollPositionUpdate = true;
 }
 
+void CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged()
+{
+    m_rootLayer->deviceOrPageScaleFactorChanged();
+    m_nonCompositedContentLayer->deviceOrPageScaleFactorChanged();
+    if (m_pageOverlayLayer)
+        m_pageOverlayLayer->deviceOrPageScaleFactorChanged();
+}
+
 GraphicsLayerFactory* CoordinatedLayerTreeHost::graphicsLayerFactory()
 {
     return this;
index 3c50c5735d09e1bf0c0ece885a09b8f182f439cd..17763809788ab0975dd17b32c4bef6f9afaf4d1c 100644 (file)
@@ -76,7 +76,7 @@ public:
 
     virtual void pauseRendering() { m_isSuspended = true; }
     virtual void resumeRendering() { m_isSuspended = false; scheduleLayerFlush(); }
-    virtual void deviceOrPageScaleFactorChanged() { }
+    virtual void deviceOrPageScaleFactorChanged() OVERRIDE;
     virtual PassRefPtr<CoordinatedImageBacking> createImageBackingIfNeeded(WebCore::Image*) OVERRIDE;
 
     virtual bool isFlushingLayerChanges() const OVERRIDE { return m_isFlushingLayerChanges; }
@@ -86,7 +86,7 @@ public:
     virtual WebCore::FloatRect visibleContentsRect() const;
     virtual void renderNextFrame();
     virtual void purgeBackingStores();
-    virtual void setVisibleContentsRect(const WebCore::FloatRect&, float scale, const WebCore::FloatPoint&);
+    virtual void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint&);
     virtual void didReceiveCoordinatedLayerTreeHostMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
     virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() OVERRIDE;
 
@@ -124,6 +124,8 @@ private:
     virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
     virtual void notifyFlushRequired(const WebCore::GraphicsLayer*);
     virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect);
+    virtual float deviceScaleFactor() const OVERRIDE;
+    virtual float pageScaleFactor() const OVERRIDE;
 
     // CoordinatedImageBacking::Coordinator
     virtual void createImageBacking(CoordinatedImageBackingID) OVERRIDE;
@@ -195,7 +197,6 @@ private:
     bool m_waitingForUIProcess;
     bool m_isSuspended;
     WebCore::FloatRect m_visibleContentsRect;
-    float m_contentsScale;
     bool m_shouldSendScrollPositionUpdate;
 
     LayerTreeContext m_layerTreeContext;
index 2a1059ee8badb034f2410c0be53d836e665bcfe4..6671b327fec6e14e0742676d9490b384ff1f9aa5 100644 (file)
@@ -21,7 +21,7 @@
 
 #if USE(COORDINATED_GRAPHICS)
 messages -> CoordinatedLayerTreeHost LegacyReceiver {
-    SetVisibleContentsRect(WebCore::FloatRect visibleContentsRect, float scale, WebCore::FloatPoint trajectoryVectory)
+    SetVisibleContentsRect(WebCore::FloatRect visibleContentsRect, WebCore::FloatPoint trajectoryVectory)
     RenderNextFrame()
     PurgeBackingStores()
 #if ENABLE(REQUEST_ANIMATION_FRAME)
index c043bb7213d0765205a8e3e0a65b5f76014d28ef..a744bb90316da70882c0ad478f25db6795e9d88e 100644 (file)
@@ -1271,6 +1271,8 @@ void WebPage::setUseFixedLayout(bool fixed)
 #if USE(COORDINATED_GRAPHICS)
     m_page->settings()->setAcceleratedCompositingForFixedPositionEnabled(fixed);
     m_page->settings()->setFixedPositionCreatesStackingContext(fixed);
+    m_page->settings()->setApplyDeviceScaleFactorInCompositor(fixed);
+    m_page->settings()->setApplyPageScaleFactorInCompositor(fixed);
 #endif
 
 #if USE(TILED_BACKING_STORE) && ENABLE(SMOOTH_SCROLLING)