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

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: change approach 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 old_paint_to_layer_ = layer() != nullptr; 129 old_paint_to_layer_ = layer() != nullptr;
130 SetPaintToLayer(); 130 if (!old_paint_to_layer_)
131 SetPaintToLayer();
132
131 layer()->SetFillsBoundsOpaquely(false); 133 layer()->SetFillsBoundsOpaquely(false);
132 ink_drop_mask_ = CreateInkDropMask(); 134 ink_drop_mask_ = CreateInkDropMask();
133 if (ink_drop_mask_) 135 if (ink_drop_mask_)
134 ink_drop_layer->SetMaskLayer(ink_drop_mask_->layer()); 136 ink_drop_layer->SetMaskLayer(ink_drop_mask_->layer());
135 layer()->Add(ink_drop_layer); 137 layer()->Add(ink_drop_layer);
136 layer()->StackAtBottom(ink_drop_layer); 138 layer()->StackAtBottom(ink_drop_layer);
137 } 139 }
138 140
139 void InkDropHostView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { 141 void InkDropHostView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
140 // No need to do anything when called during shutdown, and if a derived 142 // No need to do anything when called during shutdown, and if a derived
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 std::unique_ptr<InkDropImpl> 290 std::unique_ptr<InkDropImpl>
289 InkDropHostView::CreateDefaultFloodFillInkDropImpl() { 291 InkDropHostView::CreateDefaultFloodFillInkDropImpl() {
290 std::unique_ptr<views::InkDropImpl> ink_drop = 292 std::unique_ptr<views::InkDropImpl> ink_drop =
291 InkDropHostView::CreateDefaultInkDropImpl(); 293 InkDropHostView::CreateDefaultInkDropImpl();
292 ink_drop->SetAutoHighlightMode( 294 ink_drop->SetAutoHighlightMode(
293 views::InkDropImpl::AutoHighlightMode::SHOW_ON_RIPPLE); 295 views::InkDropImpl::AutoHighlightMode::SHOW_ON_RIPPLE);
294 return ink_drop; 296 return ink_drop;
295 } 297 }
296 298
297 } // namespace views 299 } // 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