diff options
Diffstat (limited to 'WebKit/android/RenderSkinCombo.cpp')
| -rw-r--r-- | WebKit/android/RenderSkinCombo.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/WebKit/android/RenderSkinCombo.cpp b/WebKit/android/RenderSkinCombo.cpp index e15b3c3..6f88ee3 100644 --- a/WebKit/android/RenderSkinCombo.cpp +++ b/WebKit/android/RenderSkinCombo.cpp @@ -41,7 +41,9 @@ static bool s_decoded; // True if all assets were decoded static const int s_margin = 2; static const SkIRect s_mar = { s_margin, s_margin, RenderSkinCombo::extraWidth(), s_margin }; - +static SkIRect s_subset; + + RenderSkinCombo::RenderSkinCombo() { } @@ -54,6 +56,10 @@ void RenderSkinCombo::Init(android::AssetManager* am) // but is that necessary in the final version? s_decoded = RenderSkinAndroid::DecodeBitmap(am, "images/combobox-noHighlight.png", &s_bitmap[kNormal]); s_decoded = RenderSkinAndroid::DecodeBitmap(am, "images/combobox-disabled.png", &s_bitmap[kDisabled]) && s_decoded; + + int width = s_bitmap[kNormal].width(); + int height = s_bitmap[kNormal].height(); + s_subset.set(width - RenderSkinCombo::extraWidth() + s_margin, 0, width, height); } @@ -75,7 +81,19 @@ bool RenderSkinCombo::Draw(SkCanvas* canvas, Node* element, int x, int y, int wi canvas->drawRect(bounds, paint); bounds.set(SkIntToScalar(x), SkIntToScalar(y), SkIntToScalar(x + width), SkIntToScalar(y + height)); - SkNinePatch::DrawNine(canvas, bounds, s_bitmap[state], s_mar); + + if (style->borderLeftColor().isValid() || + style->borderRightColor().isValid() || + style->borderTopColor().isValid() || + style->borderBottomColor().isValid()) { + bounds.fLeft += SkIntToScalar(width - RenderSkinCombo::extraWidth()); + bounds.fRight -= SkIntToScalar(style->borderRightWidth()); + bounds.fTop += SkIntToScalar(style->borderTopWidth()); + bounds.fBottom -= SkIntToScalar(style->borderBottomWidth()); + canvas->drawBitmapRect(s_bitmap[state], &s_subset, bounds); + } else { + SkNinePatch::DrawNine(canvas, bounds, s_bitmap[state], s_mar); + } return false; } |
