- a/Source/WebCore/ChangeLog +15 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2017-03-03  Commit Queue  <commit-queue@webkit.org>
2
3
        Unreviewed, rolling out r213400.
4
        https://bugs.webkit.org/show_bug.cgi?id=169163
5
6
        Caused frequent assertion failures (Requested by ap on
7
        #webkit).
8
9
        Reverted changeset:
10
11
        "[Modern Media Controls] Improve media documents across macOS,
12
        iPhone and iPad"
13
        https://bugs.webkit.org/show_bug.cgi?id=169145
14
        http://trac.webkit.org/changeset/213400
15
1
2017-03-03  Andy Estes  <aestes@apple.com>
16
2017-03-03  Andy Estes  <aestes@apple.com>
2
17
3
        Add support for canvas.toBlob
18
        Add support for canvas.toBlob
- a/Source/WebCore/Modules/modern-media-controls/controls/ios-inline-media-controls.css -2 / +1 lines
Lines 43-50 a/Source/WebCore/Modules/modern-media-controls/controls/ios-inline-media-controls.css_sec1
43
    will-change: transform;
43
    will-change: transform;
44
}
44
}
45
45
46
:host(audio) .media-controls.ios.inline > .controls-bar:before,
46
:host(audio) .media-controls.ios.inline > .controls-bar:before {
47
:host(.media-document.audio) .media-controls.ios.inline > .controls-bar:before {
48
    -webkit-appearance: none;
47
    -webkit-appearance: none;
49
    background-color: rgb(212, 212, 212);
48
    background-color: rgb(212, 212, 212);
50
}
49
}
- a/Source/WebCore/Modules/modern-media-controls/controls/macos-media-controls.css -4 / +2 lines
Lines 51-62 a/Source/WebCore/Modules/modern-media-controls/controls/macos-media-controls.css_sec1
51
    -webkit-appearance: none !important;
51
    -webkit-appearance: none !important;
52
}
52
}
53
53
54
:host(audio) .media-controls.mac.inline > .controls-bar,
54
:host(audio) .media-controls.mac.inline > .controls-bar {
55
:host(.media-document.audio) .media-controls.mac.inline > .controls-bar {
56
    background-color: rgb(41, 41, 41);
55
    background-color: rgb(41, 41, 41);
57
}
56
}
58
57
59
:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint,
58
:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint {
60
:host(.media-document.audio) .media-controls.mac.inline > .controls-bar > .background-tint {
61
    display: none;
59
    display: none;
62
}
60
}
- a/Source/WebCore/Modules/modern-media-controls/controls/media-document.css -65 lines
Lines 1-65 a/Source/WebCore/Modules/modern-media-controls/controls/media-document.css_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
:host(.media-document) {
27
    visibility: hidden !important;
28
    max-width: 100% !important;
29
    min-height: 50px !important;
30
}
31
32
:host(.media-document.ready) {
33
    visibility: visible !important;
34
}
35
36
/* Audio */
37
38
:host(.media-document.audio.mac) {
39
    width: 650px !important;
40
    min-height: 25px !important;
41
}
42
43
:host(.media-document.audio.ipad) {
44
    width: 650px !important;
45
}
46
47
:host(.media-document.audio.iphone) {
48
    padding: 0 10px;
49
    width: 100% !important;
50
    box-sizing: border-box;
51
}
52
53
/* Video */
54
55
:host(.media-document.video.mac) {
56
    min-width: 700px !important;
57
}
58
59
:host(.media-document.video.ipad) {
60
    min-width: 700px !important;
61
}
62
63
:host(.media-document.video.iphone) {
64
    width: 100% !important;
65
}
- a/Source/WebCore/Modules/modern-media-controls/js-files -1 lines
Lines 60-65 media/tracks-support.js a/Source/WebCore/Modules/modern-media-controls/js-files_sec1
60
media/volume-down-support.js
60
media/volume-down-support.js
61
media/volume-support.js
61
media/volume-support.js
62
media/volume-up-support.js
62
media/volume-up-support.js
63
media/media-document-controller.js
64
media/media-controller.js
63
media/media-controller.js
65
main.js
64
main.js
- a/Source/WebCore/Modules/modern-media-controls/media/fullscreen-support.js -1 / +1 lines
Lines 69-75 class FullscreenSupport extends MediaControllerSupport a/Source/WebCore/Modules/modern-media-controls/media/fullscreen-support.js_sec1
69
    {
69
    {
70
        const control = this.control;
70
        const control = this.control;
71
        const media = this.mediaController.media;
71
        const media = this.mediaController.media;
72
        control.enabled = !this.mediaController.isAudio && media.webkitSupportsFullscreen;
72
        control.enabled = media.webkitSupportsFullscreen && media.videoTracks.length > 0;
73
        control.isFullScreen = media.webkitDisplayingFullscreen;
73
        control.isFullScreen = media.webkitDisplayingFullscreen;
74
    }
74
    }
