Update all float attributes in HTMLMediaElement to double
https://bugs.webkit.org/show_bug.cgi?id=113615
Reviewed by Geoffrey Garen
Patch by Aaron Colwell
No new tests. Primary behavior doesn't change. Just time, playbackRate, and volume precision.
All existing LayoutTests/media tests still pass.
* WebCore.exp.in: Remove function that no longer need to be exported.
* html/HTMLMediaElement.cpp: Change all float attributes to double.
* html/HTMLMediaElement.h: Ditto.
* html/HTMLMediaElement.idl: Ditto.
* html/MediaController.cpp: Ditto.
* html/MediaController.h: Ditto.
* html/MediaControllerInterface.h: Ditto.
* html/TimeRanges.cpp: Ditto.
* html/TimeRanges.idl: Ditto.
* html/shadow/MediaControlElementTypes.cpp: Ditto.
* html/shadow/MediaControlElementTypes.h: Ditto.
* html/shadow/MediaControlElements.cpp: Ditto.
* html/shadow/MediaControlElements.h: Ditto.
* html/shadow/MediaControls.cpp: Ditto.
* html/shadow/MediaControlsApple.cpp: Ditto.
* html/shadow/MediaControlsBlackBerry.cpp: Ditto.
* html/shadow/MediaControlsBlackBerry.h: Ditto.
* html/shadow/MediaControlsGtk.cpp: Ditto.
* html/track/TextTrackCue.cpp: Ditto.
* html/track/TextTrackCue.h: Ditto.
* platform/Clock.h: Ditto.
* platform/ClockGeneric.cpp: Ditto.
* platform/ClockGeneric.h: Ditto.
* platform/graphics/MediaPlayer.cpp: Ditto.
* platform/graphics/MediaPlayer.h: Ditto.
* platform/graphics/MediaPlayerPrivate.h: Ditto.
* platform/mac/PlatformClockCA.cpp: Ditto.
* platform/mac/PlatformClockCA.h: Ditto.
* platform/mac/PlatformClockCM.h: Ditto.
* platform/mac/PlatformClockCM.mm: Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148099 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 2d8d0e3..ff8866c 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,46 @@
+2013-04-10 Eric Carlson <eric.carlson@apple.com>
+
+ Update all float attributes in HTMLMediaElement to double
+ https://bugs.webkit.org/show_bug.cgi?id=113615
+
+ Reviewed by Geoffrey Garen
+ Patch by Aaron Colwell
+
+ No new tests. Primary behavior doesn't change. Just time, playbackRate, and volume precision.
+ All existing LayoutTests/media tests still pass.
+
+ * WebCore.exp.in: Remove function that no longer need to be exported.
+
+ * html/HTMLMediaElement.cpp: Change all float attributes to double.
+ * html/HTMLMediaElement.h: Ditto.
+ * html/HTMLMediaElement.idl: Ditto.
+ * html/MediaController.cpp: Ditto.
+ * html/MediaController.h: Ditto.
+ * html/MediaControllerInterface.h: Ditto.
+ * html/TimeRanges.cpp: Ditto.
+ * html/TimeRanges.idl: Ditto.
+ * html/shadow/MediaControlElementTypes.cpp: Ditto.
+ * html/shadow/MediaControlElementTypes.h: Ditto.
+ * html/shadow/MediaControlElements.cpp: Ditto.
+ * html/shadow/MediaControlElements.h: Ditto.
+ * html/shadow/MediaControls.cpp: Ditto.
+ * html/shadow/MediaControlsApple.cpp: Ditto.
+ * html/shadow/MediaControlsBlackBerry.cpp: Ditto.
+ * html/shadow/MediaControlsBlackBerry.h: Ditto.
+ * html/shadow/MediaControlsGtk.cpp: Ditto.
+ * html/track/TextTrackCue.cpp: Ditto.
+ * html/track/TextTrackCue.h: Ditto.
+ * platform/Clock.h: Ditto.
+ * platform/ClockGeneric.cpp: Ditto.
+ * platform/ClockGeneric.h: Ditto.
+ * platform/graphics/MediaPlayer.cpp: Ditto.
+ * platform/graphics/MediaPlayer.h: Ditto.
+ * platform/graphics/MediaPlayerPrivate.h: Ditto.
+ * platform/mac/PlatformClockCA.cpp: Ditto.
+ * platform/mac/PlatformClockCA.h: Ditto.
+ * platform/mac/PlatformClockCM.h: Ditto.
+ * platform/mac/PlatformClockCM.mm: Ditto.
+
2013-04-10 Patrick Gansterer <paroga@webkit.org>
Replace ENABLE_MICRODATA preprocessor statements in IDL files with Conditional attribute
diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in
index 20c5169..ec43c04 100644
--- a/Source/WebCore/WebCore.exp.in
+++ b/Source/WebCore/WebCore.exp.in
@@ -2667,15 +2667,12 @@
__ZN7WebCore16HTMLMediaElement12endScrubbingEv
__ZN7WebCore16HTMLMediaElement14beginScrubbingEv
__ZN7WebCore16HTMLMediaElement14exitFullscreenEv
-__ZN7WebCore16HTMLMediaElement14setCurrentTimeEfRi
__ZN7WebCore16HTMLMediaElement15clearMediaCacheEv
__ZN7WebCore16HTMLMediaElement20getSitesInMediaCacheERN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEE
__ZN7WebCore16HTMLMediaElement22clearMediaCacheForSiteERKN3WTF6StringE
__ZN7WebCore16HTMLMediaElement4playEv
__ZN7WebCore16HTMLMediaElement5pauseEv
-__ZN7WebCore16HTMLMediaElement6rewindEf
__ZN7WebCore16HTMLMediaElement8setMutedEb
-__ZN7WebCore16HTMLMediaElement9setVolumeEfRi
__ZNK7WebCore16HTMLMediaElement11currentTimeEv
__ZNK7WebCore16HTMLMediaElement13platformMediaEv
__ZNK7WebCore16HTMLMediaElement5mutedEv
diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp
index da1ab5a..c5bd6e0 100644
--- a/Source/WebCore/html/HTMLMediaElement.cpp
+++ b/Source/WebCore/html/HTMLMediaElement.cpp
@@ -252,7 +252,7 @@
, m_lastSeekTime(0)
, m_previousProgressTime(numeric_limits<double>::max())
, m_lastTimeUpdateEventWallTime(0)
- , m_lastTimeUpdateEventMovieTime(numeric_limits<float>::max())
+ , m_lastTimeUpdateEventMovieTime(numeric_limits<double>::max())
, m_loadState(WaitingForSource)
#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
, m_proxyWidget(0)
@@ -1079,7 +1079,7 @@
}
-void HTMLMediaElement::updateActiveTextTrackCues(float movieTime)
+void HTMLMediaElement::updateActiveTextTrackCues(double movieTime)
{
// 4.8.10.8 Playing the media resource
@@ -1114,7 +1114,7 @@
// 3 - Let last time be the current playback position at the time this
// algorithm was last run for this media element, if this is not the first
// time it has run.
- float lastTime = m_lastTextTrackUpdateTime;
+ double lastTime = m_lastTextTrackUpdateTime;
// 4 - If the current playback position has, since the last time this
// algorithm was run, only changed through its usual monotonic increase
@@ -1127,8 +1127,8 @@
m_cueTree.allOverlaps(m_cueTree.createInterval(lastTime, movieTime));
for (size_t i = 0; i < potentiallySkippedCues.size(); ++i) {
- float cueStartTime = potentiallySkippedCues[i].low();
- float cueEndTime = potentiallySkippedCues[i].high();
+ double cueStartTime = potentiallySkippedCues[i].low();
+ double cueEndTime = potentiallySkippedCues[i].high();
// Consider cues that may have been missed since the last seek time.
if (cueStartTime > max(m_lastSeekTime, lastTime) && cueEndTime < movieTime)
@@ -2009,7 +2009,7 @@
}
}
-void HTMLMediaElement::rewind(float timeDelta)
+void HTMLMediaElement::rewind(double timeDelta)
{
LOG(Media, "HTMLMediaElement::rewind(%f)", timeDelta);
setCurrentTime(max(currentTime() - timeDelta, minTimeSeekable()), IGNORE_EXCEPTION);
@@ -2021,7 +2021,7 @@
setCurrentTime(maxTimeSeekable(), IGNORE_EXCEPTION);
}
-void HTMLMediaElement::addPlayedRange(float start, float end)
+void HTMLMediaElement::addPlayedRange(double start, double end)
{
LOG(Media, "HTMLMediaElement::addPlayedRange(%f, %f)", start, end);
if (!m_playedTimeRanges)
@@ -2048,7 +2048,7 @@
m_player->prepareToPlay();
}
-void HTMLMediaElement::seek(float time, ExceptionCode& ec)
+void HTMLMediaElement::seek(double time, ExceptionCode& ec)
{
LOG(Media, "HTMLMediaElement::seek(%f)", time);
@@ -2066,7 +2066,7 @@
// Get the current time before setting m_seeking, m_lastSeekTime is returned once it is set.
refreshCachedTime();
- float now = currentTime();
+ double now = currentTime();
// 2 - If the element's seeking IDL attribute is true, then another instance of this algorithm is
// already running. Abort that other instance of the algorithm without waiting for the step that
@@ -2082,7 +2082,7 @@
time = min(time, duration());
// 6 - If the new playback position is less than the earliest possible position, let it be that position instead.
- float earliestTime = m_player->startTime();
+ double earliestTime = m_player->startTime();
time = max(time, earliestTime);
// Ask the media engine for the time value in the movie's time scale before comparing with current time. This
@@ -2091,7 +2091,7 @@
// not generate a timechanged callback. This means m_seeking will never be cleared and we will never
// fire a 'seeked' event.
#if !LOG_DISABLED
- float mediaTime = m_player->mediaTimeForTimeValue(time);
+ double mediaTime = m_player->mediaTimeForTimeValue(time);
if (time != mediaTime)
LOG(Media, "HTMLMediaElement::seek(%f) - media timeline equivalent is %f", time, mediaTime);
#endif
@@ -2198,7 +2198,7 @@
}
// playback state
-float HTMLMediaElement::currentTime() const
+double HTMLMediaElement::currentTime() const
{
#if LOG_CACHED_TIME_WARNINGS
static const double minCachedDeltaForWarning = 0.01;
@@ -2214,7 +2214,7 @@
if (m_cachedTime != MediaPlayer::invalidTime() && m_paused) {
#if LOG_CACHED_TIME_WARNINGS
- float delta = m_cachedTime - m_player->currentTime();
+ double delta = m_cachedTime - m_player->currentTime();
if (delta > minCachedDeltaForWarning)
LOG(Media, "HTMLMediaElement::currentTime - WARNING, cached time is %f seconds off of media time when paused", delta);
#endif
@@ -2230,10 +2230,10 @@
// Not too soon, use the cached time only if it hasn't expired.
if (wallClockDelta < maximumDurationToCacheMediaTime) {
- float adjustedCacheTime = static_cast<float>(m_cachedTime + (m_playbackRate * wallClockDelta));
+ double adjustedCacheTime = m_cachedTime + (m_playbackRate * wallClockDelta);
#if LOG_CACHED_TIME_WARNINGS
- float delta = adjustedCacheTime - m_player->currentTime();
+ double delta = adjustedCacheTime - m_player->currentTime();
if (delta > minCachedDeltaForWarning)
LOG(Media, "HTMLMediaElement::currentTime - WARNING, cached time is %f seconds off of media time when playing", delta);
#endif
@@ -2244,7 +2244,7 @@
#if LOG_CACHED_TIME_WARNINGS
if (maximumDurationToCacheMediaTime && now > m_minimumWallClockTimeToCacheMediaTime && m_cachedTime != MediaPlayer::invalidTime()) {
double wallClockDelta = now - m_cachedTimeWallClockUpdateTime;
- float delta = m_cachedTime + (m_playbackRate * wallClockDelta) - m_player->currentTime();
+ double delta = m_cachedTime + (m_playbackRate * wallClockDelta) - m_player->currentTime();
LOG(Media, "HTMLMediaElement::currentTime - cached time was %f seconds off of media time when it expired", delta);
}
#endif
@@ -2254,7 +2254,7 @@
return m_cachedTime;
}
-void HTMLMediaElement::setCurrentTime(float time, ExceptionCode& ec)
+void HTMLMediaElement::setCurrentTime(double time, ExceptionCode& ec)
{
if (m_mediaController) {
ec = INVALID_STATE_ERR;
@@ -2263,7 +2263,7 @@
seek(time, ec);
}
-float HTMLMediaElement::startTime() const
+double HTMLMediaElement::startTime() const
{
if (!m_player)
return 0;
@@ -2281,12 +2281,12 @@
return m_player->initialTime();
}
-float HTMLMediaElement::duration() const
+double HTMLMediaElement::duration() const
{
if (m_player && m_readyState >= HAVE_METADATA)
return m_player->duration();
- return numeric_limits<float>::quiet_NaN();
+ return numeric_limits<double>::quiet_NaN();
}
bool HTMLMediaElement::paused() const
@@ -2294,12 +2294,12 @@
return m_paused;
}
-float HTMLMediaElement::defaultPlaybackRate() const
+double HTMLMediaElement::defaultPlaybackRate() const
{
return m_defaultPlaybackRate;
}
-void HTMLMediaElement::setDefaultPlaybackRate(float rate)
+void HTMLMediaElement::setDefaultPlaybackRate(double rate)
{
if (m_defaultPlaybackRate != rate) {
m_defaultPlaybackRate = rate;
@@ -2307,12 +2307,12 @@
}
}
-float HTMLMediaElement::playbackRate() const
+double HTMLMediaElement::playbackRate() const
{
return m_playbackRate;
}
-void HTMLMediaElement::setPlaybackRate(float rate)
+void HTMLMediaElement::setPlaybackRate(double rate)
{
LOG(Media, "HTMLMediaElement::setPlaybackRate(%f)", rate);
@@ -2328,7 +2328,7 @@
void HTMLMediaElement::updatePlaybackRate()
{
- float effectiveRate = m_mediaController ? m_mediaController->playbackRate() : m_playbackRate;
+ double effectiveRate = m_mediaController ? m_mediaController->playbackRate() : m_playbackRate;
if (m_player && potentiallyPlaying() && m_player->rate() != effectiveRate)
m_player->setRate(effectiveRate);
}
@@ -2624,12 +2624,12 @@
setBooleanAttribute(controlsAttr, b);
}
-float HTMLMediaElement::volume() const
+double HTMLMediaElement::volume() const
{
return m_volume;
}
-void HTMLMediaElement::setVolume(float vol, ExceptionCode& ec)
+void HTMLMediaElement::setVolume(double vol, ExceptionCode& ec)
{
LOG(Media, "HTMLMediaElement::setVolume(%f)", vol);
@@ -2758,7 +2758,7 @@
// Some media engines make multiple "time changed" callbacks at the same time, but we only want one
// event at a given time so filter here
- float movieTime = currentTime();
+ double movieTime = currentTime();
if (movieTime != m_lastTimeUpdateEventMovieTime) {
scheduleEvent(eventNames().timeupdateEvent);
m_lastTimeUpdateEventWallTime = now;
@@ -2771,20 +2771,20 @@
return paused() || ended() || m_readyState < HAVE_METADATA;
}
-float HTMLMediaElement::percentLoaded() const
+double HTMLMediaElement::percentLoaded() const
{
if (!m_player)
return 0;
- float duration = m_player->duration();
+ double duration = m_player->duration();
if (!duration || std::isinf(duration))
return 0;
- float buffered = 0;
+ double buffered = 0;
RefPtr<TimeRanges> timeRanges = m_player->buffered();
for (unsigned i = 0; i < timeRanges->length(); ++i) {
- float start = timeRanges->start(i, IGNORE_EXCEPTION);
- float end = timeRanges->end(i, IGNORE_EXCEPTION);
+ double start = timeRanges->start(i, IGNORE_EXCEPTION);
+ double end = timeRanges->end(i, IGNORE_EXCEPTION);
buffered += end - start;
}
return buffered / duration;
@@ -3462,8 +3462,8 @@
// movie time.
scheduleTimeupdateEvent(false);
- float now = currentTime();
- float dur = duration();
+ double now = currentTime();
+ double dur = duration();
// When the current playback position reaches the end of the media resource when the direction of
// playback is forwards, then the user agent must follow these steps:
@@ -3505,7 +3505,7 @@
beginProcessingMediaPlayerCallback();
if (m_player) {
- float vol = m_player->volume();
+ double vol = m_player->volume();
if (vol != m_volume) {
m_volume = vol;
updateVolume();
@@ -3534,8 +3534,8 @@
scheduleEvent(eventNames().durationchangeEvent);
mediaPlayerCharacteristicChanged(player);
- float now = currentTime();
- float dur = duration();
+ double now = currentTime();
+ double dur = duration();
if (now > dur)
seek(dur, IGNORE_EXCEPTION);
@@ -3690,7 +3690,7 @@
PassRefPtr<TimeRanges> HTMLMediaElement::played()
{
if (m_playing) {
- float time = currentTime();
+ double time = currentTime();
if (time > m_lastSeekTime)
addPlayedRange(m_lastSeekTime, time);
}
@@ -3722,7 +3722,7 @@
bool HTMLMediaElement::endedPlayback() const
{
- float dur = duration();
+ double dur = duration();
if (!m_player || std::isnan(dur))
return false;
@@ -3736,7 +3736,7 @@
// and the current playback position is the end of the media resource and the direction
// of playback is forwards, Either the media element does not have a loop attribute specified,
// or the media element has a current media controller.
- float now = currentTime();
+ double now = currentTime();
if (m_playbackRate > 0)
return dur > 0 && now >= dur && (!loop() || m_mediaController);
@@ -3765,12 +3765,12 @@
return false;
}
-float HTMLMediaElement::minTimeSeekable() const
+double HTMLMediaElement::minTimeSeekable() const
{
return 0;
}
-float HTMLMediaElement::maxTimeSeekable() const
+double HTMLMediaElement::maxTimeSeekable() const
{
return m_player ? m_player->maxTimeSeekable() : 0;
}
@@ -3783,7 +3783,7 @@
// Avoid recursion when the player reports volume changes.
if (!processingMediaPlayerCallback()) {
Page* page = document()->page();
- float volumeMultiplier = page ? page->mediaVolume() : 1;
+ double volumeMultiplier = page ? page->mediaVolume() : 1;
bool shouldMute = m_muted;
if (m_mediaController) {
@@ -3848,7 +3848,7 @@
m_playbackProgressTimer.stop();
m_playing = false;
- float time = currentTime();
+ double time = currentTime();
if (time > m_lastSeekTime)
addPlayedRange(m_lastSeekTime, time);
@@ -4712,7 +4712,7 @@
// or if its media controller position is either before the media resource's earliest possible
// position relative to the MediaController's timeline or after the end of the media resource
// relative to the MediaController's timeline.
- float mediaControllerPosition = m_mediaController->currentTime();
+ double mediaControllerPosition = m_mediaController->currentTime();
if (mediaControllerPosition < startTime() || mediaControllerPosition > startTime() + duration())
return true;
@@ -4722,7 +4722,7 @@
void HTMLMediaElement::prepareMediaFragmentURI()
{
MediaFragmentURIParser fragmentParser(m_currentSrc);
- float dur = duration();
+ double dur = duration();
double start = fragmentParser.startTime();
if (start != MediaFragmentURIParser::invalidTimeValue() && start > 0) {
diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h
index ca016c0..8e53e6f 100644
--- a/Source/WebCore/html/HTMLMediaElement.h
+++ b/Source/WebCore/html/HTMLMediaElement.h
@@ -97,7 +97,7 @@
virtual bool hasVideo() const { return false; }
virtual bool hasAudio() const;
- void rewind(float timeDelta);
+ void rewind(double timeDelta);
void returnToRealtime();
// Eventually overloaded in HTMLVideoElement
@@ -146,16 +146,16 @@
bool seeking() const;
// playback state
- float currentTime() const;
- void setCurrentTime(float, ExceptionCode&);
+ double currentTime() const;
+ void setCurrentTime(double, ExceptionCode&);
double initialTime() const;
- float startTime() const;
- float duration() const;
+ double startTime() const;
+ double duration() const;
bool paused() const;
- float defaultPlaybackRate() const;
- void setDefaultPlaybackRate(float);
- float playbackRate() const;
- void setPlaybackRate(float);
+ double defaultPlaybackRate() const;
+ void setDefaultPlaybackRate(double);
+ double playbackRate() const;
+ void setPlaybackRate(double);
void updatePlaybackRate();
bool webkitPreservesPitch() const;
void setWebkitPreservesPitch(bool);
@@ -208,8 +208,8 @@
// controls
bool controls() const;
void setControls(bool);
- float volume() const;
- void setVolume(float, ExceptionCode&);
+ double volume() const;
+ void setVolume(double, ExceptionCode&);
bool muted() const;
void setMuted(bool);
@@ -219,7 +219,7 @@
bool canPlay() const;
- float percentLoaded() const;
+ double percentLoaded() const;
#if ENABLE(VIDEO_TRACK)
PassRefPtr<TextTrack> addTextTrack(const String& kind, const String& label, const String& language, ExceptionCode&);
@@ -495,10 +495,10 @@
void startProgressEventTimer();
void stopPeriodicTimers();
- void seek(float time, ExceptionCode&);
+ void seek(double time, ExceptionCode&);
void finishSeek();
void checkIfSeekNeeded();
- void addPlayedRange(float start, float end);
+ void addPlayedRange(double start, double end);
void scheduleTimeupdateEvent(bool periodicEvent);
void scheduleEvent(const AtomicString& eventName);
@@ -522,7 +522,7 @@
void mediaLoadingFailed(MediaPlayer::NetworkState);
#if ENABLE(VIDEO_TRACK)
- void updateActiveTextTrackCues(float);
+ void updateActiveTextTrackCues(double);
HTMLTrackElement* showingTrackWithSameKind(HTMLTrackElement*) const;
void markCaptionAndSubtitleTracksAsUnconfigured();
@@ -549,13 +549,13 @@
bool pausedForUserInteraction() const;
bool couldPlayIfEnoughData() const;
- float minTimeSeekable() const;
- float maxTimeSeekable() const;
+ double minTimeSeekable() const;
+ double maxTimeSeekable() const;
// Pauses playback without changing any states or generating events
void setPausedInternal(bool);
- void setPlaybackRateInternal(float);
+ void setPlaybackRateInternal(double);
virtual void mediaCanStart();
@@ -599,8 +599,8 @@
RefPtr<TimeRanges> m_playedTimeRanges;
OwnPtr<GenericEventQueue> m_asyncEventQueue;
- float m_playbackRate;
- float m_defaultPlaybackRate;
+ double m_playbackRate;
+ double m_defaultPlaybackRate;
bool m_webkitPreservesPitch;
NetworkState m_networkState;
ReadyState m_readyState;
@@ -609,8 +609,8 @@
RefPtr<MediaError> m_error;
- float m_volume;
- float m_lastSeekTime;
+ double m_volume;
+ double m_lastSeekTime;
unsigned m_previousProgress;
double m_previousProgressTime;
@@ -619,7 +619,7 @@
double m_lastTimeUpdateEventWallTime;
// The last time a timeupdate event was sent in movie time.
- float m_lastTimeUpdateEventMovieTime;
+ double m_lastTimeUpdateEventMovieTime;
// Loading state.
enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElement };
@@ -646,7 +646,7 @@
RefPtr<MediaSource> m_mediaSource;
#endif
- mutable float m_cachedTime;
+ mutable double m_cachedTime;
mutable double m_cachedTimeWallClockUpdateTime;
mutable double m_minimumWallClockTimeToCacheMediaTime;
@@ -695,8 +695,8 @@
bool m_tracksAreReady : 1;
bool m_haveVisibleTextTrack : 1;
bool m_processingPreferenceChange : 1;
-
float m_lastTextTrackUpdateTime;
+
CaptionUserPreferences::CaptionDisplayMode m_captionDisplayMode;
RefPtr<TextTrackList> m_textTracks;
diff --git a/Source/WebCore/html/HTMLMediaElement.idl b/Source/WebCore/html/HTMLMediaElement.idl
index 920520b..ced4174 100644
--- a/Source/WebCore/html/HTMLMediaElement.idl
+++ b/Source/WebCore/html/HTMLMediaElement.idl
@@ -63,14 +63,14 @@
readonly attribute boolean seeking;
// playback state
-attribute float currentTime
+attribute double currentTime
setter raises (DOMException);
readonly attribute double initialTime;
-readonly attribute float startTime;
-readonly attribute float duration;
+readonly attribute double startTime;
+readonly attribute double duration;
readonly attribute boolean paused;
-attribute float defaultPlaybackRate;
-attribute float playbackRate;
+attribute double defaultPlaybackRate;
+attribute double playbackRate;
readonly attribute TimeRanges played;
readonly attribute TimeRanges seekable;
readonly attribute boolean ended;
@@ -81,7 +81,7 @@
// controls
attribute boolean controls;
-attribute float volume
+attribute double volume
setter raises (DOMException);
attribute boolean muted;
attribute [Reflect=muted] boolean defaultMuted;
diff --git a/Source/WebCore/html/MediaController.cpp b/Source/WebCore/html/MediaController.cpp
index 103161b..33c63a6 100644
--- a/Source/WebCore/html/MediaController.cpp
+++ b/Source/WebCore/html/MediaController.cpp
@@ -129,13 +129,13 @@
return playedRanges;
}
-float MediaController::duration() const
+double MediaController::duration() const
{
// FIXME: Investigate caching the maximum duration and only updating the cached value
// when the slaved media elements' durations change.
- float maxDuration = 0;
+ double maxDuration = 0;
for (size_t index = 0; index < m_mediaElements.size(); ++index) {
- float duration = m_mediaElements[index]->duration();
+ double duration = m_mediaElements[index]->duration();
if (std::isnan(duration))
continue;
maxDuration = max(maxDuration, duration);
@@ -143,26 +143,26 @@
return maxDuration;
}
-float MediaController::currentTime() const
+double MediaController::currentTime() const
{
if (m_mediaElements.isEmpty())
return 0;
if (m_position == MediaPlayer::invalidTime()) {
// Some clocks may return times outside the range of [0..duration].
- m_position = max(0.0f, min(duration(), m_clock->currentTime()));
+ m_position = max(0.0, min(duration(), m_clock->currentTime()));
m_clearPositionTimer.startOneShot(0);
}
return m_position;
}
-void MediaController::setCurrentTime(float time, ExceptionCode& code)
+void MediaController::setCurrentTime(double time, ExceptionCode& code)
{
// When the user agent is to seek the media controller to a particular new playback position,
// it must follow these steps:
// If the new playback position is less than zero, then set it to zero.
- time = max(0.0f, time);
+ time = max(0.0, time);
// If the new playback position is greater than the media controller duration, then set it
// to the media controller duration.
@@ -217,7 +217,7 @@
reportControllerState();
}
-void MediaController::setDefaultPlaybackRate(float rate)
+void MediaController::setDefaultPlaybackRate(double rate)
{
if (m_defaultPlaybackRate == rate)
return;
@@ -230,12 +230,12 @@
scheduleEvent(eventNames().ratechangeEvent);
}
-float MediaController::playbackRate() const
+double MediaController::playbackRate() const
{
return m_clock->playRate();
}
-void MediaController::setPlaybackRate(float rate)
+void MediaController::setPlaybackRate(double rate)
{
if (m_clock->playRate() == rate)
return;
@@ -251,7 +251,7 @@
scheduleEvent(eventNames().ratechangeEvent);
}
-void MediaController::setVolume(float level, ExceptionCode& code)
+void MediaController::setVolume(double level, ExceptionCode& code)
{
if (m_volume == level)
return;
diff --git a/Source/WebCore/html/MediaController.h b/Source/WebCore/html/MediaController.h
index 6615a3b..5e456bd 100644
--- a/Source/WebCore/html/MediaController.h
+++ b/Source/WebCore/html/MediaController.h
@@ -60,23 +60,23 @@
virtual PassRefPtr<TimeRanges> seekable() const;
virtual PassRefPtr<TimeRanges> played();
- virtual float duration() const;
- virtual float currentTime() const;
- virtual void setCurrentTime(float, ExceptionCode&);
+ virtual double duration() const;
+ virtual double currentTime() const;
+ virtual void setCurrentTime(double, ExceptionCode&);
virtual bool paused() const { return m_paused; }
virtual void play();
virtual void pause();
void unpause();
- virtual float defaultPlaybackRate() const { return m_defaultPlaybackRate; }
- virtual void setDefaultPlaybackRate(float);
+ virtual double defaultPlaybackRate() const { return m_defaultPlaybackRate; }
+ virtual void setDefaultPlaybackRate(double);
- virtual float playbackRate() const;
- virtual void setPlaybackRate(float);
+ virtual double playbackRate() const;
+ virtual void setPlaybackRate(double);
- virtual float volume() const { return m_volume; }
- virtual void setVolume(float, ExceptionCode&);
+ virtual double volume() const { return m_volume; }
+ virtual void setVolume(double, ExceptionCode&);
virtual bool muted() const { return m_muted; }
virtual void setMuted(bool);
@@ -143,9 +143,9 @@
friend class MediaControllerEventListener;
Vector<HTMLMediaElement*> m_mediaElements;
bool m_paused;
- float m_defaultPlaybackRate;
- float m_volume;
- mutable float m_position;
+ double m_defaultPlaybackRate;
+ double m_volume;
+ mutable double m_position;
bool m_muted;
ReadyState m_readyState;
PlaybackState m_playbackState;
diff --git a/Source/WebCore/html/MediaControllerInterface.h b/Source/WebCore/html/MediaControllerInterface.h
index 7bcf06c..485050c 100644
--- a/Source/WebCore/html/MediaControllerInterface.h
+++ b/Source/WebCore/html/MediaControllerInterface.h
@@ -45,22 +45,22 @@
virtual PassRefPtr<TimeRanges> seekable() const = 0;
virtual PassRefPtr<TimeRanges> played() = 0;
- virtual float duration() const = 0;
- virtual float currentTime() const = 0;
- virtual void setCurrentTime(float, ExceptionCode&) = 0;
+ virtual double duration() const = 0;
+ virtual double currentTime() const = 0;
+ virtual void setCurrentTime(double, ExceptionCode&) = 0;
virtual bool paused() const = 0;
virtual void play() = 0;
virtual void pause() = 0;
- virtual float defaultPlaybackRate() const = 0;
- virtual void setDefaultPlaybackRate(float) = 0;
+ virtual double defaultPlaybackRate() const = 0;
+ virtual void setDefaultPlaybackRate(double) = 0;
- virtual float playbackRate() const = 0;
- virtual void setPlaybackRate(float) = 0;
+ virtual double playbackRate() const = 0;
+ virtual void setPlaybackRate(double) = 0;
- virtual float volume() const = 0;
- virtual void setVolume(float, ExceptionCode&) = 0;
+ virtual double volume() const = 0;
+ virtual void setVolume(double, ExceptionCode&) = 0;
virtual bool muted() const = 0;
virtual void setMuted(bool) = 0;
diff --git a/Source/WebCore/html/TimeRanges.cpp b/Source/WebCore/html/TimeRanges.cpp
index c22474a..b045aca 100644
--- a/Source/WebCore/html/TimeRanges.cpp
+++ b/Source/WebCore/html/TimeRanges.cpp
@@ -34,7 +34,7 @@
using namespace WebCore;
using namespace std;
-TimeRanges::TimeRanges(float start, float end)
+TimeRanges::TimeRanges(double start, double end)
{
add(start, end);
}
@@ -53,19 +53,19 @@
void TimeRanges::invert()
{
RefPtr<TimeRanges> inverted = TimeRanges::create();
- float posInf = std::numeric_limits<float>::infinity();
- float negInf = -std::numeric_limits<float>::infinity();
+ double posInf = std::numeric_limits<double>::infinity();
+ double negInf = -std::numeric_limits<double>::infinity();
if (!m_ranges.size())
inverted->add(negInf, posInf);
else {
- if (float start = m_ranges.first().m_start != negInf)
+ if (double start = m_ranges.first().m_start != negInf)
inverted->add(negInf, start);
for (size_t index = 0; index + 1 < m_ranges.size(); ++index)
inverted->add(m_ranges[index].m_end, m_ranges[index + 1].m_start);
- if (float end = m_ranges.last().m_end != posInf)
+ if (double end = m_ranges.last().m_end != posInf)
inverted->add(end, posInf);
}
@@ -95,7 +95,7 @@
m_ranges.swap(unioned->m_ranges);
}
-float TimeRanges::start(unsigned index, ExceptionCode& ec) const
+double TimeRanges::start(unsigned index, ExceptionCode& ec) const
{
if (index >= length()) {
ec = INDEX_SIZE_ERR;
@@ -104,7 +104,7 @@
return m_ranges[index].m_start;
}
-float TimeRanges::end(unsigned index, ExceptionCode& ec) const
+double TimeRanges::end(unsigned index, ExceptionCode& ec) const
{
if (index >= length()) {
ec = INDEX_SIZE_ERR;
@@ -113,7 +113,7 @@
return m_ranges[index].m_end;
}
-void TimeRanges::add(float start, float end)
+void TimeRanges::add(double start, double end)
{
ASSERT(start <= end);
unsigned int overlappingArcIndex;
@@ -156,7 +156,7 @@
m_ranges.insert(overlappingArcIndex, addedRange);
}
-bool TimeRanges::contain(float time) const
+bool TimeRanges::contain(double time) const
{
for (unsigned n = 0; n < length(); n++) {
if (time >= start(n, IGNORE_EXCEPTION) && time <= end(n, IGNORE_EXCEPTION))
@@ -165,13 +165,13 @@
return false;
}
-float TimeRanges::nearest(float time) const
+double TimeRanges::nearest(double time) const
{
- float closest = 0;
+ double closest = 0;
unsigned count = length();
for (unsigned ndx = 0; ndx < count; ndx++) {
- float startTime = start(ndx, IGNORE_EXCEPTION);
- float endTime = end(ndx, IGNORE_EXCEPTION);
+ double startTime = start(ndx, IGNORE_EXCEPTION);
+ double endTime = end(ndx, IGNORE_EXCEPTION);
if (time >= startTime && time <= endTime)
return time;
if (fabs(startTime - time) < closest)
diff --git a/Source/WebCore/html/TimeRanges.h b/Source/WebCore/html/TimeRanges.h
index 4257690..efdcabf 100644
--- a/Source/WebCore/html/TimeRanges.h
+++ b/Source/WebCore/html/TimeRanges.h
@@ -41,7 +41,7 @@
{
return adoptRef(new TimeRanges);
}
- static PassRefPtr<TimeRanges> create(float start, float end)
+ static PassRefPtr<TimeRanges> create(double start, double end)
{
return adoptRef(new TimeRanges(start, end));
}
@@ -52,32 +52,32 @@
void unionWith(const TimeRanges*);
unsigned length() const { return m_ranges.size(); }
- float start(unsigned index, ExceptionCode&) const;
- float end(unsigned index, ExceptionCode&) const;
+ double start(unsigned index, ExceptionCode&) const;
+ double end(unsigned index, ExceptionCode&) const;
- void add(float start, float end);
+ void add(double start, double end);
- bool contain(float time) const;
+ bool contain(double time) const;
- float nearest(float time) const;
+ double nearest(double time) const;
private:
TimeRanges() { }
- TimeRanges(float start, float end);
+ TimeRanges(double start, double end);
TimeRanges(const TimeRanges&);
// We consider all the Ranges to be semi-bounded as follow: [start, end[
struct Range {
Range() { }
- Range(float start, float end)
+ Range(double start, double end)
{
m_start = start;
m_end = end;
}
- float m_start;
- float m_end;
+ double m_start;
+ double m_end;
- inline bool isPointInRange(float point) const
+ inline bool isPointInRange(double point) const
{
return m_start <= point && point < m_end;
}
diff --git a/Source/WebCore/html/TimeRanges.idl b/Source/WebCore/html/TimeRanges.idl
index 61da093..99ca882 100644
--- a/Source/WebCore/html/TimeRanges.idl
+++ b/Source/WebCore/html/TimeRanges.idl
@@ -28,9 +28,9 @@
ImplementationLacksVTable
] interface TimeRanges {
readonly attribute unsigned long length;
- float start(in unsigned long index)
+ double start(in unsigned long index)
raises (DOMException);
- float end(in unsigned long index)
+ double end(in unsigned long index)
raises (DOMException);
};
diff --git a/Source/WebCore/html/shadow/MediaControlElementTypes.cpp b/Source/WebCore/html/shadow/MediaControlElementTypes.cpp
index ed105f1..3212b46 100644
--- a/Source/WebCore/html/shadow/MediaControlElementTypes.cpp
+++ b/Source/WebCore/html/shadow/MediaControlElementTypes.cpp
@@ -34,7 +34,6 @@
#include "CSSValueKeywords.h"
#include "ExceptionCodePlaceholder.h"
-#include "FloatConversion.h"
#include "HTMLNames.h"
#include "MouseEvent.h"
#include "RenderMedia.h"
@@ -48,10 +47,10 @@
class Event;
// FIXME: These constants may need to be tweaked to better match the seeking in the QuickTime plug-in.
-static const float cSkipRepeatDelay = 0.1f;
-static const float cSkipTime = 0.2f;
-static const float cScanRepeatDelay = 1.5f;
-static const float cScanMaximumRate = 8;
+static const double cSkipRepeatDelay = 0.1;
+static const double cSkipTime = 0.2;
+static const double cScanRepeatDelay = 1.5;
+static const double cScanMaximumRate = 8;
HTMLMediaElement* toParentMediaElement(Node* node)
{
@@ -134,7 +133,7 @@
{
}
-void MediaControlTimeDisplayElement::setCurrentValue(float time)
+void MediaControlTimeDisplayElement::setCurrentValue(double time)
{
m_currentValue = time;
}
@@ -229,9 +228,9 @@
m_seekTimer.stop();
}
-float MediaControlSeekButtonElement::nextRate() const
+double MediaControlSeekButtonElement::nextRate() const
{
- float rate = std::min(cScanMaximumRate, fabsf(mediaController()->playbackRate() * 2));
+ double rate = std::min(cScanMaximumRate, fabs(mediaController()->playbackRate() * 2));
if (!isForwardButton())
rate *= -1;
return rate;
@@ -240,7 +239,7 @@
void MediaControlSeekButtonElement::seekTimerFired(Timer<MediaControlSeekButtonElement>*)
{
if (m_seekType == Skip) {
- float skipTime = isForwardButton() ? cSkipTime : -cSkipTime;
+ double skipTime = isForwardButton() ? cSkipTime : -cSkipTime;
mediaController()->setCurrentTime(mediaController()->currentTime() + skipTime, IGNORE_EXCEPTION);
} else
mediaController()->setPlaybackRate(nextRate());
@@ -268,7 +267,7 @@
if (event->type() == eventNames().mouseoverEvent || event->type() == eventNames().mouseoutEvent || event->type() == eventNames().mousemoveEvent)
return;
- float volume = narrowPrecisionToFloat(value().toDouble());
+ double volume = value().toDouble();
if (volume != mediaController()->volume())
mediaController()->setVolume(volume, ASSERT_NO_EXCEPTION);
if (m_clearMutedOnUserInteraction)
@@ -291,9 +290,9 @@
return MediaControlInputElement::willRespondToMouseClickEvents();
}
-void MediaControlVolumeSliderElement::setVolume(float volume)
+void MediaControlVolumeSliderElement::setVolume(double volume)
{
- if (value().toFloat() != volume)
+ if (value().toDouble() != volume)
setValue(String::number(volume));
}
diff --git a/Source/WebCore/html/shadow/MediaControlElementTypes.h b/Source/WebCore/html/shadow/MediaControlElementTypes.h
index d4b9fbe..f0ff32c 100644
--- a/Source/WebCore/html/shadow/MediaControlElementTypes.h
+++ b/Source/WebCore/html/shadow/MediaControlElementTypes.h
@@ -129,14 +129,14 @@
class MediaControlTimeDisplayElement : public MediaControlDivElement {
public:
- void setCurrentValue(float);
- float currentValue() const { return m_currentValue; }
+ void setCurrentValue(double);
+ double currentValue() const { return m_currentValue; }
protected:
explicit MediaControlTimeDisplayElement(Document*, MediaControlElementType);
private:
- float m_currentValue;
+ double m_currentValue;
};
// ----------------------------
@@ -173,7 +173,7 @@
void startTimer();
void stopTimer();
- float nextRate() const;
+ double nextRate() const;
void seekTimerFired(Timer<MediaControlSeekButtonElement>*);
enum ActionType { Nothing, Play, Pause };
@@ -189,7 +189,7 @@
public:
virtual bool willRespondToMouseMoveEvents() OVERRIDE;
virtual bool willRespondToMouseClickEvents() OVERRIDE;
- void setVolume(float);
+ void setVolume(double);
void setClearMutedOnUserInteraction(bool);
protected:
diff --git a/Source/WebCore/html/shadow/MediaControlElements.cpp b/Source/WebCore/html/shadow/MediaControlElements.cpp
index ced0ef0..c8c49e2 100644
--- a/Source/WebCore/html/shadow/MediaControlElements.cpp
+++ b/Source/WebCore/html/shadow/MediaControlElements.cpp
@@ -37,7 +37,6 @@
#include "EventNames.h"
#include "EventTarget.h"
#include "ExceptionCodePlaceholder.h"
-#include "FloatConversion.h"
#include "Frame.h"
#include "GraphicsContext.h"
#include "HTMLVideoElement.h"
@@ -629,7 +628,7 @@
void MediaControlRewindButtonElement::defaultEventHandler(Event* event)
{
if (event->type() == eventNames().clickEvent) {
- mediaController()->setCurrentTime(max(0.0f, mediaController()->currentTime() - 30), IGNORE_EXCEPTION);
+ mediaController()->setCurrentTime(max(0.0, mediaController()->currentTime() - 30), IGNORE_EXCEPTION);
event->setDefaultHandled();
}
HTMLInputElement::defaultEventHandler(event);
@@ -945,7 +944,7 @@
if (event->type() == eventNames().mouseoverEvent || event->type() == eventNames().mouseoutEvent || event->type() == eventNames().mousemoveEvent)
return;
- float time = narrowPrecisionToFloat(value().toDouble());
+ double time = value().toDouble();
if (event->type() == eventNames().inputEvent && time != mediaController()->currentTime())
mediaController()->setCurrentTime(time, IGNORE_EXCEPTION);
@@ -962,12 +961,12 @@
return true;
}
-void MediaControlTimelineElement::setPosition(float currentTime)
+void MediaControlTimelineElement::setPosition(double currentTime)
{
setValue(String::number(currentTime));
}
-void MediaControlTimelineElement::setDuration(float duration)
+void MediaControlTimelineElement::setDuration(double duration)
{
setAttribute(maxAttr, String::number(std::isfinite(duration) ? duration : 0));
}
diff --git a/Source/WebCore/html/shadow/MediaControlElements.h b/Source/WebCore/html/shadow/MediaControlElements.h
index 1199158..610c51f 100644
--- a/Source/WebCore/html/shadow/MediaControlElements.h
+++ b/Source/WebCore/html/shadow/MediaControlElements.h
@@ -333,8 +333,8 @@
virtual bool willRespondToMouseClickEvents() OVERRIDE;
- void setPosition(float);
- void setDuration(float);
+ void setPosition(double);
+ void setDuration(double);
private:
explicit MediaControlTimelineElement(Document*, MediaControls*);
diff --git a/Source/WebCore/html/shadow/MediaControls.cpp b/Source/WebCore/html/shadow/MediaControls.cpp
index b1639b7..880419a4 100644
--- a/Source/WebCore/html/shadow/MediaControls.cpp
+++ b/Source/WebCore/html/shadow/MediaControls.cpp
@@ -92,7 +92,7 @@
updateCurrentTimeDisplay();
- float duration = m_mediaController->duration();
+ double duration = m_mediaController->duration();
if (std::isfinite(duration) || page->theme()->hasOwnDisabledStateHandlingFor(MediaSliderPart)) {
m_timeline->setDuration(duration);
m_timeline->setPosition(m_mediaController->currentTime());
@@ -214,7 +214,7 @@
void MediaControls::updateCurrentTimeDisplay()
{
- float now = m_mediaController->currentTime();
+ double now = m_mediaController->currentTime();
Page* page = document()->page();
if (!page)
diff --git a/Source/WebCore/html/shadow/MediaControlsApple.cpp b/Source/WebCore/html/shadow/MediaControlsApple.cpp
index 5adeca6..c1b62da 100644
--- a/Source/WebCore/html/shadow/MediaControlsApple.cpp
+++ b/Source/WebCore/html/shadow/MediaControlsApple.cpp
@@ -323,7 +323,7 @@
else
m_fullScreenButton->hide();
- float duration = m_mediaController->duration();
+ double duration = m_mediaController->duration();
if (std::isfinite(duration) || page->theme()->hasOwnDisabledStateHandlingFor(MediaSliderPart)) {
m_timeline->setDuration(duration);
m_timelineContainer->show();
@@ -381,8 +381,8 @@
void MediaControlsApple::updateCurrentTimeDisplay()
{
- float now = m_mediaController->currentTime();
- float duration = m_mediaController->duration();
+ double now = m_mediaController->currentTime();
+ double duration = m_mediaController->duration();
Page* page = document()->page();
if (!page)
diff --git a/Source/WebCore/html/shadow/MediaControlsBlackBerry.cpp b/Source/WebCore/html/shadow/MediaControlsBlackBerry.cpp
index aff0dbf..b1cf329 100644
--- a/Source/WebCore/html/shadow/MediaControlsBlackBerry.cpp
+++ b/Source/WebCore/html/shadow/MediaControlsBlackBerry.cpp
@@ -33,7 +33,6 @@
#include "Chrome.h"
#include "DOMTokenList.h"
#include "ExceptionCodePlaceholder.h"
-#include "FloatConversion.h"
#include "Frame.h"
#include "HTMLMediaElement.h"
#include "HTMLNames.h"
@@ -481,7 +480,7 @@
RefPtr<MediaControlFullscreenTimelineElement> timeline = adoptRef(new MediaControlFullscreenTimelineElement(document, controls));
timeline->ensureUserAgentShadowRoot();
timeline->setType("range");
- timeline->setAttribute(precisionAttr, "float");
+ timeline->setAttribute(precisionAttr, "double");
return timeline.release();
}
@@ -505,7 +504,7 @@
if (event->type() == eventNames().mouseoverEvent || event->type() == eventNames().mouseoutEvent || event->type() == eventNames().mousemoveEvent)
return;
- float time = narrowPrecisionToFloat(value().toDouble());
+ double time = value().toDouble();
if (event->type() == eventNames().inputEvent && time != mediaController()->currentTime())
mediaController()->setCurrentTime(time, IGNORE_EXCEPTION);
@@ -522,12 +521,12 @@
return true;
}
-void MediaControlFullscreenTimelineElement::setPosition(float currentTime)
+void MediaControlFullscreenTimelineElement::setPosition(double currentTime)
{
setValue(String::number(currentTime));
}
-void MediaControlFullscreenTimelineElement::setDuration(float duration)
+void MediaControlFullscreenTimelineElement::setDuration(double duration)
{
setAttribute(maxAttr, String::number(std::isfinite(duration) ? duration : 0));
}
@@ -911,9 +910,9 @@
else
m_fullscreenFullScreenButton->hide();
}
- float duration = m_mediaController->duration();
+ double duration = m_mediaController->duration();
if (std::isfinite(duration) || page->theme()->hasOwnDisabledStateHandlingFor(MediaSliderPart)) {
- float now = m_mediaController->currentTime();
+ double now = m_mediaController->currentTime();
m_timeline->setDuration(duration);
m_fullscreenTimeline->setDuration(duration);
m_timelineContainer->show();
@@ -955,7 +954,7 @@
// We only need to update buffering progress when paused, during normal
// playback playbackProgressed() will take care of it.
if (m_mediaController->paused()) {
- float now = m_mediaController->currentTime();
+ double now = m_mediaController->currentTime();
m_timeline->setPosition(now);
m_fullscreenTimeline->setPosition(now);
}
@@ -963,7 +962,7 @@
void MediaControlsBlackBerry::playbackStarted()
{
- float now = m_mediaController->currentTime();
+ double now = m_mediaController->currentTime();
m_playButton->updateDisplayType();
m_fullscreenPlayButton->updateDisplayType();
m_timeline->setPosition(now);
@@ -976,7 +975,7 @@
void MediaControlsBlackBerry::playbackProgressed()
{
- float now = m_mediaController->currentTime();
+ double now = m_mediaController->currentTime();
m_timeline->setPosition(now);
m_fullscreenTimeline->setPosition(now);
updateCurrentTimeDisplay();
@@ -987,7 +986,7 @@
void MediaControlsBlackBerry::playbackStopped()
{
- float now = m_mediaController->currentTime();
+ double now = m_mediaController->currentTime();
m_playButton->updateDisplayType();
m_fullscreenPlayButton->updateDisplayType();
m_timeline->setPosition(now);
@@ -1000,8 +999,8 @@
void MediaControlsBlackBerry::updateCurrentTimeDisplay()
{
- float now = m_mediaController->currentTime();
- float duration = m_mediaController->duration();
+ double now = m_mediaController->currentTime();
+ double duration = m_mediaController->duration();
Page* page = document()->page();
if (!page)
diff --git a/Source/WebCore/html/shadow/MediaControlsBlackBerry.h b/Source/WebCore/html/shadow/MediaControlsBlackBerry.h
index e41fa69..0ff76cb 100644
--- a/Source/WebCore/html/shadow/MediaControlsBlackBerry.h
+++ b/Source/WebCore/html/shadow/MediaControlsBlackBerry.h
@@ -193,8 +193,8 @@
static PassRefPtr<MediaControlFullscreenTimelineElement> create(Document*, MediaControls*);
virtual bool willRespondToMouseClickEvents() OVERRIDE;
- void setPosition(float);
- void setDuration(float);
+ void setPosition(double);
+ void setDuration(double);
private:
MediaControlFullscreenTimelineElement(Document*, MediaControls*);
diff --git a/Source/WebCore/html/shadow/MediaControlsGtk.cpp b/Source/WebCore/html/shadow/MediaControlsGtk.cpp
index 7a8b922..5eec087 100644
--- a/Source/WebCore/html/shadow/MediaControlsGtk.cpp
+++ b/Source/WebCore/html/shadow/MediaControlsGtk.cpp
@@ -155,7 +155,7 @@
if (!page)
return;
- float duration = m_mediaController->duration();
+ double duration = m_mediaController->duration();
m_durationDisplay->setInnerText(page->theme()->formatMediaControlsTime(duration), ASSERT_NO_EXCEPTION);
m_durationDisplay->setCurrentValue(duration);
@@ -172,8 +172,8 @@
void MediaControlsGtk::updateCurrentTimeDisplay()
{
- float now = m_mediaController->currentTime();
- float duration = m_mediaController->duration();
+ double now = m_mediaController->currentTime();
+ double duration = m_mediaController->duration();
Page* page = document()->page();
if (!page)
diff --git a/Source/WebCore/html/track/TextTrackCue.cpp b/Source/WebCore/html/track/TextTrackCue.cpp
index 9d5886a..39808c9 100644
--- a/Source/WebCore/html/track/TextTrackCue.cpp
+++ b/Source/WebCore/html/track/TextTrackCue.cpp
@@ -764,7 +764,7 @@
}
}
-void TextTrackCue::updateDisplayTree(float movieTime)
+void TextTrackCue::updateDisplayTree(double movieTime)
{
// The display tree may contain WebVTT timestamp objects representing
// timestamps (processing instructions), along with displayable nodes.
diff --git a/Source/WebCore/html/track/TextTrackCue.h b/Source/WebCore/html/track/TextTrackCue.h
index 28a7116..6fe213b 100644
--- a/Source/WebCore/html/track/TextTrackCue.h
+++ b/Source/WebCore/html/track/TextTrackCue.h
@@ -147,7 +147,7 @@
PassRefPtr<TextTrackCueBox> getDisplayTree(const IntSize& videoSize);
PassRefPtr<HTMLDivElement> element() const { return m_cueBackgroundBox; }
- void updateDisplayTree(float);
+ void updateDisplayTree(double);
void removeDisplayTree();
void markFutureAndPastNodes(ContainerNode*, double, double);
diff --git a/Source/WebCore/platform/Clock.h b/Source/WebCore/platform/Clock.h
index 86af956..0b3322f 100644
--- a/Source/WebCore/platform/Clock.h
+++ b/Source/WebCore/platform/Clock.h
@@ -36,11 +36,11 @@
static PassRefPtr<Clock> create();
virtual ~Clock() { }
- virtual void setCurrentTime(float) = 0;
- virtual float currentTime() const = 0;
+ virtual void setCurrentTime(double) = 0;
+ virtual double currentTime() const = 0;
- virtual void setPlayRate(float) = 0;
- virtual float playRate() const = 0;
+ virtual void setPlayRate(double) = 0;
+ virtual double playRate() const = 0;
virtual void start() = 0;
virtual void stop() = 0;
diff --git a/Source/WebCore/platform/ClockGeneric.cpp b/Source/WebCore/platform/ClockGeneric.cpp
index ef09c4f..99aa340 100644
--- a/Source/WebCore/platform/ClockGeneric.cpp
+++ b/Source/WebCore/platform/ClockGeneric.cpp
@@ -26,7 +26,6 @@
#include "config.h"
#include "ClockGeneric.h"
-#include "FloatConversion.h"
#include <wtf/CurrentTime.h>
using namespace WebCore;
@@ -39,21 +38,20 @@
m_startTime = m_lastTime = now();
}
-void ClockGeneric::setCurrentTime(float time)
+void ClockGeneric::setCurrentTime(double time)
{
m_startTime = m_lastTime = now();
m_offset = time;
}
-float ClockGeneric::currentTime() const
+double ClockGeneric::currentTime() const
{
if (m_running)
m_lastTime = now();
- float time = narrowPrecisionToFloat(((m_lastTime - m_startTime) * m_rate) + m_offset);
- return time;
+ return ((m_lastTime - m_startTime) * m_rate) + m_offset;
}
-void ClockGeneric::setPlayRate(float rate)
+void ClockGeneric::setPlayRate(double rate)
{
m_offset = now();
m_lastTime = m_startTime = now();
@@ -83,4 +81,3 @@
{
return WTF::currentTime();
}
-
diff --git a/Source/WebCore/platform/ClockGeneric.h b/Source/WebCore/platform/ClockGeneric.h
index d53a1bc..3dc0e7d 100644
--- a/Source/WebCore/platform/ClockGeneric.h
+++ b/Source/WebCore/platform/ClockGeneric.h
@@ -35,11 +35,11 @@
ClockGeneric();
private:
- virtual void setCurrentTime(float);
- virtual float currentTime() const;
+ virtual void setCurrentTime(double);
+ virtual double currentTime() const;
- virtual void setPlayRate(float);
- virtual float playRate() const { return m_rate; }
+ virtual void setPlayRate(double);
+ virtual double playRate() const { return m_rate; }
virtual void start();
virtual void stop();
@@ -48,7 +48,7 @@
double now() const;
bool m_running;
- float m_rate;
+ double m_rate;
double m_offset;
double m_startTime;
mutable double m_lastTime;
diff --git a/Source/WebCore/platform/graphics/MediaPlayer.cpp b/Source/WebCore/platform/graphics/MediaPlayer.cpp
index 1bf0618..339fe32 100644
--- a/Source/WebCore/platform/graphics/MediaPlayer.cpp
+++ b/Source/WebCore/platform/graphics/MediaPlayer.cpp
@@ -113,17 +113,17 @@
virtual void setVisible(bool) { }
- virtual float duration() const { return 0; }
+ virtual double durationDouble() const { return 0; }
- virtual float currentTime() const { return 0; }
- virtual void seek(float) { }
+ virtual double currentTimeDouble() const { return 0; }
+ virtual void seekDouble(double) { }
virtual bool seeking() const { return false; }
- virtual void setRate(float) { }
+ virtual void setRateDouble(double) { }
virtual void setPreservesPitch(bool) { }
virtual bool paused() const { return false; }
- virtual void setVolume(float) { }
+ virtual void setVolumeDouble(double) { }
virtual bool supportsMuting() const { return false; }
virtual void setMuted(bool) { }
@@ -134,7 +134,7 @@
virtual MediaPlayer::NetworkState networkState() const { return MediaPlayer::Empty; }
virtual MediaPlayer::ReadyState readyState() const { return MediaPlayer::HaveNothing; }
- virtual float maxTimeSeekable() const { return 0; }
+ virtual double maxTimeSeekableDouble() const { return 0; }
virtual PassRefPtr<TimeRanges> buffered() const { return TimeRanges::create(); }
virtual unsigned totalBytes() const { return 0; }
@@ -511,14 +511,14 @@
}
#endif
-float MediaPlayer::duration() const
+double MediaPlayer::duration() const
{
- return m_private->duration();
+ return m_private->durationDouble();
}
-float MediaPlayer::startTime() const
+double MediaPlayer::startTime() const
{
- return m_private->startTime();
+ return m_private->startTimeDouble();
}
double MediaPlayer::initialTime() const
@@ -526,14 +526,14 @@
return m_private->initialTime();
}
-float MediaPlayer::currentTime() const
+double MediaPlayer::currentTime() const
{
- return m_private->currentTime();
+ return m_private->currentTimeDouble();
}
-void MediaPlayer::seek(float time)
+void MediaPlayer::seek(double time)
{
- m_private->seek(time);
+ m_private->seekDouble(time);
}
bool MediaPlayer::paused() const
@@ -606,17 +606,17 @@
return m_private->readyState();
}
-float MediaPlayer::volume() const
+double MediaPlayer::volume() const
{
return m_volume;
}
-void MediaPlayer::setVolume(float volume)
+void MediaPlayer::setVolume(double volume)
{
m_volume = volume;
if (m_private->supportsMuting() || !m_muted)
- m_private->setVolume(volume);
+ m_private->setVolumeDouble(volume);
}
bool MediaPlayer::muted() const
@@ -644,15 +644,15 @@
m_private->setClosedCaptionsVisible(closedCaptionsVisible);
}
-float MediaPlayer::rate() const
+double MediaPlayer::rate() const
{
return m_rate;
}
-void MediaPlayer::setRate(float rate)
+void MediaPlayer::setRate(double rate)
{
m_rate = rate;
- m_private->setRate(rate);
+ m_private->setRateDouble(rate);
}
bool MediaPlayer::preservesPitch() const
@@ -676,9 +676,9 @@
return m_private->seekable();
}
-float MediaPlayer::maxTimeSeekable()
+double MediaPlayer::maxTimeSeekable()
{
- return m_private->maxTimeSeekable();
+ return m_private->maxTimeSeekableDouble();
}
bool MediaPlayer::didLoadingProgress()
@@ -851,9 +851,9 @@
return m_private->movieLoadType();
}
-float MediaPlayer::mediaTimeForTimeValue(float timeValue) const
+double MediaPlayer::mediaTimeForTimeValue(double timeValue) const
{
- return m_private->mediaTimeForTimeValue(timeValue);
+ return m_private->mediaTimeForTimeValueDouble(timeValue);
}
double MediaPlayer::maximumDurationToCacheMediaTime() const
@@ -949,7 +949,7 @@
m_mediaPlayerClient->mediaPlayerReadyStateChanged(this);
}
-void MediaPlayer::volumeChanged(float newVolume)
+void MediaPlayer::volumeChanged(double newVolume)
{
m_volume = newVolume;
if (m_mediaPlayerClient)
diff --git a/Source/WebCore/platform/graphics/MediaPlayer.h b/Source/WebCore/platform/graphics/MediaPlayer.h
index e17ad6c..453dcf0 100644
--- a/Source/WebCore/platform/graphics/MediaPlayer.h
+++ b/Source/WebCore/platform/graphics/MediaPlayer.h
@@ -298,29 +298,29 @@
bool paused() const;
bool seeking() const;
- static float invalidTime() { return -1.0f;}
- float duration() const;
- float currentTime() const;
- void seek(float time);
+ static double invalidTime() { return -1.0;}
+ double duration() const;
+ double currentTime() const;
+ void seek(double time);
- float startTime() const;
+ double startTime() const;
double initialTime() const;
- float rate() const;
- void setRate(float);
+ double rate() const;
+ void setRate(double);
bool preservesPitch() const;
void setPreservesPitch(bool);
PassRefPtr<TimeRanges> buffered();
PassRefPtr<TimeRanges> seekable();
- float maxTimeSeekable();
+ double maxTimeSeekable();
bool didLoadingProgress();
- float volume() const;
- void setVolume(float);
+ double volume() const;
+ void setVolume(double);
bool muted() const;
void setMuted(bool);
@@ -364,7 +364,7 @@
void networkStateChanged();
void readyStateChanged();
- void volumeChanged(float);
+ void volumeChanged(double);
void muteChanged(bool);
void timeChanged();
void sizeChanged();
@@ -414,7 +414,7 @@
bool didPassCORSAccessCheck() const;
- float mediaTimeForTimeValue(float) const;
+ double mediaTimeForTimeValue(double) const;
double maximumDurationToCacheMediaTime() const;
@@ -487,8 +487,8 @@
IntSize m_size;
Preload m_preload;
bool m_visible;
- float m_rate;
- float m_volume;
+ double m_rate;
+ double m_volume;
bool m_muted;
bool m_preservesPitch;
bool m_privateBrowsing;
diff --git a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h b/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
index d22c93a..d890e6d 100644
--- a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
+++ b/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
@@ -70,22 +70,31 @@
virtual void setVisible(bool) = 0;
- virtual float duration() const = 0;
+ virtual float duration() const { return 0; }
+ virtual double durationDouble() const { return duration(); }
- virtual float currentTime() const = 0;
- virtual void seek(float time) = 0;
+ virtual float currentTime() const { return 0; }
+ virtual double currentTimeDouble() const { return currentTime(); }
+
+ virtual void seek(float) { }
+ virtual void seekDouble(double time) { seek(time); }
+
virtual bool seeking() const = 0;
virtual float startTime() const { return 0; }
+ virtual double startTimeDouble() const { return startTime(); }
virtual double initialTime() const { return 0; }
- virtual void setRate(float) = 0;
+ virtual void setRate(float) { }
+ virtual void setRateDouble(double rate) { setRate(rate); }
+
virtual void setPreservesPitch(bool) { }
virtual bool paused() const = 0;
- virtual void setVolume(float) = 0;
+ virtual void setVolume(float) { }
+ virtual void setVolumeDouble(double volume) { return setVolume(volume); }
virtual bool supportsMuting() const { return false; }
virtual void setMuted(bool) { }
@@ -97,7 +106,8 @@
virtual MediaPlayer::ReadyState readyState() const = 0;
virtual PassRefPtr<TimeRanges> seekable() const { return maxTimeSeekable() ? TimeRanges::create(0, maxTimeSeekable()) : TimeRanges::create(); }
- virtual float maxTimeSeekable() const = 0;
+ virtual float maxTimeSeekable() const { return 0; }
+ virtual double maxTimeSeekableDouble() const { return maxTimeSeekable(); }
virtual PassRefPtr<TimeRanges> buffered() const = 0;
virtual bool didLoadingProgress() const = 0;
@@ -149,6 +159,7 @@
// Time value in the movie's time scale. It is only necessary to override this if the media
// engine uses rational numbers to represent media time.
virtual float mediaTimeForTimeValue(float timeValue) const { return timeValue; }
+ virtual double mediaTimeForTimeValueDouble(double timeValue) const { return timeValue; }
// Overide this if it is safe for HTMLMediaElement to cache movie time and report
// 'currentTime' as [cached time + elapsed wall time]. Returns the maximum wall time
diff --git a/Source/WebCore/platform/mac/PlatformClockCA.cpp b/Source/WebCore/platform/mac/PlatformClockCA.cpp
index fe492f2..4d2e8df 100644
--- a/Source/WebCore/platform/mac/PlatformClockCA.cpp
+++ b/Source/WebCore/platform/mac/PlatformClockCA.cpp
@@ -29,7 +29,6 @@
#include "PlatformClockCA.h"
-#include "FloatConversion.h"
#include <AudioToolbox/CoreAudioClock.h>
#include <CoreAudio/AudioHardware.h>
@@ -61,7 +60,7 @@
CAClockDispose(m_clock);
}
-void PlatformClockCA::setCurrentTime(float time)
+void PlatformClockCA::setCurrentTime(double time)
{
if (m_running)
CAClockStop(m_clock);
@@ -73,7 +72,7 @@
CAClockStart(m_clock);
}
-float PlatformClockCA::currentTime() const
+double PlatformClockCA::currentTime() const
{
CAClockTime caTime;
@@ -81,24 +80,24 @@
// what is the start time, i.e. what the current time will be when started.
if (m_running) {
if (CAClockGetCurrentTime(m_clock, kCAClockTimeFormat_Seconds, &caTime) == noErr)
- return narrowPrecisionToFloat(caTime.time.seconds);
+ return caTime.time.seconds;
} else {
if (CAClockGetStartTime(m_clock, kCAClockTimeFormat_Seconds, &caTime) == noErr)
- return narrowPrecisionToFloat(caTime.time.seconds);
+ return caTime.time.seconds;
}
return 0;
}
-void PlatformClockCA::setPlayRate(float rate)
+void PlatformClockCA::setPlayRate(double rate)
{
CAClockSetPlayRate(m_clock, rate);
}
-float PlatformClockCA::PlatformClockCA::playRate() const
+double PlatformClockCA::PlatformClockCA::playRate() const
{
double rate = 0;
if (CAClockGetPlayRate(m_clock, &rate) == noErr)
- return narrowPrecisionToFloat(rate);
+ return rate;
return 0;
}
diff --git a/Source/WebCore/platform/mac/PlatformClockCA.h b/Source/WebCore/platform/mac/PlatformClockCA.h
index b101d7a..2633dd4 100644
--- a/Source/WebCore/platform/mac/PlatformClockCA.h
+++ b/Source/WebCore/platform/mac/PlatformClockCA.h
@@ -40,11 +40,11 @@
virtual ~PlatformClockCA();
private:
- virtual void setCurrentTime(float);
- virtual float currentTime() const;
+ virtual void setCurrentTime(double);
+ virtual double currentTime() const;
- virtual void setPlayRate(float);
- virtual float playRate() const;
+ virtual void setPlayRate(double);
+ virtual double playRate() const;
virtual void start();
virtual void stop();
diff --git a/Source/WebCore/platform/mac/PlatformClockCM.h b/Source/WebCore/platform/mac/PlatformClockCM.h
index e0349153..0d5f63d 100644
--- a/Source/WebCore/platform/mac/PlatformClockCM.h
+++ b/Source/WebCore/platform/mac/PlatformClockCM.h
@@ -44,18 +44,18 @@
private:
void initializeWithTimingSource(CMClockRef);
- virtual void setCurrentTime(float);
- virtual float currentTime() const;
+ virtual void setCurrentTime(double);
+ virtual double currentTime() const;
- virtual void setPlayRate(float);
- virtual float playRate() const { return m_rate; }
+ virtual void setPlayRate(double);
+ virtual double playRate() const { return m_rate; }
virtual void start();
virtual void stop();
virtual bool isRunning() const { return m_running; }
RetainPtr<CMTimebaseRef> m_timebase;
- float m_rate;
+ double m_rate;
bool m_running;
};
diff --git a/Source/WebCore/platform/mac/PlatformClockCM.mm b/Source/WebCore/platform/mac/PlatformClockCM.mm
index e9501a0..81fb6fd 100644
--- a/Source/WebCore/platform/mac/PlatformClockCM.mm
+++ b/Source/WebCore/platform/mac/PlatformClockCM.mm
@@ -29,7 +29,6 @@
#import "PlatformClockCM.h"
-#import "FloatConversion.h"
#import "SoftLinking.h"
#import <CoreMedia/CMAudioDeviceClock.h>
@@ -73,19 +72,19 @@
m_timebase.adoptCF(rawTimebasePtr);
}
-void PlatformClockCM::setCurrentTime(float time)
+void PlatformClockCM::setCurrentTime(double time)
{
CMTime cmTime = CMTimeMakeWithSeconds(time, DefaultTimeScale);
CMTimebaseSetTime(m_timebase.get(), cmTime);
}
-float PlatformClockCM::currentTime() const
+double PlatformClockCM::currentTime() const
{
CMTime cmTime = CMTimebaseGetTime(m_timebase.get());
- return narrowPrecisionToFloat(CMTimeGetSeconds(cmTime));
+ return CMTimeGetSeconds(cmTime);
}
-void PlatformClockCM::setPlayRate(float rate)
+void PlatformClockCM::setPlayRate(double rate)
{
if (m_rate == rate)
return;