Trigger a compositing update when video element is changing
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Jul 2019 23:36:28 +0000 (23:36 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Jul 2019 23:36:28 +0000 (23:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199522
<rdar://problem/47297159>

Reviewed by Simon Fraser.

Source/WebCore:

Test: compositing/video/video-update-rendering.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::contentChanged):

LayoutTests:

* compositing/video/video-update-rendering-expected.txt: Added.
* compositing/video/video-update-rendering.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/compositing/video/video-update-rendering-expected.txt [new file with mode: 0644]
LayoutTests/compositing/video/video-update-rendering.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerBacking.cpp

index d5b8dc2..76696ab 100644 (file)
@@ -1,3 +1,14 @@
+2019-07-05  Youenn Fablet  <youenn@apple.com> and Simon Fraser  <simon.fraser@apple.com>
+
+        Trigger a compositing update when video element is changing
+        https://bugs.webkit.org/show_bug.cgi?id=199522
+        <rdar://problem/47297159>
+
+        Reviewed by Simon Fraser.
+
+        * compositing/video/video-update-rendering-expected.txt: Added.
+        * compositing/video/video-update-rendering.html: Added.
+
 2019-07-05  Ryosuke Niwa  <rniwa@webkit.org>
 
         [iOS] Crash in WebKit::WebPage::positionInformation via Range::startPosition
 2019-07-05  Ryosuke Niwa  <rniwa@webkit.org>
 
         [iOS] Crash in WebKit::WebPage::positionInformation via Range::startPosition
diff --git a/LayoutTests/compositing/video/video-update-rendering-expected.txt b/LayoutTests/compositing/video/video-update-rendering-expected.txt
new file mode 100644 (file)
index 0000000..e71beb6
--- /dev/null
@@ -0,0 +1,4 @@
+
+
+PASS Refresh rendering when starting to play a video 
+
diff --git a/LayoutTests/compositing/video/video-update-rendering.html b/LayoutTests/compositing/video/video-update-rendering.html
new file mode 100644 (file)
index 0000000..5585e1e
--- /dev/null
@@ -0,0 +1,25 @@
+<!doctype html>
+<html>
+    <head>
+        <meta charset="utf-8">
+        <title>Video update rendering</title>
+        <script src="../../resources/testharness.js"></script>
+        <script src="../../resources/testharnessreport.js"></script>
+    </head>
+    <body>
+        <video id="video" muted playsinline preload="none"></video>
+        <script>
+video.src = "../resources/video." + (video.canPlayType("video/ogg") ? "ogv" : "mp4");
+
+promise_test(async () => {
+    assert_true(!!window.internals, "test requires internals");
+
+    await new Promise(resolve => window.onload = resolve);
+
+    internals.startTrackingCompositingUpdates();
+    await video.play();
+    assert_true(internals.compositingUpdateCount() > 1, "refreshing video rendering: " + internals.compositingUpdateCount());
+}, 'Refresh rendering when starting to play a video');
+        </script>
+    </body>
+</html>
index 008d69a..e56338d 100644 (file)
@@ -1,3 +1,16 @@
+2019-07-05  Youenn Fablet  <youenn@apple.com> and Simon Fraser  <simon.fraser@apple.com>
+
+        Trigger a compositing update when video element is changing
+        https://bugs.webkit.org/show_bug.cgi?id=199522
+        <rdar://problem/47297159>
+
+        Reviewed by Simon Fraser.
+
+        Test: compositing/video/video-update-rendering.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::contentChanged):
+
 2019-07-05  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         Unreviewed, fix -Wmisleading-indentation warning introduced in r246764
 2019-07-05  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         Unreviewed, fix -Wmisleading-indentation warning introduced in r246764
index 1b7f4bb..b2441ac 100644 (file)
@@ -2454,6 +2454,11 @@ void RenderLayerBacking::contentChanged(ContentChangeType changeType)
         return;
     }
 
         return;
     }
 
+    if (changeType == VideoChanged) {
+        compositor().scheduleCompositingLayerUpdate();
+        return;
+    }
+
     if ((changeType == BackgroundImageChanged) && canDirectlyCompositeBackgroundBackgroundImage(renderer().style()))
         m_owningLayer.setNeedsCompositingConfigurationUpdate();
 
     if ((changeType == BackgroundImageChanged) && canDirectlyCompositeBackgroundBackgroundImage(renderer().style()))
         m_owningLayer.setNeedsCompositingConfigurationUpdate();