75
75
- a/Source/WebCore/Modules/modern-media-controls/media/media-controller.js -11 / +1 lines
Lines 41-48 class MediaController a/Source/WebCore/Modules/modern-media-controls/media/media-controller.js_sec1
41
        if (host) {
41
        if (host) {
42
            host.controlsDependOnPageScaleFactor = this.layoutTraits & LayoutTraits.iOS;
42
            host.controlsDependOnPageScaleFactor = this.layoutTraits & LayoutTraits.iOS;
43
            this.container.appendChild(host.textTrackContainer);
43
            this.container.appendChild(host.textTrackContainer);
44
            if (host.isInMediaDocument)
45
                this.mediaDocumentController = new MediaDocumentController(this);
46
        }
44
        }
47
45
48
        this._updateControlsIfNeeded();
46
        this._updateControlsIfNeeded();
Lines 62-76 class MediaController a/Source/WebCore/Modules/modern-media-controls/media/media-controller.js_sec2
62
60
63
    get isAudio()
61
    get isAudio()
64
    {
62
    {
65
        if (this.media instanceof HTMLAudioElement)
63
        return this.media instanceof HTMLAudioElement || (this.media.readyState >= HTMLMediaElement.HAVE_METADATA && this.media.videoWidth === 0);
66
            return true;
67
68
        if (this.media.readyState < HTMLMediaElement.HAVE_METADATA)
69
            return false;
70
71
        const isLiveBroadcast = this.media.duration === Number.POSITIVE_INFINITY;
72
        const hasVideoTracks = this.media.videoWidth != 0;
73
        return !isLiveBroadcast && !hasVideoTracks;
74
    }
64
    }
75
65
76
    get layoutTraits()
66
    get layoutTraits()
- a/Source/WebCore/Modules/modern-media-controls/media/media-document-controller.js -73 lines
Lines 1-73 a/Source/WebCore/Modules/modern-media-controls/media/media-document-controller.js_sec1
1
/*
2
 * Copyright (C) 2017 Apple Inc. All Rights Reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without
5
 * modification, are permitted provided that the following conditions
6
 * are met:
7
 * 1. Redistributions of source code must retain the above copyright
8
 *    notice, this list of conditions and the following disclaimer.
9
 * 2. Redistributions in binary form must reproduce the above copyright
10
 *    notice, this list of conditions and the following disclaimer in the
11
 *    documentation and/or other materials provided with the distribution.
12
 *
13
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
 */
