summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorYohan Chuzeville <ychuzevi@cisco.com>2014-09-22 18:32:04 +0200
committerYohan Chuzeville <ychuzevi@cisco.com>2014-09-22 22:07:17 +0200
commitd34ae1d6603354119fb1687a59dc48560e27de82 (patch)
treedd40dcdaa4a450f5c964dbc434c8a4195674c820 /Source
parentd84668b5124b2dd973644da18dad281953414242 (diff)
downloadqtwebkit-d34ae1d6603354119fb1687a59dc48560e27de82.tar.gz
Prevent display of infinite media slider track.
When the duration received is zero but buffering already started, the computed size for the rendering is infinite. Change-Id: I9b9d8f42b6dbff792f89ac7d7e28991187762a1c Reviewed-by: Julien Brianceau <jbriance@cisco.com> Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/platform/qt/RenderThemeQt.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/WebCore/platform/qt/RenderThemeQt.cpp b/Source/WebCore/platform/qt/RenderThemeQt.cpp
index 321fd1108..8a6232ea9 100644
--- a/Source/WebCore/platform/qt/RenderThemeQt.cpp
+++ b/Source/WebCore/platform/qt/RenderThemeQt.cpp
@@ -813,17 +813,19 @@ bool RenderThemeQt::paintMediaSliderTrack(RenderObject* o, const PaintInfo& pain
paintMediaBackground(p->painter, r);
if (MediaPlayer* player = mediaElement->player()) {
+ float duration = player->duration();
+
// Get the buffered parts of the media
RefPtr<TimeRanges> buffered = player->buffered();
- if (buffered->length() > 0 && player->duration() < std::numeric_limits<float>::infinity()) {
+ if (buffered->length() > 0 && duration > 0.0f && duration < std::numeric_limits<float>::infinity()) {
// Set the transform and brush
WorldMatrixTransformer transformer(p->painter, o, r);
p->painter->setBrush(getMediaControlForegroundColor());
// Paint each buffered section
for (int i = 0; i < buffered->length(); i++) {
- float startX = (buffered->start(i, IGNORE_EXCEPTION) / player->duration()) * 100;
- float width = ((buffered->end(i, IGNORE_EXCEPTION) / player->duration()) * 100) - startX;
+ float startX = (buffered->start(i, IGNORE_EXCEPTION) / duration) * 100;
+ float width = ((buffered->end(i, IGNORE_EXCEPTION) / duration) * 100) - startX;
p->painter->drawRect(startX, 37, width, 26);
}
}