OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "views/controls/focusable_border.h" | 5 #include "views/controls/focusable_border.h" |
6 | 6 |
7 #include "ui/gfx/canvas.h" | 7 #include "ui/gfx/canvas.h" |
8 #include "ui/gfx/canvas_skia.h" | 8 #include "ui/gfx/canvas_skia.h" |
9 #include "ui/gfx/insets.h" | 9 #include "ui/gfx/insets.h" |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 }; | 53 }; |
54 SkPath path; | 54 SkPath path; |
55 path.addRoundRect(rect, corners); | 55 path.addRoundRect(rect, corners); |
56 SkPaint paint; | 56 SkPaint paint; |
57 paint.setStyle(SkPaint::kStroke_Style); | 57 paint.setStyle(SkPaint::kStroke_Style); |
58 paint.setFlags(SkPaint::kAntiAlias_Flag); | 58 paint.setFlags(SkPaint::kAntiAlias_Flag); |
59 // TODO(oshima): Copy what WebKit does for focused border. | 59 // TODO(oshima): Copy what WebKit does for focused border. |
60 paint.setColor(has_focus_ ? kFocusedBorderColor : kDefaultBorderColor); | 60 paint.setColor(has_focus_ ? kFocusedBorderColor : kDefaultBorderColor); |
61 paint.setStrokeWidth(SkIntToScalar(has_focus_ ? 2 : 1)); | 61 paint.setStrokeWidth(SkIntToScalar(has_focus_ ? 2 : 1)); |
62 | 62 |
63 canvas->AsCanvasSkia()->drawPath(path, paint); | 63 canvas->GetSkCanvas()->drawPath(path, paint); |
64 } | 64 } |
65 | 65 |
66 void FocusableBorder::GetInsets(gfx::Insets* insets) const { | 66 void FocusableBorder::GetInsets(gfx::Insets* insets) const { |
67 *insets = insets_; | 67 *insets = insets_; |
68 } | 68 } |
69 | 69 |
70 void FocusableBorder::SetInsets(int top, int left, int bottom, int right) { | 70 void FocusableBorder::SetInsets(int top, int left, int bottom, int right) { |
71 insets_.Set(top, left, bottom, right); | 71 insets_.Set(top, left, bottom, right); |
72 } | 72 } |
73 | 73 |
74 } // namespace views | 74 } // namespace views |
OLD | NEW |