[iOS] Do not flatten frames when async frame scrolling is enabled
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Oct 2017 07:54:37 +0000 (07:54 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Oct 2017 07:54:37 +0000 (07:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=173704

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

Source/WebCore:

This patch disables frame flattening when async frame scrolling is enabled on iOS, as
otherwise you can not scroll them. Once iframe scrolling is implemented in iOS (bug 149264),
developers and beta testers will be able to check it by enabling "Async Frame Scrolling"
in the "Experimental WebKit Features" menu of Safari iOS.

Test: platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling.html

* page/FrameView.cpp:
(WebCore::FrameView::frameFlatteningEnabled): Use effectiveFrameFlattening()
* page/Settings.cpp:
(WebCore::Settings::effectiveFrameFlattening): New function to return frameFlattening() or do
some exceptions on iOS.
* page/Settings.h: Declare effectiveFrameFlattening.
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::flattenFrameSet): Use effectiveFrameFlattening()
* rendering/RenderIFrame.cpp:
(WebCore::RenderIFrame::flattenFrame): Ditto.
* rendering/RenderView.cpp:
(WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower): Ditto.

Source/WebKit:

This patch disables frame flattening when async frame scrolling is enabled on iOS, as
otherwise you can not scroll them. Once iframe scrolling is implemented in iOS (bug 149264),
developers and beta testers will be able to check it by enabling "Async Frame Scrolling"
in the "Experimental WebKit Features" menu of Safari iOS.

Test: platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling.html

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::contentsSizeChanged): Use effectiveFrameFlattening() introduced in
Source/WebCore.

LayoutTests:

Add an iOS test to verify that frame flattening is disabled when async frame scrolling is enabled.

* platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling-expected.txt: Added.
* platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling.html: Added.

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling-expected.txt [new file with mode: 0644]
LayoutTests/platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/rendering/RenderFrameSet.cpp
Source/WebCore/rendering/RenderIFrame.cpp
Source/WebCore/rendering/RenderView.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp

index 40e85a5..695958f 100644 (file)
@@ -1,3 +1,15 @@
+2017-09-27  Frederic Wang  <fwang@igalia.com>
+
+        [iOS] Do not flatten frames when async frame scrolling is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=173704
+
+        Reviewed by Simon Fraser.
+
+        Add an iOS test to verify that frame flattening is disabled when async frame scrolling is enabled.
+
+        * platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling-expected.txt: Added.
+        * platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling.html: Added.
+
 2017-10-10  Ryosuke Niwa  <rniwa@webkit.org>
 
         Enable custom pasteboard data in DumpRenderTree and WebKitTestRunner
