Diff
Modified: trunk/Source/WebCore/ChangeLog (184365 => 184366)
--- trunk/Source/WebCore/ChangeLog 2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/ChangeLog 2015-05-15 03:28:24 UTC (rev 184366)
@@ -1,3 +1,21 @@
+2015-05-14 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r184359 and r184362.
+ https://bugs.webkit.org/show_bug.cgi?id=145035
+
+ Introduced a crash in six media element tests (Requested by
+ rniwa on #webkit).
+
+ Reverted changesets:
+
+ "[MediaControls] Refactor media controls & bring improvements
+ made to iOS controls to Mac."
+ https://bugs.webkit.org/show_bug.cgi?id=144973
+ http://trac.webkit.org/changeset/184359
+
+ "Unreviewed build fix after r184359; typo."
+ http://trac.webkit.org/changeset/184362
+
2015-05-14 Jer Noble <[email protected]>
Unreviewed build fix after r184359; typo.
Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css (184365 => 184366)
--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css 2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css 2015-05-15 03:28:24 UTC (rev 184366)
@@ -599,9 +599,7 @@
}
video::-webkit-media-controls-panel .hidden,
-audio::-webkit-media-controls-panel .hidden,
-video::-webkit-media-controls-panel .dropped,
-audio::-webkit-media-controls-panel .dropped {
+audio::-webkit-media-controls-panel .hidden {
display: none;
}
Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js (184365 => 184366)
--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js 2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.js 2015-05-15 03:28:24 UTC (rev 184366)
@@ -17,9 +17,6 @@
this.currentTargetIsWireless = false;
this.wirelessPlaybackDisabled = false;
this.isVolumeSliderActive = false;
- this.currentDisplayWidth = 0;
- this._scrubbing = false;
- this._pageScaleFactor = 1;
this.addVideoListeners();
this.createBase();
@@ -40,9 +37,6 @@
this.updateHasVideo();
this.updateWirelessTargetAvailable();
this.updateWirelessPlaybackStatus();
- this.scheduleUpdateLayoutForDisplayedWidth();
-
- this.listenFor(this.root, 'resize', this.handleRootResize);
};
/* Enums */
@@ -87,7 +81,6 @@
SeekDelay: 1500,
ClassNames: {
active: 'active',
- dropped: 'dropped',
exit: 'exit',
failed: 'failed',
hidden: 'hidden',
@@ -125,8 +118,6 @@
right: 39,
down: 40
},
- MinimumTimelineWidth: 150,
- ButtonWidth: 32,
extend: function(child)
{
@@ -466,7 +457,8 @@
inlinePlaybackPlaceholder.setAttribute('pseudo', '-webkit-media-controls-wireless-playback-status');
if (!Controller.gSimulateOptimizedFullscreenAvailable)
inlinePlaybackPlaceholder.classList.add(this.ClassNames.hidden);
-
+ inlinePlaybackPlaceholder.setAttribute('aria-label', this.UIString('Display Optimized Full Screen'));
+
var inlinePlaybackPlaceholderText = this.controls.inlinePlaybackPlaceholderText = document.createElement('div');
inlinePlaybackPlaceholderText.setAttribute('pseudo', '-webkit-media-controls-wireless-playback-text');
@@ -601,7 +593,6 @@
else
this.setControlsType(Controller.InlineControls);
- this.updateLayoutForDisplayedWidth();
this.setNeedsTimelineMetricsUpdate();
},
@@ -666,15 +657,12 @@
this.updateFullscreenButtons();
this.updateWirelessTargetPickerButton();
this.updateProgress();
- this.updateControls();
},
handleTimeUpdate: function(event)
{
- if (!this.scrubbing) {
+ if (!this.scrubbing)
this.updateTime();
- this.updateProgress();
- }
this.drawTimelineBackground();
},
@@ -863,9 +851,6 @@
handleTimelineInput: function(event)
{
- if (this.scrubbing)
- this.video.pause();
-
this.video.fastSeek(this.controls.timeline.value);
this.updateControlsWhileScrubbing();
},
@@ -873,7 +858,6 @@
handleTimelineChange: function(event)
{
this.video.currentTime = this.controls.timeline.value;
- this.updateProgress();
},
handleTimelineDown: function(event)
@@ -1011,7 +995,6 @@
var shouldBeHidden = !this.video.webkitSupportsFullscreen || !this.hasVideo();
this.controls.fullscreenButton.classList.toggle(this.ClassNames.hidden, shouldBeHidden);
this.controls.optimizedFullscreenButton.classList.toggle(this.ClassNames.hidden, shouldBeHidden);
- this.updateLayoutForDisplayedWidth();
},
handleFullscreenButtonClicked: function(event)
@@ -1363,7 +1346,6 @@
if (this.showInlinePlaybackPlaceholderOnly())
return;
- this.updateLayoutForDisplayedWidth();
this.setNeedsTimelineMetricsUpdate();
this.updateTime(true);
this.updateProgress(true);
@@ -1380,7 +1362,7 @@
hideControls: function()
{
- if (this.controlsAlwaysVisible())
+ if (this.controlsAlwaysVisible() || this._potentiallyScrubbing)
return;
this.updateShouldListenForPlaybackTargetAvailabilityEvent();
@@ -1389,65 +1371,9 @@
this.controls.panelBackground.classList.remove(this.ClassNames.show);
},
- scheduleUpdateLayoutForDisplayedWidth: function()
- {
- setTimeout(this.updateLayoutForDisplayedWidth.bind(this), 0);
- },
-
- isControlVisible: function(control)
- {
- if (!control)
- return false;
- if (!this.root.contains(control))
- return false;
- return !control.classList.contains(this.ClassNames.hidden)
- },
-
- updateLayoutForDisplayedWidth: function()
- {
- if (!this.controls || !this.controls.panel)
- return;
-
- var visibleWidth = this.controls.panel.getBoundingClientRect().width * this._pageScaleFactor;
- if (visibleWidth <= 0 || visibleWidth == this.currentDisplayWidth)
- return;
-
- this.currentDisplayWidth = visibleWidth;
-
- // We need to work out how many buttons are available.
- this.updateWirelessTargetAvailable();
- this.updateFullscreenButtons();
-
- // Filter all the buttons which are not explicitly hidden.
- var buttons = [this.controls.playButton, this.controls.rewindButton, this.controls.captionButton,
- this.controls.fullscreenButton, this.controls.optimizedFullscreenButton,
- this.controls.wirelessTargetPicker, this.controls.muteBox];
- var visibleButtons = buttons.filter(this.isControlVisible, this);
-
- // This tells us how much room we need in order to display every visible button.
- var visibleButtonWidth = this.ButtonWidth * visibleButtons.length;
-
- // Check if there is enough room for the scrubber.
- var shouldDropTimeline = (visibleWidth - visibleButtonWidth) < this.MinimumTimelineWidth;
- this.controls.currentTime.classList.toggle(this.ClassNames.dropped, shouldDropTimeline);
- this.controls.thumbnailTrack.classList.toggle(this.ClassNames.dropped, shouldDropTimeline);
- this.controls.remainingTime.classList.toggle(this.ClassNames.dropped, shouldDropTimeline);
-
- // Then controls in the following order:
- var removeOrder = [this.controls.wirelessTargetPicker, this.controls.optimizedFullscreenButton,
- this.controls.captionButton, this.controls.muteBox, this.controls.rewindButton,
- this.controls.fullscreenButton];
- removeOrder.forEach(function(control) {
- var shouldDropControl = visibleWidth < visibleButtonWidth && this.isControlVisible(control);
- control.classList.toggle(this.ClassNames.dropped, shouldDropControl);
- if (shouldDropControl)
- visibleButtonWidth -= this.ButtonWidth;
- }, this);
- },
-
controlsAlwaysVisible: function()
{
- return this.isAudio() || this.currentPlaybackTargetIsWireless() || this.scrubbing;
+ return this.isAudio() || this.currentPlaybackTargetIsWireless();
},
controlsAreHidden: function()
@@ -1546,7 +1472,6 @@
this.controls.captionButton.classList.remove(this.ClassNames.hidden);
else
this.controls.captionButton.classList.add(this.ClassNames.hidden);
- this.updateLayoutForDisplayedWidth();
},
updateCaptionContainer: function()
@@ -1819,11 +1744,10 @@
updateHasAudio: function()
{
- if (this.video.audioTracks.length && !this.currentPlaybackTargetIsWireless())
+ if (this.video.audioTracks.length)
this.controls.muteBox.classList.remove(this.ClassNames.hidden);
else
this.controls.muteBox.classList.add(this.ClassNames.hidden);
- this.updateLayoutForDisplayedWidth();
},
updateHasVideo: function()
@@ -1920,15 +1844,19 @@
this.controls.inlinePlaybackPlaceholderTextTop.classList.remove(this.ClassNames.small);
this.controls.inlinePlaybackPlaceholderTextBottom.classList.remove(this.ClassNames.small);
}
- this.controls.volumeBox.classList.add(this.ClassNames.hidden);
- this.controls.muteBox.classList.add(this.ClassNames.hidden);
+ if (this.isFullScreen())
+ this.controls.volumeBox.style.display = "none";
+ else
+ this.controls.muteBox.style.display = "none";
this.updateBase();
this.showControls();
} else {
this.controls.inlinePlaybackPlaceholder.classList.add(this.ClassNames.hidden);
this.controls.wirelessTargetPicker.classList.remove(this.ClassNames.playing);
- this.controls.volumeBox.classList.remove(this.ClassNames.hidden);
- this.controls.muteBox.classList.remove(this.ClassNames.hidden);
+ if (this.isFullScreen())
+ this.controls.volumeBox.style.display = "-webkit-flex";
+ else
+ this.controls.muteBox.style.display = "-webkit-flex";
}
this.updateWirelessTargetPickerButton();
},
@@ -1945,7 +1873,6 @@
this.controls.wirelessTargetPicker.classList.remove(this.ClassNames.hidden);
else
this.controls.wirelessTargetPicker.classList.add(this.ClassNames.hidden);
- this.updateLayoutForDisplayedWidth();
},
handleWirelessPickerButtonClicked: function(event)
@@ -1991,50 +1918,4 @@
return this.currentPlaybackTargetIsWireless() && !this.video.controls;
},
- get scrubbing()
- {
- return this._scrubbing;
- },
-
- set scrubbing(flag)
- {
- if (this._scrubbing == flag)
- return;
- this._scrubbing = flag;
-
- if (this._scrubbing)
- this.wasPlayingWhenScrubbingStarted = !this.video.paused;
- else if (this.wasPlayingWhenScrubbingStarted && this.video.paused) {
- this.video.play();
- this.resetHideControlsTimer();
- }
- },
-
- get pageScaleFactor()
- {
- return this._pageScaleFactor;
- },
-
- set pageScaleFactor(newScaleFactor)
- {
- if (this._pageScaleFactor === newScaleFactor)
- return;
-
- this._pageScaleFactor = newScaleFactor;
-
- // FIXME: this should react to the scale change by
- // unscaling the controls panel. However, this
- // hits a bug with the backdrop blur layer getting
- // too big and moving to a tiled layer.
- // https://bugs.webkit.org/show_bug.cgi?id=142317
- },
-
- handleRootResize: function(event)
- {
- this.updateLayoutForDisplayedWidth();
- this.setNeedsTimelineMetricsUpdate();
- this.updateTimelineMetricsIfNeeded();
- this.drawTimelineBackground();
- }
-
};
Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js (184365 => 184366)
--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js 2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.js 2015-05-15 03:28:24 UTC (rev 184366)
@@ -16,21 +16,22 @@
this._timelineIsHidden = false;
this._currentDisplayWidth = 0;
+ this._potentiallyScrubbing = false;
this.scheduleUpdateLayoutForDisplayedWidth();
host.controlsDependOnPageScaleFactor = true;
this.doingSetup = false;
};
+/* Constants */
+ControllerIOS.MinimumTimelineWidth = 200;
+ControllerIOS.ButtonWidth = 42;
+
/* Enums */
ControllerIOS.StartPlaybackControls = 2;
ControllerIOS.prototype = {
- /* Constants */
- MinimumTimelineWidth: 200,
- ButtonWidth: 42,
-
addVideoListeners: function() {
Controller.prototype.addVideoListeners.call(this);
@@ -111,6 +112,10 @@
var panelBackground = this.controls.panelBackground = document.createElement('div');
panelBackground.setAttribute('pseudo', '-webkit-media-controls-panel-background');
+ var spacer = this.controls.spacer = document.createElement('div');
+ spacer.setAttribute('pseudo', '-webkit-media-controls-spacer');
+ spacer.classList.add(this.ClassNames.hidden);
+
var inlinePlaybackPlaceholderText = this.controls.inlinePlaybackPlaceholderText = document.createElement('div');
inlinePlaybackPlaceholderText.setAttribute('pseudo', '-webkit-media-controls-wireless-playback-text');
@@ -181,6 +186,7 @@
this.controls.inlinePlaybackPlaceholderText.appendChild(this.controls.inlinePlaybackPlaceholderTextBottom);
this.controls.panel.appendChild(this.controls.playButton);
this.controls.panel.appendChild(this.controls.statusDisplay);
+ this.controls.panel.appendChild(this.controls.spacer);
this.controls.panel.appendChild(this.controls.timelineBox);
this.controls.panel.appendChild(this.controls.wirelessTargetPicker);
if (!this.isLive) {
@@ -202,6 +208,13 @@
// Explicitly do nothing to override base-class behavior.
},
+ showControls: function() {
+ this.updateLayoutForDisplayedWidth();
+ this.updateTime(true);
+ this.updateProgress(true);
+ Controller.prototype.showControls.call(this);
+ },
+
addControls: function() {
this.base.appendChild(this.controls.inlinePlaybackPlaceholder);
this.base.appendChild(this.controls.panelContainer);
@@ -222,6 +235,11 @@
this.setNeedsTimelineMetricsUpdate();
},
+ updateTime: function(forceUpdate) {
+ Controller.prototype.updateTime.call(this, forceUpdate);
+ this.updateProgress();
+ },
+
drawTimelineBackground: function() {
var width = this.timelineWidth * window.devicePixelRatio;
var height = this.timelineHeight * window.devicePixelRatio;
@@ -475,8 +493,20 @@
return true;
},
+ handleTimelineInput: function(event) {
+ if (this._potentiallyScrubbing)
+ this.video.pause();
+ Controller.prototype.handleTimelineInput.call(this, event);
+ },
+
+ handleTimelineChange: function(event) {
+ Controller.prototype.handleTimelineChange.call(this, event);
+ this.updateProgress();
+ },
+
handleTimelineTouchStart: function(event) {
- this.scrubbing = true;
+ this._potentiallyScrubbing = true;
+ this.wasPlayingWhenScrubbingStarted = !this.video.paused;
this.listenFor(this.controls.timeline, 'touchend', this.handleTimelineTouchEnd);
this.listenFor(this.controls.timeline, 'touchcancel', this.handleTimelineTouchEnd);
},
@@ -484,9 +514,18 @@
handleTimelineTouchEnd: function(event) {
this.stopListeningFor(this.controls.timeline, 'touchend', this.handleTimelineTouchEnd);
this.stopListeningFor(this.controls.timeline, 'touchcancel', this.handleTimelineTouchEnd);
- this.scrubbing = false;
+ this._potentiallyScrubbing = false;
+ if (this.wasPlayingWhenScrubbingStarted && this.video.paused) {
+ this.video.play();
+ this.resetHideControlsTimer();
+ }
},
+ handleReadyStateChange: function(event) {
+ Controller.prototype.handleReadyStateChange.call(this, event);
+ this.updateControls();
+ },
+
handleWirelessPickerButtonTouchStart: function() {
if (!this.video.error)
this.controls.wirelessTargetPicker.classList.add('active');
@@ -523,8 +562,10 @@
this.updateControls();
- if (isPlaying && this.isAudio())
+ if (isPlaying && this.isAudio() && !this._timelineIsHidden) {
this.controls.timelineBox.classList.remove(this.ClassNames.hidden);
+ this.controls.spacer.classList.add(this.ClassNames.hidden);
+ }
if (isPlaying)
this.hasPlayed = true;
@@ -540,6 +581,25 @@
Controller.prototype.setShouldListenForPlaybackTargetAvailabilityEvent.call(this, shouldListen);
},
+ get pageScaleFactor()
+ {
+ return this._pageScaleFactor;
+ },
+
+ set pageScaleFactor(newScaleFactor)
+ {
+ if (this._pageScaleFactor === newScaleFactor)
+ return;
+
+ this._pageScaleFactor = newScaleFactor;
+
+ // FIXME: this should react to the scale change by
+ // unscaling the controls panel. However, this
+ // hits a bug with the backdrop blur layer getting
+ // too big and moving to a tiled layer.
+ // https://bugs.webkit.org/show_bug.cgi?id=142317
+ },
+
handlePresentationModeChange: function(event)
{
var presentationMode = this.presentationMode();
@@ -568,6 +628,69 @@
this.handlePresentationModeChange(event);
},
+ scheduleUpdateLayoutForDisplayedWidth: function ()
+ {
+ setTimeout(function () {
+ this.updateLayoutForDisplayedWidth();
+ }.bind(this), 0);
+ },
+
+ updateLayoutForDisplayedWidth: function()
+ {
+ if (!this.controls || !this.controls.panel)
+ return;
+
+ var visibleWidth = this.controls.panel.getBoundingClientRect().width * this._pageScaleFactor;
+ if (visibleWidth <= 0 || visibleWidth == this._currentDisplayWidth)
+ return;
+
+ this._currentDisplayWidth = visibleWidth;
+
+ // We need to work out how many right-hand side buttons are available.
+ this.updateWirelessTargetAvailable();
+ this.updateFullscreenButtons();
+
+ var visibleButtonWidth = ControllerIOS.ButtonWidth; // We always try to show the fullscreen button.
+
+ if (!this.controls.wirelessTargetPicker.classList.contains(this.ClassNames.hidden))
+ visibleButtonWidth += ControllerIOS.ButtonWidth;
+ if (!this.controls.optimizedFullscreenButton.classList.contains(this.ClassNames.hidden))
+ visibleButtonWidth += ControllerIOS.ButtonWidth;
+
+ // Check if there is enough room for the scrubber.
+ if ((visibleWidth - visibleButtonWidth) < ControllerIOS.MinimumTimelineWidth) {
+ this.controls.timelineBox.classList.add(this.ClassNames.hidden);
+ this.controls.spacer.classList.remove(this.ClassNames.hidden);
+ this._timelineIsHidden = true;
+ } else {
+ if (!this.isAudio() || this.hasPlayed) {
+ this.controls.timelineBox.classList.remove(this.ClassNames.hidden);
+ this.controls.spacer.classList.add(this.ClassNames.hidden);
+ this._timelineIsHidden = false;
+ } else
+ this.controls.spacer.classList.remove(this.ClassNames.hidden);
+ }
+
+ // Drop the airplay button if there isn't enough space.
+ if (visibleWidth < visibleButtonWidth) {
+ this.controls.wirelessTargetPicker.classList.add(this.ClassNames.hidden);
+ visibleButtonWidth -= ControllerIOS.ButtonWidth;
+ }
+
+ // Drop the optimized fullscreen button if there still isn't enough space.
+ if (visibleWidth < visibleButtonWidth) {
+ this.controls.optimizedFullscreenButton.classList.add(this.ClassNames.hidden);
+ visibleButtonWidth -= ControllerIOS.ButtonWidth;
+ }
+
+ // And finally, drop the fullscreen button as a last resort.
+ if (visibleWidth < visibleButtonWidth) {
+ this.controls.fullscreenButton.classList.add(this.ClassNames.hidden);
+ visibleButtonWidth -= ControllerIOS.ButtonWidth;
+ } else
+ this.controls.fullscreenButton.classList.remove(this.ClassNames.hidden);
+ },
+
controlsAlwaysVisible: function()
{
if (this.presentationMode() === 'optimized')
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (184365 => 184366)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2015-05-15 03:28:24 UTC (rev 184366)
@@ -261,7 +261,6 @@
, m_playbackProgressTimer(*this, &HTMLMediaElement::playbackProgressTimerFired)
, m_scanTimer(*this, &HTMLMediaElement::scanTimerFired)
, m_seekTaskQueue(document)
- , m_resizeTaskQueue(document)
, m_playedTimeRanges()
, m_asyncEventQueue(*this)
, m_requestedPlaybackRate(1)
@@ -3777,18 +3776,6 @@
exec->clearException();
#endif
}
-
-void HTMLMediaElement::layoutSizeChanged()
-{
-#if ENABLE(MEDIA_CONTROLS_SCRIPT)
- RefPtr<HTMLMediaElement> strongThis = this;
- std::function<void()> task = [strongThis] {
- if (ShadowRoot* root = strongThis->userAgentShadowRoot())
- root->dispatchEvent(Event::create("resize", false, false));
- };
- m_resizeTaskQueue.enqueueTask(task);
-#endif
-}
void HTMLMediaElement::setSelectedTextTrack(TextTrack* trackToSelect)
{
@@ -5720,6 +5707,7 @@
return String();
return frame->loader().userAgent(m_currentSrc);
+
}
#if ENABLE(AVF_CAPTIONS)
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (184365 => 184366)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2015-05-15 03:28:24 UTC (rev 184366)
@@ -459,8 +459,6 @@
virtual MediaProducer::MediaStateFlags mediaState() const override;
- void layoutSizeChanged();
-
protected:
HTMLMediaElement(const QualifiedName&, Document&, bool);
virtual ~HTMLMediaElement();
@@ -750,7 +748,6 @@
Timer m_playbackProgressTimer;
Timer m_scanTimer;
GenericTaskQueue<ScriptExecutionContext> m_seekTaskQueue;
- GenericTaskQueue<ScriptExecutionContext> m_resizeTaskQueue;
RefPtr<TimeRanges> m_playedTimeRanges;
GenericEventQueue m_asyncEventQueue;
Modified: trunk/Source/WebCore/rendering/RenderMedia.cpp (184365 => 184366)
--- trunk/Source/WebCore/rendering/RenderMedia.cpp 2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/rendering/RenderMedia.cpp 2015-05-15 03:28:24 UTC (rev 184366)
@@ -55,15 +55,6 @@
{
}
-void RenderMedia::layout()
-{
- LayoutSize oldSize = size();
- RenderImage::layout();
- if (oldSize != size())
- mediaElement().layoutSizeChanged();
-}
-
-
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/rendering/RenderMedia.h (184365 => 184366)
--- trunk/Source/WebCore/rendering/RenderMedia.h 2015-05-15 02:03:23 UTC (rev 184365)
+++ trunk/Source/WebCore/rendering/RenderMedia.h 2015-05-15 03:28:24 UTC (rev 184366)
@@ -41,9 +41,6 @@
HTMLMediaElement& mediaElement() const { return downcast<HTMLMediaElement>(nodeForNonAnonymous()); }
-protected:
- virtual void layout() override;
-
private:
void element() const = delete;