Title: [289108] trunk
Revision
289108
Author
svil...@igalia.com
Date
2022-02-04 03:58:52 -0800 (Fri, 04 Feb 2022)

Log Message

HTMLMediaElement should dispatch the resize event asynchronously
https://bugs.webkit.org/show_bug.cgi?id=230895

Reviewed by Darin Adler.

Source/WebCore:

The HTMLMediaElement is currently queueing a task to dispatch the resize event in the post layout phase.
There is no need to run it synchronously and we could move it to another queue were it will be run
asynchronously as it was done for other similar tasks in the past.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::layoutSizeChanged):

LayoutTests:

* media/modern-media-controls/media-controller/media-controller-resize.html: Remove the event
listener to avoid an extra notification.
* platform/mac/TestExpectations: Unskipped tests that pass now.
* platform/wincairo/TestExpectations: Ditto.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (289107 => 289108)


--- trunk/LayoutTests/ChangeLog	2022-02-04 08:14:08 UTC (rev 289107)
+++ trunk/LayoutTests/ChangeLog	2022-02-04 11:58:52 UTC (rev 289108)
@@ -1,3 +1,15 @@
+2022-02-04  Sergio Villar Senin  <svil...@igalia.com>
+
+        HTMLMediaElement should dispatch the resize event asynchronously
+        https://bugs.webkit.org/show_bug.cgi?id=230895
+
+        Reviewed by Darin Adler.
+
+        * media/modern-media-controls/media-controller/media-controller-resize.html: Remove the event
+        listener to avoid an extra notification.
+        * platform/mac/TestExpectations: Unskipped tests that pass now.
+        * platform/wincairo/TestExpectations: Ditto.
+
 2022-02-03  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Two bopomofo tone marks are not moved to the correct place in vertical text with a particular bopomofo font

Modified: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-resize.html (289107 => 289108)


--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-resize.html	2022-02-04 08:14:08 UTC (rev 289107)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-resize.html	2022-02-04 11:58:52 UTC (rev 289108)
@@ -16,16 +16,19 @@
 shouldBeEqualToString("mediaControls.style.width", "320px");
 shouldBeEqualToString("mediaControls.style.height", "240px");
 
-shadowRoot.addEventListener("resize", () => {
+function testResize() {
     shouldBeEqualToString("mediaControls.style.width", "400px");
     shouldBeEqualToString("mediaControls.style.height", "300px");
+    shadowRoot.removeEventListener("resize", testResize);
     setTimeout(() => {
         debug("");
         media.remove();
         finishJSTest();
     });
-});
+}
 
+shadowRoot.addEventListener("resize", testResize);
+
 debug("");
 debug("Resizing to 400x300");
 media.style.width = "400px";

Modified: trunk/LayoutTests/platform/mac/TestExpectations (289107 => 289108)


--- trunk/LayoutTests/platform/mac/TestExpectations	2022-02-04 08:14:08 UTC (rev 289107)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2022-02-04 11:58:52 UTC (rev 289108)
@@ -2082,8 +2082,6 @@
 # @counter-style WPT failures specific to Mac platforms
 [ Mojave Catalina ] imported/w3c/web-platform-tests/css/css-counter-styles/lower-armenian/css3-counter-styles-112.html [ ImageOnlyFailure ]
 
-webkit.org/b/222185 media/media-extension-with-fragment.html [ Crash ]
-
 webkit.org/b/222205 css3/calc/transforms-translate.html [ Pass ImageOnlyFailure ]
 
 webkit.org/b/222422 imported/w3c/web-platform-tests/media-source/mediasource-duration.html [ Pass Failure Slow ]

Modified: trunk/LayoutTests/platform/wincairo/TestExpectations (289107 => 289108)


--- trunk/LayoutTests/platform/wincairo/TestExpectations	2022-02-04 08:14:08 UTC (rev 289107)
+++ trunk/LayoutTests/platform/wincairo/TestExpectations	2022-02-04 11:58:52 UTC (rev 289108)
@@ -241,7 +241,6 @@
 media/track/in-band/track-in-band-srt-mkv-language.html [ Skip ]
 media/track/in-band/track-in-band-srt-mkv-track-order.html [ Skip ]
 media/invalid-media-url-crash.html [ Skip ]
-media/media-extension-with-fragment.html [ Skip ]
 
 # VIDEO_PRESENTATION_MODE is disabled
 media/media-fullscreen-not-in-document.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (289107 => 289108)


--- trunk/Source/WebCore/ChangeLog	2022-02-04 08:14:08 UTC (rev 289107)
+++ trunk/Source/WebCore/ChangeLog	2022-02-04 11:58:52 UTC (rev 289108)
@@ -1,3 +1,17 @@
+2022-02-04  Sergio Villar Senin  <svil...@igalia.com>
+
+        HTMLMediaElement should dispatch the resize event asynchronously
+        https://bugs.webkit.org/show_bug.cgi?id=230895
+
+        Reviewed by Darin Adler.
+
+        The HTMLMediaElement is currently queueing a task to dispatch the resize event in the post layout phase.
+        There is no need to run it synchronously and we could move it to another queue were it will be run
+        asynchronously as it was done for other similar tasks in the past.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::layoutSizeChanged):
+
 2022-02-04  Pablo Saavedra  <psaave...@igalia.com>
 
         Fix for non-unified builds after r286821 (245056@main)

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (289107 => 289108)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2022-02-04 08:14:08 UTC (rev 289107)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2022-02-04 11:58:52 UTC (rev 289108)
@@ -4654,13 +4654,11 @@
 
 void HTMLMediaElement::layoutSizeChanged()
 {
-    if (RefPtr frameView = document().view()) {
-        auto task = [this, protectedThis = Ref { *this }] {
-            if (auto root = userAgentShadowRoot())
-                root->dispatchEvent(Event::create("resize", Event::CanBubble::No, Event::IsCancelable::No));
-        };
-        frameView->queuePostLayoutCallback(WTFMove(task));
-    }
+    auto task = [this] {
+        if (auto root = userAgentShadowRoot())
+            root->dispatchEvent(Event::create("resize", Event::CanBubble::No, Event::IsCancelable::No));
+    };
+    queueTaskKeepingObjectAlive(*this, TaskSource::MediaElement, WTFMove(task));
 
     if (!m_receivedLayoutSizeChanged) {
         m_receivedLayoutSizeChanged = true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to