Title: [147958] trunk/Source/WebCore
Revision
147958
Author
[email protected]
Date
2013-04-08 15:46:12 -0700 (Mon, 08 Apr 2013)

Log Message

[BlackBerry] Clean up render theme code.
https://bugs.webkit.org/show_bug.cgi?id=114216

Patch by Tiancheng Jiang <[email protected]> on 2013-04-08
Reviewed by Rob Buis.

BlackBerry PR 323062

Clean up redundant code.

* platform/blackberry/RenderThemeBlackBerry.cpp:
(WebCore):
(WebCore::RenderThemeBlackBerry::paintSliderTrack):
* platform/blackberry/RenderThemeBlackBerry.h:
(RenderThemeBlackBerry):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (147957 => 147958)


--- trunk/Source/WebCore/ChangeLog	2013-04-08 22:19:50 UTC (rev 147957)
+++ trunk/Source/WebCore/ChangeLog	2013-04-08 22:46:12 UTC (rev 147958)
@@ -1,3 +1,20 @@
+2013-04-08  Tiancheng Jiang  <[email protected]>
+
+        [BlackBerry] Clean up render theme code. 
+        https://bugs.webkit.org/show_bug.cgi?id=114216
+
+        Reviewed by Rob Buis.
+
+        BlackBerry PR 323062
+
+        Clean up redundant code.
+
+        * platform/blackberry/RenderThemeBlackBerry.cpp:
+        (WebCore):
+        (WebCore::RenderThemeBlackBerry::paintSliderTrack):
+        * platform/blackberry/RenderThemeBlackBerry.h:
+        (RenderThemeBlackBerry):
+
 2013-04-08  Arunprasad Rajkumar  <[email protected]>
 
         Call Netscape Plugin's toString() and valueOf() instead of providing default implementation

Modified: trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp (147957 => 147958)


--- trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp	2013-04-08 22:19:50 UTC (rev 147957)
+++ trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp	2013-04-08 22:46:12 UTC (rev 147958)
@@ -42,10 +42,6 @@
 namespace WebCore {
 
 // Sizes (unit px)
-const unsigned smallRadius = 1;
-const unsigned largeRadius = 3;
-const unsigned lineWidth = 1;
-const float marginSize = 4;
 const float mediaControlsHeight = 44;
 const float mediaBackButtonHeight = 33;
 // Scale exit-fullscreen button size.
@@ -59,18 +55,6 @@
 const float sliderThumbWidth = 15;
 const float sliderThumbHeight = 25;
 
-// Checkbox check scalers
-const float checkboxLeftX = 7 / 40.0;
-const float checkboxLeftY = 1 / 2.0;
-const float checkboxMiddleX = 19 / 50.0;
-const float checkboxMiddleY = 7 / 25.0;
-const float checkboxRightX = 33 / 40.0;
-const float checkboxRightY = 1 / 5.0;
-const float checkboxStrokeThickness = 6.5;
-
-// Radio button scaler
-const float radioButtonCheckStateScaler = 7 / 30.0;
-
 // Multipliers
 const unsigned paddingDivisor = 10;
 const unsigned fullScreenEnlargementFactor = 2;
@@ -91,53 +75,8 @@
 const float heightRatio = 0.23;
 
 // Colors
-const RGBA32 caretBottom = 0xff2163bf;
-const RGBA32 caretTop = 0xff69a5fa;
-
-const RGBA32 regularBottom = 0xffdcdee4;
-const RGBA32 regularTop = 0xfff7f2ee;
-const RGBA32 hoverBottom = 0xffb5d3fc;
-const RGBA32 hoverTop = 0xffcceaff;
-const RGBA32 depressedBottom = 0xff3388ff;
-const RGBA32 depressedTop = 0xff66a0f2;
-const RGBA32 disabledBottom = 0xffe7e7e7;
-const RGBA32 disabledTop = 0xffefefef;
-
-const RGBA32 regularBottomOutline = 0xff6e7073;
-const RGBA32 regularTopOutline = 0xffb9b8b8;
-const RGBA32 hoverBottomOutline = 0xff2163bf;
-const RGBA32 hoverTopOutline = 0xff69befa;
-const RGBA32 depressedBottomOutline = 0xff0c3d81;
-const RGBA32 depressedTopOutline = 0xff1d4d70;
-const RGBA32 disabledOutline = 0xffd5d9de;
-
-const RGBA32 progressRegularBottom = caretTop;
-const RGBA32 progressRegularTop = caretBottom;
-
-const RGBA32 rangeSliderRegularBottom = 0xfff6f2ee;
-const RGBA32 rangeSliderRegularTop = 0xffdee0e5;
-const RGBA32 rangeSliderRollBottom = 0xffc9e8fe;
-const RGBA32 rangeSliderRollTop = 0xffb5d3fc;
-
-const RGBA32 rangeSliderRegularBottomOutline = 0xffb9babd;
-const RGBA32 rangeSliderRegularTopOutline = 0xffb7b7b7;
-const RGBA32 rangeSliderRollBottomOutline = 0xff67abe0;
-const RGBA32 rangeSliderRollTopOutline = 0xff69adf9;
-
-const RGBA32 dragRegularLight = 0xfffdfdfd;
-const RGBA32 dragRegularDark = 0xffbababa;
-const RGBA32 dragRollLight = 0xfff2f2f2;
-const RGBA32 dragRollDark = 0xff69a8ff;
-
-const RGBA32 blackPen = Color::black;
 const RGBA32 focusRingPen = 0xffa3c8fe;
 
-const RGBA32 mediaSliderTrackOutline = 0xff848587;
-const RGBA32 mediaSliderTrackPlayed = 0xff2b8fff;
-const RGBA32 mediaSliderTrackBuffered = 0xffbbbdbf;
-
-const RGBA32 selection = 0xff2b8fff;
-
 float RenderThemeBlackBerry::defaultFontSize = 16;
 
 const String& RenderThemeBlackBerry::defaultGUIFont()
@@ -146,14 +85,6 @@
     return fontFace;
 }
 
