Title: [133632] trunk/Source/WebCore
Revision
133632
Author
[email protected]
Date
2012-11-06 10:17:36 -0800 (Tue, 06 Nov 2012)

Log Message

[BlackBerry] Update BB10 form theme.
https://bugs.webkit.org/show_bug.cgi?id=100760

Patch by Tiancheng Jiang <[email protected]> on 2012-11-06
Reviewed by Rob Buis.

Revert webkit/ce306dcc698199a6f7ce679daf0a30c25d3a3d43 slider theme
change which break media control and vertical slider.

RIM PR 236993
Internal Reviewed by Jeff Rogers.

* platform/blackberry/RenderThemeBlackBerry.cpp:
(WebCore::RenderThemeBlackBerry::paintSliderTrackRect):
(WebCore::RenderThemeBlackBerry::paintSliderThumb):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (133631 => 133632)


--- trunk/Source/WebCore/ChangeLog	2012-11-06 18:15:44 UTC (rev 133631)
+++ trunk/Source/WebCore/ChangeLog	2012-11-06 18:17:36 UTC (rev 133632)
@@ -1,3 +1,20 @@
+2012-11-06  Tiancheng Jiang  <[email protected]>
+
+        [BlackBerry] Update BB10 form theme.
+        https://bugs.webkit.org/show_bug.cgi?id=100760
+
+        Reviewed by Rob Buis.
+
+        Revert webkit/ce306dcc698199a6f7ce679daf0a30c25d3a3d43 slider theme
+        change which break media control and vertical slider.
+
+        RIM PR 236993
+        Internal Reviewed by Jeff Rogers.
+
+        * platform/blackberry/RenderThemeBlackBerry.cpp:
+        (WebCore::RenderThemeBlackBerry::paintSliderTrackRect):
+        (WebCore::RenderThemeBlackBerry::paintSliderThumb):
+
 2012-11-06  Michael Saboff  <[email protected]>
 
         canonicalizedTitle() shouldn't convert 8 bit title strings to 16 bit

Modified: trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp (133631 => 133632)


--- trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp	2012-11-06 18:15:44 UTC (rev 133631)
+++ trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp	2012-11-06 18:17:36 UTC (rev 133632)
@@ -176,24 +176,6 @@
     gc->drawImage(img, ColorSpaceDeviceRGB, rect, srcRect);
 }
 
