Diff
Modified: trunk/LayoutTests/ChangeLog (209387 => 209388)
--- trunk/LayoutTests/ChangeLog 2016-12-06 05:44:10 UTC (rev 209387)
+++ trunk/LayoutTests/ChangeLog 2016-12-06 06:55:43 UTC (rev 209388)
@@ -1,3 +1,20 @@
+2016-12-05 Antoine Quint <[email protected]>
+
+ [Modern Media Controls] Controls bar in fullscreen cannot be dragged
+ https://bugs.webkit.org/show_bug.cgi?id=165448
+
+ Reviewed by Simon Fraser.
+
+ Add a new test that simulates a dragging interaction of the controls bar in fullscreen.
+
+ * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles-expected.txt:
+ * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html:
+ * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-controls-bar-styles-expected.txt:
+ * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-controls-bar-styles.html:
+ * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt: Added.
+ * media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html: Added.
+ * platform/ios-simulator/TestExpectations:
+
2016-12-05 Dave Hyatt <[email protected]>
[CSS Parser] Skip more bad tests
Modified: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles-expected.txt (209387 => 209388)
--- trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles-expected.txt 2016-12-06 05:44:10 UTC (rev 209387)
+++ trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles-expected.txt 2016-12-06 06:55:43 UTC (rev 209388)
@@ -3,13 +3,13 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS centerContainerBounds.left is 61
-PASS centerContainerBounds.top is 50
+PASS centerContainerBounds.left is 311
+PASS centerContainerBounds.top is 500
PASS centerContainerBounds.width is 178
PASS centerContainerBounds.height is 44
-PASS rightContainerBounds.left is within 0.5 of 218
-PASS rightContainerBounds.top is 50
+PASS rightContainerBounds.left is within 0.5 of 468
+PASS rightContainerBounds.top is 500
PASS rightContainerBounds.width is within 0.5 of 166
PASS rightContainerBounds.height is 44
Modified: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html (209387 => 209388)
--- trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html 2016-12-06 05:44:10 UTC (rev 209387)
+++ trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html 2016-12-06 06:55:43 UTC (rev 209388)
@@ -2,7 +2,18 @@
<script src="" type="text/_javascript_"></script>
<script src="" type="text/_javascript_"></script>
<body>
-<div id="container" style="position: absolute; top: 0; left: 0;"></div>
+<div id="container"></div>
+<style type="text/css" media="screen">
+
+#container {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 800px;
+ height: 600px;
+}
+
+</style>
<script type="text/_javascript_">
description("Testing the <code>MacOSFullscreenMediaControls</code> computed styles.");
@@ -23,15 +34,15 @@
document.getElementById("container").appendChild(mediaControls.element);
centerContainerBounds = centerContainer.element.getBoundingClientRect();
- shouldBe("centerContainerBounds.left", "61");
- shouldBe("centerContainerBounds.top", "50");
+ shouldBe("centerContainerBounds.left", "311");
+ shouldBe("centerContainerBounds.top", "500");
shouldBe("centerContainerBounds.width", "178");
shouldBe("centerContainerBounds.height", "44");
debug("");
rightContainerBounds = rightContainer.element.getBoundingClientRect();
- shouldBeCloseTo("rightContainerBounds.left", 218, 0.5);
- shouldBe("rightContainerBounds.top", "50");
+ shouldBeCloseTo("rightContainerBounds.left", 468, 0.5);
+ shouldBe("rightContainerBounds.top", "500");
shouldBeCloseTo("rightContainerBounds.width", 166, 0.5);
shouldBe("rightContainerBounds.height", "44");
Modified: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-controls-bar-styles-expected.txt (209387 => 209388)
--- trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-controls-bar-styles-expected.txt 2016-12-06 05:44:10 UTC (rev 209387)
+++ trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-controls-bar-styles-expected.txt 2016-12-06 06:55:43 UTC (rev 209388)
@@ -3,14 +3,12 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS style.left is "50%"
PASS style.bottom is "25px"
PASS style.width is "468px"
PASS style.height is "75px"
-PASS style.transform is "matrix(1, 0, 0, 1, -234, 0)"
PASS style.borderRadius is "8px"
-PASS bounds.left is -84
-PASS bounds.top is 50
+PASS bounds.left is 166
+PASS bounds.top is 500
PASS bounds.width is 468
PASS bounds.height is 75
PASS rgba(style.backgroundColor).r is 30
Modified: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-controls-bar-styles.html (209387 => 209388)
--- trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-controls-bar-styles.html 2016-12-06 05:44:10 UTC (rev 209387)
+++ trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-controls-bar-styles.html 2016-12-06 06:55:43 UTC (rev 209388)
@@ -2,14 +2,17 @@
<script src="" type="text/_javascript_"></script>
<script src="" type="text/_javascript_"></script>
<body>
+<div id="container"></div>
<style type="text/css" media="screen">
-
-.media-controls {
+
+#container {
position: absolute;
top: 0;
left: 0;
+ width: 800px;
+ height: 600px;
}
-
+
</style>
<script type="text/_javascript_">
@@ -22,20 +25,18 @@
let style, bounds;
scheduler.frameDidFire = function()
{
- document.body.appendChild(mediaControls.element);
+ document.getElementById("container").appendChild(mediaControls.element);
style = window.getComputedStyle(mediaControls.controlsBar.element);
bounds = mediaControls.controlsBar.element.getBoundingClientRect();
- shouldBeEqualToString("style.left", "50%");
shouldBeEqualToString("style.bottom", "25px");
shouldBeEqualToString("style.width", "468px");
shouldBeEqualToString("style.height", "75px");
- shouldBeEqualToString("style.transform", "matrix(1, 0, 0, 1, -234, 0)");
shouldBeEqualToString("style.borderRadius", "8px");
- shouldBe("bounds.left", "-84");
- shouldBe("bounds.top", "50");
+ shouldBe("bounds.left", "166");
+ shouldBe("bounds.top", "500");
shouldBe("bounds.width", "468");
shouldBe("bounds.height", "75");
Added: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt (0 => 209388)
--- trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-expected.txt 2016-12-06 06:55:43 UTC (rev 209388)
@@ -0,0 +1,10 @@
+Testing the MediaController resizing behavior.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS mediaControls.querySelector('.controls-bar').style.transform is "translate(-50px, -100px)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html (0 => 209388)
--- trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html 2016-12-06 06:55:43 UTC (rev 209388)
@@ -0,0 +1,50 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableModernMediaControls=true ] -->
+<script src=""
+<body>
+<video src="" style="width: 320px; height: 240px;" controls autoplay></video>
+<script type="text/_javascript_">
+
+window.jsTestIsAsync = true;
+
+description("Testing the <code>MediaController</code> resizing behavior.");
+
+const media = document.querySelector("video");
+const shadowRoot = window.internals.shadowRoot(media);
+let mediaControls = shadowRoot.lastChild;
+
+media.addEventListener("webkitbeginfullscreen", () => {
+ debug("webkitbeginfullscreen");
+});
+
+media.addEventListener("webkitfullscreenchange", () => {
+ if (media.webkitDisplayingFullscreen) {
+ mediaControls = shadowRoot.lastChild;
+ window.requestAnimationFrame(() => {
+ const bounds = mediaControls.querySelector(".controls-bar").getBoundingClientRect();
+ eventSender.mouseMoveTo(bounds.left + 10, bounds.top + 10);
+ eventSender.mouseDown();
+ eventSender.mouseMoveTo(bounds.left - 40, bounds.top - 90);
+ eventSender.mouseUp();
+
+ window.requestAnimationFrame(() => {
+ shouldBeEqualToString("mediaControls.querySelector('.controls-bar').style.transform", "translate(-50px, -100px)");
+ finishJSTest();
+ });
+ });
+ }
+});
+
+media.addEventListener("play", () => {
+ media.pause();
+
+ window.requestAnimationFrame(() => {
+ const bounds = mediaControls.querySelector("button.fullscreen").getBoundingClientRect();
+ eventSender.mouseMoveTo(bounds.left + 1, bounds.top + 1);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ });
+});
+
+</script>
+<script src=""
+</body>
Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (209387 => 209388)
--- trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-12-06 05:44:10 UTC (rev 209387)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations 2016-12-06 06:55:43 UTC (rev 209388)
@@ -2754,6 +2754,7 @@
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 ]
+media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html [ Skip ]
# These tests are all Mac-specific, we never show the tracks menu on iOS
media/modern-media-controls/tracks-panel
Modified: trunk/Source/WebCore/ChangeLog (209387 => 209388)
--- trunk/Source/WebCore/ChangeLog 2016-12-06 05:44:10 UTC (rev 209387)
+++ trunk/Source/WebCore/ChangeLog 2016-12-06 06:55:43 UTC (rev 209388)
@@ -1,3 +1,30 @@
+2016-12-05 Antoine Quint <[email protected]>
+
+ [Modern Media Controls] Controls bar in fullscreen cannot be dragged
+ https://bugs.webkit.org/show_bug.cgi?id=165448
+
+ Reviewed by Simon Fraser.
+
+ We weren't listening to mousemove and mouseup events on the right event target, window in the context
+ of a fullscreen shadow root makes no sense. We now listen to those events on the media controls, which
+ we size to fit the whole of the media element's bounds. We then apply a transform to the controls bar
+ to apply the dragging distance.
+
+ Test: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html
+
+ * Modules/modern-media-controls/controls/controls-bar.js:
+ (ControlsBar.prototype.get translation):
+ (ControlsBar.prototype.set translation):
+ (ControlsBar.prototype.commitProperty):
+ (ControlsBar): Deleted.
+ * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
+ (.media-controls.mac.fullscreen):
+ (.media-controls.mac.fullscreen > .controls-bar):
+ * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
+ (MacOSFullscreenMediaControls.prototype._handleMousedown):
+ (MacOSFullscreenMediaControls.prototype._handleMousemove):
+ (MacOSFullscreenMediaControls.prototype._handleMouseup):
+
2016-12-05 Dave Hyatt <[email protected]>
[CSS Parser] Allow calc in SVG attributes
Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/controls-bar.js (209387 => 209388)
--- trunk/Source/WebCore/Modules/modern-media-controls/controls/controls-bar.js 2016-12-06 05:44:10 UTC (rev 209387)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/controls-bar.js 2016-12-06 06:55:43 UTC (rev 209388)
@@ -29,6 +29,34 @@
constructor()
{
super(`<div class="controls-bar">`);
+
+ this._translation = new DOMPoint;
}
+ // Public
+
+ get translation()
+ {
+ return new DOMPoint(this._translation.x, this._translation.y);
+ }
+
+ set translation(point)
+ {
+ if (this._translation.x === point.x && this._translation.y === point.y)
+ return
+
+ this._translation = new DOMPoint(point.x, point.y);
+ this.markDirtyProperty("translation");
+ }
+
+ // Protected
+
+ commitProperty(propertyName)
+ {
+ if (propertyName === "translation")
+ this.element.style.transform = `translate(${this._translation.x}px, ${this._translation.y}px)`;
+ else
+ super.commitProperty(propertyName);
+ }
+
}
Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css (209387 => 209388)
--- trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css 2016-12-06 05:44:10 UTC (rev 209387)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css 2016-12-06 06:55:43 UTC (rev 209388)
@@ -28,14 +28,16 @@
.media-controls.mac.fullscreen {
--controls-bar-width: 468px;
--tracks-panel-right-margin: 40px;
+
+ width: 100% !important;
+ height: 100% !important;
}
.media-controls.mac.fullscreen > .controls-bar {
- left: 50%;
+ left: calc((100% - var(--controls-bar-width)) / 2);
bottom: 25px;
width: var(--controls-bar-width);
height: 75px;
- transform: translateX(-50%);
overflow: hidden;
border-radius: 8px;
Modified: trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js (209387 => 209388)
--- trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js 2016-12-06 05:44:10 UTC (rev 209387)
+++ trunk/Source/WebCore/Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js 2016-12-06 06:55:43 UTC (rev 209388)
@@ -82,8 +82,6 @@
}
}
- // Public
-
layout()
{
super.layout();
@@ -104,6 +102,8 @@
this.timeControl.width = FullscreenTimeControlWidth;
}
+ // Private
+
_handleMousedown(event)
{
if (event.target !== this.controlsBar.element)
@@ -113,8 +113,8 @@
this._lastDragPoint = this._pointForEvent(event);
- window.addEventListener("mousemove", this, true);
- window.addEventListener("mouseup", this, true);
+ this.element.addEventListener("mousemove", this, true);
+ this.element.addEventListener("mouseup", this, true);
}
_handleMousemove(event)
@@ -122,8 +122,11 @@
event.preventDefault();
const currentDragPoint = this._pointForEvent(event);
- this.x += currentDragPoint.x - this._lastDragPoint.x;
- this.y += currentDragPoint.y - this._lastDragPoint.y;
+
+ this.controlsBar.translation = new DOMPoint(
+ this.controlsBar.translation.x + currentDragPoint.x - this._lastDragPoint.x,
+ this.controlsBar.translation.y + currentDragPoint.y - this._lastDragPoint.y
+ );
this._lastDragPoint = currentDragPoint;
}
@@ -132,8 +135,10 @@
{
event.preventDefault();
- window.removeEventListener("mousemove", this, true);
- window.removeEventListener("mouseup", this, true);
+ delete this._lastDragPoint;
+
+ this.element.removeEventListener("mousemove", this, true);
+ this.element.removeEventListener("mouseup", this, true);
}
_pointForEvent(event)