Pipe initial scale factor to TileController
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Apr 2014 18:58:07 +0000 (18:58 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Apr 2014 18:58:07 +0000 (18:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=131521

Reviewed by Tim Horton.

Source/WebCore:

* WebCore.exp.in:
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::setZoomedOutPageScaleFactor):
* page/Page.h:
(WebCore::Page::zoomedOutPageScaleFactor):
* platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::zoomedOutPageScaleFactor):
* platform/graphics/TiledBacking.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateContentsScale):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/mac/TileController.h:
* platform/graphics/ca/mac/TileController.mm:
(WebCore::TileController::TileController):
(WebCore::TileController::setContentsScale):
(WebCore::TileController::setZoomedOutContentsScale):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::zoomedOutPageScaleFactor):
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::zoomedOutPageScaleFactor):
* rendering/RenderLayerCompositor.h:

Source/WebKit2:

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::viewportConfigurationChanged):

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

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/platform/graphics/GraphicsLayerClient.h
Source/WebCore/platform/graphics/TiledBacking.h
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
Source/WebCore/platform/graphics/ca/mac/TileController.h
Source/WebCore/platform/graphics/ca/mac/TileController.mm
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerBacking.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderLayerCompositor.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

index 3891633..e5d0faa 100644 (file)
@@ -1,3 +1,34 @@
+2014-04-11  Antti Koivisto  <antti@apple.com>
+
+        Pipe initial scale factor to TileController
+        https://bugs.webkit.org/show_bug.cgi?id=131521
+
+        Reviewed by Tim Horton.
+
+        * WebCore.exp.in:
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        (WebCore::Page::setZoomedOutPageScaleFactor):
+        * page/Page.h:
+        (WebCore::Page::zoomedOutPageScaleFactor):
+        * platform/graphics/GraphicsLayerClient.h:
+        (WebCore::GraphicsLayerClient::zoomedOutPageScaleFactor):
+        * platform/graphics/TiledBacking.h:
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::updateContentsScale):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        * platform/graphics/ca/mac/TileController.h:
+        * platform/graphics/ca/mac/TileController.mm:
+        (WebCore::TileController::TileController):
+        (WebCore::TileController::setContentsScale):
+        (WebCore::TileController::setZoomedOutContentsScale):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::zoomedOutPageScaleFactor):
+        * rendering/RenderLayerBacking.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::zoomedOutPageScaleFactor):
+        * rendering/RenderLayerCompositor.h:
+
 2014-04-10  Chris Fleizach  <cfleizach@apple.com>
 
         Heap-use-after-free in WebCore::SpeechSynthesisUtterance::startTime
index f763611..39abc67 100644 (file)
@@ -1072,6 +1072,7 @@ __ZN7WebCore4Page24scrollingStateTreeAsTextEv
 __ZN7WebCore4Page25suspendScriptedAnimationsEv
 __ZN7WebCore4Page27enableLegacyPrivateBrowsingEb
 __ZN7WebCore4Page27invalidateStylesForAllLinksEv
+__ZN7WebCore4Page27setZoomedOutPageScaleFactorEf
 __ZN7WebCore4Page32setMemoryCacheClientCallsEnabledEb
 __ZN7WebCore4Page33synchronousScrollingReasonsAsTextEv
 __ZN7WebCore4Page35resumeActiveDOMObjectsAndAnimationsEv
index 3c24c06..9694934 100644 (file)
@@ -158,6 +158,7 @@ Page::Page(PageClients& pageClients)
     , m_areMemoryCacheClientCallsEnabled(true)
     , m_mediaVolume(1)
     , m_pageScaleFactor(1)
+    , m_zoomedOutPageScaleFactor(0)
     , m_deviceScaleFactor(1)
     , m_topContentInset(0)
     , m_suppressScrollbarAnimations(false)
@@ -690,6 +691,15 @@ void Page::setMediaVolume(float volume)
     }
 }
 