diff --git a/LayoutTests/platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling-expected.txt b/LayoutTests/platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling-expected.txt
new file mode 100644 (file)
index 0000000..1e1fcae
--- /dev/null
@@ -0,0 +1,5 @@
+
+PASS simple iframe 
+PASS fullscreen iframe 
+
diff --git a/LayoutTests/platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling.html b/LayoutTests/platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling.html
new file mode 100644 (file)
index 0000000..96711b2
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>This tests frame flattening when async frame scrolling is enabled</title>
+    <meta charset="utf-8"/>
+    <script src="../../../../../resources/testharness.js"></script>
+    <script src="../../../../../resources/testharnessreport.js"></script>
+    <script>
+      if (window.internals) {
+        window.internals.settings.setFrameFlattening("FullyEnabled");
+        window.internals.settings.setAsyncFrameScrollingEnabled(true);
+      }
+
+      setup({explicit_done: true});
+      function isUnflatten(id) {
+        var iframe = document.getElementById(id);
+        var iframeBox = iframe.getBoundingClientRect();
+        var innerDivBox = iframe.contentDocument.body.firstElementChild.getBoundingClientRect();
+        return iframeBox.width < innerDivBox.width && iframeBox.height < innerDivBox.height;
+      }
+      function start() {
+        test(function() { assert_true(isUnflatten("iframe_simple")); }, "simple iframe");
+        test(function() { assert_true(isUnflatten("iframe_fullscreen")); }, "fullscreen iframe");
+        done();
+      }
+    </script>
+  </head>
+  <body onload="start()">
+    <iframe id="iframe_simple" style="background: blue; width: 50px; height: 50px;" scrolling="yes" srcdoc="&lt;div style='width: 1000px; height: 1000px;'&gt;&lt;/div&gt;"></iframe>
+    <iframe id="iframe_fullscreen" style="background: cyan; position: absolute; width: 100vw; height: 100vh;" scrolling="yes" srcdoc="&lt;div style='width: 1000px; height: 1000px;'&gt;&lt;/div&gt;"></iframe>
+  </body>
+</html>
index 9a05240..235cf97 100644 (file)
@@ -1,3 +1,30 @@
+2017-09-27  Frederic Wang  <fwang@igalia.com>
+
+        [iOS] Do not flatten frames when async frame scrolling is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=173704
+
+        Reviewed by Simon Fraser.
+
+        This patch disables frame flattening when async frame scrolling is enabled on iOS, as
+        otherwise you can not scroll them. Once iframe scrolling is implemented in iOS (bug 149264),
+        developers and beta testers will be able to check it by enabling "Async Frame Scrolling"
+        in the "Experimental WebKit Features" menu of Safari iOS.
+
+        Test: platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::frameFlatteningEnabled): Use effectiveFrameFlattening()
+        * page/Settings.cpp:
+        (WebCore::Settings::effectiveFrameFlattening): New function to return frameFlattening() or do
+        some exceptions on iOS.
+        * page/Settings.h: Declare effectiveFrameFlattening.
+        * rendering/RenderFrameSet.cpp:
+        (WebCore::RenderFrameSet::flattenFrameSet): Use effectiveFrameFlattening()
+        * rendering/RenderIFrame.cpp:
+        (WebCore::RenderIFrame::flattenFrame): Ditto.
+        * rendering/RenderView.cpp:
+        (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower): Ditto.
+
 2017-10-10  Xabier Rodriguez Calvar  <calvaris@igalia.com>
 
         [GStreamer] Fix double seek requested by downloadbuffer GStreamer element in webkibwebsrc
index 6d5e93f..e2b6619 100644 (file)
@@ -568,7 +568,7 @@ void FrameView::setMarginHeight(LayoutUnit h)
 
 bool FrameView::frameFlatteningEnabled() const
 {
-    return frame().settings().frameFlattening() != FrameFlatteningDisabled;
+    return frame().settings().effectiveFrameFlattening() != FrameFlatteningDisabled;
 }
 
 bool FrameView::isFrameFlatteningValidForThisFrame() const
index 129c6dc..4bc38c4 100644 (file)
@@ -441,6 +441,18 @@ void Settings::setForcePendingWebGLPolicy(bool forced)
     m_forcePendingWebGLPolicy = forced;
 }
 
