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

Unified Diff: ui/compositor/layer.cc

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: Sync with ToT Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/compositor/layer_owner_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer.cc
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index 6f2ac6c5b6a06c625c14d91316b7f104d99d4cf6..d436259ef739df50c3f939926db82124d50d3a7f 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -40,6 +40,10 @@
namespace {
const ui::Layer* GetRoot(const ui::Layer* layer) {
+ // Parent walk cannot be done on a layer that is being used as a mask. Get the
+ // layer to which this layer is a mask of.
+ if (layer->layer_mask_back_link())
+ layer = layer->layer_mask_back_link();
while (layer->parent())
layer = layer->parent();
return layer;
@@ -315,7 +319,7 @@ void Layer::SetAnimator(LayerAnimator* animator) {
Compositor* compositor = GetCompositor();
if (animator_) {
- if (compositor)
+ if (compositor && !layer_mask_back_link())
animator_->DetachLayerAndTimeline(compositor);
animator_->SetDelegate(nullptr);
}
@@ -324,7 +328,7 @@ void Layer::SetAnimator(LayerAnimator* animator) {
if (animator_) {
animator_->SetDelegate(this);
- if (compositor)
+ if (compositor && !layer_mask_back_link())
animator_->AttachLayerAndTimeline(compositor);
}
}
@@ -943,8 +947,9 @@ scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList(
paint_region_.Clear();
auto display_list = make_scoped_refptr(new cc::DisplayItemList);
if (delegate_) {
- delegate_->OnPaintLayer(
- PaintContext(display_list.get(), device_scale_factor_, invalidation));
+ delegate_->OnPaintLayer(PaintContext(display_list.get(),
+ device_scale_factor_, invalidation,
+ GetCompositor()->is_pixel_canvas()));
}
display_list->Finalize();
// TODO(domlaskowski): Move mirror invalidation to Layer::SchedulePaint.
« no previous file with comments | « ui/compositor/layer.h ('k') | ui/compositor/layer_owner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698