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

Side by Side Diff: cc/layers/layer.cc

Issue 2816063003: Replace layer id with Element id for tracking scrollbar animation controllers (Closed)
Patch Set: Address reviewer comments, pull element_id.h change to another patch Created 3 years, 8 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
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 "cc/layers/layer.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 1122
1123 void Layer::PushPropertiesTo(LayerImpl* layer) { 1123 void Layer::PushPropertiesTo(LayerImpl* layer) {
1124 TRACE_EVENT0("cc", "Layer::PushPropertiesTo"); 1124 TRACE_EVENT0("cc", "Layer::PushPropertiesTo");
1125 DCHECK(layer_tree_host_); 1125 DCHECK(layer_tree_host_);
1126 1126
1127 // If we did not SavePaintProperties() for the layer this frame, then push the 1127 // If we did not SavePaintProperties() for the layer this frame, then push the
1128 // real property values, not the paint property values. 1128 // real property values, not the paint property values.
1129 bool use_paint_properties = paint_properties_.source_frame_number == 1129 bool use_paint_properties = paint_properties_.source_frame_number ==
1130 layer_tree_host_->SourceFrameNumber(); 1130 layer_tree_host_->SourceFrameNumber();
1131 1131
1132 // The ElementId should be set first because other setters depend on it such
1133 // as LayerImpl::SetScrollClipLayer.
1134 layer->SetElementId(inputs_.element_id);
1132 layer->SetBackgroundColor(inputs_.background_color); 1135 layer->SetBackgroundColor(inputs_.background_color);
1133 layer->SetSafeOpaqueBackgroundColor(safe_opaque_background_color_); 1136 layer->SetSafeOpaqueBackgroundColor(safe_opaque_background_color_);
1134 layer->SetBounds(use_paint_properties ? paint_properties_.bounds 1137 layer->SetBounds(use_paint_properties ? paint_properties_.bounds
1135 : inputs_.bounds); 1138 : inputs_.bounds);
1136 1139
1137 #if defined(NDEBUG) 1140 #if defined(NDEBUG)
1138 if (frame_viewer_instrumentation::IsTracingLayerTreeSnapshots()) 1141 if (frame_viewer_instrumentation::IsTracingLayerTreeSnapshots())
1139 layer->SetDebugInfo(TakeDebugInfo()); 1142 layer->SetDebugInfo(TakeDebugInfo());
1140 #else 1143 #else
1141 layer->SetDebugInfo(TakeDebugInfo()); 1144 layer->SetDebugInfo(TakeDebugInfo());
(...skipping 20 matching lines...) Expand all
1162 layer->set_should_flatten_transform_from_property_tree( 1165 layer->set_should_flatten_transform_from_property_tree(
1163 should_flatten_transform_from_property_tree_); 1166 should_flatten_transform_from_property_tree_);
1164 layer->SetUseParentBackfaceVisibility(inputs_.use_parent_backface_visibility); 1167 layer->SetUseParentBackfaceVisibility(inputs_.use_parent_backface_visibility);
1165 layer->SetUseLocalTransformForBackfaceVisibility( 1168 layer->SetUseLocalTransformForBackfaceVisibility(
1166 use_local_transform_for_backface_visibility_); 1169 use_local_transform_for_backface_visibility_);
1167 layer->SetShouldCheckBackfaceVisibility(should_check_backface_visibility_); 1170 layer->SetShouldCheckBackfaceVisibility(should_check_backface_visibility_);
1168 1171
1169 layer->SetScrollClipLayer(inputs_.scroll_clip_layer_id); 1172 layer->SetScrollClipLayer(inputs_.scroll_clip_layer_id);
1170 layer->set_user_scrollable_horizontal(inputs_.user_scrollable_horizontal); 1173 layer->set_user_scrollable_horizontal(inputs_.user_scrollable_horizontal);
1171 layer->set_user_scrollable_vertical(inputs_.user_scrollable_vertical); 1174 layer->set_user_scrollable_vertical(inputs_.user_scrollable_vertical);
1172 layer->SetElementId(inputs_.element_id);
1173 layer->SetMutableProperties(inputs_.mutable_properties); 1175 layer->SetMutableProperties(inputs_.mutable_properties);
1174 1176
1175 // When a scroll offset animation is interrupted the new scroll position on 1177 // When a scroll offset animation is interrupted the new scroll position on
1176 // the pending tree will clobber any impl-side scrolling occuring on the 1178 // the pending tree will clobber any impl-side scrolling occuring on the
1177 // active tree. To do so, avoid scrolling the pending tree along with it 1179 // active tree. To do so, avoid scrolling the pending tree along with it
1178 // instead of trying to undo that scrolling later. 1180 // instead of trying to undo that scrolling later.
1179 if (ScrollOffsetAnimationWasInterrupted()) 1181 if (ScrollOffsetAnimationWasInterrupted())
1180 layer->layer_tree_impl() 1182 layer->layer_tree_impl()
1181 ->property_trees() 1183 ->property_trees()
1182 ->scroll_tree.SetScrollOffsetClobberActiveValue(layer->id()); 1184 ->scroll_tree.SetScrollOffsetClobberActiveValue(layer->id());
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 ->num_copy_requests_in_subtree; 1444 ->num_copy_requests_in_subtree;
1443 } 1445 }
1444 1446
1445 gfx::Transform Layer::ScreenSpaceTransform() const { 1447 gfx::Transform Layer::ScreenSpaceTransform() const {
1446 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); 1448 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId);
1447 return draw_property_utils::ScreenSpaceTransform( 1449 return draw_property_utils::ScreenSpaceTransform(
1448 this, layer_tree_host_->property_trees()->transform_tree); 1450 this, layer_tree_host_->property_trees()->transform_tree);
1449 } 1451 }
1450 1452
1451 } // namespace cc 1453 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698