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

Unified Diff: ui/views/animation/ink_drop_host_view.cc

Issue 2499523003: Add ink drop masking to TrayBackgroundView (Closed)
Patch Set: Addressed review comments Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/animation/ink_drop_host_view.h ('k') | ui/views/animation/ink_drop_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/ink_drop_host_view.cc
diff --git a/ui/views/animation/ink_drop_host_view.cc b/ui/views/animation/ink_drop_host_view.cc
index a082ef1b500756641984cdedeeec50d033ed2bbb..e12fc8a9e3916b35f7e438c7b2429a053da8425e 100644
--- a/ui/views/animation/ink_drop_host_view.cc
+++ b/ui/views/animation/ink_drop_host_view.cc
@@ -12,6 +12,7 @@
#include "ui/views/animation/ink_drop.h"
#include "ui/views/animation/ink_drop_highlight.h"
#include "ui/views/animation/ink_drop_impl.h"
+#include "ui/views/animation/ink_drop_mask.h"
#include "ui/views/animation/ink_drop_stub.h"
#include "ui/views/animation/square_ink_drop_ripple.h"
@@ -128,6 +129,9 @@ void InkDropHostView::AddInkDropLayer(ui::Layer* ink_drop_layer) {
old_paint_to_layer_ = layer() != nullptr;
SetPaintToLayer(true);
layer()->SetFillsBoundsOpaquely(false);
+ ink_drop_mask_ = CreateInkDropMask();
+ if (ink_drop_mask_)
+ ink_drop_layer->SetMaskLayer(ink_drop_mask_->layer());
layer()->Add(ink_drop_layer);
layer()->StackAtBottom(ink_drop_layer);
}
@@ -139,6 +143,8 @@ void InkDropHostView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
if (destroying_)
return;
layer()->Remove(ink_drop_layer);
+ ink_drop_layer->SetMaskLayer(nullptr);
+ ink_drop_mask_.reset();
SetPaintToLayer(old_paint_to_layer_);
}
@@ -211,6 +217,11 @@ void InkDropHostView::AnimateInkDrop(InkDropState state,
GetInkDrop()->AnimateToState(state);
}
+void InkDropHostView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
+ if (ink_drop_)
+ ink_drop_->HostSizeChanged(size());
bruthig 2016/11/14 21:07:41 Should we be re-creating/applying the mask here to
bruthig 2016/11/14 21:45:41 Discussed offline, my request is not needed until
+}
+
void InkDropHostView::VisibilityChanged(View* starting_from, bool is_visible) {
View::VisibilityChanged(starting_from, is_visible);
if (GetWidget() && !is_visible) {
@@ -251,6 +262,10 @@ SkColor InkDropHostView::GetInkDropBaseColor() const {
return gfx::kPlaceholderColor;
}
+std::unique_ptr<views::InkDropMask> InkDropHostView::CreateInkDropMask() const {
+ return nullptr;
+}
+
InkDrop* InkDropHostView::GetInkDrop() {
if (!ink_drop_) {
if (ink_drop_mode_ == InkDropMode::OFF)
@@ -262,7 +277,8 @@ InkDrop* InkDropHostView::GetInkDrop() {
}
std::unique_ptr<InkDropImpl> InkDropHostView::CreateDefaultInkDropImpl() {
- std::unique_ptr<InkDropImpl> ink_drop = base::MakeUnique<InkDropImpl>(this);
+ std::unique_ptr<InkDropImpl> ink_drop =
+ base::MakeUnique<InkDropImpl>(this, size());
ink_drop->SetAutoHighlightMode(
views::InkDropImpl::AutoHighlightMode::HIDE_ON_RIPPLE);
return ink_drop;
« no previous file with comments | « ui/views/animation/ink_drop_host_view.h ('k') | ui/views/animation/ink_drop_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698