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

Side by Side Diff: ui/views/animation/ink_drop_host_view.cc

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: fix cros build Created 3 years, 9 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 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 "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "ui/events/event.h" 8 #include "ui/events/event.h"
9 #include "ui/events/scoped_target_handler.h" 9 #include "ui/events/scoped_target_handler.h"
10 #include "ui/gfx/color_palette.h" 10 #include "ui/gfx/color_palette.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return CreateDefaultInkDropRipple(GetLocalBounds().CenterPoint()); 159 return CreateDefaultInkDropRipple(GetLocalBounds().CenterPoint());
160 } 160 }
161 161
162 std::unique_ptr<InkDropHighlight> InkDropHostView::CreateInkDropHighlight() 162 std::unique_ptr<InkDropHighlight> InkDropHostView::CreateInkDropHighlight()
163 const { 163 const {
164 return CreateDefaultInkDropHighlight( 164 return CreateDefaultInkDropHighlight(
165 gfx::RectF(GetLocalBounds()).CenterPoint()); 165 gfx::RectF(GetLocalBounds()).CenterPoint());
166 } 166 }
167 167
168 std::unique_ptr<InkDropRipple> InkDropHostView::CreateDefaultInkDropRipple( 168 std::unique_ptr<InkDropRipple> InkDropHostView::CreateDefaultInkDropRipple(
169 const gfx::Point& center_point, 169 const gfx::Point& center_point) const {
170 const gfx::Size& size) const { 170 const gfx::Size& size = GetInkDropSize();
171 std::unique_ptr<InkDropRipple> ripple(new SquareInkDropRipple( 171 std::unique_ptr<InkDropRipple> ripple(new SquareInkDropRipple(
172 CalculateLargeInkDropSize(size), kInkDropLargeCornerRadius, size, 172 CalculateLargeInkDropSize(size), kInkDropLargeCornerRadius, size,
173 kInkDropSmallCornerRadius, center_point, GetInkDropBaseColor(), 173 kInkDropSmallCornerRadius, center_point, GetInkDropBaseColor(),
174 ink_drop_visible_opacity())); 174 ink_drop_visible_opacity()));
175 return ripple; 175 return ripple;
176 } 176 }
177 177
178 std::unique_ptr<InkDropHighlight> 178 std::unique_ptr<InkDropHighlight>
179 InkDropHostView::CreateDefaultInkDropHighlight(const gfx::PointF& center_point, 179 InkDropHostView::CreateDefaultInkDropHighlight(
180 const gfx::Size& size) const { 180 const gfx::PointF& center_point) const {
181 const gfx::Size& size = GetInkDropSize();
181 std::unique_ptr<InkDropHighlight> highlight(new InkDropHighlight( 182 std::unique_ptr<InkDropHighlight> highlight(new InkDropHighlight(
182 size, kInkDropSmallCornerRadius, center_point, GetInkDropBaseColor())); 183 size, kInkDropSmallCornerRadius, center_point, GetInkDropBaseColor()));
183 highlight->set_explode_size(CalculateLargeInkDropSize(size)); 184 highlight->set_explode_size(CalculateLargeInkDropSize(size));
184 return highlight; 185 return highlight;
185 } 186 }
186 187
187 void InkDropHostView::SetInkDropMode(InkDropMode ink_drop_mode) { 188 void InkDropHostView::SetInkDropMode(InkDropMode ink_drop_mode) {
188 ink_drop_mode_ = ink_drop_mode; 189 ink_drop_mode_ = ink_drop_mode;
189 ink_drop_ = nullptr; 190 ink_drop_ = nullptr;
190 191
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 290
290 std::unique_ptr<InkDropImpl> 291 std::unique_ptr<InkDropImpl>
291 InkDropHostView::CreateDefaultFloodFillInkDropImpl() { 292 InkDropHostView::CreateDefaultFloodFillInkDropImpl() {
292 std::unique_ptr<views::InkDropImpl> ink_drop = 293 std::unique_ptr<views::InkDropImpl> ink_drop =
293 InkDropHostView::CreateDefaultInkDropImpl(); 294 InkDropHostView::CreateDefaultInkDropImpl();
294 ink_drop->SetAutoHighlightMode( 295 ink_drop->SetAutoHighlightMode(
295 views::InkDropImpl::AutoHighlightMode::SHOW_ON_RIPPLE); 296 views::InkDropImpl::AutoHighlightMode::SHOW_ON_RIPPLE);
296 return ink_drop; 297 return ink_drop;
297 } 298 }
298 299
300 gfx::Size InkDropHostView::GetInkDropSize() const {
301 return gfx::Size(std::min(size().width(), kDefaultInkDropSize),
bruthig 2017/03/09 05:04:42 |kDefaultInkDropSize| is somewhat of an arbitrary
Bret 2017/03/09 22:32:37 It's not just the find-in-page buttons, I modified
bruthig 2017/03/10 14:35:25 I guess I dislike the conditional 'min()' logic mo
302 std::min(size().height(), kDefaultInkDropSize));
303 }
304
299 } // namespace views 305 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698