Changeset 209291 in webkit
- Timestamp:
- Dec 2, 2016 6:40:30 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r209290 r209291 1 2016-12-02 Antoine Quint <graouts@apple.com> 2 3 [Modern Media Controls] Update the media controls size as the media element is resized 4 https://bugs.webkit.org/show_bug.cgi?id=165346 5 6 Reviewed by Dean Jackson. 7 8 Write an accurate test to check for media controls updating their size to match the 9 media's layout size and no longer mark that test as flaky. 10 11 * TestExpectations: 12 * media/modern-media-controls/media-controller/media-controller-resize-expected.txt: 13 * media/modern-media-controls/media-controller/media-controller-resize.html: 14 * platform/ios-simulator/TestExpectations: 15 1 16 2016-12-02 Ryan Haddad <ryanhaddad@apple.com> 2 17 -
trunk/LayoutTests/TestExpectations
r209286 r209291 972 972 imported/blink/http/tests/security/shape-image-cors-port.html [ ImageOnlyFailure ] 973 973 974 webkit.org/b/163636 media/modern-media-controls/media-controller/media-controller-resize.html [ Pass Failure Timeout ]975 976 974 webkit.org/b/163887 svg/as-image/svg-image-with-data-uri-use-data-uri.svg [ Pass Crash ] 977 975 -
trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-resize-expected.txt
r207436 r209291 5 5 6 6 Checking initial size 7 PASS mediaControl ler.controls.width is 3208 PASS mediaControl ler.controls.height is 2407 PASS mediaControls.style.width is "320px" 8 PASS mediaControls.style.height is "240px" 9 9 10 10 Resizing to 400x300 11 PASS mediaController.controls.width is 400 12 PASS mediaController.controls.height is 300 11 12 Shadow root received a resize event 13 PASS mediaControls.style.width is "400px" 14 PASS mediaControls.style.height is "300px" 13 15 14 16 PASS successfullyParsed is true -
trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-resize.html
r208226 r209291 1 <!DOCTYPE html><!-- webkit-test-runner [ enableModernMediaControls=true ] --> 1 2 <script src="../../../resources/js-test-pre.js"></script> 2 <script src="../resources/media-controls-loader.js" type="text/javascript"></script>3 3 <body> 4 <video src="../../content/test.mp4" style="width: 320px; height: 240px;"></video> 5 <div id="shadow"></div> 4 <video src="../../content/test.mp4" style="width: 320px; height: 240px;" controls></video> 6 5 <script type="text/javascript"> 7 6 … … 10 9 description("Testing the <code>MediaController</code> resizing behavior."); 11 10 12 const shadowRoot = document.querySelector("div#shadow").attachShadow({ mode: "open" });13 11 const media = document.querySelector("video"); 14 const mediaController = createControls(shadowRoot, media, null); 12 const shadowRoot = window.internals.shadowRoot(media); 13 const mediaControls = shadowRoot.lastChild; 15 14 16 let numberOfFrames = 0; 17 scheduler.frameDidFire = function() 18 { 19 numberOfFrames++; 15 debug("Checking initial size"); 16 shouldBeEqualToString("mediaControls.style.width", "320px"); 17 shouldBeEqualToString("mediaControls.style.height", "240px"); 20 18 21 if (numberOfFrames == 1) { 22 debug("Checking initial size"); 23 shouldBe("mediaController.controls.width", "320"); 24 shouldBe("mediaController.controls.height", "240"); 25 26 debug(""); 27 debug("Resizing to 400x300"); 28 media.style.width = "400px"; 29 media.style.height = "300px"; 30 } else { 31 shouldBe("mediaController.controls.width", "400"); 32 shouldBe("mediaController.controls.height", "300"); 19 window.requestAnimationFrame(() => { 20 shadowRoot.addEventListener("resize", () => { 21 window.requestAnimationFrame(() => { 22 debug(""); 23 debug("Shadow root received a resize event"); 24 shouldBeEqualToString("mediaControls.style.width", "400px"); 25 shouldBeEqualToString("mediaControls.style.height", "300px"); 33 26 34 debug(""); 35 shadowRoot.host.remove(); 36 media.remove(); 37 finishJSTest(); 38 } 39 }; 27 debug(""); 28 media.remove(); 29 finishJSTest(); 30 }); 31 }); 32 33 debug(""); 34 debug("Resizing to 400x300"); 35 media.style.width = "400px"; 36 media.style.height = "300px"; 37 }); 40 38 41 39 </script> -
trunk/LayoutTests/platform/ios-simulator/TestExpectations
r209271 r209291 2759 2759 media/modern-media-controls/tracks-panel 2760 2760 2761 # We don't enable media controls on iOS yet and this test requires them 2762 webkit.org/b/165353 media/modern-media-controls/media-controller/media-controller-resize.html [ Skip ] 2763 2761 2764 webkit.org/b/164594 http/tests/cache/disk-cache/disk-cache-request-headers.html [ Pass Timeout ] 2762 2765 -
trunk/Source/WebCore/ChangeLog
r209288 r209291 1 2016-12-02 Antoine Quint <graouts@apple.com> 2 3 [Modern Media Controls] Update the media controls size as the media element is resized 4 https://bugs.webkit.org/show_bug.cgi?id=165346 5 6 Reviewed by Dean Jackson. 7 8 The "resize" event dispatched by HTMLMediaElement indicates a change in the media's 9 intrinsic size, while the "resize" event dispatched by the HTMLMediaElement's ShadowRoot 10 indicates that the layout size of the media element has changed. We now use the latter. 11 12 * Modules/modern-media-controls/media/media-controller.js: 13 (MediaController): 14 (MediaController.prototype.handleEvent): 15 1 16 2016-12-02 Andy Estes <aestes@apple.com> 2 17 -
trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js
r209271 r209291 40 40 this._updateControlsIfNeeded(); 41 41 42 media.addEventListener("resize", this);42 shadowRoot.addEventListener("resize", this); 43 43 44 44 media.addEventListener("webkitfullscreenchange", this); … … 67 67 handleEvent(event) 68 68 { 69 if (event.currentTarget !== this.media) 69 if (event.type === "resize" && event.currentTarget === this.shadowRoot) 70 this._updateControlsSize(); 71 else if (event.currentTarget !== this.media) 70 72 return; 71 72 switch (event.type) { 73 case "resize": 74 this._updateControlsSize(); 75 break; 76 case "webkitfullscreenchange": 73 else if (event.type === "webkitfullscreenchange") 77 74 this._updateControlsIfNeeded(); 78 break; 79 case "webkitpresentationmodechanged": 75 else if (event.type === "webkitpresentationmodechanged") 80 76 this._returnMediaLayerToInlineIfNeeded(); 81 break;82 }83 77 } 84 78
Note: See TracChangeset
for help on using the changeset viewer.