Changeset 134227 in webkit
- Timestamp:
- Nov 12, 2012 7:20:11 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r134225 r134227 1 2012-11-12 Tiancheng Jiang <tijiang@rim.com> 2 3 [BlackBerry] Update BB10 form theme. 4 https://bugs.webkit.org/show_bug.cgi?id=100760 5 6 Reviewed by Rob Buis. 7 8 RIM PR 236993 9 Internally Reviewed by Jeff Rogers. 10 Enable GL slider. 11 12 * platform/blackberry/RenderThemeBlackBerry.cpp: 13 (WebCore::drawThreeSlice): 14 (WebCore): 15 (WebCore::RenderThemeBlackBerry::paintSliderTrackRect): 16 (WebCore::RenderThemeBlackBerry::paintSliderThumb): 17 1 18 2012-11-12 Kentaro Hara <haraken@chromium.org> 2 19 -
trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp
r133808 r134227 181 181 FloatRect srcRect(0, 0, img->width(), img->height()); 182 182 gc->drawImage(img, ColorSpaceDeviceRGB, rect, srcRect); 183 } 184 185 static void drawThreeSlice(GraphicsContext* gc, const IntRect& rect, Image* img, int slice) 186 { 187 if (!img) 188 return; 189 FloatSize dstSlice(rect.height() / 2, rect.height()); 190 FloatRect srcRect(0, 0, slice, img->height()); 191 FloatRect dstRect(rect.location(), dstSlice); 192 193 gc->drawImage(img, ColorSpaceDeviceRGB, dstRect, srcRect); 194 srcRect.move(img->width() - srcRect.width(), 0); 195 dstRect.move(rect.width() - dstRect.width(), 0); 196 gc->drawImage(img, ColorSpaceDeviceRGB, dstRect, srcRect); 197 198 srcRect = FloatRect(slice, 0, img->width() - 2 * slice, img->height()); 199 dstRect = FloatRect(rect.x() + dstSlice.width(), rect.y(), rect.width() - 2 * dstSlice.width(), dstSlice.height()); 200 gc->drawImage(img, ColorSpaceDeviceRGB, dstRect, srcRect); 183 201 } 184 202 … … 712 730 RGBA32 strokeColorStart, RGBA32 strokeColorEnd, RGBA32 fillColorStart, RGBA32 fillColorEnd) 713 731 { 714 FloatSize smallCorner(smallRadius, smallRadius); 715 732 ASSERT(info.context); 716 733 info.context->save(); 717 info.context->setStrokeStyle(SolidStroke); 718 info.context->setStrokeThickness(lineWidth); 719 720 info.context->setStrokeGradient(createLinearGradient(strokeColorStart, strokeColorEnd, rect.maxXMinYCorner(), rect. maxXMaxYCorner())); 721 info.context->setFillGradient(createLinearGradient(fillColorStart, fillColorEnd, rect.maxXMinYCorner(), rect.maxXMaxYCorner())); 722 723 Path path; 724 path.addRoundedRect(rect, smallCorner); 725 info.context->fillPath(path); 726 727 info.context->restore(); 734 GraphicsContext* context = info.context; 735 736 static RefPtr<Image> disabled, inactive; 737 if (!disabled) { 738 disabled = loadImage("core_slider_fill_disabled"); 739 inactive = loadImage("core_slider_bg"); 740 } 741 742 if (isEnabled(object)) 743 drawThreeSlice(context, rect, inactive.get(), mediumSlice); 744 else 745 drawThreeSlice(context, rect, disabled.get(), (smallSlice - 1)); 746 747 context->restore(); 728 748 return false; 729 749 } … … 731 751 bool RenderThemeBlackBerry::paintSliderThumb(RenderObject* object, const PaintInfo& info, const IntRect& rect) 732 752 { 733 FloatSize largeCorner(largeRadius, largeRadius);753 ASSERT(info.context); 734 754 info.context->save(); 735 info.context->setStrokeStyle(SolidStroke); 736 info.context->setStrokeThickness(lineWidth); 737 if (isPressed(object) || isHovered(object)) { 738 info.context->setStrokeGradient(createLinearGradient(hoverTopOutline, hoverBottomOutline, rect.maxXMinYCorner(), rect. maxXMaxYCorner())); 739 info.context->setFillGradient(createLinearGradient(hoverTop, hoverBottom, rect.maxXMinYCorner(), rect.maxXMaxYCorner())); 755 GraphicsContext* context = info.context; 756 757 static RefPtr<Image> disabled, inactive, pressed, aura; 758 if (!disabled) { 759 disabled = loadImage("core_slider_handle_disabled"); 760 inactive = loadImage("core_slider_handle"); 761 pressed = loadImage("core_slider_handle_pressed"); 762 aura = loadImage("core_slider_aura"); 763 } 764 765 FloatRect tmpRect(rect); 766 float length = std::max(tmpRect.width(), tmpRect.height()); 767 if (tmpRect.width() > tmpRect.height()) { 768 tmpRect.setY(tmpRect.y() - (length - tmpRect.height()) / 2); 769 tmpRect.setHeight(length); 740 770 } else { 741 info.context->setStrokeGradient(createLinearGradient(regularTopOutline, regularBottomOutline, rect.maxXMinYCorner(), rect. maxXMaxYCorner())); 742 info.context->setFillGradient(createLinearGradient(regularTop, regularBottom, rect.maxXMinYCorner(), rect.maxXMaxYCorner())); 743 } 744 Path path; 745 path.addRoundedRect(rect, largeCorner); 746 info.context->fillPath(path); 747 bool isVertical = rect.width() > rect.height(); 748 IntPoint startPoint(rect.x() + (isVertical ? 5 : 2), rect.y() + (isVertical ? 2 : 5)); 749 IntPoint endPoint(rect.x() + (isVertical ? 20 : 2), rect.y() + (isVertical ? 2 : 20)); 750 const int lineOffset = 2; 751 const int shadowOffset = 1; 752 for (int i = 0; i < 3; i++) { 753 if (isVertical) { 754 startPoint.setY(startPoint.y() + lineOffset); 755 endPoint.setY(endPoint.y() + lineOffset); 771 tmpRect.setX(tmpRect.x() - (length - tmpRect.width()) / 2); 772 tmpRect.setWidth(length); 773 } 774 775 float auraHeight = length * auraRatio; 776 float auraWidth = auraHeight; 777 float auraX = tmpRect.x() - (auraWidth - tmpRect.width()) / 2; 778 float auraY = tmpRect.y() - (auraHeight - tmpRect.height()) / 2; 779 FloatRect auraRect(auraX, auraY, auraWidth, auraHeight); 780 781 if (!isEnabled(object)) 782 drawControl(context, tmpRect, disabled.get()); 783 else { 784 if (isPressed(object) || isHovered(object) || isFocused(object)) { 785 drawControl(context, tmpRect, pressed.get()); 786 drawControl(context, auraRect, aura.get()); 756 787 } else { 757 startPoint.setX(startPoint.x() + lineOffset); 758 endPoint.setX(endPoint.x() + lineOffset); 788 drawControl(context, tmpRect, inactive.get()); 759 789 } 760 if (isPressed(object) || isHovered(object)) 761 info.context->setStrokeColor(dragRollLight, ColorSpaceDeviceRGB); 762 else 763 info.context->setStrokeColor(dragRegularLight, ColorSpaceDeviceRGB); 764 info.context->drawLine(startPoint, endPoint); 765 if (isVertical) { 766 startPoint.setY(startPoint.y() + shadowOffset); 767 endPoint.setY(endPoint.y() + shadowOffset); 768 } else { 769 startPoint.setX(startPoint.x() + shadowOffset); 770 endPoint.setX(endPoint.x() + shadowOffset); 771 } 772 if (isPressed(object) || isHovered(object)) 773 info.context->setStrokeColor(dragRollDark, ColorSpaceDeviceRGB); 774 else 775 info.context->setStrokeColor(dragRegularDark, ColorSpaceDeviceRGB); 776 info.context->drawLine(startPoint, endPoint); 777 } 778 info.context->restore(); 790 } 791 792 context->restore(); 779 793 return false; 780 794 }
Note: See TracChangeset
for help on using the changeset viewer.