Title: [209156] trunk/Source/WebCore
- Revision
- 209156
- Author
- commit-qu...@webkit.org
- Date
- 2016-11-30 14:45:38 -0800 (Wed, 30 Nov 2016)
Log Message
[Modern Media Controls] Controls are not visible when returning from picture-in-picture playback
https://bugs.webkit.org/show_bug.cgi?id=165183
Patch by Antoine Quint <grao...@apple.com> on 2016-11-30
Reviewed by Dean Jackson.
We need to call MediaControlsHost::setPreparedToReturnVideoLayerToInline() when we return from
picture-in-picture playback such that the video layer is correctly stacked under the media controls.
We call that function in a rAF call to ensure it's performed in sync with the next scheduled layout
or the media controls would not appear in sync with the video layer.
We also fix an error from a previous commit in ControlsVisibilitySupport.
* Modules/modern-media-controls/media/controls-visibility-support.js:
(ControlsVisibilitySupport.prototype.syncControl):
(ControlsVisibilitySupport):
* Modules/modern-media-controls/media/media-controller.js:
(MediaController):
(MediaController.prototype.handleEvent):
(MediaController.prototype._returnMediaLayerToInlineIfNeeded):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (209155 => 209156)
--- trunk/Source/WebCore/ChangeLog 2016-11-30 22:26:10 UTC (rev 209155)
+++ trunk/Source/WebCore/ChangeLog 2016-11-30 22:45:38 UTC (rev 209156)
@@ -1,3 +1,25 @@
+2016-11-30 Antoine Quint <grao...@apple.com>
+
+ [Modern Media Controls] Controls are not visible when returning from picture-in-picture playback
+ https://bugs.webkit.org/show_bug.cgi?id=165183
+
+ Reviewed by Dean Jackson.
+
+ We need to call MediaControlsHost::setPreparedToReturnVideoLayerToInline() when we return from
+ picture-in-picture playback such that the video layer is correctly stacked under the media controls.
+ We call that function in a rAF call to ensure it's performed in sync with the next scheduled layout
+ or the media controls would not appear in sync with the video layer.
+
+ We also fix an error from a previous commit in ControlsVisibilitySupport.
+
+ * Modules/modern-media-controls/media/controls-visibility-support.js:
+ (ControlsVisibilitySupport.prototype.syncControl):
+ (ControlsVisibilitySupport):
+ * Modules/modern-media-controls/media/media-controller.js:
+ (MediaController):
+ (MediaController.prototype.handleEvent):
+ (MediaController.prototype._returnMediaLayerToInlineIfNeeded):
+
2016-11-30 Jiewen Tan <jiewen_...@apple.com>
Update SubtleCrypto::wrapKey to match the latest spec
Modified: trunk/Source/WebCore/Modules/modern-media-controls/media/controls-visibility-support.js (209155 => 209156)
--- trunk/Source/WebCore/Modules/modern-media-controls/media/controls-visibility-support.js 2016-11-30 22:26:10 UTC (rev 209155)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/controls-visibility-support.js 2016-11-30 22:45:38 UTC (rev 209156)
@@ -49,7 +49,7 @@
syncControl()
{
let shouldShowControls = this.mediaController.media.controls;
- if (media instanceof HTMLVideoElement)
+ if (this.mediaController.media instanceof HTMLVideoElement)
shouldShowControls = shouldShowControls && this.mediaController.media.readyState > HTMLMediaElement.HAVE_NOTHING;
this.mediaController.controls.startButton.visible = shouldShowControls;
Modified: trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js (209155 => 209156)
--- trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js 2016-11-30 22:26:10 UTC (rev 209155)
+++ trunk/Source/WebCore/Modules/modern-media-controls/media/media-controller.js 2016-11-30 22:45:38 UTC (rev 209156)
@@ -32,6 +32,9 @@
this.media = media;
this.host = host;
+ if (host)
+ media.addEventListener("webkitpresentationmodechanged", this);
+
this._updateControlsIfNeeded();
media.addEventListener("resize", this);
@@ -61,10 +64,20 @@
handleEvent(event)
{
- if (event.type === "resize" && event.currentTarget === this.media)
+ if (event.currentTarget !== this.media)
+ return;
+
+ switch (event.type) {
+ case "resize":
this._updateControlsSize();
- else if (event.type === "webkitfullscreenchange" && event.currentTarget === this.media)
+ break;
+ case "webkitfullscreenchange":
this._updateControlsIfNeeded();
+ break;
+ case "webkitpresentationmodechanged":
+ this._returnMediaLayerToInlineIfNeeded();
+ break;
+ }
}
// Private
@@ -103,6 +116,11 @@
this.controls.height = this.media.offsetHeight;
}
+ _returnMediaLayerToInlineIfNeeded()
+ {
+ window.requestAnimationFrame(() => this.host.setPreparedToReturnVideoLayerToInline(this.media.webkitPresentationMode !== PiPMode));
+ }
+
_controlsClass()
{
const layoutTraits = this.layoutTraits;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes