Skip to content
Permalink
Browse files
[BlackBerry] Update BB10 form theme.
https://bugs.webkit.org/show_bug.cgi?id=100760

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

Canonical link: https://commits.webkit.org/119449@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@133632 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Tiancheng Jiang authored and webkit-commit-queue committed Nov 6, 2012
1 parent 3684e6b commit a63f0f09b674c00f9a67062c79f8a35414f819c0
Showing 2 changed files with 67 additions and 64 deletions.
@@ -1,3 +1,20 @@
2012-11-06 Tiancheng Jiang <tijiang@rim.com>

[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 <msaboff@apple.com>

canonicalizedTitle() shouldn't convert 8 bit title strings to 16 bit
@@ -176,24 +176,6 @@ static void drawControl(GraphicsContext* gc, const FloatRect& rect, Image* img)
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 Pai
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;
}

0 comments on commit a63f0f0

Please sign in to comment.