Diff
Modified: trunk/LayoutTests/ChangeLog (209270 => 209271)
--- trunk/LayoutTests/ChangeLog 2016-12-02 22:34:01 UTC (rev 209270)
+++ trunk/LayoutTests/ChangeLog 2016-12-02 22:36:50 UTC (rev 209271)
@@ -1,3 +1,23 @@
+2016-12-02 Antoine Quint <[email protected]>
+
+ [Modern Media Controls] Add rewind and fast-forward support
+ https://bugs.webkit.org/show_bug.cgi?id=165294
+
+ Reviewed by Dean Jackson.
+
+ New test for the LayoutNode.parentOfType() method and the seeking buttons.
+
+ * media/modern-media-controls/forward-button/forward-button.html:
+ * media/modern-media-controls/layout-node/layout-node-parent-of-type-expected.txt: Added.
+ * media/modern-media-controls/layout-node/layout-node-parent-of-type.html: Added.
+ * media/modern-media-controls/rewind-button/rewind-button.html:
+ * media/modern-media-controls/seek-backward-support/seek-backward-support-expected.txt: Added.
+ * media/modern-media-controls/seek-backward-support/seek-backward-support.html: Added.
+ * media/modern-media-controls/seek-forward-support/seek-forward-support-expected.txt: Added.
+ * media/modern-media-controls/seek-forward-support/seek-forward-support.html: Added.
+ * platform/ios-simulator/TestExpectations:
+ * platform/mac/TestExpectations:
+
2016-12-02 Ryan Haddad <[email protected]>
Marking media/modern-media-controls/scrubber-support/scrubber-support-click.html as a flaky failure.
Modified: trunk/LayoutTests/media/modern-media-controls/forward-button/forward-button.html (209270 => 209271)
--- trunk/LayoutTests/media/modern-media-controls/forward-button/forward-button.html 2016-12-02 22:34:01 UTC (rev 209270)
+++ trunk/LayoutTests/media/modern-media-controls/forward-button/forward-button.html 2016-12-02 22:36:50 UTC (rev 209271)
@@ -1,13 +1,5 @@
-<link rel="stylesheet" href="" type="text/css" media="screen">
-<link rel="stylesheet" href="" type="text/css" media="screen">
<script src=""
-<script src="" type="text/_javascript_"></script>
-<script src="" type="text/_javascript_"></script>
-<script src="" type="text/_javascript_"></script>
-<script src="" type="text/_javascript_"></script>
-<script src="" type="text/_javascript_"></script>
-<script src="" type="text/_javascript_"></script>
-<script src="" type="text/_javascript_"></script>
+<script src="" type="text/_javascript_"></script>
<body>
<script type="text/_javascript_">
Added: trunk/LayoutTests/media/modern-media-controls/layout-node/layout-node-parent-of-type-expected.txt (0 => 209271)
--- trunk/LayoutTests/media/modern-media-controls/layout-node/layout-node-parent-of-type-expected.txt (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/layout-node-parent-of-type-expected.txt 2016-12-02 22:36:50 UTC (rev 209271)
@@ -0,0 +1,12 @@
+Testing the LayoutNode.parentOfType method.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS childNode.parentOfType(CustomNode) is rootNode
+PASS childNode.parentOfType(OtherCustomNode) is null
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/media/modern-media-controls/layout-node/layout-node-parent-of-type.html (0 => 209271)
--- trunk/LayoutTests/media/modern-media-controls/layout-node/layout-node-parent-of-type.html (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/layout-node/layout-node-parent-of-type.html 2016-12-02 22:36:50 UTC (rev 209271)
@@ -0,0 +1,19 @@
+<script src=""
+<script src="" type="text/_javascript_"></script>
+<script src="" type="text/_javascript_"></script>
+<script type="text/_javascript_">
+
+description("Testing the <code>LayoutNode.parentOfType</code> method.");
+
+class CustomNode extends LayoutNode {}
+class OtherCustomNode extends LayoutNode {}
+
+const rootNode = new CustomNode;
+const childNode = rootNode.addChild(new LayoutNode).addChild(new LayoutNode);
+
+shouldBe("childNode.parentOfType(CustomNode)", "rootNode");
+shouldBeNull("childNode.parentOfType(OtherCustomNode)");
+debug("");
+
+</script>
+<script src=""
Modified: trunk/LayoutTests/media/modern-media-controls/rewind-button/rewind-button.html (209270 => 209271)
--- trunk/LayoutTests/media/modern-media-controls/rewind-button/rewind-button.html 2016-12-02 22:34:01 UTC (rev 209270)
+++ trunk/LayoutTests/media/modern-media-controls/rewind-button/rewind-button.html 2016-12-02 22:36:50 UTC (rev 209271)
@@ -1,13 +1,5 @@
-<link rel="stylesheet" href="" type="text/css" media="screen">
-<link rel="stylesheet" href="" type="text/css" media="screen">
<script src=""
-<script src="" type="text/_javascript_"></script>
-<script src="" type="text/_javascript_"></script>
-<script src="" type="text/_javascript_"></script>
-<script src="" type="text/_javascript_"></script>
-<script src="" type="text/_javascript_"></script>
-<script src="" type="text/_javascript_"></script>
-<script src="" type="text/_javascript_"></script>
+<script src="" type="text/_javascript_"></script>
<body>
<script type="text/_javascript_">
Added: trunk/LayoutTests/media/modern-media-controls/seek-backward-support/seek-backward-support-expected.txt (0 => 209271)
--- trunk/LayoutTests/media/modern-media-controls/seek-backward-support/seek-backward-support-expected.txt (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/seek-backward-support/seek-backward-support-expected.txt 2016-12-02 22:36:50 UTC (rev 209271)
@@ -0,0 +1,18 @@
+Testing the rewind button in fullscreen.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Media entered fullscreen
+Setting media.currentTime to 5s
+PASS media.currentTime is 5
+PASS media.paused is true
+
+Media was rewinded for 1 second
+PASS media.currentTime < 4 is true
+PASS media.paused is true
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/media/modern-media-controls/seek-backward-support/seek-backward-support.html (0 => 209271)
--- trunk/LayoutTests/media/modern-media-controls/seek-backward-support/seek-backward-support.html (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/seek-backward-support/seek-backward-support.html 2016-12-02 22:36:50 UTC (rev 209271)
@@ -0,0 +1,68 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableModernMediaControls=true ] -->
+<script src=""
+<body>
+<video src="" style="width: 320px; height: 240px;" controls></video>
+<div id="shadow"></div>
+<script type="text/_javascript_">
+
+window.jsTestIsAsync = true;
+
+description("Testing the rewind button in fullscreen.");
+
+const media = document.querySelector("video");
+const button = document.body.appendChild(document.createElement("button"));
+let shadowRoot = window.internals.shadowRoot(media);
+
+media.addEventListener("webkitfullscreenchange", function() {
+ if (media.webkitDisplayingFullscreen) {
+ window.requestAnimationFrame(() => {
+ debug("Media entered fullscreen");
+ debug("Setting media.currentTime to 5s");
+ media.currentTime = 5;
+ shouldBe("media.currentTime", "5");
+ shouldBeTrue("media.paused");
+
+ const forwardButtonElement = shadowRoot.lastChild.querySelector("button.rewind");
+ forwardButtonElement.dispatchEvent(new MouseEvent("mousedown"));
+
+ setTimeout(() => {
+ debug("");
+ debug("Media was rewinded for 1 second");
+ forwardButtonElement.dispatchEvent(new MouseEvent("mouseup"));
+
+ shouldBeTrue("media.currentTime < 4");
+ shouldBeTrue("media.paused");
+
+ debug("");
+ media.remove();
+ button.remove();
+ finishJSTest();
+ }, 1000);
+ });
+ }
+});
+
+media.addEventListener("loadedmetadata", () => {
+ if (!("eventSender" in window)) {
+ debug("This test is designed to run in DRT");
+ return;
+ }
+
+ // Click a button so we may enter fullscreen.
+ button.addEventListener("click", event => {
+ try {
+ media.webkitEnterFullscreen();
+ } catch(e) {
+ debug("Toggling fullscreen failed");
+ finishJSTest();
+ }
+ });
+
+ eventSender.mouseMoveTo(button.offsetLeft + 1, button.offsetTop + 1);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+});
+
+</script>
+<script src=""
+</body>
Added: trunk/LayoutTests/media/modern-media-controls/seek-forward-support/seek-forward-support-expected.txt (0 => 209271)
--- trunk/LayoutTests/media/modern-media-controls/seek-forward-support/seek-forward-support-expected.txt (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/seek-forward-support/seek-forward-support-expected.txt 2016-12-02 22:36:50 UTC (rev 209271)
@@ -0,0 +1,17 @@
+Testing the fast forward button in fullscreen.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Media entered fullscreen
+PASS media.currentTime is 0
+PASS media.paused is true
+
+Media was fast-forwarded for 1 second
+PASS media.currentTime is >= 1
+PASS media.paused is true
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/media/modern-media-controls/seek-forward-support/seek-forward-support.html (0 => 209271)
--- trunk/LayoutTests/media/modern-media-controls/seek-forward-support/seek-forward-support.html (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/seek-forward-support/seek-forward-support.html 2016-12-02 22:36:50 UTC (rev 209271)
@@ -0,0 +1,66 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableModernMediaControls=true ] -->
+<script src=""
+<body>
+<video src="" style="width: 320px; height: 240px;" controls></video>
+<div id="shadow"></div>
+<script type="text/_javascript_">
+
+window.jsTestIsAsync = true;
+
+description("Testing the fast forward button in fullscreen.");
+
+const media = document.querySelector("video");
+const button = document.body.appendChild(document.createElement("button"));
+let shadowRoot = window.internals.shadowRoot(media);
+
+media.addEventListener("webkitfullscreenchange", function() {
+ if (media.webkitDisplayingFullscreen) {
+ window.requestAnimationFrame(() => {
+ debug("Media entered fullscreen");
+ shouldBe("media.currentTime", "0");
+ shouldBeTrue("media.paused");
+
+ const forwardButtonElement = shadowRoot.lastChild.querySelector("button.forward");
+ forwardButtonElement.dispatchEvent(new MouseEvent("mousedown"));
+
+ setTimeout(() => {
+ debug("");
+ debug("Media was fast-forwarded for 1 second");
+ forwardButtonElement.dispatchEvent(new MouseEvent("mouseup"));
+
+ shouldBeGreaterThanOrEqual("media.currentTime", "1");
+ shouldBeTrue("media.paused");
+
+ debug("");
+ media.remove();
+ button.remove();
+ finishJSTest();
+ }, 1000);
+ });
+ }
+});
+
+media.addEventListener("loadedmetadata", () => {
+ if (!("eventSender" in window)) {
+ debug("This test is designed to run in DRT");
+ return;
+ }
+
+ // Click a button so we may enter fullscreen.
+ button.addEventListener("click", event => {
+ try {
+ media.webkitEnterFullscreen();
+ } catch(e) {
+ debug("Toggling fullscreen failed");
+ finishJSTest();
+ }
+ });
+
+ eventSender.mouseMoveTo(button.offsetLeft + 1, button.offsetTop + 1);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+});
+
+</script>
+<script src=""
+</body>
Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (209270 => 209271)
--- trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-12-02 22:34:01 UTC (rev 209270)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-12-02 22:36:50 UTC (rev 209271)
@@ -2752,6 +2752,8 @@
media/modern-media-controls/media-controller/media-controller-fullscreen-change.html [ Skip ]
media/modern-media-controls/media-controller/media-controller-fullscreen-ltr.html [ Skip ]
media/modern-media-controls/media-controller/media-controller-fade-controls-when-entering-fullscreen.html [ Skip ]
+media/modern-media-controls/seek-backward-support/seek-backward-support.html [ Skip ]
+media/modern-media-controls/seek-forward-support/seek-forward-support.html [ Skip ]
# These tests are all Mac-specific, we never show the tracks menu on iOS
media/modern-media-controls/tracks-panel
Modified: trunk/LayoutTests/platform/mac/TestExpectations (209270 => 209271)
--- trunk/LayoutTests/platform/mac/TestExpectations 2016-12-02 22:34:01 UTC (rev 209270)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2016-12-02 22:36:50 UTC (rev 209271)
@@ -1455,7 +1455,9 @@
[ Yosemite ] media/modern-media-controls/tracks-panel/tracks-panel-select-track-with-keyboard.html [ Skip ]
[ Yosemite ] media/modern-media-controls/tracks-support/tracks-support-show-and-populate-panel.html [ Skip ]
[ Yosemite ] media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html [ Skip ]
-[ Yosemite ] media/modern-media-controls/media-controller/media-controller-fade-controls-when-entering-fullscreen.html
+[ Yosemite ] media/modern-media-controls/media-controller/media-controller-fade-controls-when-entering-fullscreen.html [ Skip ]
+[ Yosemite ] media/modern-media-controls/seek-backward-support/seek-backward-support.html [ Skip ]
+[ Yosemite ] media/modern-media-controls/seek-forward-support/seek-forward-support.html [ Skip ]
webkit.org/b/164616 http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click.html [ Pass Failure ]
webkit.org/b/164323 media/modern-media-controls/airplay-support/airplay-support.html [ Pass Failure ]
Modified: trunk/Source/WebCore/ChangeLog (209270 => 209271)
--- trunk/Source/WebCore/ChangeLog 2016-12-02 22:34:01 UTC (rev 209270)
+++ trunk/Source/WebCore/ChangeLog 2016-12-02 22:36:50 UTC (rev 209271)
@@ -1,3 +1,54 @@
+2016-12-02 Antoine Quint <[email protected]>
+
+ [Modern Media Controls] Add rewind and fast-forward support
+ https://bugs.webkit.org/show_bug.cgi?id=165294
+
+ Reviewed by Dean Jackson.
+
+ We implement support for rewinding and fast-forwarding the media by pressing dedicated
+ buttons in fullscreen on macOS. We introduce a new SeekButton class that the existing
+ RewindButton and ForwardButton classes now extend and which provides handling of
+ "mousedown" and "mouseup" events to indicate that a button is being pressed to the
+ UI delegate.
+
+ We also introduce a new SeekSupport class from which SeekBackwardSupport and
+ SeekForwardSupport inherit to integrate with those controls and update the media
+ time.
+
+ Tests: media/modern-media-controls/layout-node/layout-node-parent-of-type.html
+ media/modern-media-controls/seek-backward-support/seek-backward-support.html
+ media/modern-media-controls/seek-forward-support/seek-forward-support.html
+
+ * Modules/modern-media-controls/controls/forward-button.js:
+ * Modules/modern-media-controls/controls/layout-node.js:
+ (LayoutNode.prototype.parentOfType):
+ * Modules/modern-media-controls/controls/rewind-button.js:
+ * Modules/modern-media-controls/controls/seek-button.js: Added.
+ (SeekButton):
+ (SeekButton.prototype.handleEvent):
+ (SeekButton.prototype._didStartPressing):
+ (SeekButton.prototype._didStopPressing):
+ (SeekButton.prototype._notifyDelegateOfPressingState):
+ * Modules/modern-media-controls/js-files:
+ * Modules/modern-media-controls/media/media-controller.js:
+ (MediaController.prototype._updateControlsIfNeeded):
+ * Modules/modern-media-controls/media/seek-backward-support.js: Added.
+ (SeekBackwardSupport.prototype.get control):
+ (SeekBackwardSupport.prototype.get multiplier):
+ (SeekBackwardSupport):
+ * Modules/modern-media-controls/media/seek-forward-support.js: Added.
+ (SeekForwardSupport.prototype.get control):
+ (SeekForwardSupport.prototype.get multiplier):
+ (SeekForwardSupport):
+ * Modules/modern-media-controls/media/seek-support.js: Added.
+ (SeekSupport.prototype.get multiplier):
+ (SeekSupport.prototype.buttonPressedStateDidChange):
+ (SeekSupport.prototype._startSeeking):
+ (SeekSupport.prototype._stopSeeking):
+ (SeekSupport.prototype._seek):
+ (SeekSupport):
+ * WebCore.xcodeproj/project.pbxproj:
+
2016-12-02 Dave Hyatt <[email protected]>
[CSS Parser] Need to set edit flags properly when user-modify/select are used.
Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/forward-button.js (209270 => 209271)
--- trunk/Source/WebCore/Modules/modern-media-controls/controls/forward-button.js 2016-12-02 22:34:01 UTC (rev 209270)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/forward-button.js 2016-12-02 22:36:50 UTC (rev 209271)
@@ -23,7 +23,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-class ForwardButton extends IconButton
+class ForwardButton extends SeekButton
{
constructor(layoutDelegate)
Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js (209270 => 209271)
--- trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js 2016-12-02 22:34:01 UTC (rev 209270)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/layout-node.js 2016-12-02 22:36:50 UTC (rev 209271)
@@ -133,6 +133,16 @@
this.addChild(child);
}
+ parentOfType(type)
+ {
+ let node = this;
+ while (node = node._parent) {
+ if (node instanceof type)
+ return node;
+ }
+ return null;
+ }
+
addChild(child, index)
{
child.remove();
Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/rewind-button.js (209270 => 209271)
--- trunk/Source/WebCore/Modules/modern-media-controls/controls/rewind-button.js 2016-12-02 22:34:01 UTC (rev 209270)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/rewind-button.js 2016-12-02 22:36:50 UTC (rev 209271)
@@ -23,7 +23,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-class RewindButton extends IconButton
+class RewindButton extends SeekButton
{
constructor(layoutDelegate)
Copied: trunk/Source/WebCore/Modules/modern-media-controls/controls/seek-button.js (from rev 209270, trunk/Source/WebCore/Modules/modern-media-controls/controls/rewind-button.js) (0 => 209271)
--- trunk/Source/WebCore/Modules/modern-media-controls/controls/seek-button.js (rev 0)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/seek-button.js 2016-12-02 22:36:50 UTC (rev 209271)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+class SeekButton extends IconButton
+{
+
+ constructor(options)
+ {
+ super(options);
+
+ this.element.addEventListener("mousedown", this);
+ }
+
+ // Protected
+
+ handleEvent(event)
+ {
+ if (event.type === "mousedown" && event.currentTarget === this.element)
+ this._didStartPressing();
+ else if (event.type === "mouseup")
+ this._didStopPressing();
+ else
+ super.handleEvent(event);
+ }
+
+ // Private
+
+ _didStartPressing()
+ {
+ const mediaControls = this.parentOfType(MediaControls);
+ if (!mediaControls)
+ return;
+
+ this._mouseupTarget = mediaControls.element;
+ this._mouseupTarget.addEventListener("mouseup", this, true);
+ this._notifyDelegateOfPressingState(true);
+ }
+
+ _didStopPressing()
+ {
+ this._mouseupTarget.removeEventListener("mouseup", this, true);
+ this._notifyDelegateOfPressingState(false);
+ }
+
+ _notifyDelegateOfPressingState(isPressed)
+ {
+ if (this._enabled && this.uiDelegate && typeof this.uiDelegate.buttonPressedStateDidChange === "function")
+ this.uiDelegate.buttonPressedStateDidChange(this, isPressed);
+ }
+
+}
Modified: trunk/Source/WebCore/Modules/modern-media-controls/js-files (209270 => 209271)
--- trunk/Source/WebCore/Modules/modern-media-controls/js-files 2016-12-02 22:34:01 UTC (rev 209270)
+++ trunk/Source/WebCore/Modules/modern-media-controls/js-files 2016-12-02 22:36:50 UTC (rev 209271)
@@ -18,6 +18,7 @@
controls/tracks-button.js
controls/fullscreen-button.js
controls/aspect-ratio-button.js
+controls/seek-button.js
controls/rewind-button.js
controls/forward-button.js
controls/buttons-container.js
@@ -44,6 +45,9 @@
media/playback-support.js
media/remaining-time-support.js
media/scrubbing-support.js
+media/seek-support.js
+media/seek-backward-support.js
+media/seek-forward-support.js
media/skip-back-support.js
media/start-support.js
media/status-support.js
Modified: trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js (209270 => 209271)
--- trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js 2016-12-02 22:34:01 UTC (rev 209270)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js 2016-12-02 22:36:50 UTC (rev 209271)
@@ -107,7 +107,7 @@
this._updateControlsSize();
- this._supportingObjects = [AirplaySupport, ControlsVisibilitySupport, ElapsedTimeSupport, FullscreenSupport, MuteSupport, PiPSupport, PlacardSupport, PlaybackSupport, RemainingTimeSupport, ScrubbingSupport, SkipBackSupport, StartSupport, StatusSupport, TracksSupport, VolumeSupport].map(SupportClass => {
+ this._supportingObjects = [AirplaySupport, ControlsVisibilitySupport, ElapsedTimeSupport, FullscreenSupport, MuteSupport, PiPSupport, PlacardSupport, PlaybackSupport, RemainingTimeSupport, ScrubbingSupport, SeekBackwardSupport, SeekForwardSupport, SkipBackSupport, StartSupport, StatusSupport, TracksSupport, VolumeSupport].map(SupportClass => {
return new SupportClass(this);
}, this);
}
Copied: trunk/Source/WebCore/Modules/modern-media-controls/media/seek-backward-support.js (from rev 209270, trunk/Source/WebCore/Modules/modern-media-controls/controls/rewind-button.js) (0 => 209271)
--- trunk/Source/WebCore/Modules/modern-media-controls/media/seek-backward-support.js (rev 0)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/seek-backward-support.js 2016-12-02 22:36:50 UTC (rev 209271)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+class SeekBackwardSupport extends SeekSupport
+{
+
+ get control()
+ {
+ return this.mediaController.controls.rewindButton;
+ }
+
+ get multiplier()
+ {
+ return -1;
+ }
+
+}
Copied: trunk/Source/WebCore/Modules/modern-media-controls/media/seek-forward-support.js (from rev 209270, trunk/Source/WebCore/Modules/modern-media-controls/controls/rewind-button.js) (0 => 209271)
--- trunk/Source/WebCore/Modules/modern-media-controls/media/seek-forward-support.js (rev 0)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/seek-forward-support.js 2016-12-02 22:36:50 UTC (rev 209271)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+class SeekForwardSupport extends SeekSupport
+{
+
+ get control()
+ {
+ return this.mediaController.controls.forwardButton;
+ }
+
+ get multiplier()
+ {
+ return 1;
+ }
+
+}
Copied: trunk/Source/WebCore/Modules/modern-media-controls/media/seek-support.js (from rev 209270, trunk/Source/WebCore/Modules/modern-media-controls/controls/rewind-button.js) (0 => 209271)
--- trunk/Source/WebCore/Modules/modern-media-controls/media/seek-support.js (rev 0)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/seek-support.js 2016-12-02 22:36:50 UTC (rev 209271)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+class SeekSupport extends MediaControllerSupport
+{
+
+ // Protected
+
+ get multiplier()
+ {
+ // Implemented by subclasses.
+ }
+
+ buttonPressedStateDidChange(control, isPressed)
+ {
+ if (isPressed)
+ this._startSeeking();
+ else
+ this._stopSeeking();
+ }
+
+ // Private
+
+ _startSeeking()
+ {
+ const media = this.mediaController.media;
+ const isPaused = media.paused;
+ if (isPaused)
+ media.play();
+
+ this._wasPausedWhenSeekingStarted = isPaused;
+ this._interval = window.setInterval(this._seek.bind(this), SeekSupport.SeekDelay);
+ this._seek();
+ }
+
+ _stopSeeking()
+ {
+ const media = this.mediaController.media;
+ media.playbackRate = media.defaultPlaybackRate;
+ if (this._wasPausedWhenSeekingStarted)
+ media.pause();
+ if (this._interval)
+ window.clearInterval(this._interval);
+ }
+
+ _seek()
+ {
+ const media = this.mediaController.media;
+ media.playbackRate = Math.min(SeekSupport.MaximumSeekRate, Math.abs(media.playbackRate * 2)) * this.multiplier;
+ }
+
+}
+
+SeekSupport.MaximumSeekRate = 8;
+SeekSupport.SeekDelay = 1500;
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (209270 => 209271)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-12-02 22:34:01 UTC (rev 209270)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-12-02 22:36:50 UTC (rev 209271)
@@ -10103,6 +10103,10 @@
7177E2481DB80D2F00919A0B /* start-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "start-support.js"; sourceTree = "<group>"; };
717F90571DC40ED60006F520 /* volume-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "volume-support.js"; sourceTree = "<group>"; };
717F90581DC4BB600006F520 /* airplay-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "airplay-support.js"; sourceTree = "<group>"; };
+ 718675431DF101AD0033D7F3 /* seek-button.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "seek-button.js"; sourceTree = "<group>"; };
+ 718675441DF101C60033D7F3 /* seek-backward-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "seek-backward-support.js"; sourceTree = "<group>"; };
+ 718675451DF101C60033D7F3 /* seek-forward-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "seek-forward-support.js"; sourceTree = "<group>"; };
+ 718675461DF101C60033D7F3 /* seek-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "seek-support.js"; sourceTree = "<group>"; };
718C7F561DD385C500B733C8 /* status-label.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = "status-label.css"; sourceTree = "<group>"; };
718C7F571DD385C500B733C8 /* status-label.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "status-label.js"; sourceTree = "<group>"; };
71A1B6071DEE5A820073BCFB /* English */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; name = English; path = "English.lproj/modern-media-controls-localized-strings.js"; sourceTree = SOURCE_ROOT; };
@@ -18120,6 +18124,7 @@
716FA0F31DB26591007323CC /* scheduler.js */,
716FA0F41DB26591007323CC /* scrubber.css */,
716FA0F51DB26591007323CC /* scrubber.js */,
+ 718675431DF101AD0033D7F3 /* seek-button.js */,
716FA0F61DB26591007323CC /* skip-back-button.js */,
716FA0F71DB26591007323CC /* slider.css */,
716FA0F81DB26591007323CC /* slider.js */,
@@ -18153,6 +18158,9 @@
71004B9D1DC1398800A52A38 /* playback-support.js */,
71004B9B1DC1109300A52A38 /* remaining-time-support.js */,
7157E3D11DC1EE4B0094550E /* scrubbing-support.js */,
+ 718675441DF101C60033D7F3 /* seek-backward-support.js */,
+ 718675451DF101C60033D7F3 /* seek-forward-support.js */,
+ 718675461DF101C60033D7F3 /* seek-support.js */,
71D2554F1DB900020004D76B /* skip-back-support.js */,
7177E2481DB80D2F00919A0B /* start-support.js */,
71B0460A1DD3C2EE00EE19CF /* status-support.js */,