+void Page::setZoomedOutPageScaleFactor(float scale)
+{
+    if (m_zoomedOutPageScaleFactor == scale)
+        return;
+    m_zoomedOutPageScaleFactor = scale;
+
+    mainFrame().deviceOrPageScaleFactorChanged();
+}
+
 void Page::setPageScaleFactor(float scale, const IntPoint& origin)
 {
     Document* document = mainFrame().document();
index 5c22a3c..6e837ea 100644 (file)
@@ -275,6 +275,9 @@ public:
     void setPageScaleFactor(float scale, const IntPoint& origin);
     float pageScaleFactor() const { return m_pageScaleFactor; }
 
+    void setZoomedOutPageScaleFactor(float);
+    float zoomedOutPageScaleFactor() const { return m_zoomedOutPageScaleFactor; }
+
     float deviceScaleFactor() const { return m_deviceScaleFactor; }
     void setDeviceScaleFactor(float);
 
@@ -490,6 +493,7 @@ private:
     float m_mediaVolume;
 
     float m_pageScaleFactor;
+    float m_zoomedOutPageScaleFactor;
     float m_deviceScaleFactor;
 
     float m_topContentInset;
index 5aadbae..368addc 100644 (file)
@@ -86,6 +86,7 @@ public:
     virtual float deviceScaleFactor() const { return 1; }
     // Page scale factor.
     virtual float pageScaleFactor() const { return 1; }
+    virtual float zoomedOutPageScaleFactor() const { return 0; }
 
     virtual float contentsScaleMultiplierForNewTiles(const GraphicsLayer*) const { return 1; }
     virtual bool paintsOpaquelyAtNonIntegralScales(const GraphicsLayer*) const { return false; }
index 4e8556b..5673ff0 100644 (file)
@@ -88,6 +88,9 @@ public:
     virtual int leftMarginWidth() const = 0;
     virtual int rightMarginWidth() const = 0;
 
+    virtual void setZoomedOutContentsScale(float) = 0;
+    virtual float zoomedOutContentsScale() const = 0;
+
     // Includes margins.
     virtual IntRect bounds() const = 0;
 
index 32d6ba5..4467a15 100644 (file)
@@ -2982,6 +2982,12 @@ GraphicsLayerCA::LayerMap* GraphicsLayerCA::animatedLayerClones(AnimatedProperty
 void GraphicsLayerCA::updateContentsScale(float pageScaleFactor)
 {
     float contentsScale = clampedContentsScaleForScale(m_rootRelativeScaleFactor * pageScaleFactor * deviceScaleFactor());
+
+    if (m_isPageTiledBackingLayer && tiledBacking()) {
+        float zoomedOutScale = m_client->zoomedOutPageScaleFactor() * deviceScaleFactor();
+        tiledBacking()->setZoomedOutContentsScale(zoomedOutScale);
+    }
+
     if (contentsScale == m_layer->contentsScale())
         return;
 
index 391ad6c..43cac4b 100644 (file)
@@ -30,6 +30,7 @@
 #include "PlatformCAAnimation.h"
 #include "PlatformCALayer.h"
 #include "PlatformCALayerClient.h"
+#include "TileController.h"
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/RetainPtr.h>
index e1d0a36..a520de2 100644 (file)
@@ -147,6 +147,8 @@ private:
     virtual PlatformCALayer* tiledScrollingIndicatorLayer() override;
     virtual void setScrollingModeIndication(ScrollingModeIndication) override;
     virtual void setTileMargins(int marginTop, int marginBottom, int marginLeft, int marginRight) override;
+    virtual void setZoomedOutContentsScale(float) override;
+    virtual float zoomedOutContentsScale() const override { return m_zoomedOutContentsScale; }
 
     void scheduleTileRevalidation(double interval);
     void tileRevalidationTimerFired(Timer<TileController>*);
@@ -169,6 +171,7 @@ private:
     Timer<TileController> m_tileRevalidationTimer;
 
     float m_contentsScale;
+    float m_zoomedOutContentsScale;
     float m_deviceScaleFactor;
 
     TileCoverage m_tileCoverage;
index 265110c..5afb961 100644 (file)
@@ -60,6 +60,7 @@ TileController::TileController(PlatformCALayer* rootPlatformLayer)
     , m_tileSize(defaultTileWidth, defaultTileHeight)
     , m_tileRevalidationTimer(this, &TileController::tileRevalidationTimerFired)
     , m_contentsScale(1)
+    , m_zoomedOutContentsScale(0)
     , m_deviceScaleFactor(1)
     , m_tileCoverage(CoverageForVisibleArea)
     , m_marginTop(0)
@@ -104,10 +105,10 @@ void TileController::setNeedsDisplayInRect(const IntRect& rect)
 
 void TileController::setContentsScale(float scale)
 {
-    m_contentsScale = scale;
-    
     ASSERT(owningGraphicsLayer()->isCommittingChanges());
 
+    m_contentsScale = scale;
+
     float deviceScaleFactor = owningGraphicsLayer()->platformCALayerDeviceScaleFactor();
 
     // The scale we get is the product of the page scale factor and device scale factor.
@@ -123,6 +124,15 @@ void TileController::setContentsScale(float scale)
     tileGrid().setScale(scale);
 }
 
+void TileController::setZoomedOutContentsScale(float scale)
+{
+    ASSERT(owningGraphicsLayer()->isCommittingChanges());
+
+    if (m_zoomedOutContentsScale == scale)
+        return;
+    m_zoomedOutContentsScale = scale;
+}
+
 void TileController::setAcceleratesDrawing(bool acceleratesDrawing)
 {
     if (m_acceleratesDrawing == acceleratesDrawing)
index 6cbcf29..e8e3984 100644 (file)
@@ -2242,6 +2242,11 @@ float RenderLayerBacking::pageScaleFactor() const
     return compositor().pageScaleFactor();
 }
 
+float RenderLayerBacking::zoomedOutPageScaleFactor() const
+{
+    return compositor().zoomedOutPageScaleFactor();
+}
+
 float RenderLayerBacking::deviceScaleFactor() const
 {
     return compositor().deviceScaleFactor();
index 01d5d81..071e668 100644 (file)
@@ -180,6 +180,7 @@ public:
     virtual bool paintsOpaquelyAtNonIntegralScales(const GraphicsLayer*) const override;
 
     virtual float pageScaleFactor() const override;
+    virtual float zoomedOutPageScaleFactor() const override;
     virtual void didCommitChangesForLayer(const GraphicsLayer*) const override;
     virtual bool getCurrentTransform(const GraphicsLayer*, TransformationMatrix&) const override;
 
index aed38d2..aca3ddb 100644 (file)
@@ -2702,6 +2702,12 @@ float RenderLayerCompositor::pageScaleFactor() const
     return page ? page->pageScaleFactor() : 1;
 }
 
+float RenderLayerCompositor::zoomedOutPageScaleFactor() const
+{
+    Page* page = this->page();
+    return page ? page->zoomedOutPageScaleFactor() : 0;
+}
+
 float RenderLayerCompositor::contentsScaleMultiplierForNewTiles(const GraphicsLayer*) const
 {
 #if PLATFORM(IOS)
index 03952bc..06a6ca3 100644 (file)
@@ -242,6 +242,8 @@ public:
     virtual float deviceScaleFactor() const override;
     virtual float contentsScaleMultiplierForNewTiles(const GraphicsLayer*) const override;
     virtual float pageScaleFactor() const override;
+    virtual float zoomedOutPageScaleFactor() const override;
+
     virtual void didCommitChangesForLayer(const GraphicsLayer*) const override;
     virtual void notifyFlushBeforeDisplayRefresh(const GraphicsLayer*) override;
 
index 48f1536..19ab023 100644 (file)
@@ -1,3 +1,13 @@
+2014-04-11  Antti Koivisto  <antti@apple.com>
+
+        Pipe initial scale factor to TileController
+        https://bugs.webkit.org/show_bug.cgi?id=131521
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::viewportConfigurationChanged):
+
 2014-04-10  Chris Fleizach  <cfleizach@apple.com>
 
         AX: WebProcess at com.apple.WebCore: WebCore::AXObjectCache::rootObject + 18
index 61261a4..83840e4 100644 (file)
@@ -1836,11 +1836,14 @@ void WebPage::viewportConfigurationChanged()
 {
     setFixedLayoutSize(m_viewportConfiguration.layoutSize());
 
+    double initialScale = m_viewportConfiguration.initialScale();
     double scale;
     if (m_userHasChangedPageScaleFactor)
         scale = std::max(std::min(pageScaleFactor(), m_viewportConfiguration.maximumScale()), m_viewportConfiguration.minimumScale());
     else
-        scale = m_viewportConfiguration.initialScale();
+        scale = initialScale;
+
+    m_page->setZoomedOutPageScaleFactor(initialScale);
 
     FrameView& frameView = *m_page->mainFrame().view();
     IntPoint scrollPosition = frameView.scrollPosition();