25
26
class MediaDocumentController
27
{
28
29
    constructor(mediaController)
30
    {
31
        this.mediaController = mediaController;
32
33
        const media = mediaController.media;
34
        media.classList.add("media-document");
35
36
        if (media.readyState >= HTMLMediaElement.HAVE_METADATA)
37
            this._mediaDocumentHasMetadata();
38
        else
39
            media.addEventListener("loadedmetadata", this);
40
    }
41
42
    // Protected
43
44
    handleEvent(event)
45
    {
46
        event.currentTarget.removeEventListener(event.type, this);
47
48
        if (event.type === "loadedmetadata")
49
            this._mediaDocumentHasMetadata();
50
        else if (event.type === "resize")
51
            this._mediaDocumentHasSize();
52
    }
53
54
    // Private
55
56
    _mediaDocumentHasMetadata()
57
    {
58
        const media = this.mediaController.media;
59
        media.classList.add(this.mediaController.isAudio ? "audio" : "video");
60
        media.classList.add(window.navigator.platform === "MacIntel" ? "mac" : window.navigator.platform);
61
62
        if (this.mediaController.isAudio)
63
            this._mediaDocumentHasSize();
64
        else
65
            this.mediaController.shadowRoot.addEventListener("resize", this);
66
    }
67
68
    _mediaDocumentHasSize()
69
    {
70
        window.requestAnimationFrame(() => this.mediaController.media.classList.add("ready"));
71
    }
72
73
}
- a/Source/WebCore/Modules/modern-media-controls/media/pip-support.js -1 / +1 lines
Lines 56-62 class PiPSupport extends MediaControllerSupport a/Source/WebCore/Modules/modern-media-controls/media/pip-support.js_sec1
56
    {
56
    {
57
        const media = this.mediaController.media;
57
        const media = this.mediaController.media;
58
        if (media.webkitSupportsPresentationMode)
58
        if (media.webkitSupportsPresentationMode)
59
            this.control.enabled = !this.mediaController.isAudio && media.webkitSupportsPresentationMode(PiPMode) && !media.webkitCurrentPlaybackTargetIsWireless;
59
            this.control.enabled = media instanceof HTMLVideoElement && media.webkitSupportsPresentationMode(PiPMode) && !media.webkitCurrentPlaybackTargetIsWireless;
60
        else
60
        else
61
            this.control.enabled = false;
61
            this.control.enabled = false;
62
    }
62
    }
- a/Source/WebCore/html/MediaDocument.cpp -9 / +21 lines
Lines 104-129 void MediaDocumentParser::createDocumentStructure() a/Source/WebCore/html/MediaDocument.cpp_sec1
104
#endif
104
#endif
105
105
106
    auto body = HTMLBodyElement::create(document);
106
    auto body = HTMLBodyElement::create(document);
107
    if (RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled()) {
108
        StringBuilder bodyStyle;
109
        bodyStyle.appendLiteral("margin: 0; padding: 0;");
110
        bodyStyle.appendLiteral("background-color: rgb(38, 38, 38);");
111
        bodyStyle.appendLiteral("display: flex; justify-content: center; align-items: center;");
112
        body->setAttribute(styleAttr, bodyStyle.toString());
113
    }
107
    rootElement->appendChild(body);
114
    rootElement->appendChild(body);
108
115
109
    auto videoElement = HTMLVideoElement::create(document);
116
    auto videoElement = HTMLVideoElement::create(document);
110
    m_mediaElement = videoElement.ptr();
117
    m_mediaElement = videoElement.ptr();
111
    videoElement->setAttributeWithoutSynchronization(controlsAttr, emptyAtom);
118
    videoElement->setAttributeWithoutSynchronization(controlsAttr, emptyAtom);
112
    videoElement->setAttributeWithoutSynchronization(autoplayAttr, emptyAtom);
119
    videoElement->setAttributeWithoutSynchronization(autoplayAttr, emptyAtom);
113
    videoElement->setAttributeWithoutSynchronization(playsinlineAttr, emptyAtom);
120
    videoElement->setAttributeWithoutSynchronization(nameAttr, AtomicString("media", AtomicString::ConstructFromLiteral));
114
    videoElement->setSrc(document.url());
115
    if (auto* loader = document.loader())
116
        videoElement->setAttributeWithoutSynchronization(typeAttr, loader->responseMIMEType());
