Diff
Modified: trunk/LayoutTests/ChangeLog (209290 => 209291)
--- trunk/LayoutTests/ChangeLog 2016-12-03 01:53:56 UTC (rev 209290)
+++ trunk/LayoutTests/ChangeLog 2016-12-03 02:40:30 UTC (rev 209291)
@@ -1,3 +1,18 @@
+2016-12-02 Antoine Quint <[email protected]>
+
+ [Modern Media Controls] Update the media controls size as the media element is resized
+ https://bugs.webkit.org/show_bug.cgi?id=165346
+
+ Reviewed by Dean Jackson.
+
+ Write an accurate test to check for media controls updating their size to match the
+ media's layout size and no longer mark that test as flaky.
+
+ * TestExpectations:
+ * media/modern-media-controls/media-controller/media-controller-resize-expected.txt:
+ * media/modern-media-controls/media-controller/media-controller-resize.html:
+ * platform/ios-simulator/TestExpectations:
+
2016-12-02 Ryan Haddad <[email protected]>
Marking fast/dom/Window/window-resize-contents.html as flaky on mac-wk2.
Modified: trunk/LayoutTests/TestExpectations (209290 => 209291)
--- trunk/LayoutTests/TestExpectations 2016-12-03 01:53:56 UTC (rev 209290)
+++ trunk/LayoutTests/TestExpectations 2016-12-03 02:40:30 UTC (rev 209291)
@@ -971,8 +971,6 @@
imported/blink/http/tests/security/shape-image-cors-disallow-origin.html [ ImageOnlyFailure ]
imported/blink/http/tests/security/shape-image-cors-port.html [ ImageOnlyFailure ]
-webkit.org/b/163636 media/modern-media-controls/media-controller/media-controller-resize.html [ Pass Failure Timeout ]
-
webkit.org/b/163887 svg/as-image/svg-image-with-data-uri-use-data-uri.svg [ Pass Crash ]
# Temporary failure until we start using ANGLE as a WebGL backend
Modified: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-resize-expected.txt (209290 => 209291)
--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-resize-expected.txt 2016-12-03 01:53:56 UTC (rev 209290)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-resize-expected.txt 2016-12-03 02:40:30 UTC (rev 209291)
@@ -4,13 +4,15 @@
Checking initial size
-PASS mediaController.controls.width is 320
-PASS mediaController.controls.height is 240
+PASS mediaControls.style.width is "320px"
+PASS mediaControls.style.height is "240px"
Resizing to 400x300
-PASS mediaController.controls.width is 400
-PASS mediaController.controls.height is 300
+Shadow root received a resize event
+PASS mediaControls.style.width is "400px"
+PASS mediaControls.style.height is "300px"
+
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-resize.html (209290 => 209291)
--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-resize.html 2016-12-03 01:53:56 UTC (rev 209290)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-resize.html 2016-12-03 02:40:30 UTC (rev 209291)
@@ -1,8 +1,7 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableModernMediaControls=true ] -->
<script src=""
-<script src="" type="text/_javascript_"></script>
<body>
-<video src="" style="width: 320px; height: 240px;"></video>
-<div id="shadow"></div>
+<video src="" style="width: 320px; height: 240px;" controls></video>
<script type="text/_javascript_">
window.jsTestIsAsync = true;
@@ -9,35 +8,34 @@
description("Testing the <code>MediaController</code> resizing behavior.");
-const shadowRoot = document.querySelector("div#shadow").attachShadow({ mode: "open" });
const media = document.querySelector("video");
-const mediaController = createControls(shadowRoot, media, null);
+const shadowRoot = window.internals.shadowRoot(media);
+const mediaControls = shadowRoot.lastChild;
-let numberOfFrames = 0;
-scheduler.frameDidFire = function()
-{
- numberOfFrames++;
+debug("Checking initial size");
+shouldBeEqualToString("mediaControls.style.width", "320px");
+shouldBeEqualToString("mediaControls.style.height", "240px");
- if (numberOfFrames == 1) {
- debug("Checking initial size");
- shouldBe("mediaController.controls.width", "320");
- shouldBe("mediaController.controls.height", "240");
-
- debug("");
- debug("Resizing to 400x300");
- media.style.width = "400px";
- media.style.height = "300px";
- } else {
- shouldBe("mediaController.controls.width", "400");
- shouldBe("mediaController.controls.height", "300");
+window.requestAnimationFrame(() => {
+ shadowRoot.addEventListener("resize", () => {
+ window.requestAnimationFrame(() => {
+ debug("");
+ debug("Shadow root received a resize event");
+ shouldBeEqualToString("mediaControls.style.width", "400px");
+ shouldBeEqualToString("mediaControls.style.height", "300px");
- debug("");
- shadowRoot.host.remove();
- media.remove();
- finishJSTest();
- }
-};
+ debug("");
+ media.remove();
+ finishJSTest();
+ });
+ });
+ debug("");
+ debug("Resizing to 400x300");
+ media.style.width = "400px";
+ media.style.height = "300px";
+});
+
</script>
<script src=""
</body>
Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (209290 => 209291)
--- trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-12-03 01:53:56 UTC (rev 209290)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-12-03 02:40:30 UTC (rev 209291)
@@ -2758,6 +2758,9 @@
# These tests are all Mac-specific, we never show the tracks menu on iOS
media/modern-media-controls/tracks-panel
+# We don't enable media controls on iOS yet and this test requires them
+webkit.org/b/165353 media/modern-media-controls/media-controller/media-controller-resize.html [ Skip ]
+
webkit.org/b/164594 http/tests/cache/disk-cache/disk-cache-request-headers.html [ Pass Timeout ]
webkit.org/b/163046 js/regress-141098.html [ Pass Failure ]
Modified: trunk/Source/WebCore/ChangeLog (209290 => 209291)
--- trunk/Source/WebCore/ChangeLog 2016-12-03 01:53:56 UTC (rev 209290)
+++ trunk/Source/WebCore/ChangeLog 2016-12-03 02:40:30 UTC (rev 209291)
@@ -1,3 +1,18 @@
+2016-12-02 Antoine Quint <[email protected]>
+
+ [Modern Media Controls] Update the media controls size as the media element is resized
+ https://bugs.webkit.org/show_bug.cgi?id=165346
+
+ Reviewed by Dean Jackson.
+
+ The "resize" event dispatched by HTMLMediaElement indicates a change in the media's
+ intrinsic size, while the "resize" event dispatched by the HTMLMediaElement's ShadowRoot
+ indicates that the layout size of the media element has changed. We now use the latter.
+
+ * Modules/modern-media-controls/media/media-controller.js:
+ (MediaController):
+ (MediaController.prototype.handleEvent):
+
2016-12-02 Andy Estes <[email protected]>
[Cocoa] Adopt the PRODUCT_BUNDLE_IDENTIFIER build setting
Modified: trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js (209290 => 209291)
--- trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js 2016-12-03 01:53:56 UTC (rev 209290)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js 2016-12-03 02:40:30 UTC (rev 209291)
@@ -39,7 +39,7 @@
this._updateControlsIfNeeded();
- media.addEventListener("resize", this);
+ shadowRoot.addEventListener("resize", this);
media.addEventListener("webkitfullscreenchange", this);
}
@@ -66,20 +66,14 @@
handleEvent(event)
{
- if (event.currentTarget !== this.media)
+ if (event.type === "resize" && event.currentTarget === this.shadowRoot)
+ this._updateControlsSize();
+ else if (event.currentTarget !== this.media)
return;
-
- switch (event.type) {
- case "resize":
- this._updateControlsSize();
- break;
- case "webkitfullscreenchange":
+ else if (event.type === "webkitfullscreenchange")
this._updateControlsIfNeeded();
- break;
- case "webkitpresentationmodechanged":
+ else if (event.type === "webkitpresentationmodechanged")
this._returnMediaLayerToInlineIfNeeded();
- break;
- }
}
// Private