diff options
author | shawnsingh@chromium.org <shawnsingh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-16 05:47:14 +0000 |
---|---|---|
committer | shawnsingh@chromium.org <shawnsingh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-16 05:47:14 +0000 |
commit | b168871584f817ee586b5482bec6b4876ea66da7 (patch) | |
tree | c41c78f71ce1f760e9cf505a2bbf892eddbba1d5 /cc | |
parent | 2e9d79f5f464c68f5f5d957fa32ffc2c72ef3881 (diff) | |
download | chromium_src-b168871584f817ee586b5482bec6b4876ea66da7.zip chromium_src-b168871584f817ee586b5482bec6b4876ea66da7.tar.gz chromium_src-b168871584f817ee586b5482bec6b4876ea66da7.tar.bz2 |
Don't compute data_for_children in CalcDrawProps if there are no children.
Review URL: https://chromiumcodereview.appspot.com/22865013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217950 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/trees/layer_tree_host_common.cc | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc index 7d69b48..dba7b50 100644 --- a/cc/trees/layer_tree_host_common.cc +++ b/cc/trees/layer_tree_host_common.cc @@ -1416,29 +1416,6 @@ static void CalculateDrawPropertiesInternal( } } - if (layer == globals.page_scale_application_layer) { - data_for_children.parent_matrix.Scale( - globals.page_scale_factor, - globals.page_scale_factor); - data_for_children.in_subtree_of_page_scale_application_layer = true; - } - - // Flatten to 2D if the layer doesn't preserve 3D. - if (!layer->preserves_3d()) - data_for_children.parent_matrix.FlattenTo2d(); - - // Apply the sublayer transform at the anchor point of the layer. - if (!layer->sublayer_transform().IsIdentity()) { - data_for_children.parent_matrix.Translate( - layer->anchor_point().x() * bounds.width(), - layer->anchor_point().y() * bounds.height()); - data_for_children.parent_matrix.PreconcatTransform( - layer->sublayer_transform()); - data_for_children.parent_matrix.Translate( - -layer->anchor_point().x() * bounds.width(), - -layer->anchor_point().y() * bounds.height()); - } - LayerListType& descendants = (layer->render_surface() ? layer->render_surface()->layer_list() : *layer_list); @@ -1450,23 +1427,48 @@ static void CalculateDrawPropertiesInternal( if (!LayerShouldBeSkipped(layer, layer_is_visible)) descendants.push_back(layer); - data_for_children.scroll_compensation_matrix = - ComputeScrollCompensationMatrixForChildren( - layer, - data_from_ancestor.parent_matrix, - data_from_ancestor.scroll_compensation_matrix); - data_for_children.fixed_container = - layer->IsContainerForFixedPositionLayers() ? - layer : data_from_ancestor.fixed_container; - - data_for_children.clip_rect_in_target_space = clip_rect_in_target_space; - data_for_children.clip_rect_of_target_surface_in_target_space = - clip_rect_of_target_surface_in_target_space; - data_for_children.ancestor_clips_subtree = - layer_or_ancestor_clips_descendants; - data_for_children.nearest_ancestor_surface_that_moves_pixels = - nearest_ancestor_surface_that_moves_pixels; - data_for_children.subtree_is_visible_from_ancestor = layer_is_visible; + if (!layer->children().empty()) { + if (layer == globals.page_scale_application_layer) { + data_for_children.parent_matrix.Scale( + globals.page_scale_factor, + globals.page_scale_factor); + data_for_children.in_subtree_of_page_scale_application_layer = true; + } + + // Flatten to 2D if the layer doesn't preserve 3D. + if (!layer->preserves_3d()) + data_for_children.parent_matrix.FlattenTo2d(); + + // Apply the sublayer transform at the anchor point of the layer. + if (!layer->sublayer_transform().IsIdentity()) { + data_for_children.parent_matrix.Translate( + layer->anchor_point().x() * bounds.width(), + layer->anchor_point().y() * bounds.height()); + data_for_children.parent_matrix.PreconcatTransform( + layer->sublayer_transform()); + data_for_children.parent_matrix.Translate( + -layer->anchor_point().x() * bounds.width(), + -layer->anchor_point().y() * bounds.height()); + } + + data_for_children.scroll_compensation_matrix = + ComputeScrollCompensationMatrixForChildren( + layer, + data_from_ancestor.parent_matrix, + data_from_ancestor.scroll_compensation_matrix); + data_for_children.fixed_container = + layer->IsContainerForFixedPositionLayers() ? + layer : data_from_ancestor.fixed_container; + + data_for_children.clip_rect_in_target_space = clip_rect_in_target_space; + data_for_children.clip_rect_of_target_surface_in_target_space = + clip_rect_of_target_surface_in_target_space; + data_for_children.ancestor_clips_subtree = + layer_or_ancestor_clips_descendants; + data_for_children.nearest_ancestor_surface_that_moves_pixels = + nearest_ancestor_surface_that_moves_pixels; + data_for_children.subtree_is_visible_from_ancestor = layer_is_visible; + } gfx::Rect accumulated_drawable_content_rect_of_children; for (size_t i = 0; i < layer->children().size(); ++i) { |