- Revision
- 203151
- Author
- [email protected]
- Date
- 2016-07-12 21:50:14 -0700 (Tue, 12 Jul 2016)
Log Message
REGRESSION (r202509): media controls controls enabled AirPlay placeholder is shown
https://bugs.webkit.org/show_bug.cgi?id=159685
<rdar://problem/27198899>
Reviewed by Dean Jackson.
Source/WebCore:
Test: media/controls/airplay-controls.html
* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.shouldShowControls): Split some of the logic out of shouldHaveControls.
(Controller.prototype.shouldHaveControls): Having controls != showing controls.
(Controller.prototype.updateControls): Call shouldShowControls, not shouldHaveControls.
(Controller.prototype.updateWirelessPlaybackStatus): Add 'appletv' to the class when active.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::getCurrentMediaControlsStatus): Call ensureMediaControlsShadowRoot
in case the controls haven't been created yet.
LayoutTests:
* media/controls/airplay-controls-expected.txt: Added.
* media/controls/airplay-controls.html: Added.
* media/controls/controls-test-helpers.js:
(ControlsTest.prototype.get currentState): Put a try block around the call to get the current
status in case it fails.
* platform/mac/TestExpectations: Skip the new test on Yosemite where AirPlay doesn't work.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (203150 => 203151)
--- trunk/LayoutTests/ChangeLog 2016-07-13 04:47:00 UTC (rev 203150)
+++ trunk/LayoutTests/ChangeLog 2016-07-13 04:50:14 UTC (rev 203151)
@@ -1,3 +1,20 @@
+2016-07-12 Eric Carlson <[email protected]>
+
+ REGRESSION (r202509): media controls controls enabled AirPlay placeholder is shown
+ https://bugs.webkit.org/show_bug.cgi?id=159685
+ <rdar://problem/27198899>
+
+ Reviewed by Dean Jackson.
+
+ * media/controls/airplay-controls-expected.txt: Added.
+ * media/controls/airplay-controls.html: Added.
+
+ * media/controls/controls-test-helpers.js:
+ (ControlsTest.prototype.get currentState): Put a try block around the call to get the current
+ status in case it fails.
+
+ * platform/mac/TestExpectations: Skip the new test on Yosemite where AirPlay doesn't work.
+
2016-07-12 Benjamin Poulain <[email protected]>
[JSC] Array.prototype.join() fails some conformance tests
Added: trunk/LayoutTests/media/controls/airplay-controls-expected.txt (0 => 203151)
--- trunk/LayoutTests/media/controls/airplay-controls-expected.txt (rev 0)
+++ trunk/LayoutTests/media/controls/airplay-controls-expected.txt 2016-07-13 04:50:14 UTC (rev 203151)
@@ -0,0 +1,21 @@
+This tests that showing the wireless device placeholder does not show controls.
+
+This test only runs in DRT!
+
+
+EVENT: canplaythrough
+
+Test initial state
+
+PASS: We are using the apple idiom
+PASS: video.controls should be false
+PASS: Controls should not be visible
+
+Select an AppleTV device
+
+PASS: Placeholder is visible
+PASS: Placeholder has classname 'appletv'
+PASS: Controls should not be visible
+
+Testing finished.
+
Added: trunk/LayoutTests/media/controls/airplay-controls.html (0 => 203151)
--- trunk/LayoutTests/media/controls/airplay-controls.html (rev 0)
+++ trunk/LayoutTests/media/controls/airplay-controls.html 2016-07-13 04:50:14 UTC (rev 203151)
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src=""
+ <script src=""
+ <script>
+ internals.setMockMediaPlaybackTargetPickerEnabled(true);
+ internals.settings.setAllowsAirPlayForMediaPlayback(true);
+
+ let eventCounter = 0;
+
+ function isVisible(state)
+ {
+ if (state === null || typeof state.className !== "string")
+ return true;
+
+ const classes = state.className.split();
+ return !classes.includes("dropped") && !classes.includes("hidden");
+ }
+
+ function start()
+ {
+ tester.startNewSection("Test initial state");
+
+ tester.test("We are using the apple idiom")
+ .value(tester.currentState.idiom)
+ .isEqualTo("apple");
+
+ tester.test("video.controls should be false")
+ .value(tester.media.controls)
+ .isFalse();
+
+ const controlPanel = tester.stateForControlsElement("Media Controls Panel");
+ tester.test("Controls should not be visible")
+ .value(isVisible(controlPanel))
+ .isFalse();
+
+ tester.startNewSection("Select an AppleTV device");
+ internals.setMediaElementRestrictions(tester.media, "norestrictions");
+ tester.media.addEventListener('webkitplaybacktargetavailabilitychanged', () => { }, false);
+ tester.media.addEventListener('webkitcurrentplaybacktargetiswirelesschanged', targetChanged, false);
+ internals.setMockMediaPlaybackTargetPickerState("Sleepy TV", "DeviceAvailable");
+ }
+
+ function targetChanged()
+ {
+ if (!tester.media.webkitCurrentPlaybackTargetIsWireless)
+ return;
+
+ // Because this script is triggered by the same event the default controls use to
+ // show the placeholder, this may run before the controls have been reconfigured.
+ const placeholder = tester.stateForControlsElement("Inline playback placeholder", true);
+ if (!isVisible(placeholder) && ++eventCounter < 5) {
+ setTimeout(targetChanged, 100);
+ return;
+ }
+
+ tester.test("Placeholder is visible")
+ .value(isVisible(placeholder))
+ .isTrue();
+ tester.test("Placeholder has classname 'appletv'")
+ .value(placeholder.className)
+ .contains("appletv");
+
+ const controlPanel = tester.stateForControlsElement("Media Controls Panel");
+ tester.test("Controls should not be visible")
+ .value(isVisible(controlPanel))
+ .isFalse();
+
+ tester.end();
+ }
+
+ const tester = new ControlsTest()
+ .whenReady(start)
+ .start();
+
+ </script>
+ </head>
+ <body>
+ <p>This tests that showing the wireless device placeholder does not show controls.</p>
+ <p>This test only runs in DRT!</p>
+ <video ></video>
+ </body>
+</html>
Modified: trunk/LayoutTests/media/controls/controls-test-helpers.js (203150 => 203151)
--- trunk/LayoutTests/media/controls/controls-test-helpers.js 2016-07-13 04:47:00 UTC (rev 203150)
+++ trunk/LayoutTests/media/controls/controls-test-helpers.js 2016-07-13 04:50:14 UTC (rev 203151)
@@ -40,7 +40,11 @@
return null;
if (window.internals) {
- this.cachedCurrentState = JSON.parse(internals.getCurrentMediaControlsStatusForElement(this.media));
+ let state = { idiom: "apple", status: "fail" };
+ try {
+ state = JSON.parse(internals.getCurrentMediaControlsStatusForElement(this.media));
+ } catch(e) { }
+ this.cachedCurrentState = state;
return this.cachedCurrentState;
}
Modified: trunk/LayoutTests/platform/mac/TestExpectations (203150 => 203151)
--- trunk/LayoutTests/platform/mac/TestExpectations 2016-07-13 04:47:00 UTC (rev 203150)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2016-07-13 04:50:14 UTC (rev 203151)
@@ -1288,6 +1288,7 @@
[ Yosemite ] media/airplay-target-availability.html
[ Yosemite ] media/controls/airplay-picker.html
[ Yosemite ] media/airplay-autoplay.html
+[ Yosemite ] media/controls/airplay-controls.html
webkit.org/b/153086 sputnik/Conformance/15_Native_Objects/15.1_The_Global_Object/15.1.3/15.1.3.3_encodeURI/S15.1.3.3_A2.4_T2.html [ Pass Crash ]
Modified: trunk/Source/WebCore/ChangeLog (203150 => 203151)
--- trunk/Source/WebCore/ChangeLog 2016-07-13 04:47:00 UTC (rev 203150)
+++ trunk/Source/WebCore/ChangeLog 2016-07-13 04:50:14 UTC (rev 203151)
@@ -1,3 +1,23 @@
+2016-07-12 Eric Carlson <[email protected]>
+
+ REGRESSION (r202509): media controls controls enabled AirPlay placeholder is shown
+ https://bugs.webkit.org/show_bug.cgi?id=159685
+ <rdar://problem/27198899>
+
+ Reviewed by Dean Jackson.
+
+ Test: media/controls/airplay-controls.html
+
+ * Modules/mediacontrols/mediaControlsApple.js:
+ (Controller.prototype.shouldShowControls): Split some of the logic out of shouldHaveControls.
+ (Controller.prototype.shouldHaveControls): Having controls != showing controls.
+ (Controller.prototype.updateControls): Call shouldShowControls, not shouldHaveControls.
+ (Controller.prototype.updateWirelessPlaybackStatus): Add 'appletv' to the class when active.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus): Call ensureMediaControlsShadowRoot
+ in case the controls haven't been created yet.
+
2016-07-12 Frederic Wang <[email protected]>
Move parsing of mpadded attributes to a MathMLPaddedElement class
Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (203150 => 203151)
--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js 2016-07-13 04:47:00 UTC (rev 203150)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js 2016-07-13 04:50:14 UTC (rev 203151)
@@ -118,7 +118,8 @@
out: 'out',
pictureInPictureButton: 'picture-in-picture-button',
placeholderShowing: 'placeholder-showing',
- usesLTRUserInterfaceLayoutDirection: 'uses-ltr-user-interface-layout-direction'
+ usesLTRUserInterfaceLayoutDirection: 'uses-ltr-user-interface-layout-direction',
+ appleTV: 'appletv',
},
KeyCodes: {
enter: 13,
@@ -301,16 +302,19 @@
return this.shouldHaveControls() || (this.video.textTracks && this.video.textTracks.length) || this.currentPlaybackTargetIsWireless();
},
- shouldHaveControls: function()
+ shouldShowControls: function()
{
if (!this.isAudio() && !this.host.allowsInlineMediaPlayback)
return true;
- if (this.isFullScreen() || this.presentationMode() === 'picture-in-picture' || this.currentPlaybackTargetIsWireless())
- return true;
+ return this.video.controls || this.isFullScreen();
+ },
- return this.video.controls;
+ shouldHaveControls: function()
+ {
+ return this.shouldShowControls() || this.isFullScreen() || this.presentationMode() === 'picture-in-picture' || this.currentPlaybackTargetIsWireless();
},
+
setNeedsTimelineMetricsUpdate: function()
{
@@ -670,7 +674,7 @@
this.updateLayoutForDisplayedWidth();
this.setNeedsTimelineMetricsUpdate();
- if (this.shouldHaveControls()) {
+ if (this.shouldShowControls()) {
this.controls.panel.classList.add(this.ClassNames.show);
this.controls.panel.classList.remove(this.ClassNames.hidden);
this.resetHideControlsTimer();
@@ -2153,6 +2157,7 @@
this.controls.inlinePlaybackPlaceholderTextTop.innerText = deviceType;
this.controls.inlinePlaybackPlaceholderTextBottom.innerText = deviceName;
this.controls.inlinePlaybackPlaceholder.setAttribute('aria-label', deviceType + ", " + deviceName);
+ this.controls.inlinePlaybackPlaceholder.classList.add(this.ClassNames.appleTV);
this.controls.inlinePlaybackPlaceholder.classList.remove(this.ClassNames.hidden);
this.controls.wirelessTargetPicker.classList.add(this.ClassNames.playing);
if (!this.isFullScreen() && (this.video.offsetWidth <= 250 || this.video.offsetHeight <= 200)) {
@@ -2170,6 +2175,7 @@
this.showControls();
} else {
this.controls.inlinePlaybackPlaceholder.classList.add(this.ClassNames.hidden);
+ this.controls.inlinePlaybackPlaceholder.classList.remove(this.ClassNames.appleTV);
this.controls.wirelessTargetPicker.classList.remove(this.ClassNames.playing);
this.controls.volumeBox.classList.remove(this.ClassNames.hidden);
this.controls.muteBox.classList.remove(this.ClassNames.hidden);
@@ -2364,6 +2370,15 @@
name: "Inline playback placeholder",
object: this.controls.inlinePlaybackPlaceholder,
},
+ {
+ name: "Media Controls Panel",
+ object: this.controls.panel,
+ extraProperties: ["hidden"],
+ },
+ {
+ name: "Control Base Element",
+ object: this.base || null,
+ },
];
elements.forEach(function (element) {
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (203150 => 203151)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-07-13 04:47:00 UTC (rev 203150)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-07-13 04:50:14 UTC (rev 203151)
@@ -6704,6 +6704,8 @@
String HTMLMediaElement::getCurrentMediaControlsStatus()
{
DOMWrapperWorld& world = ensureIsolatedWorld();
+ ensureMediaControlsShadowRoot();
+
ScriptController& scriptController = document().frame()->script();
JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(world));
JSC::ExecState* exec = globalObject->globalExec();