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

Unified Diff: chrome/browser/chromeos/ui/focus_ring_layer.cc

Issue 2789583004: Add a color argument to accessibilityPrivate.setFocusRing (Closed)
Patch Set: Created 3 years, 9 months 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
Index: chrome/browser/chromeos/ui/focus_ring_layer.cc
diff --git a/chrome/browser/chromeos/ui/focus_ring_layer.cc b/chrome/browser/chromeos/ui/focus_ring_layer.cc
index f988578bc2182556391068b0a2aa3df748e5b287..73aadb2a11a001e61bcf652ba27c564f4c2f76cd 100644
--- a/chrome/browser/chromeos/ui/focus_ring_layer.cc
+++ b/chrome/browser/chromeos/ui/focus_ring_layer.cc
@@ -29,7 +29,9 @@ const SkColor kShadowColor = SkColorSetRGB(77, 144, 254);
FocusRingLayerDelegate::~FocusRingLayerDelegate() {}
FocusRingLayer::FocusRingLayer(FocusRingLayerDelegate* delegate)
- : delegate_(delegate), root_window_(nullptr), compositor_(nullptr) {}
+ : delegate_(delegate), root_window_(nullptr),
+ has_custom_color_(false), custom_color_(SK_ColorBLACK),
+ compositor_(nullptr) {}
xiyuan 2017/03/30 21:27:38 nit: move initialization to header since you are h
dmazzoni 2017/03/30 21:34:52 Done.
FocusRingLayer::~FocusRingLayer() {
if (compositor_ && compositor_->HasAnimationObserver(this))
@@ -52,6 +54,15 @@ void FocusRingLayer::SetOpacity(float opacity) {
layer()->SetOpacity(opacity);
}
+void FocusRingLayer::SetColor(SkColor color) {
+ has_custom_color_ = true;
+ custom_color_ = color;
+}
+
+void FocusRingLayer::ResetColor() {
+ has_custom_color_ = false;
+}
+
void FocusRingLayer::CreateOrUpdateLayer(aura::Window* root_window,
const char* layer_name,
const gfx::Rect& bounds) {
@@ -92,7 +103,7 @@ void FocusRingLayer::OnPaintLayer(const ui::PaintContext& context) {
cc::PaintFlags flags;
flags.setAntiAlias(true);
- flags.setColor(kShadowColor);
+ flags.setColor(has_custom_color_ ? custom_color_ : kShadowColor);
flags.setStyle(cc::PaintFlags::kStroke_Style);
flags.setStrokeWidth(2);

Powered by Google App Engine
This is Rietveld 408576698