diff options
author | John Reck <jreck@google.com> | 2012-02-15 18:04:25 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-02-15 18:04:25 -0800 |
commit | da43c48a8a46092ef12e8cbabdaecc30b677342c (patch) | |
tree | 7f738f22e6c506988f312da7ec6b2cf1d0b77e49 /Source/WebCore/platform/graphics/android | |
parent | 80ec17f6451f55bcadd789d4c4b4c6444171d10f (diff) | |
parent | ceeeab6161d7d8bf970ecf98affa4f4966df6f01 (diff) | |
download | external_webkit-da43c48a8a46092ef12e8cbabdaecc30b677342c.zip external_webkit-da43c48a8a46092ef12e8cbabdaecc30b677342c.tar.gz external_webkit-da43c48a8a46092ef12e8cbabdaecc30b677342c.tar.bz2 |
Merge "Initial support for keyboard navigation"
Diffstat (limited to 'Source/WebCore/platform/graphics/android')
-rw-r--r-- | Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp index 848b713..9cfed60 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp @@ -36,6 +36,7 @@ #include "SkBlurMaskFilter.h" #include "SkCanvas.h" #include "SkColorPriv.h" +#include "SkCornerPathEffect.h" #include "SkDashPathEffect.h" #include "SkDevice.h" #include "SkGradientShader.h" @@ -949,9 +950,33 @@ void GraphicsContext::clearPlatformShadow() /////////////////////////////////////////////////////////////////////////////// -void GraphicsContext::drawFocusRing(const Vector<IntRect>&, int, int, const Color&) +void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int /* width */, int /* offset */, const Color& color) { - // Do nothing, since we draw the focus ring independently. + if (paintingDisabled()) + return; + + unsigned rectCount = rects.size(); + if (!rectCount) + return; + + SkRegion focusRingRegion; + const SkScalar focusRingOutset = WebCoreFloatToSkScalar(0.8); + for (unsigned i = 0; i < rectCount; i++) { + SkIRect r = rects[i]; + r.inset(-focusRingOutset, -focusRingOutset); + focusRingRegion.op(r, SkRegion::kUnion_Op); + } + + SkPath path; + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + + paint.setColor(color.rgb()); + paint.setStrokeWidth(focusRingOutset * 2); + paint.setPathEffect(new SkCornerPathEffect(focusRingOutset * 2))->unref(); + focusRingRegion.getBoundaryPath(&path); + platformContext()->mCanvas->drawPath(path, paint); } void GraphicsContext::drawFocusRing(const Path&, int, int, const Color&) |