Title: [217472] trunk
Revision
217472
Author
[email protected]
Date
2017-05-25 20:53:24 -0700 (Thu, 25 May 2017)

Log Message

Frame's composited content is visible when the frame has visibility: hidden.
https://bugs.webkit.org/show_bug.cgi?id=125565
<rdar://problem/32196849>

Reviewed by Simon Fraser.

Source/WebCore:

Do not construct composited layers for hidden RenderWidgets (frameset, iframe, object).
Note that we still construct layers for the associated renderers as usual.

Tests: compositing/visibility/frameset-visibility-hidden.html
       compositing/visibility/iframe-visibility-hidden.html
       compositing/visibility/object-visibility-hidden.html

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForPlugin):
(WebCore::RenderLayerCompositor::requiresCompositingForFrame):

LayoutTests:

* compositing/resources/visibility.html: Added.
* compositing/visibility/frameset-visibility-hidden-expected.html: Added.
* compositing/visibility/frameset-visibility-hidden.html: Added.
* compositing/visibility/iframe-visibility-hidden-expected.html: Added.
* compositing/visibility/iframe-visibility-hidden.html: Added.
* compositing/visibility/object-visibility-hidden-expected.html: Added.
* compositing/visibility/object-visibility-hidden.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (217471 => 217472)


--- trunk/LayoutTests/ChangeLog	2017-05-26 02:58:11 UTC (rev 217471)
+++ trunk/LayoutTests/ChangeLog	2017-05-26 03:53:24 UTC (rev 217472)
@@ -1,3 +1,19 @@
+2017-05-25  Zalan Bujtas  <[email protected]>
+
+        Frame's composited content is visible when the frame has visibility: hidden.
+        https://bugs.webkit.org/show_bug.cgi?id=125565
+        <rdar://problem/32196849>
+
+        Reviewed by Simon Fraser.
+
+        * compositing/resources/visibility.html: Added.
+        * compositing/visibility/frameset-visibility-hidden-expected.html: Added.
+        * compositing/visibility/frameset-visibility-hidden.html: Added.
+        * compositing/visibility/iframe-visibility-hidden-expected.html: Added.
+        * compositing/visibility/iframe-visibility-hidden.html: Added.
+        * compositing/visibility/object-visibility-hidden-expected.html: Added.
+        * compositing/visibility/object-visibility-hidden.html: Added.
+
 2017-05-25  Brent Fulgham  <[email protected]>
 
         Gracefully handle missing localStorage support in results.html

Added: trunk/LayoutTests/compositing/resources/visibility.html (0 => 217472)


--- trunk/LayoutTests/compositing/resources/visibility.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/resources/visibility.html	2017-05-26 03:53:24 UTC (rev 217472)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests visibility with frames and objects.</title>
+<style>
+div {
+    will-change: transform;
+    width: 50px;
+    height: 50px;
+    background-color: green;
+}
+</style>
+</head>
+<body>
+<div></div>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/visibility/frameset-visibility-hidden-expected.html (0 => 217472)


--- trunk/LayoutTests/compositing/visibility/frameset-visibility-hidden-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/visibility/frameset-visibility-hidden-expected.html	2017-05-26 03:53:24 UTC (rev 217472)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests frames with visibility hidden</title>
+<style>
+div {
+	will-change: transform;
+	width: 50px;
+	height: 50px;
+	background-color: green;
+}
+</style>
+</head>
+<body>
+<div></div>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/visibility/frameset-visibility-hidden.html (0 => 217472)


--- trunk/LayoutTests/compositing/visibility/frameset-visibility-hidden.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/visibility/frameset-visibility-hidden.html	2017-05-26 03:53:24 UTC (rev 217472)
@@ -0,0 +1,6 @@
+<frameset cols="100, 100, 100, *">
+  <frame noresize frameborder=no src="" style='will-change: transform; width: 50px; height: 50px; background-color: green;'><div style='visibility: visible;'></div>">
+  <frame noresize frameborder=no style="visibility: hidden" src="" style='will-change: transform; width: 50px; height: 50px; background-color: red;'><div style='visibility: visible;'></div>">
+  <frame noresize frameborder=no style="visibility: hidden" src="" style='will-change: transform; width: 50px; height: 50px; background-color: red;'><div style='visibility: hidden;'></div>">
+  <frame noresize frameborder=no style="visibility: collapse" src="" style='will-change: transform; width: 50px; height: 50px; background-color: red;'><div style='visibility: visible;'></div>">
+</frameset>

Added: trunk/LayoutTests/compositing/visibility/iframe-visibility-hidden-expected.html (0 => 217472)


--- trunk/LayoutTests/compositing/visibility/iframe-visibility-hidden-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/visibility/iframe-visibility-hidden-expected.html	2017-05-26 03:53:24 UTC (rev 217472)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests iframe with visibility hidden</title>
+<style>
+div {
+    margin: 8px;
+    margin-right: 26px;
+    width: 50px;
+    height: 50px;
+    background-color: green;
+    display: inline-block;
+}
+
+.positioned {
+    position: absolute;
+    left: 80px;
+    top: 8px;
+}
+</style>
+</head>
+<body>
+<div></div><div class=positioned></div>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/visibility/iframe-visibility-hidden.html (0 => 217472)


