Use TilesBacking for iframes when async frame scrolling is enabled
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Sep 2017 13:38:10 +0000 (13:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Sep 2017 13:38:10 +0000 (13:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=173644

Patch by Frederic Wang <fwang@igalia.com> on 2017-09-05
Reviewed by Simon Fraser.

Source/WebCore:

This patch adds creation of TilesBacking for non-main frames when async frame scrolling is
enabled. RenderLayerBacking::m_isMainFrameLayerWithTiledBacking is also renamed to reflect
that tiled backing is not exclusive to the main frame. More adjustments might be needed for
non-main frames and will be handled in follow-up commits.

Test: compositing/tiling/tiled-drawing-async-frame-scrolling.html

* rendering/RenderLayerBacking.cpp: Rename m_isMainFrameLayerWithTiledBacking
* rendering/RenderLayerBacking.h: Rename isMainFrameLayerWithTiledBacking and
m_isMainFrameLayerWithTiledBacking.
* rendering/RenderLayerCompositor.cpp: Use isFrameLayerWithTiledBacking

Source/WebKit:

This patch adds creation of TilesBacking for non-main frames when async frame scrolling is
enabled. RenderLayerBacking::m_isMainFrameLayerWithTiledBacking is also renamed to reflect
that tiled backing is not exclusive to the main frame. More adjustments might be needed for
non-main frames and will be handled in follow-up commits.

* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::shouldUseTiledBackingForFrameView): Also use tiled
backing when asyncFrameScrollingEnabled is true.
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView): Ditto.

LayoutTests:

This patch adds a test to verify the graphic layers created for frames when async scrolling
is enabled. On iOS and macOS and WK2, new layers appear for the tiled content, scroll bars...

* compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Added.
* compositing/tiling/tiled-drawing-async-frame-scrolling.html: Added.
* platform/ios-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Added.
* platform/mac-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Added.

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt [new file with mode: 0644]
LayoutTests/compositing/tiling/tiled-drawing-async-frame-scrolling.html [new file with mode: 0644]
LayoutTests/platform/ios-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerBacking.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm
Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

index 31e482c..0d7d6b4 100644 (file)
@@ -1,3 +1,18 @@
+2017-09-05  Frederic Wang  <fwang@igalia.com>
+
+        Use TilesBacking for iframes when async frame scrolling is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=173644
+
+        Reviewed by Simon Fraser.
+
+        This patch adds a test to verify the graphic layers created for frames when async scrolling
+        is enabled. On iOS and macOS and WK2, new layers appear for the tiled content, scroll bars...
+
+        * compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Added.
+        * compositing/tiling/tiled-drawing-async-frame-scrolling.html: Added.
+        * platform/ios-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Added.
+        * platform/mac-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Added.
+
 2017-09-04  Yoav Weiss  <yoav@yoav.ws>
 
         [iOS Simulator] http/tests/preload/viewport/meta-viewport-link-headers.php is a flaky failure.
