From 5e2bc6953fe6923165b8a5d7679939693a1d58d6 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Fri, 5 Feb 2010 14:27:46 +0000 Subject: Merge webkit.org at r54340 : Initial merge by git Change-Id: Ib489d2ff91186ea3652522e1d586e54416a2cf44 --- WebCore/rendering/RenderTheme.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'WebCore/rendering/RenderTheme.cpp') diff --git a/WebCore/rendering/RenderTheme.cpp b/WebCore/rendering/RenderTheme.cpp index af92465..f1e564b 100644 --- a/WebCore/rendering/RenderTheme.cpp +++ b/WebCore/rendering/RenderTheme.cpp @@ -440,6 +440,35 @@ bool RenderTheme::shouldRenderMediaControlPart(ControlPart part, Element* e) return true; } } + +String RenderTheme::formatMediaControlsTime(float time) const +{ + if (!isfinite(time)) + time = 0; + int seconds = (int)fabsf(time); + int hours = seconds / (60 * 60); + int minutes = (seconds / 60) % 60; + seconds %= 60; + if (hours) { + if (hours > 9) + return String::format("%s%02d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds); + + return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds); + } + + return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds); +} + +String RenderTheme::formatMediaControlsCurrentTime(float currentTime, float /*duration*/) const +{ + return formatMediaControlsTime(currentTime); +} + +String RenderTheme::formatMediaControlsRemainingTime(float currentTime, float duration) const +{ + return formatMediaControlsTime(currentTime - duration); +} + #endif Color RenderTheme::activeSelectionBackgroundColor() const -- cgit v1.1