Title: [141310] trunk/Source/WebKit2
Revision
141310
Author
[email protected]
Date
2013-01-30 14:27:52 -0800 (Wed, 30 Jan 2013)

Log Message

[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

Patch by Huang Dongsung <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (141309 => 141310)


--- trunk/Source/WebKit2/ChangeLog	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/ChangeLog	2013-01-30 22:27:52 UTC (rev 141310)
@@ -1,3 +1,77 @@
+2013-01-30  Huang Dongsung  <[email protected]>
+
+        [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  <[email protected]>
 
         [Qt] Fix Win build after r141177

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (141309 => 141310)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2013-01-30 22:27:52 UTC (rev 141310)
@@ -846,7 +846,7 @@
     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

Modified: trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp (141309 => 141310)


--- trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp	2013-01-30 22:27:52 UTC (rev 141310)
@@ -355,7 +355,7 @@
     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()

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp (141309 => 141310)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp	2013-01-30 22:27:52 UTC (rev 141310)
@@ -41,7 +41,6 @@
 CoordinatedLayerTreeHostProxy::CoordinatedLayerTreeHostProxy(DrawingAreaProxy* drawingAreaProxy)
     : m_drawingAreaProxy(drawingAreaProxy)
     , m_renderer(adoptRef(new LayerTreeRenderer(this)))
-    , m_lastSentScale(0)
 {
 }
 
@@ -55,11 +54,6 @@
     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 @@
     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;
 }
 

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h (141309 => 141310)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h	2013-01-30 22:27:52 UTC (rev 141310)
@@ -65,7 +65,7 @@
     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 @@
 #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;

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h (141309 => 141310)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h	2013-01-30 22:27:52 UTC (rev 141310)
@@ -86,7 +86,7 @@
     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; }

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp (141309 => 141310)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp	2013-01-30 22:27:52 UTC (rev 141310)
@@ -376,10 +376,10 @@
         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

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h (141309 => 141310)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h	2013-01-30 22:27:52 UTC (rev 141310)
@@ -83,7 +83,7 @@
     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

Modified: trunk/Source/WebKit2/UIProcess/PageViewportController.cpp (141309 => 141310)


--- trunk/Source/WebKit2/UIProcess/PageViewportController.cpp	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/UIProcess/PageViewportController.cpp	2013-01-30 22:27:52 UTC (rev 141310)
@@ -197,6 +197,8 @@
         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 @@
     if (!m_pendingPositionChange)
         m_contentsPosition = position;
     if (!m_pendingScaleChange)
-        m_pageScaleFactor = scale;
+        applyScaleAfterRenderingContents(scale);
 
     syncVisibleContents(trajectoryVector);
 }
@@ -271,7 +273,7 @@
 
     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::applyScaleAfterRenderingContents(float scale)
 {
+    if (m_pageScaleFactor == scale)
+        return;
+
     m_pageScaleFactor = scale;
     m_pendingScaleChange = true;
     syncVisibleContents();
@@ -333,6 +338,9 @@
 
 void PageViewportController::applyPositionAfterRenderingContents(const FloatPoint& pos)
 {
+    if (m_contentsPosition == pos)
+        return;
+
     m_contentsPosition = pos;
     m_pendingPositionChange = true;
     syncVisibleContents();

Modified: trunk/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp (141309 => 141310)


--- trunk/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp	2013-01-30 22:27:52 UTC (rev 141310)
@@ -50,7 +50,7 @@
 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
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp (141309 => 141310)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp	2013-01-30 22:27:52 UTC (rev 141310)
@@ -123,7 +123,6 @@
     , 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 @@
     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()

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h (141309 => 141310)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h	2013-01-30 22:27:52 UTC (rev 141310)
@@ -123,6 +123,7 @@
     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 @@
     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 @@
     WebKit::CoordinatedGraphicsLayerClient* m_coordinator;
     OwnPtr<TiledBackingStore> m_mainBackingStore;
     OwnPtr<TiledBackingStore> m_previousBackingStore;
-    float m_contentsScale;
 
     RefPtr<Image> m_compositedImage;
     NativeImagePtr m_compositedNativeImagePtr;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp (141309 => 141310)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp	2013-01-30 22:27:52 UTC (rev 141310)
@@ -87,7 +87,6 @@
     , 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 @@
     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 @@
     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 @@
         m_shouldSendScrollPositionUpdate = true;
 }
 
+void CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged()
+{
+    m_rootLayer->deviceOrPageScaleFactorChanged();
+    m_nonCompositedContentLayer->deviceOrPageScaleFactorChanged();
+    if (m_pageOverlayLayer)
+        m_pageOverlayLayer->deviceOrPageScaleFactorChanged();
+}
+
 GraphicsLayerFactory* CoordinatedLayerTreeHost::graphicsLayerFactory()
 {
     return this;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h (141309 => 141310)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h	2013-01-30 22:27:52 UTC (rev 141310)
@@ -76,7 +76,7 @@
 
     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 @@
     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 @@
     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 @@
     bool m_waitingForUIProcess;
     bool m_isSuspended;
     WebCore::FloatRect m_visibleContentsRect;
-    float m_contentsScale;
     bool m_shouldSendScrollPositionUpdate;
 
     LayerTreeContext m_layerTreeContext;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.messages.in (141309 => 141310)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.messages.in	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.messages.in	2013-01-30 22:27:52 UTC (rev 141310)
@@ -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)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (141309 => 141310)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-01-30 22:27:15 UTC (rev 141309)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-01-30 22:27:52 UTC (rev 141310)
@@ -1271,6 +1271,8 @@
 #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)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to