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

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

Issue 557393003: Introduce AccessibilityFocusRing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@accessibility_private_histograms
Patch Set: Address last feedback Created 6 years, 3 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 43ba8364bb2d9c459ca49ec743400f474b6b7ae0..812055e056333816d3f5eb5da6444ae12d15e6e5 100644
--- a/chrome/browser/chromeos/ui/focus_ring_layer.cc
+++ b/chrome/browser/chromeos/ui/focus_ring_layer.cc
@@ -30,11 +30,22 @@ FocusRingLayer::~FocusRingLayer() {}
void FocusRingLayer::Set(aura::Window* root_window, const gfx::Rect& bounds) {
focus_ring_ = bounds;
+ CreateOrUpdateLayer(root_window, "FocusRing");
+
+ // Update the layer bounds.
+ gfx::Rect layer_bounds = bounds;
+ int inset = -(kShadowRadius + 2);
+ layer_bounds.Inset(inset, inset, inset, inset);
+ layer_->SetBounds(layer_bounds);
+}
+
+void FocusRingLayer::CreateOrUpdateLayer(
+ aura::Window* root_window, const char* layer_name) {
if (!layer_ || root_window != root_window_) {
root_window_ = root_window;
ui::Layer* root_layer = root_window->layer();
layer_.reset(new ui::Layer(ui::LAYER_TEXTURED));
- layer_->set_name("FocusRing");
+ layer_->set_name(layer_name);
layer_->set_delegate(this);
layer_->SetFillsBoundsOpaquely(false);
root_layer->Add(layer_.get());
@@ -43,12 +54,6 @@ void FocusRingLayer::Set(aura::Window* root_window, const gfx::Rect& bounds) {
// Keep moving it to the top in case new layers have been added
// since we created this layer.
layer_->parent()->StackAtTop(layer_.get());
-
- // Update the layer bounds.
- gfx::Rect layer_bounds = bounds;
- int inset = -(kShadowRadius + 2);
- layer_bounds.Inset(inset, inset, inset, inset);
- layer_->SetBounds(layer_bounds);
}
void FocusRingLayer::OnPaintLayer(gfx::Canvas* canvas) {

Powered by Google App Engine
This is Rietveld 408576698