117
121
118
    if (!RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled()) {
122
    StringBuilder elementStyle;
119
        StringBuilder elementStyle;
123
    elementStyle.appendLiteral("max-width: 100%; max-height: 100%;");
120
        elementStyle.appendLiteral("max-width: 100%; max-height: 100%;");
121
#if PLATFORM(IOS)
124
#if PLATFORM(IOS)
122
        elementStyle.appendLiteral("width: 100%; height: auto;");
125
    elementStyle.appendLiteral("width: 100%; height: auto;");
123
#endif
126
#endif
124
        videoElement->setAttribute(styleAttr, elementStyle.toString());
127
    if (RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled()) {
128
        elementStyle.appendLiteral("min-height: 50px;");
125
    }
129
    }
130
    videoElement->setAttribute(styleAttr, elementStyle.toString());
131
132
    auto sourceElement = HTMLSourceElement::create(document);
133
    sourceElement->setSrc(document.url());
134
135
    if (auto* loader = document.loader())
136
        sourceElement->setType(loader->responseMIMEType());
126
137
138
    videoElement->appendChild(sourceElement);
127
    body->appendChild(videoElement);
139
    body->appendChild(videoElement);
128
140
129
    Frame* frame = document.frame();
141
    Frame* frame = document.frame();
- a/LayoutTests/ChangeLog +15 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2017-03-03  Commit Queue  <commit-queue@webkit.org>
2
3
        Unreviewed, rolling out r213400.
4
        https://bugs.webkit.org/show_bug.cgi?id=169163
5
6
        Caused frequent assertion failures (Requested by ap on
7
        #webkit).
8
9
        Reverted changeset:
10
11
        "[Modern Media Controls] Improve media documents across macOS,
12
        iPhone and iPad"
13
        https://bugs.webkit.org/show_bug.cgi?id=169145
14
        http://trac.webkit.org/changeset/213400
15
1
2017-03-03  Antoine Quint  <graouts@apple.com>
16
2017-03-03  Antoine Quint  <graouts@apple.com>
2
17
3
        [Modern Media Controls] Improve media documents across macOS, iPhone and iPad
18
        [Modern Media Controls] Improve media documents across macOS, iPhone and iPad
- a/LayoutTests/media/modern-media-controls/fullscreen-support/fullscreen-support-disabled-video-with-audio-tracks-only-expected.txt -14 lines
Lines 1-14 a/LayoutTests/media/modern-media-controls/fullscreen-support/fullscreen-support-disabled-video-with-audio-tracks-only-expected.txt_sec1
1
Testing that the fullscreen button is disabled for <video> with an audio resource.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
Once media loads its metadata the fullscreen button should become disabled
7
Obtained loadedmetadata event
8
PASS mediaController.isAudio is true
9
PASS mediaController.controls.fullscreenButton.enabled is false
10
11
PASS successfullyParsed is true
12
13
TEST COMPLETE
14
- a/LayoutTests/media/modern-media-controls/fullscreen-support/fullscreen-support-disabled-video-with-audio-tracks-only.html -44 lines
Lines 1-44 a/LayoutTests/media/modern-media-controls/fullscreen-support/fullscreen-support-disabled-video-with-audio-tracks-only.html_sec1
1
<script src="../../../resources/js-test-pre.js"></script>
2
<script src="../resources/media-controls-loader.js" type="text/javascript"></script>
3
<body>
4
<style type="text/css" media="screen">
5
    
6
    video, #host {
7
        position: absolute;
8
        top: 0;
9
        left: 0;
10
    }
11
12
    video {
13
        width: 800px;
14
        height: 240px;
15
    }
16
    
