[Mac] Use compositing for frames when ScrollingTreeIncludesFrames=true
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jun 2017 18:42:03 +0000 (18:42 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jun 2017 18:42:03 +0000 (18:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172851

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

Source/WebCore:

When fast frame scrolling is supported on mac (bug 171667), scrollable frames will require
special composited layer. This commit enables that on mac but only when
ScrollingTreeIncludesFrames=true, so that the default behavior is unchanged.

Test: compositing/iframes/compositing-for-scrollable-iframe.html

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame): Do not enable frame
compositing when ScrollingTreeIncludesFrames=false.
Rename ScrollableInnerFrameTrigger to ScrollableNonMainFrameTrigger.
* page/ChromeClient.h: Rename ScrollableInnerFrameTrigger.

Source/WebKit2:

When fast frame scrolling is supported on mac (bug 171667), scrollable frames will require
special composited layer. This commit enables that on mac but only when
ScrollingTreeIncludesFrames=true, so that the default behavior is unchanged.

* WebProcess/WebCoreSupport/WebChromeClient.h: Make scrollable inner frame trigger
compositing on Mac by default. This is ignored on mac when ScrollingTreeIncludesFrames=false.
Rename ScrollableInnerFrameTrigger to ScrollableNonMainFrameTrigger.

LayoutTests:

This commit adds a test to check whether scrollable iframes require a special composited
layer when ScrollingTreeIncludesFrames=true. This is currently only done on Mac WK2.

* compositing/iframes/compositing-for-scrollable-iframe.html: Added. This is a basic test
printing the layer tree of a page with an iframe.
* platform/ios-simulator/compositing/iframes/compositing-for-scrollable-iframe-expected.txt: Added.
* platform/mac/compositing/iframes/compositing-for-scrollable-iframe-expected.txt: Added.
* platform/mac-wk1/compositing/iframes/compositing-for-scrollable-iframe-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/compositing/iframes/compositing-for-scrollable-iframe.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator/compositing/iframes/compositing-for-scrollable-iframe-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk1/compositing/iframes/compositing-for-scrollable-iframe-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/compositing/iframes/compositing-for-scrollable-iframe-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/ChromeClient.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

index 35890a5..9252321 100644 (file)
@@ -1,3 +1,19 @@
+2017-06-02  Frederic Wang  <fwang@igalia.com>
+
+        [Mac] Use compositing for frames when ScrollingTreeIncludesFrames=true
+        https://bugs.webkit.org/show_bug.cgi?id=172851
+
+        Reviewed by Simon Fraser.
+
+        This commit adds a test to check whether scrollable iframes require a special composited
+        layer when ScrollingTreeIncludesFrames=true. This is currently only done on Mac WK2.
+
+        * compositing/iframes/compositing-for-scrollable-iframe.html: Added. This is a basic test
+        printing the layer tree of a page with an iframe.
+        * platform/ios-simulator/compositing/iframes/compositing-for-scrollable-iframe-expected.txt: Added.
+        * platform/mac/compositing/iframes/compositing-for-scrollable-iframe-expected.txt: Added.
+        * platform/mac-wk1/compositing/iframes/compositing-for-scrollable-iframe-expected.txt: Added.
+
 2017-06-02  Andy Estes  <aestes@apple.com>
 
         [Cocoa] Add a "supportedCountries" property to ApplePayPaymentRequest
diff --git a/LayoutTests/compositing/iframes/compositing-for-scrollable-iframe.html b/LayoutTests/compositing/iframes/compositing-for-scrollable-iframe.html
new file mode 100644 (file)
index 0000000..71a09ea
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Check whether scrollable iframes require compositing when they are included in the scrolling tree</title>
+    <script>
+      if (window.internals)
+          window.internals.settings.setScrollingTreeIncludesFrames(true);
+    </script>
+  </head>
+  <body>
+    <iframe id="frame" style="width: 100px; height: 200px; border: 1px solid black;" src="data:text/html,<div style='width: 300px; height: 400px; background: gray;'></div>"></iframe>
+  </body>
+</html>
diff --git a/LayoutTests/platform/ios-simulator/compositing/iframes/compositing-for-scrollable-iframe-expected.txt b/LayoutTests/platform/ios-simulator/compositing/iframes/compositing-for-scrollable-iframe-expected.txt
new file mode 100644 (file)
index 0000000..0c0effd
--- /dev/null
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x223
+  RenderBlock {HTML} at (0,0) size 800x223
+    RenderBody {BODY} at (8,8) size 784x207
+      RenderPartObject {IFRAME} at (0,0) size 102x202 [border: (1px solid #000000)]
+        layer at (0,0) size 308x416
+          RenderView at (0,0) size 100x200
+        layer at (0,0) size 100x416
+          RenderBlock {HTML} at (0,0) size 100x416
+            RenderBody {BODY} at (8,8) size 84x400
+              RenderBlock {DIV} at (0,0) size 300x400 [bgcolor=#808080]
+      RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac-wk1/compositing/iframes/compositing-for-scrollable-iframe-expected.txt b/LayoutTests/platform/mac-wk1/compositing/iframes/compositing-for-scrollable-iframe-expected.txt
new file mode 100644 (file)
index 0000000..9c6025c
--- /dev/null
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x222
+  RenderBlock {HTML} at (0,0) size 800x222
+    RenderBody {BODY} at (8,8) size 784x206
+      RenderIFrame {IFRAME} at (0,0) size 102x202 [border: (1px solid #000000)]
+        layer at (0,0) size 308x416
+          RenderView at (0,0) size 85x185
+        layer at (0,0) size 85x416
+          RenderBlock {HTML} at (0,0) size 85x416
+            RenderBody {BODY} at (8,8) size 69x400
+              RenderBlock {DIV} at (0,0) size 300x400 [bgcolor=#808080]
+      RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/compositing/iframes/compositing-for-scrollable-iframe-expected.txt b/LayoutTests/platform/mac/compositing/iframes/compositing-for-scrollable-iframe-expected.txt
new file mode 100644 (file)
index 0000000..20f80b3
--- /dev/null
@@ -0,0 +1,14 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x222
+  RenderBlock {HTML} at (0,0) size 800x222
+    RenderBody {BODY} at (8,8) size 784x206
+      RenderText {#text} at (0,0) size 0x0
+layer at (8,8) size 102x202
+  RenderIFrame {IFRAME} at (0,0) size 102x202 [border: (1px solid #000000)]
+    layer at (0,0) size 308x416
+      RenderView at (0,0) size 85x185
+    layer at (0,0) size 85x416
+      RenderBlock {HTML} at (0,0) size 85x416
+        RenderBody {BODY} at (8,8) size 69x400
+          RenderBlock {DIV} at (0,0) size 300x400 [bgcolor=#808080]
index 980f620..3bc2852 100644 (file)
@@ -1,3 +1,22 @@
+2017-06-02  Frederic Wang  <fwang@igalia.com>
+
+        [Mac] Use compositing for frames when ScrollingTreeIncludesFrames=true
+        https://bugs.webkit.org/show_bug.cgi?id=172851
+
+        Reviewed by Simon Fraser.
+
+        When fast frame scrolling is supported on mac (bug 171667), scrollable frames will require
+        special composited layer. This commit enables that on mac but only when
+        ScrollingTreeIncludesFrames=true, so that the default behavior is unchanged.
+
+        Test: compositing/iframes/compositing-for-scrollable-iframe.html
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame): Do not enable frame
+        compositing when ScrollingTreeIncludesFrames=false.
+        Rename ScrollableInnerFrameTrigger to ScrollableNonMainFrameTrigger.
+        * page/ChromeClient.h: Rename ScrollableInnerFrameTrigger.
+
 2017-06-02  Simon Fraser  <simon.fraser@apple.com>
 
         Get <chrono> out of StdLibExtras.h
index 01ae409..ebf0c4f 100644 (file)
@@ -318,7 +318,7 @@ public:
         CanvasTrigger = 1 << 3,
         AnimationTrigger = 1 << 4,
         FilterTrigger = 1 << 5,
-        ScrollableInnerFrameTrigger = 1 << 6,
+        ScrollableNonMainFrameTrigger = 1 << 6,
         AnimatedOpacityTrigger = 1 << 7,
         AllTriggers = 0xFFFFFFFF
     };
index 1ff136a..ac6eee7 100644 (file)
@@ -2469,7 +2469,12 @@ bool RenderLayerCompositor::requiresCompositingForScrollableFrame() const
     if (isMainFrameCompositor())
         return false;
 
-    if (!(m_compositingTriggers & ChromeClient::ScrollableInnerFrameTrigger))
+#if PLATFORM(MAC)
+    if (!m_renderView.settings().scrollingTreeIncludesFrames())
+        return false;
+#endif
+
+    if (!(m_compositingTriggers & ChromeClient::ScrollableNonMainFrameTrigger))
         return false;
 
     // Need this done first to determine overflow.
index 6f3b70d..08fd1b7 100644 (file)
@@ -1,3 +1,18 @@
+2017-06-02  Frederic Wang  <fwang@igalia.com>
+
+        [Mac] Use compositing for frames when ScrollingTreeIncludesFrames=true
+        https://bugs.webkit.org/show_bug.cgi?id=172851
+
+        Reviewed by Simon Fraser.
+
+        When fast frame scrolling is supported on mac (bug 171667), scrollable frames will require
+        special composited layer. This commit enables that on mac but only when
+        ScrollingTreeIncludesFrames=true, so that the default behavior is unchanged.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.h: Make scrollable inner frame trigger
+        compositing on Mac by default. This is ignored on mac when ScrollingTreeIncludesFrames=false.
+        Rename ScrollableInnerFrameTrigger to ScrollableNonMainFrameTrigger.
+
 2017-06-02  Zalan Bujtas  <zalan@apple.com>
 
         Allow clients to override viewport size for CSS viewport units.
index 8787d0e..966e1ab 100644 (file)
@@ -225,6 +225,9 @@ private:
             VideoTrigger |
             PluginTrigger|
             CanvasTrigger |
+#if PLATFORM(MAC)
+            ScrollableNonMainFrameTrigger |
+#endif
 #if PLATFORM(IOS)
             AnimatedOpacityTrigger | // Allow opacity animations to trigger compositing mode for iPhone: <rdar://problem/7830677>
 #endif