Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(904)

Unified Diff: ui/gfx/canvas.cc

Issue 78803002: Fixing focus highlight on high DPI devices for accessibility (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/canvas.h ('k') | ui/message_center/message_center.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/canvas.cc
diff --git a/ui/gfx/canvas.cc b/ui/gfx/canvas.cc
index 69f10cfff2311475eb232bc5b044d3e4fb321d80..b89efa9e2b7cede3e188c92cdc10f3bf58625eb4 100644
--- a/ui/gfx/canvas.cc
+++ b/ui/gfx/canvas.cc
@@ -332,6 +332,22 @@ void Canvas::DrawFocusRect(const Rect& rect) {
DrawDashedRect(rect, SK_ColorGRAY);
}
+void Canvas::DrawSolidFocusRect(const Rect& rect, SkColor color) {
+ SkPaint paint;
+ paint.setColor(color);
+ paint.setStrokeWidth(SkIntToScalar(1));
+ // Note: We cannot use DrawRect since it would create a path and fill it which
+ // would cause problems near the edge of the canvas.
+ int x1 = std::min(rect.x(), rect.right());
+ int x2 = std::max(rect.x(), rect.right());
+ int y1 = std::min(rect.y(), rect.bottom());
+ int y2 = std::max(rect.y(), rect.bottom());
+ DrawLine(Point(x1, y1), Point(x2, y1), paint);
+ DrawLine(Point(x1, y2), Point(x2, y2), paint);
+ DrawLine(Point(x1, y1), Point(x1, y2), paint);
+ DrawLine(Point(x2, y1), Point(x2, y2 + 1), paint);
+}
+
void Canvas::DrawImageInt(const ImageSkia& image, int x, int y) {
SkPaint paint;
DrawImageInt(image, x, y, paint);
« no previous file with comments | « ui/gfx/canvas.h ('k') | ui/message_center/message_center.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698