17
</style>
18
<video src="../../content/test.wav" controls autoplay></video>
19
<div id="host"></div>
20
<script type="text/javascript">
21
22
window.jsTestIsAsync = true;
23
24
description("Testing that the fullscreen button is disabled for &lt;video> with an audio resource.");
25
26
const container = document.querySelector("div#host");
27
const media = document.querySelector("video");
28
const mediaController = createControls(container, media, null);
29
30
debug("Once media loads its metadata the fullscreen button should become disabled");
31
media.addEventListener("loadedmetadata", () => {
32
    debug("Obtained loadedmetadata event");
33
    shouldBeTrue("mediaController.isAudio");
34
    shouldBeFalse("mediaController.controls.fullscreenButton.enabled");
35
    
36
    debug("");
37
    media.remove();
38
    container.remove();
39
    finishJSTest();
40
});
41
42
</script>
43
<script src="../../../resources/js-test-post.js"></script>
44
</body>
- a/LayoutTests/media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing-expected.txt -12 lines
Lines 1-12 a/LayoutTests/media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing-expected.txt_sec1
1
Testing the size of the media element in an audio media document on iOS.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS getComputedStyle(media).width became "650px"
7
PASS getComputedStyle(media).height is "50px"
8
9
PASS successfullyParsed is true
10
11
TEST COMPLETE
12
- a/LayoutTests/media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing.html -34 lines
Lines 1-34 a/LayoutTests/media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing.html_sec1
1
<script src="../../../../resources/js-test-pre.js"></script>
2
<meta name="viewport" content="width=device-width, initial-scale=1">
3
<body>
4
<iframe src="../../../content/silence.mp3" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
5
<script type="text/javascript">
6
7
description("Testing the size of the media element in an audio media document on iOS.");
8
9
window.jsTestIsAsync = true;
10
11
let media;
12
13
(function runTestIfReady() {
14
    const iframe = document.querySelector("iframe");
15
    media = iframe.contentDocument.querySelector("video");
16
17
    if (!media) {
18
        setTimeout(runTestIfReady);
19
        return;
20
    }
21
22
    shouldBecomeEqualToString("getComputedStyle(media).width", "650px", () => {
23
        shouldBeEqualToString("getComputedStyle(media).height", "50px");
24
25
        debug("");
26
        iframe.remove();
27
        finishJSTest();
28
    });
29
30
})();
31
32
</script>
33
<script src="../../../../resources/js-test-post.js"></script>
34
</body>
- a/LayoutTests/media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing-expected.txt -12 lines
Lines 1-12 a/LayoutTests/media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing-expected.txt_sec1
1
Testing the size of the media element in a video media document on iOS.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS getComputedStyle(media).width became "700px"
7
PASS getComputedStyle(media).height is "525px"
8
9
PASS successfullyParsed is true
10
11
TEST COMPLETE
12
- a/LayoutTests/media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing.html -34 lines
Lines 1-34 a/LayoutTests/media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing.html_sec1
1
<script src="../../../../resources/js-test-pre.js"></script>
2
<meta name="viewport" content="width=device-width, initial-scale=1">
3
<body>
4
<iframe src="../../../content/test.mp4" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
5
<script type="text/javascript">
6
7
description("Testing the size of the media element in a video media document on iOS.");
8
9
window.jsTestIsAsync = true;
10
11
let media;
12
13
(function runTestIfReady() {
14
    const iframe = document.querySelector("iframe");
15
    media = iframe.contentDocument.querySelector("video");
16
17
    if (!media) {
18
        setTimeout(runTestIfReady);
19
        return;
20
    }
21
22
    shouldBecomeEqualToString("getComputedStyle(media).width", "700px", () => {
23
        shouldBeEqualToString("getComputedStyle(media).height", "525px");
24
25
        debug("");
26
        iframe.remove();
27
        finishJSTest();
28
    });
29
30
})();
31
32
</script>
33
<script src="../../../../resources/js-test-post.js"></script>
34
</body>
- a/LayoutTests/media/modern-media-controls/media-documents/media-document-audio-ios-sizing-expected.txt -12 lines
Lines 1-12 a/LayoutTests/media/modern-media-controls/media-documents/media-document-audio-ios-sizing-expected.txt_sec1
1
Testing the size of the media element in an audio media document on iOS.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS getComputedStyle(media).width became "320px"
7
PASS getComputedStyle(media).height is "50px"
8
9
PASS successfullyParsed is true
10
11
TEST COMPLETE
12
- a/LayoutTests/media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html -35 lines
Lines 1-35 a/LayoutTests/media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html_sec1
1
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
2
<script src="../../../resources/js-test-pre.js"></script>
3
<meta name="viewport" content="width=device-width, initial-scale=1">
4
<body>
5
<iframe src="../../content/silence.mp3" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
6
<script type="text/javascript">
7
8
description("Testing the size of the media element in an audio media document on iOS.");
9
10
window.jsTestIsAsync = true;
11
12
let media;
13
14
(function runTestIfReady() {
15
    const iframe = document.querySelector("iframe");
16
    media = iframe.contentDocument.querySelector("video");
17
18
    if (!media) {
19
        setTimeout(runTestIfReady);
20
        return;
21
    }
22
23
    shouldBecomeEqualToString("getComputedStyle(media).width", "320px", () => {
24
        shouldBeEqualToString("getComputedStyle(media).height", "50px");
25
26
        debug("");
27
        iframe.remove();
28
        finishJSTest();
29
    });
30
31
})();
32
33
</script>
34
<script src="../../../resources/js-test-post.js"></script>
35
</body>
- a/LayoutTests/media/modern-media-controls/media-documents/media-document-audio-mac-sizing-expected.txt -12 lines
Lines 1-12 a/LayoutTests/media/modern-media-controls/media-documents/media-document-audio-mac-sizing-expected.txt_sec1
1
Testing the size of the media element in an audio media document on macOS.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS getComputedStyle(media).width became "650px"
7
PASS getComputedStyle(media).height is "25px"
8
9
PASS successfullyParsed is true
10
11
TEST COMPLETE
12
- a/LayoutTests/media/modern-media-controls/media-documents/media-document-audio-mac-sizing.html -33 lines
Lines 1-33 a/LayoutTests/media/modern-media-controls/media-documents/media-document-audio-mac-sizing.html_sec1
1
<script src="../../../resources/js-test-pre.js"></script>
2
<body>
3
<iframe src="../../content/test.wav" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
4
<script type="text/javascript">
5
6
description("Testing the size of the media element in an audio media document on macOS.");
7
8
window.jsTestIsAsync = true;
9
10
let media;
11
12
(function runTestIfReady() {
13
    const iframe = document.querySelector("iframe");
14
    media = iframe.contentDocument.querySelector("video");
15
16
    if (!media) {
17
        setTimeout(runTestIfReady);
18
        return;
19
    }
20
21
    shouldBecomeEqualToString("getComputedStyle(media).width", "650px", () => {
22
        shouldBeEqualToString("getComputedStyle(media).height", "25px");
23
24
        debug("");
25
        iframe.remove();
26
        finishJSTest();
27
    });
28
29
})();
30
31
</script>
32
<script src="../../../resources/js-test-post.js"></script>
33
</body>
- a/LayoutTests/media/modern-media-controls/media-documents/media-document-video-ios-sizing-expected.txt -12 lines
Lines 1-12 a/LayoutTests/media/modern-media-controls/media-documents/media-document-video-ios-sizing-expected.txt_sec1
1
Testing the size of the media element in a video media document on iOS.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS getComputedStyle(media).height became "240px"
7
PASS getComputedStyle(media).width is "320px"
8
9
PASS successfullyParsed is true
10
11
TEST COMPLETE
12
- a/LayoutTests/media/modern-media-controls/media-documents/media-document-video-ios-sizing.html -35 lines
Lines 1-35 a/LayoutTests/media/modern-media-controls/media-documents/media-document-video-ios-sizing.html_sec1
1
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
2
<script src="../../../resources/js-test-pre.js"></script>
3
<meta name="viewport" content="width=device-width, initial-scale=1">
4
<body>
5
<iframe src="../../content/test.mp4" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
6
<script type="text/javascript">
7
8
description("Testing the size of the media element in a video media document on iOS.");
9
10
window.jsTestIsAsync = true;
11
12
let media;
13
14
(function runTestIfReady() {
15
    const iframe = document.querySelector("iframe");
16
    media = iframe.contentDocument.querySelector("video");
17
18
    if (!media) {
19
        setTimeout(runTestIfReady);
20
        return;
21
    }
22
23
    shouldBecomeEqualToString("getComputedStyle(media).height", "240px", () => {
24
        shouldBeEqualToString("getComputedStyle(media).width", "320px");
25
26
        debug("");
27
        iframe.remove();
28
        finishJSTest();
29
    });
30
31
})();
32
33
</script>
34
<script src="../../../resources/js-test-post.js"></script>
35
</body>
- a/LayoutTests/media/modern-media-controls/media-documents/media-document-video-mac-sizing-expected.txt -12 lines
Lines 1-12 a/LayoutTests/media/modern-media-controls/media-documents/media-document-video-mac-sizing-expected.txt_sec1
1
Testing the size of the media element in a video media document on macOS.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS getComputedStyle(media).width became "700px"
7
PASS getComputedStyle(media).height is "525px"
8
9
PASS successfullyParsed is true
10
11
TEST COMPLETE
12
- a/LayoutTests/media/modern-media-controls/media-documents/media-document-video-mac-sizing.html -33 lines
Lines 1-33 a/LayoutTests/media/modern-media-controls/media-documents/media-document-video-mac-sizing.html_sec1
1
<script src="../../../resources/js-test-pre.js"></script>
2
<body>
3
<iframe src="../../content/test.mp4" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
4
<script type="text/javascript">
5
6
description("Testing the size of the media element in a video media document on macOS.");
7
8
window.jsTestIsAsync = true;
9
10
let media;
11
12
(function runTestIfReady() {
13
    const iframe = document.querySelector("iframe");
14
    media = iframe.contentDocument.querySelector("video");
15
16
    if (!media) {
17
        setTimeout(runTestIfReady);
18
        return;
19
    }
20
21
    shouldBecomeEqualToString("getComputedStyle(media).width", "700px", () => {
22
        shouldBeEqualToString("getComputedStyle(media).height", "525px");
23
24
        debug("");
25
        iframe.remove();
26
        finishJSTest();
27
    });
28
29
})();
30
31
</script>
32
<script src="../../../resources/js-test-post.js"></script>
33
</body>
- a/LayoutTests/media/modern-media-controls/pip-support/pip-support-disabled-video-with-audio-tracks-only-expected.txt -14 lines
Lines 1-14 a/LayoutTests/media/modern-media-controls/pip-support/pip-support-disabled-video-with-audio-tracks-only-expected.txt_sec1
1
Testing that the picture-in-picture button is disabled for <video> with an audio resource.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
Once media loads its metadata the picture-in-picture button should become disabled
7
Obtained loadedmetadata event
8
PASS mediaController.isAudio is true
9
PASS mediaController.controls.pipButton.enabled is false
10
11
PASS successfullyParsed is true
12
13
TEST COMPLETE
14
- a/LayoutTests/media/modern-media-controls/pip-support/pip-support-disabled-video-with-audio-tracks-only.html -44 lines
Lines 1-44 a/LayoutTests/media/modern-media-controls/pip-support/pip-support-disabled-video-with-audio-tracks-only.html_sec1
1
<script src="../../../resources/js-test-pre.js"></script>
2
<script src="../resources/media-controls-loader.js" type="text/javascript"></script>
3
<body>
4
<style type="text/css" media="screen">
5
    
