diff options
author | John Reck <jreck@google.com> | 2012-02-06 09:00:44 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2012-02-15 16:57:38 -0800 |
commit | ceeeab6161d7d8bf970ecf98affa4f4966df6f01 (patch) | |
tree | 0666a9ebf25e9d4e09ef3f8ee8ed0f6cf33fd4f1 /Source/WebCore/platform/graphics/android | |
parent | 628a06bda2490e4c405ce3263381412423f4c735 (diff) | |
download | external_webkit-ceeeab6161d7d8bf970ecf98affa4f4966df6f01.zip external_webkit-ceeeab6161d7d8bf970ecf98affa4f4966df6f01.tar.gz external_webkit-ceeeab6161d7d8bf970ecf98affa4f4966df6f01.tar.bz2 |
Initial support for keyboard navigation
Bug: 6019693
Change-Id: I7b4f6d83e8913e647e8ac7340afd01d609c4343b
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&) |