Title: [177324] trunk
Revision
177324
Author
[email protected]
Date
2014-12-15 17:05:19 -0800 (Mon, 15 Dec 2014)

Log Message

Switching src of <video> with clipping layer results in empty black square.
https://bugs.webkit.org/show_bug.cgi?id=139650

Reviewed by Simon Fraser.

Source/WebCore:

Test: compositing/video-clip-change-src.html

When the contentsLayer changes after a contentsClippingLayer has already been created, make sure to parent the
new contentsLayer, as updateRects() will only reparent when first creating a contentsClippingLayer.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setContentsToPlatformLayer):

LayoutTests:

* compositing/video-clip-change-src-expected.html: Added.
* compositing/video-clip-change-src.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (177323 => 177324)


--- trunk/LayoutTests/ChangeLog	2014-12-16 00:51:31 UTC (rev 177323)
+++ trunk/LayoutTests/ChangeLog	2014-12-16 01:05:19 UTC (rev 177324)
@@ -1,3 +1,13 @@
+2014-12-15  Jer Noble  <[email protected]>
+
+        Switching src of <video> with clipping layer results in empty black square.
+        https://bugs.webkit.org/show_bug.cgi?id=139650
+
+        Reviewed by Simon Fraser.
+
+        * compositing/video-clip-change-src-expected.html: Added.
+        * compositing/video-clip-change-src.html: Added.
+
 2014-12-15  Ryosuke Niwa  <[email protected]>
 
         cloneNode(true) does not clone nested template elements' contents

Added: trunk/LayoutTests/compositing/video/video-clip-change-src-expected.html (0 => 177324)


--- trunk/LayoutTests/compositing/video/video-clip-change-src-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/video/video-clip-change-src-expected.html	2014-12-16 01:05:19 UTC (rev 177324)
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <title>Replacing Contents Clipped</title>
+    <script src=""
+    <script>
+    if (window.testRunner) {
+        window.testRunner.dumpAsText(true);
+        window.testRunner.waitUntilDone();
+    }
+
+    function runTest() {
+        var video = document.getElementsByTagName('video')[0];
+        video.addEventListener('canplaythrough', endTest);
+        video.src = "" '../../media/content/test');
+        video.load();
+    }
+
+    function endTest() {
+        if (window.testRunner)
+            setTimeout(function() { testRunner.notifyDone(); }, 150);
+    }
+    </script>
+    <style>
+    video { 
+        width: 200px;
+        height: 200px;
+        object-fit: cover;
+        background-color: red;
+    }
+    </style>
+</head>
+<body _onload_="runTest()">
+    <button _onclick_="runTest()">run test</button><br>
+    <video></video>
+</body>
\ No newline at end of file

Added: trunk/LayoutTests/compositing/video/video-clip-change-src.html (0 => 177324)


--- trunk/LayoutTests/compositing/video/video-clip-change-src.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/video/video-clip-change-src.html	2014-12-16 01:05:19 UTC (rev 177324)
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+    <title>Replacing Contents Clipped</title>
+    <script src=""
+    <script>
+    var callback;
+    var video;
+
+    if (window.testRunner) {
+        window.testRunner.dumpAsText(true);
+        window.testRunner.waitUntilDone();
+    }
+
+    function runTest() {
+        video = document.getElementsByTagName('video')[0];
+        video.addEventListener('canplaythrough', canplaythrough);
+        callback = switchSrc;
+        video.src = "" '../../media/content/counting');
+        video.load();
+    }
+
+    function canplaythrough() {
+        if (callback)
+            callback();
+    }
+
+    function switchSrc() {
+        callback = endTest;
+        video.src = "" '../../media/content/test');
+        video.load();
+    }
+
+    function endTest() {
+        if (window.testRunner)
+            setTimeout(function() { testRunner.notifyDone(); }, 150);
+    }
+    </script>
+    <style>
+    video { 
+        width: 200px;
+        height: 200px;
+        object-fit: cover;
+    }
+    </style>
+</head>
+<body _onload_="runTest()">
+    <button _onclick_="runTest()">run test</button><br>
+    <video></video>
+</body>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (177323 => 177324)


--- trunk/Source/WebCore/ChangeLog	2014-12-16 00:51:31 UTC (rev 177323)
+++ trunk/Source/WebCore/ChangeLog	2014-12-16 01:05:19 UTC (rev 177324)
@@ -1,3 +1,18 @@
+2014-12-15  Jer Noble  <[email protected]>
+
+        Switching src of <video> with clipping layer results in empty black square.
+        https://bugs.webkit.org/show_bug.cgi?id=139650
+
+        Reviewed by Simon Fraser.
+
+        Test: compositing/video-clip-change-src.html
+
+        When the contentsLayer changes after a contentsClippingLayer has already been created, make sure to parent the
+        new contentsLayer, as updateRects() will only reparent when first creating a contentsClippingLayer.
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::setContentsToPlatformLayer):
+
 2014-12-15  Beth Dakin  <[email protected]>
 
         Make lookup an immediate action instead of an action menu item

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (177323 => 177324)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2014-12-16 00:51:31 UTC (rev 177323)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2014-12-16 01:05:19 UTC (rev 177324)
@@ -933,6 +933,9 @@
     if (m_contentsLayer && platformLayer == m_contentsLayer->platformLayer())
         return;
 
+    if (m_contentsClippingLayer && m_contentsLayer)
+        m_contentsLayer->removeFromSuperlayer();
+
     // FIXME: The passed in layer might be a raw layer or an externally created
     // PlatformCALayer. To determine this we attempt to get the
     // PlatformCALayer pointer. If this returns a null pointer we assume it's
@@ -944,6 +947,9 @@
     m_contentsLayer = platformLayer ? (platformCALayer ? platformCALayer : createPlatformCALayer(platformLayer, this)) : nullptr;
     m_contentsLayerPurpose = platformLayer ? purpose : NoContentsLayer;
 
+    if (m_contentsClippingLayer && m_contentsLayer)
+        m_contentsClippingLayer->appendSublayer(*m_contentsLayer);
+
     noteSublayersChanged();
     noteLayerPropertyChanged(ContentsPlatformLayerChanged);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to