6
    video, #host {
7
        position: absolute;
8
        top: 0;
9
        left: 0;
10
    }
11
12
    video {
13
        width: 800px;
14
        height: 240px;
15
    }
16
    
17
</style>
18
<video src="../../content/test.wav" controls autoplay></video>
19
<div id="host"></div>
20
<script type="text/javascript">
21
22
window.jsTestIsAsync = true;
23
24
description("Testing that the picture-in-picture button is disabled for &lt;video> with an audio resource.");
25
26
const container = document.querySelector("div#host");
27
const media = document.querySelector("video");
28
const mediaController = createControls(container, media, null);
29
30
debug("Once media loads its metadata the picture-in-picture button should become disabled");
31
media.addEventListener("loadedmetadata", () => {
32
    debug("Obtained loadedmetadata event");
33
    shouldBeTrue("mediaController.isAudio");
34
    shouldBeFalse("mediaController.controls.pipButton.enabled");
35
    
36
    debug("");
37
    media.remove();
38
    container.remove();
39
    finishJSTest();
40
});
41
42
</script>
43
<script src="../../../resources/js-test-post.js"></script>
44
</body>
- a/LayoutTests/platform/ios-simulator/TestExpectations -2 lines
Lines 2818-2825 media/modern-media-controls/pip-support/pip-support-enabled.html [ Skip ] a/LayoutTests/platform/ios-simulator/TestExpectations_sec1
2818
media/modern-media-controls/placard-support/placard-support-pip.html [ Skip ]
2818
media/modern-media-controls/placard-support/placard-support-pip.html [ Skip ]
2819
media/modern-media-controls/scrubber-support/scrubber-support-drag.html [ Skip ]
2819
media/modern-media-controls/scrubber-support/scrubber-support-drag.html [ Skip ]
2820
media/modern-media-controls/scrubber-support/ipad/scrubber-support-drag.html [ Skip ]
2820
media/modern-media-controls/scrubber-support/ipad/scrubber-support-drag.html [ Skip ]
2821
media/modern-media-controls/media-documents/media-document-audio-mac-sizing.html [ Skip ]
2822
media/modern-media-controls/media-documents/media-document-video-mac-sizing.html [ Skip ]
2823
2821
2824
# These tests use uiController and need to be skipped in open-source
2822
# These tests use uiController and need to be skipped in open-source
2825
media/modern-media-controls/placard-support/ipad/placard-support-pip.html [ Skip ]
2823
media/modern-media-controls/placard-support/ipad/placard-support-pip.html [ Skip ]
- a/LayoutTests/platform/mac/TestExpectations -4 lines
Lines 1480-1489 media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls- a/LayoutTests/platform/mac/TestExpectations_sec1
1480
media/modern-media-controls/media-controller/media-controller-ios-only-enable-tap-gesture-recognizer-with-fades-when-idle.html [ Skip ]
1480
media/modern-media-controls/media-controller/media-controller-ios-only-enable-tap-gesture-recognizer-with-fades-when-idle.html [ Skip ]
1481
media/modern-media-controls/media-controller/media-controller-ios-do-not-hide-controls-when-tapping-button.html [ Skip ]
1481
media/modern-media-controls/media-controller/media-controller-ios-do-not-hide-controls-when-tapping-button.html [ Skip ]
1482
media/modern-media-controls/media-controller/media-controller-tight-padding.html [ Skip ]
1482
media/modern-media-controls/media-controller/media-controller-tight-padding.html [ Skip ]
1483
media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html [ Skip ]
1484
media/modern-media-controls/media-documents/media-document-video-ios-sizing.html [ Skip ]
1485
media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing.html [ Skip ]
1486
media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing.html [ Skip ]
1487
1483
1488
webkit.org/b/167266 media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-enter-over-controls-bar.html [ Pass Failure ]
1484
webkit.org/b/167266 media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-enter-over-controls-bar.html [ Pass Failure ]
1489
1485

Return to Bug 169163