Changeset 147958 in webkit
- Timestamp:
- Apr 8, 2013 3:46:12 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r147956 r147958 1 2013-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 1 18 2013-04-08 Arunprasad Rajkumar <arunprasadr@nds.com> 2 19 -
trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp
r147578 r147958 43 43 44 44 // Sizes (unit px) 45 const unsigned smallRadius = 1;46 const unsigned largeRadius = 3;47 const unsigned lineWidth = 1;48 const float marginSize = 4;49 45 const float mediaControlsHeight = 44; 50 46 const float mediaBackButtonHeight = 33; … … 60 56 const float sliderThumbHeight = 25; 61 57 62 // Checkbox check scalers63 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 scaler72 const float radioButtonCheckStateScaler = 7 / 30.0;73 74 58 // Multipliers 75 59 const unsigned paddingDivisor = 10; … … 92 76 93 77 // 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;133 78 const 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;140 79 141 80 float RenderThemeBlackBerry::defaultFontSize = 16; … … 145 84 DEFINE_STATIC_LOCAL(String, fontFace, (ASCIILiteral("Slate Pro"))); 146 85 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();155 86 } 156 87 … … 732 663 rect2.setY(rect.y()); 733 664 } 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); 764 667 } 765 668 … … 1236 1139 } 1237 1140 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 // Animating1269 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 1284 1141 Color RenderThemeBlackBerry::platformActiveTextSearchHighlightColor() const 1285 1142 { -
trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.h
r144063 r147958 87 87 virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&); 88 88 virtual bool paintMediaRewindButton(RenderObject*, const PaintInfo&, const IntRect&); 89 virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&);90 89 virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; 91 90 virtual double animationDurationForProgressBar(RenderProgress*) const; … … 112 111 bool paintTextFieldOrTextAreaOrSearchField(RenderObject*, const PaintInfo&, const IntRect&); 113 112 114 bool paintSliderTrackRect(RenderObject*, const PaintInfo&, const IntRect&);115 116 bool paintSliderTrackRect(RenderObject*, const PaintInfo&, const IntRect&, RGBA32, RGBA32, RGBA32, RGBA32);117 118 113 bool paintSliderTrackRect(RenderObject*, const PaintInfo&, const IntRect&, Image*); 119 114
Note: See TracChangeset
for help on using the changeset viewer.