-static void drawThreeSlice(GraphicsContext* gc, const IntRect& rect, Image* img, int slice)
-{
-    if (!img)
-        return;
-    FloatSize dstSlice(rect.height() / 2, rect.height());
-    FloatRect srcRect(0, 0, slice, img->height());
-    FloatRect dstRect(rect.location(), dstSlice);
-
-    gc->drawImage(img, ColorSpaceDeviceRGB, dstRect, srcRect);
-    srcRect.move(img->width() - srcRect.width(), 0);
-    dstRect.move(rect.width() - dstRect.width(), 0);
-    gc->drawImage(img, ColorSpaceDeviceRGB, dstRect, srcRect);
-
-    srcRect = FloatRect(slice, 0, img->width() - 2 * slice, img->height());
-    dstRect = FloatRect(rect.x() + dstSlice.width(), rect.y(), rect.width() - 2 * dstSlice.width(), dstSlice.height());
-    gc->drawImage(img, ColorSpaceDeviceRGB, dstRect, srcRect);
-}
-
 static void drawNineSlice(GraphicsContext* gc, const IntRect& rect, double scale, Image* img, int slice)
 {
     if (!img)
@@ -722,67 +704,71 @@
 bool RenderThemeBlackBerry::paintSliderTrackRect(RenderObject* object, const PaintInfo& info, const IntRect& rect,
         RGBA32 strokeColorStart, RGBA32 strokeColorEnd, RGBA32 fillColorStart, RGBA32 fillColorEnd)
 {
-    ASSERT(info.context);
+    FloatSize smallCorner(smallRadius, smallRadius);
+
     info.context->save();
-    GraphicsContext* context = info.context;
+    info.context->setStrokeStyle(SolidStroke);
+    info.context->setStrokeThickness(lineWidth);
 
-    static RefPtr<Image> disabled, inactive;
-    if (!disabled) {
-        disabled = loadImage("core_slider_fill_disabled");
-        inactive = loadImage("core_slider_bg");
-    }
+    info.context->setStrokeGradient(createLinearGradient(strokeColorStart, strokeColorEnd, rect.maxXMinYCorner(), rect. maxXMaxYCorner()));
+    info.context->setFillGradient(createLinearGradient(fillColorStart, fillColorEnd, rect.maxXMinYCorner(), rect.maxXMaxYCorner()));
 
-    if (isEnabled(object))
-        drawThreeSlice(context, rect, inactive.get(), mediumSlice);
-    else
-        drawThreeSlice(context, rect, disabled.get(), (smallSlice - 1));
+    Path path;
+    path.addRoundedRect(rect, smallCorner);
+    info.context->fillPath(path);
 
-    context->restore();
+    info.context->restore();
     return false;
 }
 
 bool RenderThemeBlackBerry::paintSliderThumb(RenderObject* object, const PaintInfo& info, const IntRect& rect)
 {
-    ASSERT(info.context);
+    FloatSize largeCorner(largeRadius, largeRadius);
     info.context->save();
-    GraphicsContext* context = info.context;
-
-    static RefPtr<Image> disabled, inactive, pressed, aura;
-    if (!disabled) {
-        disabled = loadImage("core_slider_handle_disabled");
-        inactive = loadImage("core_slider_handle");
-        pressed = loadImage("core_slider_handle_pressed");
-        aura = loadImage("core_slider_aura");
-    }
-
-    FloatRect tmpRect(rect);
-    float length = std::max(tmpRect.width(), tmpRect.height());
-    if (tmpRect.width() > tmpRect.height()) {
-        tmpRect.setY(tmpRect.y() - (length - tmpRect.height()) / 2);
-        tmpRect.setHeight(length);
+    info.context->setStrokeStyle(SolidStroke);
+    info.context->setStrokeThickness(lineWidth);
+    if (isPressed(object) || isHovered(object)) {
+        info.context->setStrokeGradient(createLinearGradient(hoverTopOutline, hoverBottomOutline, rect.maxXMinYCorner(), rect. maxXMaxYCorner()));
+        info.context->setFillGradient(createLinearGradient(hoverTop, hoverBottom, rect.maxXMinYCorner(), rect.maxXMaxYCorner()));
     } else {
-        tmpRect.setX(tmpRect.x() - (length - tmpRect.width()) / 2);
-        tmpRect.setWidth(length);
+        info.context->setStrokeGradient(createLinearGradient(regularTopOutline, regularBottomOutline, rect.maxXMinYCorner(), rect. maxXMaxYCorner()));
+        info.context->setFillGradient(createLinearGradient(regularTop, regularBottom, rect.maxXMinYCorner(), rect.maxXMaxYCorner()));
     }
-
-    float auraHeight = length * auraRatio;
-    float auraWidth = auraHeight;
-    float auraX = tmpRect.x() - (auraWidth - tmpRect.width()) / 2;
-    float auraY = tmpRect.y() - (auraHeight - tmpRect.height()) / 2;
-    FloatRect auraRect(auraX, auraY, auraWidth, auraHeight);
-
-    if (!isEnabled(object))
-        drawControl(context, tmpRect, disabled.get());
-    else {
-        if (isPressed(object) || isHovered(object) || isFocused(object)) {
-            drawControl(context, tmpRect, pressed.get());
-            drawControl(context, auraRect, aura.get());
+    Path path;
+    path.addRoundedRect(rect, largeCorner);
+    info.context->fillPath(path);
+    bool isVertical = rect.width() > rect.height();
+    IntPoint startPoint(rect.x() + (isVertical ? 5 : 2), rect.y() + (isVertical ? 2 : 5));
+    IntPoint endPoint(rect.x() + (isVertical ? 20 : 2), rect.y() + (isVertical ? 2 : 20));
+    const int lineOffset = 2;
+    const int shadowOffset = 1;
+    for (int i = 0; i < 3; i++) {
+        if (isVertical) {
+            startPoint.setY(startPoint.y() + lineOffset);
+            endPoint.setY(endPoint.y() + lineOffset);
         } else {
-            drawControl(context, tmpRect, inactive.get());
+            startPoint.setX(startPoint.x() + lineOffset);
+            endPoint.setX(endPoint.x() + lineOffset);
         }
+        if (isPressed(object) || isHovered(object))
+            info.context->setStrokeColor(dragRollLight, ColorSpaceDeviceRGB);
+        else
+            info.context->setStrokeColor(dragRegularLight, ColorSpaceDeviceRGB);
+        info.context->drawLine(startPoint, endPoint);
+        if (isVertical) {
+            startPoint.setY(startPoint.y() + shadowOffset);
+            endPoint.setY(endPoint.y() + shadowOffset);
+        } else {
+            startPoint.setX(startPoint.x() + shadowOffset);
+            endPoint.setX(endPoint.x() + shadowOffset);
+        }
+        if (isPressed(object) || isHovered(object))
+            info.context->setStrokeColor(dragRollDark, ColorSpaceDeviceRGB);
+        else
+            info.context->setStrokeColor(dragRegularDark, ColorSpaceDeviceRGB);
+        info.context->drawLine(startPoint, endPoint);
     }
-
-    context->restore();
+    info.context->restore();
     return false;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to