+FrameFlattening Settings::effectiveFrameFlattening()
+{
+#if PLATFORM(IOS)
+    // On iOS when async frame scrolling is enabled, it does not make sense to use full frame flattening.
+    // In that case, we just consider that frame flattening is disabled. This allows people to test
+    // frame scrolling on iOS by enabling "Async Frame Scrolling" via the Safari menu.
+    if (asyncFrameScrollingEnabled() && frameFlattening() == FrameFlatteningFullyEnabled)
+        return FrameFlatteningDisabled;
+#endif
+    return frameFlattening();
+}
+
 void Settings::setPluginsEnabled(bool arePluginsEnabled)
 {
     if (m_arePluginsEnabled == arePluginsEnabled)
index 735f4ee..328a0b9 100644 (file)
@@ -334,6 +334,8 @@ public:
     WEBCORE_EXPORT void setForcePendingWebGLPolicy(bool);
     bool isForcePendingWebGLPolicy() const { return m_forcePendingWebGLPolicy; }
 
+    WEBCORE_EXPORT FrameFlattening effectiveFrameFlattening();
+
     WEBCORE_EXPORT static void setAllowsAnySSLCertificate(bool);
     static bool allowsAnySSLCertificate();
 
index a10f6bf..3ec12eb 100644 (file)
@@ -651,7 +651,7 @@ void RenderFrameSet::positionFramesWithFlattening()
 
 bool RenderFrameSet::flattenFrameSet() const
 {
-    return settings().frameFlattening() != FrameFlatteningDisabled;
+    return settings().effectiveFrameFlattening() != FrameFlatteningDisabled;
 }
 
 void RenderFrameSet::startResizing(GridAxis& axis, int position)
index 1ef0dd3..76bb567 100644 (file)
@@ -78,7 +78,7 @@ bool RenderIFrame::isFullScreenIFrame() const
 
 bool RenderIFrame::flattenFrame() const
 {
-    if (settings().frameFlattening() == FrameFlatteningDisabled)
+    if (settings().effectiveFrameFlattening() == FrameFlatteningDisabled)
         return false;
 
     if (style().width().isFixed() && style().height().isFixed()) {
@@ -89,7 +89,7 @@ bool RenderIFrame::flattenFrame() const
         if (style().width().value() <= 0 || style().height().value() <= 0)
             return false;
         // Do not flatten "fullscreen" iframes or they could become larger than the viewport.
-        if (settings().frameFlattening() <= FrameFlatteningEnabledForNonFullScreenIFrames && isFullScreenIFrame())
+        if (settings().effectiveFrameFlattening() <= FrameFlatteningEnabledForNonFullScreenIFrames && isFullScreenIFrame())
             return false;
     }
 
index d26f3a7..ce346b8 100644 (file)
@@ -59,7 +59,7 @@ namespace WebCore {
 struct FrameFlatteningLayoutDisallower {
     FrameFlatteningLayoutDisallower(FrameView& frameView)
         : m_frameView(frameView)
-        , m_disallowLayout(frameView.frame().settings().frameFlattening() != FrameFlatteningDisabled)
+        , m_disallowLayout(frameView.frame().settings().effectiveFrameFlattening() != FrameFlatteningDisabled)
     {
         if (m_disallowLayout)
             m_frameView.startDisallowingLayout();
index 5f5b291..1fdb8ce 100644 (file)
@@ -1,3 +1,21 @@
+2017-09-27  Frederic Wang  <fwang@igalia.com>
+
+        [iOS] Do not flatten frames when async frame scrolling is enabled
+        https://bugs.webkit.org/show_bug.cgi?id=173704
+
+        Reviewed by Simon Fraser.
+
+        This patch disables frame flattening when async frame scrolling is enabled on iOS, as
+        otherwise you can not scroll them. Once iframe scrolling is implemented in iOS (bug 149264),
+        developers and beta testers will be able to check it by enabling "Async Frame Scrolling"
+        in the "Experimental WebKit Features" menu of Safari iOS.
+
+        Test: platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling.html
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::contentsSizeChanged): Use effectiveFrameFlattening() introduced in
+        Source/WebCore.
+
 2017-10-10  Ryosuke Niwa  <rniwa@webkit.org>
 
         Enable custom pasteboard data in DumpRenderTree and WebKitTestRunner
index 4a6a3a1..aba932d 100644 (file)
@@ -566,7 +566,7 @@ PlatformPageClient WebChromeClient::platformPageClient() const
 
 void WebChromeClient::contentsSizeChanged(Frame& frame, const IntSize& size) const
 {
-    if (m_page.corePage()->settings().frameFlattening() == FrameFlatteningDisabled) {
+    if (m_page.corePage()->settings().effectiveFrameFlattening() == FrameFlatteningDisabled) {
         WebFrame* largestFrame = findLargestFrameInFrameSet(m_page);
         if (largestFrame != m_cachedFrameSetLargestFrame.get()) {
             m_cachedFrameSetLargestFrame = largestFrame;