summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/shadow/MediaControls.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/html/shadow/MediaControls.cpp')
-rw-r--r--Source/WebCore/html/shadow/MediaControls.cpp45
1 files changed, 22 insertions, 23 deletions
diff --git a/Source/WebCore/html/shadow/MediaControls.cpp b/Source/WebCore/html/shadow/MediaControls.cpp
index 7bfaf436c..2228f49b5 100644
--- a/Source/WebCore/html/shadow/MediaControls.cpp
+++ b/Source/WebCore/html/shadow/MediaControls.cpp
@@ -11,10 +11,10 @@
* 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 COMPUTER, INC. ``AS IS'' AND ANY
+ * 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 COMPUTER, INC. OR
+ * 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
@@ -29,7 +29,9 @@
#if ENABLE(VIDEO)
#include "MediaControls.h"
-#include "ExceptionCodePlaceholder.h"
+#include "EventNames.h"
+#include "Page.h"
+#include "RenderElement.h"
#include "Settings.h"
namespace WebCore {
@@ -48,10 +50,11 @@ MediaControls::MediaControls(Document& document)
, m_volumeSlider(0)
, m_toggleClosedCaptionsButton(0)
, m_fullScreenButton(0)
- , m_hideFullscreenControlsTimer(this, &MediaControls::hideFullscreenControlsTimerFired)
+ , m_hideFullscreenControlsTimer(*this, &MediaControls::hideFullscreenControlsTimerFired)
, m_isFullscreen(false)
, m_isMouseOverControls(false)
{
+ setPseudo(AtomicString("-webkit-media-controls", AtomicString::ConstructFromLiteral));
}
void MediaControls::setMediaController(MediaControllerInterface* controller)
@@ -115,7 +118,7 @@ void MediaControls::reset()
refreshClosedCaptionsButtonVisibility();
if (m_fullScreenButton) {
- if (m_mediaController->supportsFullscreen() && m_mediaController->hasVideo())
+ if (m_mediaController->supportsFullscreen(HTMLMediaElementEnums::VideoFullscreenModeStandard) && m_mediaController->hasVideo())
m_fullScreenButton->show();
else
m_fullScreenButton->hide();
@@ -220,7 +223,7 @@ void MediaControls::updateCurrentTimeDisplay()
if (!page)
return;
- m_currentTimeDisplay->setInnerText(page->theme().formatMediaControlsTime(now), IGNORE_EXCEPTION);
+ m_currentTimeDisplay->setInnerText(page->theme().formatMediaControlsTime(now));
m_currentTimeDisplay->setCurrentValue(now);
}
@@ -293,11 +296,11 @@ void MediaControls::exitedFullscreen()
#endif
}
-void MediaControls::defaultEventHandler(Event* event)
+void MediaControls::defaultEventHandler(Event& event)
{
HTMLDivElement::defaultEventHandler(event);
- if (event->type() == eventNames().mouseoverEvent) {
+ if (event.type() == eventNames().mouseoverEvent) {
if (!containsRelatedTarget(event)) {
m_isMouseOverControls = true;
if (!m_mediaController->canPlay()) {
@@ -309,7 +312,7 @@ void MediaControls::defaultEventHandler(Event* event)
return;
}
- if (event->type() == eventNames().mouseoutEvent) {
+ if (event.type() == eventNames().mouseoutEvent) {
if (!containsRelatedTarget(event)) {
m_isMouseOverControls = false;
stopHideFullscreenControlsTimer();
@@ -317,7 +320,7 @@ void MediaControls::defaultEventHandler(Event* event)
return;
}
- if (event->type() == eventNames().mousemoveEvent) {
+ if (event.type() == eventNames().mousemoveEvent) {
if (m_isFullscreen) {
// When we get a mouse move in fullscreen mode, show the media controls, and start a timer
// that will hide the media controls after a 3 seconds without a mouse move.
@@ -329,7 +332,7 @@ void MediaControls::defaultEventHandler(Event* event)
}
}
-void MediaControls::hideFullscreenControlsTimerFired(Timer<MediaControls>&)
+void MediaControls::hideFullscreenControlsTimerFired()
{
if (m_mediaController->paused())
return;
@@ -363,36 +366,31 @@ void MediaControls::stopHideFullscreenControlsTimer()
m_hideFullscreenControlsTimer.stop();
}
-const AtomicString& MediaControls::shadowPseudoId() const
+bool MediaControls::containsRelatedTarget(Event& event)
{
- DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls"));
- return id;
-}
-
-bool MediaControls::containsRelatedTarget(Event* event)
-{
- if (!event->isMouseEvent())
+ if (!is<MouseEvent>(event))
return false;
- EventTarget* relatedTarget = static_cast<MouseEvent*>(event)->relatedTarget();
+ EventTarget* relatedTarget = downcast<MouseEvent>(event).relatedTarget();
if (!relatedTarget)
return false;
return contains(relatedTarget->toNode());
}
#if ENABLE(VIDEO_TRACK)
+
void MediaControls::createTextTrackDisplay()
{
if (m_textDisplayContainer)
return;
- RefPtr<MediaControlTextTrackContainerElement> textDisplayContainer = MediaControlTextTrackContainerElement::create(document());
- m_textDisplayContainer = textDisplayContainer.get();
+ auto textDisplayContainer = MediaControlTextTrackContainerElement::create(document());
+ m_textDisplayContainer = textDisplayContainer.ptr();
if (m_mediaController)
m_textDisplayContainer->setMediaController(m_mediaController);
// Insert it before the first controller element so it always displays behind the controls.
- insertBefore(textDisplayContainer.release(), m_panel, IGNORE_EXCEPTION);
+ insertBefore(textDisplayContainer, m_panel);
}
void MediaControls::showTextTrackDisplay()
@@ -423,6 +421,7 @@ void MediaControls::textTrackPreferencesChanged()
if (m_textDisplayContainer)
m_textDisplayContainer->updateSizes(true);
}
+
#endif
void MediaControls::setSliderVolume()