OLD | NEW |
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 "ui/views/animation/ink_drop_host_view.h" | 5 #include "ui/views/animation/ink_drop_host_view.h" |
6 | 6 |
7 #include "ui/events/event.h" | 7 #include "ui/events/event.h" |
8 #include "ui/events/scoped_target_handler.h" | 8 #include "ui/events/scoped_target_handler.h" |
9 #include "ui/gfx/color_palette.h" | 9 #include "ui/gfx/color_palette.h" |
10 #include "ui/gfx/geometry/size_conversions.h" | 10 #include "ui/gfx/geometry/size_conversions.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 layer()->Remove(ink_drop_layer); | 135 layer()->Remove(ink_drop_layer); |
136 SetPaintToLayer(old_paint_to_layer_); | 136 SetPaintToLayer(old_paint_to_layer_); |
137 } | 137 } |
138 | 138 |
139 std::unique_ptr<InkDropRipple> InkDropHostView::CreateInkDropRipple() const { | 139 std::unique_ptr<InkDropRipple> InkDropHostView::CreateInkDropRipple() const { |
140 return CreateDefaultInkDropRipple(GetLocalBounds().CenterPoint()); | 140 return CreateDefaultInkDropRipple(GetLocalBounds().CenterPoint()); |
141 } | 141 } |
142 | 142 |
143 std::unique_ptr<InkDropHighlight> InkDropHostView::CreateInkDropHighlight() | 143 std::unique_ptr<InkDropHighlight> InkDropHostView::CreateInkDropHighlight() |
144 const { | 144 const { |
145 return CreateDefaultInkDropHighlight(GetLocalBounds().CenterPoint()); | 145 return CreateDefaultInkDropHighlight( |
| 146 gfx::RectF(GetLocalBounds()).CenterPoint()); |
146 } | 147 } |
147 | 148 |
148 std::unique_ptr<InkDropRipple> InkDropHostView::CreateDefaultInkDropRipple( | 149 std::unique_ptr<InkDropRipple> InkDropHostView::CreateDefaultInkDropRipple( |
149 const gfx::Point& center_point) const { | 150 const gfx::Point& center_point) const { |
150 std::unique_ptr<InkDropRipple> ripple(new SquareInkDropRipple( | 151 std::unique_ptr<InkDropRipple> ripple(new SquareInkDropRipple( |
151 CalculateLargeInkDropSize(ink_drop_size_), kInkDropLargeCornerRadius, | 152 CalculateLargeInkDropSize(ink_drop_size_), kInkDropLargeCornerRadius, |
152 ink_drop_size_, kInkDropSmallCornerRadius, center_point, | 153 ink_drop_size_, kInkDropSmallCornerRadius, center_point, |
153 GetInkDropBaseColor(), ink_drop_visible_opacity())); | 154 GetInkDropBaseColor(), ink_drop_visible_opacity())); |
154 return ripple; | 155 return ripple; |
155 } | 156 } |
156 | 157 |
157 std::unique_ptr<InkDropHighlight> | 158 std::unique_ptr<InkDropHighlight> |
158 InkDropHostView::CreateDefaultInkDropHighlight( | 159 InkDropHostView::CreateDefaultInkDropHighlight( |
159 const gfx::Point& center_point) const { | 160 const gfx::PointF& center_point) const { |
160 std::unique_ptr<InkDropHighlight> highlight( | 161 std::unique_ptr<InkDropHighlight> highlight( |
161 new InkDropHighlight(ink_drop_size_, kInkDropSmallCornerRadius, | 162 new InkDropHighlight(ink_drop_size_, kInkDropSmallCornerRadius, |
162 center_point, GetInkDropBaseColor())); | 163 center_point, GetInkDropBaseColor())); |
163 highlight->set_explode_size(CalculateLargeInkDropSize(ink_drop_size_)); | 164 highlight->set_explode_size(CalculateLargeInkDropSize(ink_drop_size_)); |
164 return highlight; | 165 return highlight; |
165 } | 166 } |
166 | 167 |
167 gfx::Point InkDropHostView::GetInkDropCenterBasedOnLastEvent() const { | 168 gfx::Point InkDropHostView::GetInkDropCenterBasedOnLastEvent() const { |
168 return last_ripple_triggering_event_ | 169 return last_ripple_triggering_event_ |
169 ? last_ripple_triggering_event_->location() | 170 ? last_ripple_triggering_event_->location() |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 if (has_an_ink_drop) { | 225 if (has_an_ink_drop) { |
225 ink_drop_.reset(new InkDropImpl(this)); | 226 ink_drop_.reset(new InkDropImpl(this)); |
226 gesture_handler_.reset(new InkDropGestureHandler(this, ink_drop_.get())); | 227 gesture_handler_.reset(new InkDropGestureHandler(this, ink_drop_.get())); |
227 } else { | 228 } else { |
228 gesture_handler_.reset(); | 229 gesture_handler_.reset(); |
229 ink_drop_.reset(new InkDropStub()); | 230 ink_drop_.reset(new InkDropStub()); |
230 } | 231 } |
231 } | 232 } |
232 | 233 |
233 } // namespace views | 234 } // namespace views |
OLD | NEW |