OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_focus_ring_controller.h" | 5 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/browser/chromeos/ui/focus_ring_layer.h" | 10 #include "chrome/browser/chromeos/ui/focus_ring_layer.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 Update(); | 55 Update(); |
56 } | 56 } |
57 | 57 |
58 void AccessibilityFocusRingController::Update() { | 58 void AccessibilityFocusRingController::Update() { |
59 previous_rings_.swap(rings_); | 59 previous_rings_.swap(rings_); |
60 rings_.clear(); | 60 rings_.clear(); |
61 RectsToRings(rects_, &rings_); | 61 RectsToRings(rects_, &rings_); |
62 layers_.resize(rings_.size()); | 62 layers_.resize(rings_.size()); |
63 for (size_t i = 0; i < rings_.size(); ++i) { | 63 for (size_t i = 0; i < rings_.size(); ++i) { |
64 if (!layers_[i]) | 64 if (!layers_[i]) |
65 layers_[i].reset(new AccessibilityFocusRingLayer(this)); | 65 layers_[i] = new AccessibilityFocusRingLayer(this); |
66 | 66 |
67 if (i > 0) { | 67 if (i > 0) { |
68 // Focus rings other than the first one don't animate. | 68 // Focus rings other than the first one don't animate. |
69 layers_[i]->Set(rings_[i]); | 69 layers_[i]->Set(rings_[i]); |
70 continue; | 70 continue; |
71 } | 71 } |
72 | 72 |
73 gfx::Rect bounds = rings_[0].GetBounds(); | 73 gfx::Rect bounds = rings_[0].GetBounds(); |
74 gfx::Display display = | 74 gfx::Display display = |
75 gfx::Screen::GetNativeScreen()->GetDisplayMatching(bounds); | 75 gfx::Screen::GetNativeScreen()->GetDisplayMatching(bounds); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 double fraction = delta.InSecondsF() / transition_time.InSecondsF(); | 316 double fraction = delta.InSecondsF() / transition_time.InSecondsF(); |
317 | 317 |
318 // Ease-in effect. | 318 // Ease-in effect. |
319 fraction = pow(fraction, 0.3); | 319 fraction = pow(fraction, 0.3); |
320 | 320 |
321 layers_[0]->Set(AccessibilityFocusRing::Interpolate( | 321 layers_[0]->Set(AccessibilityFocusRing::Interpolate( |
322 previous_rings_[0], rings_[0], fraction)); | 322 previous_rings_[0], rings_[0], fraction)); |
323 } | 323 } |
324 | 324 |
325 } // namespace chromeos | 325 } // namespace chromeos |
OLD | NEW |