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

Side by Side Diff: ui/views/animation/ink_drop_highlight.h

Issue 2094343005: Fix MD button hover shadow effect on odd-sized buttons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef UI_VIEWS_ANIMATION_INK_DROP_HIGHLIGHT_H_ 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_HIGHLIGHT_H_
6 #define UI_VIEWS_ANIMATION_INK_DROP_HIGHLIGHT_H_ 6 #define UI_VIEWS_ANIMATION_INK_DROP_HIGHLIGHT_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 24 matching lines...) Expand all
35 class InkDropHighlightObserver; 35 class InkDropHighlightObserver;
36 36
37 // Manages fade in/out animations for a painted Layer that is used to provide 37 // Manages fade in/out animations for a painted Layer that is used to provide
38 // visual feedback on ui::Views for highlight states (e.g. mouse hover, keyboard 38 // visual feedback on ui::Views for highlight states (e.g. mouse hover, keyboard
39 // focus). 39 // focus).
40 class VIEWS_EXPORT InkDropHighlight { 40 class VIEWS_EXPORT InkDropHighlight {
41 public: 41 public:
42 enum AnimationType { FADE_IN, FADE_OUT }; 42 enum AnimationType { FADE_IN, FADE_OUT };
43 43
44 // Creates a highlight with a specified painter. 44 // Creates a highlight with a specified painter.
45 InkDropHighlight(const gfx::Point& center_point, 45 InkDropHighlight(const gfx::PointF& center_point,
46 std::unique_ptr<BasePaintedLayerDelegate> layer_delegate); 46 std::unique_ptr<BasePaintedLayerDelegate> layer_delegate);
47 47
48 // Creates a highlight that paints a partially transparent roundrect with 48 // Creates a highlight that paints a partially transparent roundrect with
49 // color |color|. 49 // color |color|.
50 InkDropHighlight(const gfx::Size& size, 50 InkDropHighlight(const gfx::Size& size,
51 int corner_radius, 51 int corner_radius,
52 const gfx::Point& center_point, 52 const gfx::PointF& center_point,
53 SkColor color); 53 SkColor color);
54 virtual ~InkDropHighlight(); 54 virtual ~InkDropHighlight();
55 55
56 void set_observer(InkDropHighlightObserver* observer) { 56 void set_observer(InkDropHighlightObserver* observer) {
57 observer_ = observer; 57 observer_ = observer;
58 } 58 }
59 59
60 void set_explode_size(const gfx::Size& size) { explode_size_ = size; } 60 void set_explode_size(const gfx::Size& size) { explode_size_ = size; }
61 61
62 // Returns true if the highlight animation is either in the process of fading 62 // Returns true if the highlight animation is either in the process of fading
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 // The size of the highlight shape when fully faded in. 106 // The size of the highlight shape when fully faded in.
107 gfx::Size size_; 107 gfx::Size size_;
108 108
109 // The target size of the highlight shape when it expands during a fade out 109 // The target size of the highlight shape when it expands during a fade out
110 // animation. 110 // animation.
111 gfx::Size explode_size_; 111 gfx::Size explode_size_;
112 112
113 // The center point of the highlight shape in the parent Layer's coordinate 113 // The center point of the highlight shape in the parent Layer's coordinate
114 // space. 114 // space.
115 gfx::PointF center_point_; 115 gfx::PointF center_point_;
sky 2016/06/28 02:46:25 I'm surprised we stored a float but didn't take a
116 116
117 // The opacity for the fully visible state of the highlight. 117 // The opacity for the fully visible state of the highlight.
118 float visible_opacity_; 118 float visible_opacity_;
119 119
120 // True if the last animation to be initiated was a FADE_IN, and false 120 // True if the last animation to be initiated was a FADE_IN, and false
121 // otherwise. 121 // otherwise.
122 bool last_animation_initiated_was_fade_in_; 122 bool last_animation_initiated_was_fade_in_;
123 123
124 // The LayerDelegate that paints the highlight |layer_|. 124 // The LayerDelegate that paints the highlight |layer_|.
125 std::unique_ptr<BasePaintedLayerDelegate> layer_delegate_; 125 std::unique_ptr<BasePaintedLayerDelegate> layer_delegate_;
(...skipping 12 matching lines...) Expand all
138 138
139 // This is declared here for use in gtest-based unit tests but is defined in 139 // This is declared here for use in gtest-based unit tests but is defined in
140 // the views_test_support target. Depend on that to use this in your unit test. 140 // the views_test_support target. Depend on that to use this in your unit test.
141 // This should not be used in production code - call ToString() instead. 141 // This should not be used in production code - call ToString() instead.
142 void PrintTo(InkDropHighlight::AnimationType animation_type, 142 void PrintTo(InkDropHighlight::AnimationType animation_type,
143 ::std::ostream* os); 143 ::std::ostream* os);
144 144
145 } // namespace views 145 } // namespace views
146 146
147 #endif // UI_VIEWS_ANIMATION_INK_DROP_HIGHLIGHT_H_ 147 #endif // UI_VIEWS_ANIMATION_INK_DROP_HIGHLIGHT_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/download/download_item_view_md.cc ('k') | ui/views/animation/ink_drop_highlight.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698