[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

philn at webkit.org philn at webkit.org
Wed Dec 22 12:49:36 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a6827975c09b1a9db7a8114e9824299539174f6a
Author: philn at webkit.org <philn at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 31 06:44:41 2010 +0000

    2010-08-30  Philippe Normand  <pnormand at igalia.com>
    
            Reviewed by Martin Robinson.
    
            [GTK] Buffered ranges drawing support
            https://bugs.webkit.org/show_bug.cgi?id=44869
    
            Refactored the media slider track painting code to support
            multiple buffered ranges painting. This change introduces no
            functional regression.
    
            * platform/gtk/RenderThemeGtk.cpp:
            (WebCore::RenderThemeGtk::paintMediaSliderTrack):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66460 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a11a5f7..4c14741 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-08-30  Philippe Normand  <pnormand at igalia.com>
+
+        Reviewed by Martin Robinson.
+
+        [GTK] Buffered ranges drawing support
+        https://bugs.webkit.org/show_bug.cgi?id=44869
+
+        Refactored the media slider track painting code to support
+        multiple buffered ranges painting. This change introduces no
+        functional regression.
+
+        * platform/gtk/RenderThemeGtk.cpp:
+        (WebCore::RenderThemeGtk::paintMediaSliderTrack):
+
 2010-08-30  Mihai Parparita  <mihaip at chromium.org>
 
         Reviewed by Adam Barth.
diff --git a/WebCore/platform/gtk/RenderThemeGtk.cpp b/WebCore/platform/gtk/RenderThemeGtk.cpp
index d9f477c..92431c7 100644
--- a/WebCore/platform/gtk/RenderThemeGtk.cpp
+++ b/WebCore/platform/gtk/RenderThemeGtk.cpp
@@ -38,6 +38,7 @@
 #include "RenderBox.h"
 #include "RenderObject.h"
 #include "Scrollbar.h"
+#include "TimeRanges.h"
 #include "UserAgentStyleSheets.h"
 #include "gtkdrawing.h"
 #include <gdk/gdk.h>
@@ -805,33 +806,48 @@ bool RenderThemeGtk::paintMediaSliderTrack(RenderObject* o, const PaintInfo& pai
         return false;
 
     // Draw the buffered ranges. This code is highly inspired from
-    // Chrome.
-    // FIXME: Draw multiple ranges if there are multiple buffered
-    // ranges. The current implementation of the player is always
-    // buffering a single range anyway.
-    IntRect bufferedRect = r;
-    bufferedRect.inflate(-style->borderLeftWidth());
-    bufferedRect.setWidth((bufferedRect.width() * mediaElement->percentLoaded()));
-
-    // Don't bother drawing an empty area.
-    if (bufferedRect.isEmpty())
-        return false;
-
-    IntPoint sliderTopLeft = bufferedRect.location();
-    IntPoint sliderTopRight = sliderTopLeft;
-    sliderTopRight.move(0, bufferedRect.height());
-
-    RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderTopRight);
-    Color startColor = m_panelColor;
-    gradient->addColorStop(0.0, startColor);
-    gradient->addColorStop(1.0, Color(startColor.red() / 2, startColor.green() / 2, startColor.blue() / 2, startColor.alpha()));
+    // Chrome for the gradient code.
+    float mediaDuration = mediaElement->duration();
+    RefPtr<TimeRanges> timeRanges = mediaElement->buffered();
+    IntRect trackRect = r;
+    int totalWidth = trackRect.width();
 
+    trackRect.inflate(-style->borderLeftWidth());
     context->save();
     context->setStrokeStyle(NoStroke);
-    context->setFillGradient(gradient);
-    context->fillRect(bufferedRect);
-    context->restore();
 
+    for (unsigned index = 0; index < timeRanges->length(); ++index) {
+        ExceptionCode ignoredException;
+        float start = timeRanges->start(index, ignoredException);
+        float end = timeRanges->end(index, ignoredException);
+        int width = ((end - start) * totalWidth) / mediaDuration;
+        IntRect rangeRect;
+        if (!index) {
+            rangeRect = trackRect;
+            rangeRect.setWidth(width);
+        } else {
+            rangeRect.setLocation(IntPoint((start * totalWidth) / mediaDuration, trackRect.y()));
+            rangeRect.setSize(IntSize(width, trackRect.height()));
+        }
+
+        // Don't bother drawing empty range.
+        if (rangeRect.isEmpty())
+            continue;
+
+        IntPoint sliderTopLeft = rangeRect.location();
+        IntPoint sliderTopRight = sliderTopLeft;
+        sliderTopRight.move(0, rangeRect.height());
+
+        RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderTopRight);
+        Color startColor = m_panelColor;
+        gradient->addColorStop(0.0, startColor);
+        gradient->addColorStop(1.0, Color(startColor.red() / 2, startColor.green() / 2, startColor.blue() / 2, startColor.alpha()));
+
+        context->setFillGradient(gradient);
+        context->fillRect(rangeRect);
+    }
+
+    context->restore();
     return false;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list