-static PassRefPtr<Gradient> createLinearGradient(RGBA32 top, RGBA32 bottom, const IntPoint& a, const IntPoint& b)
-{
-    RefPtr<Gradient> gradient = Gradient::create(a, b);
-    gradient->addColorStop(0.0, Color(top));
-    gradient->addColorStop(1.0, Color(bottom));
-    return gradient.release();
-}
-
 static RenderSlider* determineRenderSlider(RenderObject* object)
 {
     ASSERT(object->isSliderThumb());
@@ -731,38 +662,10 @@
         rect2.setX(rect.x() + (rect.width() - SliderTrackHeight) / 2);
         rect2.setY(rect.y());
     }
-    return paintSliderTrackRect(object, info, rect2);
+    static Image* sliderTrack = Image::loadPlatformResource("core_slider_bg").leakRef();
+    return paintSliderTrackRect(object, info, rect2, sliderTrack);
 }
 
-bool RenderThemeBlackBerry::paintSliderTrackRect(RenderObject* object, const PaintInfo& info, const IntRect& rect)
-{
-    return paintSliderTrackRect(object, info, rect, rangeSliderRegularTopOutline, rangeSliderRegularBottomOutline, rangeSliderRegularTop, rangeSliderRegularBottom);
-}
-
-bool RenderThemeBlackBerry::paintSliderTrackRect(RenderObject* object, const PaintInfo& info, const IntRect& rect, RGBA32 strokeColorStart, RGBA32 strokeColorEnd, RGBA32 fillColorStart, RGBA32 fillColorEnd)
-{
-    FloatSize smallCorner(mediaSliderTrackRadius, mediaSliderTrackRadius);
-
-    info.context->save();
-    info.context->setStrokeStyle(SolidStroke);
-    info.context->setStrokeThickness(lineWidth);
-
-#if USE(SKIA)
-    info.context->setStrokeGradient(createLinearGradient(strokeColorStart, strokeColorEnd, rect.maxXMinYCorner(), rect.maxXMaxYCorner()));
-    info.context->setFillGradient(createLinearGradient(fillColorStart, fillColorEnd, rect.maxXMinYCorner(), rect.maxXMaxYCorner()));
-#else
-    info.context->setStrokeColor(strokeColorStart, ColorSpaceDeviceRGB);
-    info.context->setFillColor(fillColorStart, ColorSpaceDeviceRGB);
-#endif
-
-    Path path;
-    path.addRoundedRect(rect, smallCorner);
-    info.context->fillPath(path);
-
-    info.context->restore();
-    return false;
-}
-
 bool RenderThemeBlackBerry::paintSliderTrackRect(RenderObject* object, const PaintInfo& info, const IntRect& rect, Image* inactive)
 {
     ASSERT(info.context);
@@ -1235,52 +1138,6 @@
     return renderProgress->isDeterminate() ? 0.0 : 2.0;
 }
 