diff --git a/LayoutTests/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt b/LayoutTests/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt
new file mode 100644 (file)
index 0000000..139597f
--- /dev/null
@@ -0,0 +1,2 @@
+
+
diff --git a/LayoutTests/compositing/tiling/tiled-drawing-async-frame-scrolling.html b/LayoutTests/compositing/tiling/tiled-drawing-async-frame-scrolling.html
new file mode 100644 (file)
index 0000000..a6df091
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Check whether scrollable iframes have tile backing</title>
+    <script>
+        if (window.internals)
+            window.internals.settings.setAsyncFrameScrollingEnabled(true);
+
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+       }
+
+        function doTest()
+        {
+            if (window.internals && window.testRunner) {
+                document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES | internals.LAYER_TREE_INCLUDES_BACKING_STORE_ATTACHED);
+                testRunner.notifyDone();
+            }
+        }
+    </script>
+  </head>
+  <body>
+    <iframe onload="setTimeout(doTest, 0)" id="frame" style="height: 100px; width: 200px;" scrolling="yes" srcdoc="&lt;div style='height: 300px; width: 400px;'&gt;&lt;/div&gt;"></iframe>
+    <pre id="layers">Layer tree goes here</p>
+  </body>
+</html>
diff --git a/LayoutTests/platform/ios-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt b/LayoutTests/platform/ios-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt
new file mode 100644 (file)
index 0000000..336f0ab
--- /dev/null
@@ -0,0 +1,104 @@
+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (backingStoreAttached 1)
+  (visible rect 0.00, 0.00 800.00 x 600.00)
+  (coverage rect 0.00, 0.00 800.00 x 600.00)
+  (intersects coverage rect 1)
+  (contentsScale 2.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (backingStoreAttached 1)
+      (visible rect 0.00, 0.00 800.00 x 600.00)
+      (coverage rect 0.00, 0.00 800.00 x 600.00)
+      (intersects coverage rect 1)
+      (contentsScale 2.00)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 204.00 104.00)
+          (drawsContent 1)
+          (backingStoreAttached 1)
+          (visible rect 0.00, 0.00 204.00 x 104.00)
+          (coverage rect -8.00, -8.00 800.00 x 600.00)
+          (intersects coverage rect 1)
+          (contentsScale 2.00)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (backingStoreAttached 0)
+              (visible rect 0.00, 0.00 0.00 x 0.00)
+              (coverage rect -10.00, -10.00 800.00 x 600.00)
+              (intersects coverage rect 0)
+              (contentsScale 2.00)
+              (children 1
+                (GraphicsLayer
+                  (anchor 0.00 0.00)
+                  (bounds 200.00 100.00)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 200.00 x 100.00)
+                  (coverage rect 0.00, 0.00 200.00 x 100.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 2.00)
+                  (children 1
+                    (GraphicsLayer
+                      (backingStoreAttached 0)
+                      (visible rect 0.00, 0.00 0.00 x 0.00)
+                      (coverage rect 0.00, 0.00 200.00 x 100.00)
+                      (intersects coverage rect 0)
+                      (contentsScale 2.00)
+                      (children 1
+                        (GraphicsLayer
+                          (anchor 0.00 0.00)
+                          (bounds 408.00 316.00)
+                          (backingStoreAttached 1)
+                          (visible rect 0.00, 0.00 200.00 x 100.00)
+                          (coverage rect 0.00, 0.00 200.00 x 100.00)
+                          (intersects coverage rect 1)
+                          (contentsScale 2.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 408.00 316.00)
+                              (drawsContent 1)
+                              (backgroundColor #FFFFFF)
+                              (backingStoreAttached 1)
+                              (visible rect 0.00, 0.00 200.00 x 100.00)
+                              (coverage rect 0.00, 0.00 200.00 x 100.00)
+                              (intersects coverage rect 1)
+                              (contentsScale 2.00)
+                              (tile cache coverage 0, 0 408 x 316)
+                              (tile size 512 x 512)
+                              (top left tile 0, 0 tiles grid 1 x 1)
+                              (in window 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (backingStoreAttached 0)
+                                  (visible rect 0.00, 0.00 0.00 x 0.00)
+                                  (coverage rect 0.00, 0.00 200.00 x 100.00)
+                                  (intersects coverage rect 0)
+                                  (contentsScale 2.00)
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
diff --git a/LayoutTests/platform/mac-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt b/LayoutTests/platform/mac-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt
new file mode 100644 (file)
index 0000000..b09eebe
--- /dev/null
@@ -0,0 +1,134 @@
+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (backingStoreAttached 1)
+  (visible rect 0.00, 0.00 800.00 x 600.00)
+  (coverage rect 0.00, 0.00 800.00 x 600.00)
+  (intersects coverage rect 1)
+  (contentsScale 1.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (backingStoreAttached 1)
+      (visible rect 0.00, 0.00 800.00 x 600.00)
+      (coverage rect 0.00, 0.00 800.00 x 600.00)
+      (intersects coverage rect 1)
+      (contentsScale 1.00)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 204.00 104.00)
+          (drawsContent 1)
+          (backingStoreAttached 1)
+          (visible rect 0.00, 0.00 204.00 x 104.00)
+          (coverage rect -8.00, -8.00 800.00 x 600.00)
+          (intersects coverage rect 1)
+          (contentsScale 1.00)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (backingStoreAttached 0)
+              (visible rect 0.00, 0.00 0.00 x 0.00)
+              (coverage rect -10.00, -10.00 800.00 x 600.00)
+              (intersects coverage rect 0)
+              (contentsScale 1.00)
+              (children 4
+                (GraphicsLayer
+                  (anchor 0.00 0.00)
+                  (bounds 185.00 85.00)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 185.00 x 85.00)
+                  (coverage rect 0.00, 0.00 185.00 x 85.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 1.00)
+                  (children 1
+                    (GraphicsLayer
+                      (backingStoreAttached 0)
+                      (visible rect 0.00, 0.00 0.00 x 0.00)
+                      (coverage rect 0.00, 0.00 185.00 x 85.00)
+                      (intersects coverage rect 0)
+                      (contentsScale 1.00)
+                      (children 1
+                        (GraphicsLayer
+                          (anchor 0.00 0.00)
+                          (bounds 408.00 316.00)
+                          (backingStoreAttached 1)
+                          (visible rect 0.00, 0.00 185.00 x 85.00)
+                          (coverage rect 0.00, 0.00 185.00 x 85.00)
+                          (intersects coverage rect 1)
+                          (contentsScale 1.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 408.00 316.00)
+                              (drawsContent 1)
+                              (backgroundColor #FFFFFF)
+                              (backingStoreAttached 1)
+                              (visible rect 0.00, 0.00 185.00 x 85.00)
+                              (coverage rect 0.00, 0.00 185.00 x 85.00)
+                              (intersects coverage rect 1)
+                              (contentsScale 1.00)
+                              (tile cache coverage 0, 0 408 x 316)
+                              (tile size 512 x 512)
+                              (top left tile 0, 0 tiles grid 1 x 1)
+                              (in window 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (backingStoreAttached 0)
+                                  (visible rect 0.00, 0.00 0.00 x 0.00)
+                                  (coverage rect 0.00, 0.00 185.00 x 85.00)
+                                  (intersects coverage rect 0)
+                                  (contentsScale 1.00)
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+                (GraphicsLayer
+                  (position 0.00 85.00)
+                  (bounds 185.00 15.00)
+                  (drawsContent 1)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 185.00 x 15.00)
+                  (coverage rect -10.00, -95.00 800.00 x 600.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 1.00)
+                )
+                (GraphicsLayer
+                  (position 185.00 0.00)
+                  (bounds 15.00 85.00)
+                  (drawsContent 1)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 15.00 x 85.00)
+                  (coverage rect -195.00, -10.00 800.00 x 600.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 1.00)
+                )
+                (GraphicsLayer
+                  (position 185.00 85.00)
+                  (bounds 15.00 15.00)
+                  (drawsContent 1)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 15.00 x 15.00)
+                  (coverage rect -195.00, -95.00 800.00 x 600.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 1.00)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
index 2480a87..c93ba07 100644 (file)
@@ -1,3 +1,22 @@
+2017-09-05  Frederic Wang  <fwang@igalia.com>
+
+        Use TilesBacking for iframes when async frame scrolling is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=173644
+
+        Reviewed by Simon Fraser.
+
+        This patch adds creation of TilesBacking for non-main frames when async frame scrolling is
+        enabled. RenderLayerBacking::m_isMainFrameLayerWithTiledBacking is also renamed to reflect
+        that tiled backing is not exclusive to the main frame. More adjustments might be needed for
+        non-main frames and will be handled in follow-up commits.
+
+        Test: compositing/tiling/tiled-drawing-async-frame-scrolling.html
+
+        * rendering/RenderLayerBacking.cpp: Rename m_isMainFrameLayerWithTiledBacking
+        * rendering/RenderLayerBacking.h: Rename isMainFrameLayerWithTiledBacking and
+        m_isMainFrameLayerWithTiledBacking.
+        * rendering/RenderLayerCompositor.cpp: Use isFrameLayerWithTiledBacking
+
 2017-09-05  Zan Dobersek  <zdobersek@igalia.com>
 
         HTMLMediaElement: attach any existing EME CDMInstance in mediaEngineWasUpdated()
index 0161ca5..3fa7540 100644 (file)
@@ -211,7 +211,7 @@ RenderLayerBacking::RenderLayerBacking(RenderLayer& layer)
 {
     if (layer.isRootLayer()) {
         m_isMainFrameRenderViewLayer = renderer().frame().isMainFrame();
-        m_isMainFrameLayerWithTiledBacking = renderer().page().chrome().client().shouldUseTiledBackingForFrameView(renderer().view().frameView());
+        m_isFrameLayerWithTiledBacking = renderer().page().chrome().client().shouldUseTiledBackingForFrameView(renderer().view().frameView());
     }
     
     createPrimaryGraphicsLayer();
@@ -219,7 +219,7 @@ RenderLayerBacking::RenderLayerBacking(RenderLayer& layer)
     if (TiledBacking* tiledBacking = this->tiledBacking()) {
         tiledBacking->setIsInWindow(renderer().page().isInWindow());
 
-        if (m_isMainFrameLayerWithTiledBacking) {
+        if (m_isFrameLayerWithTiledBacking) {
             tiledBacking->setScrollingPerformanceLoggingEnabled(renderer().settings().scrollingPerformanceLoggingEnabled());
             adjustTiledBackingCoverage();
         }
@@ -322,7 +322,7 @@ static TiledBacking::TileCoverage computePageTiledBackingCoverage(RenderLayerBac
 
 void RenderLayerBacking::adjustTiledBackingCoverage()
 {
-    if (!m_isMainFrameLayerWithTiledBacking)
+    if (!m_isFrameLayerWithTiledBacking)
         return;
 
     TiledBacking::TileCoverage tileCoverage = computePageTiledBackingCoverage(this);
@@ -331,7 +331,7 @@ void RenderLayerBacking::adjustTiledBackingCoverage()
 
 void RenderLayerBacking::setTiledBackingHasMargins(bool hasExtendedBackgroundOnLeftAndRight, bool hasExtendedBackgroundOnTopAndBottom)
 {
-    if (!m_isMainFrameLayerWithTiledBacking)
+    if (!m_isFrameLayerWithTiledBacking)
         return;
 
     tiledBacking()->setHasMargins(hasExtendedBackgroundOnTopAndBottom, hasExtendedBackgroundOnTopAndBottom, hasExtendedBackgroundOnLeftAndRight, hasExtendedBackgroundOnLeftAndRight);
@@ -389,9 +389,9 @@ void RenderLayerBacking::createPrimaryGraphicsLayer()
         layerName.truncate(maxLayerNameLength);
         layerName.append("...");
     }
-    m_graphicsLayer = createGraphicsLayer(layerName, m_isMainFrameLayerWithTiledBacking ? GraphicsLayer::Type::PageTiledBacking : GraphicsLayer::Type::Normal);
+    m_graphicsLayer = createGraphicsLayer(layerName, m_isFrameLayerWithTiledBacking ? GraphicsLayer::Type::PageTiledBacking : GraphicsLayer::Type::Normal);
 
-    if (m_isMainFrameLayerWithTiledBacking) {
+    if (m_isFrameLayerWithTiledBacking) {
         m_childContainmentLayer = createGraphicsLayer("Page TiledBacking containment");
         m_graphicsLayer->addChild(m_childContainmentLayer.get());
     }
@@ -566,7 +566,7 @@ bool RenderLayerBacking::shouldClipCompositedBounds() const
         return false;
 #endif
 
-    if (m_isMainFrameLayerWithTiledBacking)
+    if (m_isFrameLayerWithTiledBacking)
         return false;
 
     if (layerOrAncestorIsTransformedOrUsingCompositedScrolling(m_owningLayer))
@@ -1450,7 +1450,7 @@ bool RenderLayerBacking::updateDescendantClippingLayer(bool needsDescendantClip)
     bool layersChanged = false;
 
     if (needsDescendantClip) {
-        if (!m_childContainmentLayer && !m_isMainFrameLayerWithTiledBacking) {
+        if (!m_childContainmentLayer && !m_isFrameLayerWithTiledBacking) {
             m_childContainmentLayer = createGraphicsLayer("child clipping");
             m_childContainmentLayer->setMasksToBounds(true);
             layersChanged = true;
@@ -1959,7 +1959,7 @@ void RenderLayerBacking::updateDirectlyCompositedBackgroundImage(PaintedContents
 
 void RenderLayerBacking::updateRootLayerConfiguration()
 {
-    if (!m_isMainFrameLayerWithTiledBacking)
+    if (!m_isFrameLayerWithTiledBacking)
         return;
 
     Color backgroundColor;
@@ -2399,7 +2399,7 @@ bool RenderLayerBacking::paintsIntoWindow() const
         return false;
 #endif
 
-    if (m_isMainFrameLayerWithTiledBacking)
+    if (m_isFrameLayerWithTiledBacking)
         return false;
 
     if (m_owningLayer.isRootLayer()) {
@@ -3050,8 +3050,8 @@ TextStream& operator<<(TextStream& ts, const RenderLayerBacking& backing)
 {
     ts << "RenderLayerBacking " << &backing << " bounds " << backing.compositedBounds();
 
-    if (backing.isMainFrameLayerWithTiledBacking())
-        ts << " main tiled backing";
+    if (backing.isFrameLayerWithTiledBacking())
+        ts << " frame layer tiled backing";
     if (backing.paintsIntoWindow())
         ts << " paintsIntoWindow";
     if (backing.paintsIntoCompositedAncestor())
index 4676812..9ce00de 100644 (file)
@@ -88,8 +88,8 @@ public:
     GraphicsLayer* graphicsLayer() const { return m_graphicsLayer.get(); }
 
     // Layer to clip children
-    bool hasClippingLayer() const { return (m_childContainmentLayer && !m_isMainFrameLayerWithTiledBacking); }
-    GraphicsLayer* clippingLayer() const { return !m_isMainFrameLayerWithTiledBacking ? m_childContainmentLayer.get() : nullptr; }
+    bool hasClippingLayer() const { return (m_childContainmentLayer && !m_isFrameLayerWithTiledBacking); }
+    GraphicsLayer* clippingLayer() const { return !m_isFrameLayerWithTiledBacking ? m_childContainmentLayer.get() : nullptr; }
 
     // Layer to get clipped by ancestor
     bool hasAncestorClippingLayer() const { return m_ancestorClippingLayer != nullptr; }
@@ -182,7 +182,7 @@ public:
     void positionOverflowControlsLayers();
     bool hasUnpositionedOverflowControlsLayers() const;
 
-    bool isMainFrameLayerWithTiledBacking() const { return m_isMainFrameLayerWithTiledBacking; }
+    bool isFrameLayerWithTiledBacking() const { return m_isFrameLayerWithTiledBacking; }
 
     WEBCORE_EXPORT TiledBacking* tiledBacking() const;
     void adjustTiledBackingCoverage();
@@ -339,8 +339,8 @@ private:
 
     bool shouldClipCompositedBounds() const;
 
-    bool hasTiledBackingFlatteningLayer() const { return (m_childContainmentLayer && m_isMainFrameLayerWithTiledBacking); }
-    GraphicsLayer* tileCacheFlatteningLayer() const { return m_isMainFrameLayerWithTiledBacking ? m_childContainmentLayer.get() : nullptr; }
+    bool hasTiledBackingFlatteningLayer() const { return (m_childContainmentLayer && m_isFrameLayerWithTiledBacking); }
+    GraphicsLayer* tileCacheFlatteningLayer() const { return m_isFrameLayerWithTiledBacking ? m_childContainmentLayer.get() : nullptr; }
 
     void paintIntoLayer(const GraphicsLayer*, GraphicsContext&, const IntRect& paintDirtyRect, PaintBehavior, GraphicsLayerPaintingPhase);
 
@@ -381,7 +381,7 @@ private:
 
     bool m_artificiallyInflatedBounds { false }; // bounds had to be made non-zero to make transform-origin work
     bool m_isMainFrameRenderViewLayer { false };
-    bool m_isMainFrameLayerWithTiledBacking { false };
+    bool m_isFrameLayerWithTiledBacking { false };
     bool m_requiresOwnBackingStore { true };
     bool m_canCompositeFilters { false };
 #if ENABLE(FILTERS_LEVEL_2)
index 94ab7af..319dc5c 100644 (file)
@@ -1804,7 +1804,7 @@ void RenderLayerCompositor::frameViewDidLayout()
 void RenderLayerCompositor::rootFixedBackgroundsChanged()
 {
     RenderLayerBacking* renderViewBacking = m_renderView.layer()->backing();
-    if (renderViewBacking && renderViewBacking->isMainFrameLayerWithTiledBacking())
+    if (renderViewBacking && renderViewBacking->isFrameLayerWithTiledBacking())
         setCompositingLayersNeedRebuild();
 }
 
@@ -2916,7 +2916,7 @@ void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, Gr
 bool RenderLayerCompositor::supportsFixedRootBackgroundCompositing() const
 {
     RenderLayerBacking* renderViewBacking = m_renderView.layer()->backing();
-    return renderViewBacking && renderViewBacking->isMainFrameLayerWithTiledBacking();
+    return renderViewBacking && renderViewBacking->isFrameLayerWithTiledBacking();
 }
 
 bool RenderLayerCompositor::needsFixedRootBackgroundLayer(const RenderLayer& layer) const
@@ -3010,7 +3010,7 @@ bool RenderLayerCompositor::documentUsesTiledBacking() const
     if (!backing)
         return false;
 
-    return backing->isMainFrameLayerWithTiledBacking();
+    return backing->isFrameLayerWithTiledBacking();
 }
 
 bool RenderLayerCompositor::isMainFrameCompositor() const
index 53e873d..c1871b1 100644 (file)
@@ -1,3 +1,21 @@
+2017-09-05  Frederic Wang  <fwang@igalia.com>
+
+        Use TilesBacking for iframes when async frame scrolling is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=173644
+
+        Reviewed by Simon Fraser.
+
+        This patch adds creation of TilesBacking for non-main frames when async frame scrolling is
+        enabled. RenderLayerBacking::m_isMainFrameLayerWithTiledBacking is also renamed to reflect
+        that tiled backing is not exclusive to the main frame. More adjustments might be needed for
+        non-main frames and will be handled in follow-up commits.
+
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::shouldUseTiledBackingForFrameView): Also use tiled
+        backing when asyncFrameScrollingEnabled is true.
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView): Ditto.
+
 2017-09-05  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Rename PLUGIN_ARCHITECTURE(X11) as PLUGIN_ARCHITECTURE(UNIX)
index 6545cf2..e0fe4c1 100644 (file)
@@ -156,7 +156,7 @@ void RemoteLayerTreeDrawingArea::updateGeometry(const IntSize& viewSize, const I
 
 bool RemoteLayerTreeDrawingArea::shouldUseTiledBackingForFrameView(const FrameView& frameView)
 {
-    return frameView.frame().isMainFrame();
+    return frameView.frame().isMainFrame() || m_webPage.corePage()->settings().asyncFrameScrollingEnabled();
 }
 
 void RemoteLayerTreeDrawingArea::updatePreferences(const WebPreferencesStore&)
index d1ab442..0ddf3c9 100644 (file)
@@ -681,7 +681,7 @@ void TiledCoreAnimationDrawingArea::updateDebugInfoLayer(bool showLayer)
 
 bool TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView(const FrameView& frameView)
 {
-    return frameView.frame().isMainFrame();
+    return frameView.frame().isMainFrame() || m_webPage.corePage()->settings().asyncFrameScrollingEnabled();
 }
 
 PlatformCALayer* TiledCoreAnimationDrawingArea::layerForTransientZoom() const