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

Side by Side Diff: chrome/browser/chromeos/ui/accessibility_cursor_ring_layer.cc

Issue 2038093003: Refactor accessible focus ring code so the layers are animation observers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@improve_highlights
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/chromeos/ui/accessibility_cursor_ring_layer.h" 5 #include "chrome/browser/chromeos/ui/accessibility_cursor_ring_layer.h"
6 6
7 #include "ash/display/window_tree_host_manager.h" 7 #include "ash/display/window_tree_host_manager.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "third_party/skia/include/core/SkPaint.h" 10 #include "third_party/skia/include/core/SkPaint.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 gfx::Rect bounds = gfx::Rect(location.x(), location.y(), 0, 0); 44 gfx::Rect bounds = gfx::Rect(location.x(), location.y(), 0, 0);
45 int inset = kGradientWidth + kCursorRingRadius + kLayerMargin; 45 int inset = kGradientWidth + kCursorRingRadius + kLayerMargin;
46 bounds.Inset(-inset, -inset, -inset, -inset); 46 bounds.Inset(-inset, -inset, -inset, -inset);
47 47
48 display::Display display = 48 display::Display display =
49 display::Screen::GetScreen()->GetDisplayMatching(bounds); 49 display::Screen::GetScreen()->GetDisplayMatching(bounds);
50 aura::Window* root_window = ash::Shell::GetInstance() 50 aura::Window* root_window = ash::Shell::GetInstance()
51 ->window_tree_host_manager() 51 ->window_tree_host_manager()
52 ->GetRootWindowForDisplayId(display.id()); 52 ->GetRootWindowForDisplayId(display.id());
53 CreateOrUpdateLayer(root_window, "AccessibilityCursorRing"); 53 CreateOrUpdateLayer(root_window, "AccessibilityCursorRing", bounds);
54
55 // Update the layer bounds.
56 layer()->SetBounds(bounds);
57 } 54 }
58 55
59 void AccessibilityCursorRingLayer::SetOpacity(float opacity) { 56 void AccessibilityCursorRingLayer::SetOpacity(float opacity) {
60 layer()->SetOpacity(opacity); 57 layer()->SetOpacity(opacity);
61 } 58 }
62 59
63 void AccessibilityCursorRingLayer::OnPaintLayer( 60 void AccessibilityCursorRingLayer::OnPaintLayer(
64 const ui::PaintContext& context) { 61 const ui::PaintContext& context) {
65 ui::PaintRecorder recorder(context, layer()->size()); 62 ui::PaintRecorder recorder(context, layer()->size());
66 63
(...skipping 10 matching lines...) Expand all
77 paint.setColor( 74 paint.setColor(
78 SkColorSetARGBMacro(255 * (i) * (i) / (w * w), red_, green_, blue_)); 75 SkColorSetARGBMacro(255 * (i) * (i) / (w * w), red_, green_, blue_));
79 SkPath path; 76 SkPath path;
80 path.addOval(SkRect::MakeXYWH(r.x(), r.y(), r.width(), r.height())); 77 path.addOval(SkRect::MakeXYWH(r.x(), r.y(), r.width(), r.height()));
81 r.Inset(1, 1, 1, 1); 78 r.Inset(1, 1, 1, 1);
82 recorder.canvas()->DrawPath(path, paint); 79 recorder.canvas()->DrawPath(path, paint);
83 } 80 }
84 } 81 }
85 82
86 } // namespace chromeos 83 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698