--- trunk/LayoutTests/compositing/visibility/iframe-visibility-hidden.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/visibility/iframe-visibility-hidden.html	2017-05-26 03:53:24 UTC (rev 217472)
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests iframe with visibility hidden</title>
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+var iframe1IsVisible = false;
+var iframe2IsVisible = false;
+
+function makeiframe1Visible()
+{
+    document.getElementById("iframe1").style.visibility = "visible";
+    iframe1IsVisible = true;
+    elementIsVisibleNow();
+}
+
+function makeiframe2Visible()
+{
+    document.getElementById("iframe2").style.visibility = "visible";
+    iframe2IsVisible = true;
+    elementIsVisibleNow();
+}
+
+function elementIsVisibleNow()
+{
+    if (!iframe1IsVisible || !iframe2IsVisible)
+        return;
+    document.body.offsetHeight;
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+</script>
+<style>
+#iframe2 {
+    position: absolute;
+    left: 80px;
+    top: 8px;
+}
+</style>
+</head>
+<body>
+<iframe frameborder=no id=iframe1 _onload_="makeiframe1Visible()" width="80" height="80" style="visibility: hidden"
+    srcdoc="<div style='will-change: transform; width: 50px; height: 50px; background-color: green;'>
+          <div style='visibility: visible;'></div>
+        </div>">
+</iframe>
+<iframe frameborder=no id=iframe2 _onload_="makeiframe2Visible()" width="80" height="80" style="visibility: hidden"
+    srcdoc="
+        <video style='width: 50px; height: 50px; background-color: green;'>
+            <source src='' type='video/mp4'>
+        </video>">
+</iframe>
+<iframe frameborder=no width="80" height="80" style="visibility: hidden"
+    srcdoc="<div style='will-change: transform; width: 50px; height: 50px; background-color: red;'>
+          <div style='visibility: visible;'></div>
+        </div>">
+</iframe>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/visibility/object-visibility-hidden-expected.html (0 => 217472)


--- trunk/LayoutTests/compositing/visibility/object-visibility-hidden-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/visibility/object-visibility-hidden-expected.html	2017-05-26 03:53:24 UTC (rev 217472)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests object with visibility hidden</title>
+<style>
+div {
+	will-change: transform;
+	width: 50px;
+	height: 50px;
+	margin: 16px 0px 0px 8px;
+	background-color: green;
+}
+</style>
+</head>
+<body>
+<div></div>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/visibility/object-visibility-hidden.html (0 => 217472)


--- trunk/LayoutTests/compositing/visibility/object-visibility-hidden.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/visibility/object-visibility-hidden.html	2017-05-26 03:53:24 UTC (rev 217472)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests object with visibility hidden</title>
+</head>
+<body>
+<object style="visibility: visible" data="" type="text/html" width="80" height="80"></object>
+<object style="visibility: collapse" data="" type="text/html" width="80" height="80"></object>
+<object style="visibility: hidden" data="" type="text/html" width="80" height="80"></object>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (217471 => 217472)


--- trunk/Source/WebCore/ChangeLog	2017-05-26 02:58:11 UTC (rev 217471)
+++ trunk/Source/WebCore/ChangeLog	2017-05-26 03:53:24 UTC (rev 217472)
@@ -1,3 +1,22 @@
+2017-05-25  Zalan Bujtas  <[email protected]>
+
+        Frame's composited content is visible when the frame has visibility: hidden.
+        https://bugs.webkit.org/show_bug.cgi?id=125565
+        <rdar://problem/32196849>
+
+        Reviewed by Simon Fraser.
+
+        Do not construct composited layers for hidden RenderWidgets (frameset, iframe, object).
+        Note that we still construct layers for the associated renderers as usual. 
+
+        Tests: compositing/visibility/frameset-visibility-hidden.html
+               compositing/visibility/iframe-visibility-hidden.html
+               compositing/visibility/object-visibility-hidden.html
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresCompositingForPlugin):
+        (WebCore::RenderLayerCompositor::requiresCompositingForFrame):
+
 2017-05-25  Yusuke Suzuki  <[email protected]>
 
         Unreviewed, build fix in GTK and WPE ports

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (217471 => 217472)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2017-05-26 02:58:11 UTC (rev 217471)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2017-05-26 03:53:24 UTC (rev 217472)
@@ -2551,6 +2551,9 @@
     m_reevaluateCompositingAfterLayout = true;
     
     RenderWidget& pluginRenderer = downcast<RenderWidget>(renderer);
+    if (pluginRenderer.style().visibility() != VISIBLE)
+        return false;
+
     // If we can't reliably know the size of the plugin yet, don't change compositing state.
     if (pluginRenderer.needsLayout())
         return pluginRenderer.isComposited();
@@ -2566,6 +2569,9 @@
         return false;
 
     auto& frameRenderer = downcast<RenderWidget>(renderer);
+    if (frameRenderer.style().visibility() != VISIBLE)
+        return false;
+
     if (!frameRenderer.requiresAcceleratedCompositing())
         return false;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to