-bool RenderThemeBlackBerry::paintProgressBar(RenderObject* object, const PaintInfo& info, const IntRect& rect)
-{
-    if (!object->isProgress())
-        return true;
-
-    RenderProgress* renderProgress = toRenderProgress(object);
-
-    FloatSize smallCorner(smallRadius, smallRadius);
-
-    info.context->save();
-    info.context->setStrokeStyle(SolidStroke);
-    info.context->setStrokeThickness(lineWidth);
-
-    info.context->setStrokeGradient(createLinearGradient(rangeSliderRegularTopOutline, rangeSliderRegularBottomOutline, rect.maxXMinYCorner(), rect.maxXMaxYCorner()));
-    info.context->setFillGradient(createLinearGradient(rangeSliderRegularTop, rangeSliderRegularBottom, rect.maxXMinYCorner(), rect.maxXMaxYCorner()));
-
-    Path path;
-    path.addRoundedRect(rect, smallCorner);
-    info.context->fillPath(path);
-
-    IntRect rect2 = rect;
-    rect2.setX(rect2.x() + 1);
-    rect2.setHeight(rect2.height() - 2);
-    rect2.setY(rect2.y() + 1);
-    info.context->setStrokeStyle(NoStroke);
-    info.context->setStrokeThickness(0);
-    if (renderProgress->isDeterminate()) {
-        rect2.setWidth(rect2.width() * renderProgress->position() - 2);
-        info.context->setFillGradient(createLinearGradient(progressRegularTop, progressRegularBottom, rect2.maxXMinYCorner(), rect2.maxXMaxYCorner()));
-    } else {
-        // Animating
-        rect2.setWidth(rect2.width() - 2);
-        RefPtr<Gradient> gradient = Gradient::create(rect2.minXMaxYCorner(), rect2.maxXMaxYCorner());
-        gradient->addColorStop(0.0, Color(progressRegularBottom));
-        gradient->addColorStop(renderProgress->animationProgress(), Color(progressRegularTop));
-        gradient->addColorStop(1.0, Color(progressRegularBottom));
-        info.context->setFillGradient(gradient);
-    }
-    Path path2;
-    path2.addRoundedRect(rect2, smallCorner);
-    info.context->fillPath(path2);
-
-    info.context->restore();
-    return false;
-}
-
 Color RenderThemeBlackBerry::platformActiveTextSearchHighlightColor() const
 {
     return Color(255, 150, 50); // Orange.

Modified: trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.h (147957 => 147958)


--- trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.h	2013-04-08 22:19:50 UTC (rev 147957)
+++ trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.h	2013-04-08 22:46:12 UTC (rev 147958)
@@ -86,7 +86,6 @@
     virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&);
     virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&);
     virtual bool paintMediaRewindButton(RenderObject*, const PaintInfo&, const IntRect&);
-    virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&);
     virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const;
     virtual double animationDurationForProgressBar(RenderProgress*) const;
 
@@ -111,10 +110,6 @@
 
     bool paintTextFieldOrTextAreaOrSearchField(RenderObject*, const PaintInfo&, const IntRect&);
 
-    bool paintSliderTrackRect(RenderObject*, const PaintInfo&, const IntRect&);
-
-    bool paintSliderTrackRect(RenderObject*, const PaintInfo&, const IntRect&, RGBA32, RGBA32, RGBA32, RGBA32);
-
     bool paintSliderTrackRect(RenderObject*, const PaintInfo&, const IntRect&, Image*);
 
     IntRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to