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

Unified Diff: cc/layers/layer.cc

Issue 1588093004: Compute if a layer is drawn without LayerTree hierarchy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 9fa27317b5bd4d3b6f48c4f15c456865d2c87ffd..e9c222b0ae8b035924881043f85206b6737317ff 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -77,7 +77,6 @@ Layer::Layer(const LayerSettings& settings)
is_container_for_fixed_position_layers_(false),
is_drawable_(false),
draws_content_(false),
- hide_layer_and_subtree_(false),
masks_to_bounds_(false),
contents_opaque_(false),
double_sided_(true),
@@ -99,8 +98,7 @@ Layer::Layer(const LayerSettings& settings)
replica_layer_(nullptr),
client_(nullptr),
num_unclipped_descendants_(0),
- frame_timing_requests_dirty_(false),
- is_hidden_from_property_trees_(false) {
+ frame_timing_requests_dirty_(false) {
if (!settings.use_compositor_animation_timelines) {
layer_animation_controller_ = LayerAnimationController::Create(layer_id_);
layer_animation_controller_->AddValueObserver(this);
@@ -1097,15 +1095,6 @@ void Layer::SetIsDrawable(bool is_drawable) {
UpdateDrawsContent(HasDrawableContent());
}
-void Layer::SetHideLayerAndSubtree(bool hide) {
- DCHECK(IsPropertyChangeAllowed());
- if (hide_layer_and_subtree_ == hide)
- return;
-
- hide_layer_and_subtree_ = hide;
- SetNeedsCommit();
-}
-
void Layer::SetNeedsDisplayRect(const gfx::Rect& dirty_rect) {
if (dirty_rect.IsEmpty())
return;
@@ -1188,7 +1177,6 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
layer->set_offset_to_transform_parent(offset_to_transform_parent_);
layer->SetDoubleSided(double_sided_);
layer->SetDrawsContent(DrawsContent());
- layer->SetHideLayerAndSubtree(hide_layer_and_subtree_);
layer->SetHasRenderSurface(has_render_surface_);
layer->SetForceRenderSurface(force_render_surface_);
if (!layer->FilterIsAnimatingOnImplOnly() && !FilterIsAnimating())
@@ -1228,7 +1216,6 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
layer->set_user_scrollable_vertical(user_scrollable_vertical_);
layer->SetElementId(element_id_);
layer->SetMutableProperties(mutable_properties_);
- layer->set_is_hidden_from_property_trees(is_hidden_from_property_trees_);
LayerImpl* scroll_parent = nullptr;
if (scroll_parent_) {
@@ -1458,7 +1445,6 @@ void Layer::LayerSpecificPropertiesToProto(proto::LayerProperties* proto) {
base->mutable_offset_to_transform_parent());
base->set_double_sided(double_sided_);
base->set_draws_content(draws_content_);
- base->set_hide_layer_and_subtree(hide_layer_and_subtree_);
base->set_has_render_surface(has_render_surface_);
// TODO(nyquist): Add support for serializing FilterOperations for
@@ -1548,7 +1534,6 @@ void Layer::FromLayerSpecificPropertiesProto(
ProtoToVector2dF(base.offset_to_transform_parent());
double_sided_ = base.double_sided();
draws_content_ = base.draws_content();
- hide_layer_and_subtree_ = base.hide_layer_and_subtree();
has_render_surface_ = base.has_render_surface();
masks_to_bounds_ = base.masks_to_bounds();
should_scroll_on_main_thread_ = base.should_scroll_on_main_thread();
@@ -1931,6 +1916,21 @@ bool Layer::HasDelegatedContent() const {
return false;
}
+bool Layer::IsDrawnFromPropertyTrees() const {
+ // Layers that have screen space opacity are hidden. So they are not drawn.
ajuma 2016/01/15 15:02:46 "screen space opacity 0"?
jaydasika 2016/01/19 20:02:49 Done.
+ // Exceptions:
+ // 1) Layers that contribute to copy requests, whether hidden or not, must be
+ // drawn.
+ // 2) Layers that have a background filter or an animating opacity.
+ if (HasPotentiallyRunningOpacityAnimation() ||
ajuma 2016/01/15 15:02:46 This only checks if the layer itself has an animat
jaydasika 2016/01/19 20:02:49 Done.
+ OpacityCanAnimateOnImplThread() || !background_filters().IsEmpty())
+ return true;
+ EffectTree& effect_tree = layer_tree_host_->property_trees()->effect_tree;
+ EffectNode* node = effect_tree.Node(effect_tree_index_);
+ return node->data.screen_space_opacity != 0.f ||
+ node->data.contributes_to_copy_request;
+}
+
void Layer::SetFrameTimingRequests(
const std::vector<FrameTimingRequest>& requests) {
// TODO(vmpstr): Early out if there are no changes earlier in the call stack.
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | cc/layers/layer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698