OLD | NEW |
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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 358 |
359 void Layer::SetBounds(const gfx::Size& size) { | 359 void Layer::SetBounds(const gfx::Size& size) { |
360 DCHECK(IsPropertyChangeAllowed()); | 360 DCHECK(IsPropertyChangeAllowed()); |
361 if (bounds() == size) | 361 if (bounds() == size) |
362 return; | 362 return; |
363 bounds_ = size; | 363 bounds_ = size; |
364 | 364 |
365 if (!layer_tree_host_) | 365 if (!layer_tree_host_) |
366 return; | 366 return; |
367 | 367 |
368 if (ClipNode* clip_node = layer_tree_host_->property_trees()->clip_tree.Node( | 368 SetNeedsCommit(); |
369 clip_tree_index())) { | |
370 if (clip_node->owner_id == id()) { | |
371 clip_node->data.clip.set_size(gfx::SizeF(size)); | |
372 layer_tree_host_->property_trees()->clip_tree.set_needs_update(true); | |
373 } | |
374 } | |
375 | |
376 SetNeedsCommitNoRebuild(); | |
377 } | 369 } |
378 | 370 |
379 Layer* Layer::RootLayer() { | 371 Layer* Layer::RootLayer() { |
380 Layer* layer = this; | 372 Layer* layer = this; |
381 while (layer->parent()) | 373 while (layer->parent()) |
382 layer = layer->parent(); | 374 layer = layer->parent(); |
383 return layer; | 375 return layer; |
384 } | 376 } |
385 | 377 |
386 void Layer::RemoveAllChildren() { | 378 void Layer::RemoveAllChildren() { |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 } | 927 } |
936 | 928 |
937 void Layer::SetScrollClipLayerId(int clip_layer_id) { | 929 void Layer::SetScrollClipLayerId(int clip_layer_id) { |
938 DCHECK(IsPropertyChangeAllowed()); | 930 DCHECK(IsPropertyChangeAllowed()); |
939 if (scroll_clip_layer_id_ == clip_layer_id) | 931 if (scroll_clip_layer_id_ == clip_layer_id) |
940 return; | 932 return; |
941 scroll_clip_layer_id_ = clip_layer_id; | 933 scroll_clip_layer_id_ = clip_layer_id; |
942 SetNeedsCommit(); | 934 SetNeedsCommit(); |
943 } | 935 } |
944 | 936 |
| 937 Layer* Layer::scroll_clip_layer() const { |
| 938 return layer_tree_host()->LayerById(scroll_clip_layer_id_); |
| 939 } |
| 940 |
945 void Layer::SetUserScrollable(bool horizontal, bool vertical) { | 941 void Layer::SetUserScrollable(bool horizontal, bool vertical) { |
946 DCHECK(IsPropertyChangeAllowed()); | 942 DCHECK(IsPropertyChangeAllowed()); |
947 if (user_scrollable_horizontal_ == horizontal && | 943 if (user_scrollable_horizontal_ == horizontal && |
948 user_scrollable_vertical_ == vertical) | 944 user_scrollable_vertical_ == vertical) |
949 return; | 945 return; |
950 user_scrollable_horizontal_ = horizontal; | 946 user_scrollable_horizontal_ = horizontal; |
951 user_scrollable_vertical_ = vertical; | 947 user_scrollable_vertical_ = vertical; |
952 SetNeedsCommit(); | 948 SetNeedsCommit(); |
953 } | 949 } |
954 | 950 |
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2039 this, layer_tree_host_->property_trees()->transform_tree); | 2035 this, layer_tree_host_->property_trees()->transform_tree); |
2040 } | 2036 } |
2041 | 2037 |
2042 gfx::Transform Layer::screen_space_transform() const { | 2038 gfx::Transform Layer::screen_space_transform() const { |
2043 DCHECK_NE(transform_tree_index_, -1); | 2039 DCHECK_NE(transform_tree_index_, -1); |
2044 return ScreenSpaceTransformFromPropertyTrees( | 2040 return ScreenSpaceTransformFromPropertyTrees( |
2045 this, layer_tree_host_->property_trees()->transform_tree); | 2041 this, layer_tree_host_->property_trees()->transform_tree); |
2046 } | 2042 } |
2047 | 2043 |
2048 } // namespace cc | 2044 } // namespace cc |
OLD | NEW |