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

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

Issue 2709283002: Avoid to change layer type in InkDropHostView::AddInkDropLayer (Closed)
Patch Set: Created 3 years, 10 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 | no next file » | 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 "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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 old_paint_to_layer_(false), 119 old_paint_to_layer_(false),
120 destroying_(false) {} 120 destroying_(false) {}
121 121
122 InkDropHostView::~InkDropHostView() { 122 InkDropHostView::~InkDropHostView() {
123 // TODO(bruthig): Improve InkDropImpl to be safer about calling back to 123 // TODO(bruthig): Improve InkDropImpl to be safer about calling back to
124 // potentially destroyed InkDropHosts and remove |destroying_|. 124 // potentially destroyed InkDropHosts and remove |destroying_|.
125 destroying_ = true; 125 destroying_ = true;
126 } 126 }
127 127
128 void InkDropHostView::AddInkDropLayer(ui::Layer* ink_drop_layer) { 128 void InkDropHostView::AddInkDropLayer(ui::Layer* ink_drop_layer) {
129 DCHECK(!layer() || layer()->type() == ui::LAYER_TEXTURED);
sky 2017/02/22 21:29:49 Please add a comment as to why this expects ui::LA
yiyix 2017/02/22 23:15:39 I tried to answer your questions in the descriptio
129 old_paint_to_layer_ = layer() != nullptr; 130 old_paint_to_layer_ = layer() != nullptr;
130 SetPaintToLayer(); 131 SetPaintToLayer();
131 layer()->SetFillsBoundsOpaquely(false); 132 layer()->SetFillsBoundsOpaquely(false);
132 ink_drop_mask_ = CreateInkDropMask(); 133 ink_drop_mask_ = CreateInkDropMask();
133 if (ink_drop_mask_) 134 if (ink_drop_mask_)
134 ink_drop_layer->SetMaskLayer(ink_drop_mask_->layer()); 135 ink_drop_layer->SetMaskLayer(ink_drop_mask_->layer());
135 layer()->Add(ink_drop_layer); 136 layer()->Add(ink_drop_layer);
136 layer()->StackAtBottom(ink_drop_layer); 137 layer()->StackAtBottom(ink_drop_layer);
137 } 138 }
138 139
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 std::unique_ptr<InkDropImpl> 289 std::unique_ptr<InkDropImpl>
289 InkDropHostView::CreateDefaultFloodFillInkDropImpl() { 290 InkDropHostView::CreateDefaultFloodFillInkDropImpl() {
290 std::unique_ptr<views::InkDropImpl> ink_drop = 291 std::unique_ptr<views::InkDropImpl> ink_drop =
291 InkDropHostView::CreateDefaultInkDropImpl(); 292 InkDropHostView::CreateDefaultInkDropImpl();
292 ink_drop->SetAutoHighlightMode( 293 ink_drop->SetAutoHighlightMode(
293 views::InkDropImpl::AutoHighlightMode::SHOW_ON_RIPPLE); 294 views::InkDropImpl::AutoHighlightMode::SHOW_ON_RIPPLE);
294 return ink_drop; 295 return ink_drop;
295 } 296 }
296 297
297 } // namespace views 298 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698