Changeset 147958 in webkit


Ignore:
Timestamp:
Apr 8, 2013 3:46:12 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Tiancheng Jiang <tijiang@rim.com> 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):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r147956 r147958  
     12013-04-08  Tiancheng Jiang  <tijiang@rim.com>
     2
     3        [BlackBerry] Clean up render theme code.
     4        https://bugs.webkit.org/show_bug.cgi?id=114216
     5
     6        Reviewed by Rob Buis.
     7
     8        BlackBerry PR 323062
     9
     10        Clean up redundant code.
     11
     12        * platform/blackberry/RenderThemeBlackBerry.cpp:
     13        (WebCore):
     14        (WebCore::RenderThemeBlackBerry::paintSliderTrack):
     15        * platform/blackberry/RenderThemeBlackBerry.h:
     16        (RenderThemeBlackBerry):
     17
    1182013-04-08  Arunprasad Rajkumar  <arunprasadr@nds.com>
    219
  • trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp

    r147578 r147958  
    4343
    4444// Sizes (unit px)
    45 const unsigned smallRadius = 1;
    46 const unsigned largeRadius = 3;
    47 const unsigned lineWidth = 1;
    48 const float marginSize = 4;
    4945const float mediaControlsHeight = 44;
    5046const float mediaBackButtonHeight = 33;
     
    6056const float sliderThumbHeight = 25;
    6157
    62 // Checkbox check scalers
    63 const float checkboxLeftX = 7 / 40.0;
    64 const float checkboxLeftY = 1 / 2.0;
    65 const float checkboxMiddleX = 19 / 50.0;
    66 const float checkboxMiddleY = 7 / 25.0;
    67 const float checkboxRightX = 33 / 40.0;
    68 const float checkboxRightY = 1 / 5.0;
    69 const float checkboxStrokeThickness = 6.5;
    70 
    71 // Radio button scaler
    72 const float radioButtonCheckStateScaler = 7 / 30.0;
    73 
    7458// Multipliers
    7559const unsigned paddingDivisor = 10;
     
    9276
    9377// Colors
    94 const RGBA32 caretBottom = 0xff2163bf;
    95 const RGBA32 caretTop = 0xff69a5fa;
    96 
    97 const RGBA32 regularBottom = 0xffdcdee4;
    98 const RGBA32 regularTop = 0xfff7f2ee;
    99 const RGBA32 hoverBottom = 0xffb5d3fc;
    100 const RGBA32 hoverTop = 0xffcceaff;
    101 const RGBA32 depressedBottom = 0xff3388ff;
    102 const RGBA32 depressedTop = 0xff66a0f2;
    103 const RGBA32 disabledBottom = 0xffe7e7e7;
    104 const RGBA32 disabledTop = 0xffefefef;
    105 
    106 const RGBA32 regularBottomOutline = 0xff6e7073;
    107 const RGBA32 regularTopOutline = 0xffb9b8b8;
    108 const RGBA32 hoverBottomOutline = 0xff2163bf;
    109 const RGBA32 hoverTopOutline = 0xff69befa;
    110 const RGBA32 depressedBottomOutline = 0xff0c3d81;
    111 const RGBA32 depressedTopOutline = 0xff1d4d70;
    112 const RGBA32 disabledOutline = 0xffd5d9de;
    113 
    114 const RGBA32 progressRegularBottom = caretTop;
    115 const RGBA32 progressRegularTop = caretBottom;
    116 
    117 const RGBA32 rangeSliderRegularBottom = 0xfff6f2ee;
    118 const RGBA32 rangeSliderRegularTop = 0xffdee0e5;
    119 const RGBA32 rangeSliderRollBottom = 0xffc9e8fe;
    120 const RGBA32 rangeSliderRollTop = 0xffb5d3fc;
    121 
    122 const RGBA32 rangeSliderRegularBottomOutline = 0xffb9babd;
    123 const RGBA32 rangeSliderRegularTopOutline = 0xffb7b7b7;
    124 const RGBA32 rangeSliderRollBottomOutline = 0xff67abe0;
    125 const RGBA32 rangeSliderRollTopOutline = 0xff69adf9;
    126 
    127 const RGBA32 dragRegularLight = 0xfffdfdfd;
    128 const RGBA32 dragRegularDark = 0xffbababa;
    129 const RGBA32 dragRollLight = 0xfff2f2f2;
    130 const RGBA32 dragRollDark = 0xff69a8ff;
    131 
    132 const RGBA32 blackPen = Color::black;
    13378const RGBA32 focusRingPen = 0xffa3c8fe;
    134 
    135 const RGBA32 mediaSliderTrackOutline = 0xff848587;
    136 const RGBA32 mediaSliderTrackPlayed = 0xff2b8fff;
    137 const RGBA32 mediaSliderTrackBuffered = 0xffbbbdbf;
    138 
    139 const RGBA32 selection = 0xff2b8fff;
    14079
    14180float RenderThemeBlackBerry::defaultFontSize = 16;
     
    14584    DEFINE_STATIC_LOCAL(String, fontFace, (ASCIILiteral("Slate Pro")));
    14685    return fontFace;
    147 }
    148 
    149 static PassRefPtr<Gradient> createLinearGradient(RGBA32 top, RGBA32 bottom, const IntPoint& a, const IntPoint& b)
    150 {
    151     RefPtr<Gradient> gradient = Gradient::create(a, b);
    152     gradient->addColorStop(0.0, Color(top));
    153     gradient->addColorStop(1.0, Color(bottom));
    154     return gradient.release();
    15586}
    15687
     
    732663        rect2.setY(rect.y());
    733664    }
    734     return paintSliderTrackRect(object, info, rect2);
    735 }
    736 
    737 bool RenderThemeBlackBerry::paintSliderTrackRect(RenderObject* object, const PaintInfo& info, const IntRect& rect)
    738 {
    739     return paintSliderTrackRect(object, info, rect, rangeSliderRegularTopOutline, rangeSliderRegularBottomOutline, rangeSliderRegularTop, rangeSliderRegularBottom);
    740 }
    741 
    742 bool RenderThemeBlackBerry::paintSliderTrackRect(RenderObject* object, const PaintInfo& info, const IntRect& rect, RGBA32 strokeColorStart, RGBA32 strokeColorEnd, RGBA32 fillColorStart, RGBA32 fillColorEnd)
    743 {
    744     FloatSize smallCorner(mediaSliderTrackRadius, mediaSliderTrackRadius);
    745 
    746     info.context->save();
    747     info.context->setStrokeStyle(SolidStroke);
    748     info.context->setStrokeThickness(lineWidth);
    749 
    750 #if USE(SKIA)
    751     info.context->setStrokeGradient(createLinearGradient(strokeColorStart, strokeColorEnd, rect.maxXMinYCorner(), rect.maxXMaxYCorner()));
    752     info.context->setFillGradient(createLinearGradient(fillColorStart, fillColorEnd, rect.maxXMinYCorner(), rect.maxXMaxYCorner()));
    753 #else
    754     info.context->setStrokeColor(strokeColorStart, ColorSpaceDeviceRGB);
    755     info.context->setFillColor(fillColorStart, ColorSpaceDeviceRGB);
    756 #endif
    757 
    758     Path path;
    759     path.addRoundedRect(rect, smallCorner);
    760     info.context->fillPath(path);
    761 
    762     info.context->restore();
    763     return false;
     665    static Image* sliderTrack = Image::loadPlatformResource("core_slider_bg").leakRef();
     666    return paintSliderTrackRect(object, info, rect2, sliderTrack);
    764667}
    765668
     
    12361139}
    12371140
    1238 bool RenderThemeBlackBerry::paintProgressBar(RenderObject* object, const PaintInfo& info, const IntRect& rect)
    1239 {
    1240     if (!object->isProgress())
    1241         return true;
    1242 
    1243     RenderProgress* renderProgress = toRenderProgress(object);
    1244 
    1245     FloatSize smallCorner(smallRadius, smallRadius);
    1246 
    1247     info.context->save();
    1248     info.context->setStrokeStyle(SolidStroke);
    1249     info.context->setStrokeThickness(lineWidth);
    1250 
    1251     info.context->setStrokeGradient(createLinearGradient(rangeSliderRegularTopOutline, rangeSliderRegularBottomOutline, rect.maxXMinYCorner(), rect.maxXMaxYCorner()));
    1252     info.context->setFillGradient(createLinearGradient(rangeSliderRegularTop, rangeSliderRegularBottom, rect.maxXMinYCorner(), rect.maxXMaxYCorner()));
    1253 
    1254     Path path;
    1255     path.addRoundedRect(rect, smallCorner);
    1256     info.context->fillPath(path);
    1257 
    1258     IntRect rect2 = rect;
    1259     rect2.setX(rect2.x() + 1);
    1260     rect2.setHeight(rect2.height() - 2);
    1261     rect2.setY(rect2.y() + 1);
    1262     info.context->setStrokeStyle(NoStroke);
    1263     info.context->setStrokeThickness(0);
    1264     if (renderProgress->isDeterminate()) {
    1265         rect2.setWidth(rect2.width() * renderProgress->position() - 2);
    1266         info.context->setFillGradient(createLinearGradient(progressRegularTop, progressRegularBottom, rect2.maxXMinYCorner(), rect2.maxXMaxYCorner()));
    1267     } else {
    1268         // Animating
    1269         rect2.setWidth(rect2.width() - 2);
    1270         RefPtr<Gradient> gradient = Gradient::create(rect2.minXMaxYCorner(), rect2.maxXMaxYCorner());
    1271         gradient->addColorStop(0.0, Color(progressRegularBottom));
    1272         gradient->addColorStop(renderProgress->animationProgress(), Color(progressRegularTop));
    1273         gradient->addColorStop(1.0, Color(progressRegularBottom));
    1274         info.context->setFillGradient(gradient);
    1275     }
    1276     Path path2;
    1277     path2.addRoundedRect(rect2, smallCorner);
    1278     info.context->fillPath(path2);
    1279 
    1280     info.context->restore();
    1281     return false;
    1282 }
    1283 
    12841141Color RenderThemeBlackBerry::platformActiveTextSearchHighlightColor() const
    12851142{
  • trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.h

    r144063 r147958  
    8787    virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&);
    8888    virtual bool paintMediaRewindButton(RenderObject*, const PaintInfo&, const IntRect&);
    89     virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&);
    9089    virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const;
    9190    virtual double animationDurationForProgressBar(RenderProgress*) const;
     
    112111    bool paintTextFieldOrTextAreaOrSearchField(RenderObject*, const PaintInfo&, const IntRect&);
    113112
    114     bool paintSliderTrackRect(RenderObject*, const PaintInfo&, const IntRect&);
    115 
    116     bool paintSliderTrackRect(RenderObject*, const PaintInfo&, const IntRect&, RGBA32, RGBA32, RGBA32, RGBA32);
    117 
    118113    bool paintSliderTrackRect(RenderObject*, const PaintInfo&, const IntRect&, Image*);
    119114
Note: See TracChangeset for help on using the changeset viewer.