Home | History | Annotate | Download | only in trees

Lines Matching refs:layer

12 #include "cc/layers/layer.h"
43 static gfx::Vector2dF GetEffectiveScrollDelta(LayerType* layer) {
44 gfx::Vector2dF scroll_delta = layer->ScrollDelta();
46 // compositor thread since the commit for this layer tree's source frame.
49 if (layer->scroll_parent())
50 scroll_delta += layer->scroll_parent()->ScrollDelta();
55 static gfx::Vector2dF GetEffectiveTotalScrollOffset(LayerType* layer) {
56 gfx::Vector2dF offset = layer->TotalScrollOffset();
59 // scroll children's positions by the main thread layer positioning code.
60 if (layer->scroll_parent())
61 offset += layer->scroll_parent()->ScrollDelta();
73 // Is this layer fully contained within the target surface?
77 // If the layer doesn't fill up the entire surface, then find the part of
78 // the surface rect where the layer could be visible. This avoids trying to
86 // Project the corners of the target surface rect into the layer space.
94 // the layer is visible, we must conservatively assume the full layer is
116 static LayerType* NextTargetSurface(LayerType* layer) {
117 return layer->parent() ? layer->parent()->render_target() : 0;
166 // Attempts to update the clip rects for the given layer. If the layer has a
170 const LayerType* layer,
173 // If the layer has no clip_parent, or the ancestor is the same as its actual
176 const LayerType* clip_parent = layer->scroll_parent();
179 clip_parent = layer->clip_parent();
181 if (!clip_parent || clip_parent == layer->parent())
184 // The root layer is never a clip child.
185 DCHECK(layer->parent());
197 if (clip_parent == layer->clip_parent()) {
200 *layer->parent(),
209 TranslateRectToTargetSpace<LayerType>(*layer->parent(),
217 // Typically, a layer will contribute to only one surface, the surface
222 // NB: we accumulate the layer's *clipped* drawable content rect.
241 LayerType* layer,
245 if (IsRootLayer(layer))
255 LayerType* render_target = layer->clip_parent()
256 ? layer->clip_parent()->render_target()
257 : layer->parent()->render_target();
259 // If the layer owns a surface, then the content rect is in the wrong space.
263 if (layer->render_surface()) {
265 gfx::ToEnclosedRect(layer->render_surface()->DrawableContentRect());
270 // If the layer has a clip parent, the clip rect may be in the wrong space,
272 if (layer->clip_parent()) {
274 *layer->clip_parent(),
275 *layer,
324 template <typename LayerType> static inline bool IsRootLayer(LayerType* layer) {
325 return !layer->parent();
329 static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) {
330 return layer->Is3dSorted() && layer->parent() &&
331 layer->parent()->Is3dSorted();
335 static bool IsRootLayerOfNewRenderingContext(LayerType* layer) {
336 if (layer->parent())
337 return !layer->parent()->Is3dSorted() && layer->Is3dSorted();
339 return layer->Is3dSorted();
343 static bool IsLayerBackFaceVisible(LayerType* layer) {
345 // be determined differently depending on whether the layer is in a "3d
349 if (LayerIsInExisting3DRenderingContext(layer))
350 return layer->draw_transform().IsBackFaceVisible();
352 // In this case, either the layer establishes a new 3d rendering context, or
354 return layer->transform().IsBackFaceVisible();
358 static bool IsSurfaceBackFaceVisible(LayerType* layer,
360 if (LayerIsInExisting3DRenderingContext(layer))
363 if (IsRootLayerOfNewRenderingContext(layer))
364 return layer->transform().IsBackFaceVisible();
373 static inline bool LayerClipsSubtree(LayerType* layer) {
374 return layer->masks_to_bounds() || layer->mask_layer();
379 LayerType* layer,
382 DCHECK(layer->render_target());
384 // Nothing is visible if the layer bounds are empty.
385 if (!layer->DrawsContent() || layer->content_bounds().IsEmpty() ||
386 layer->drawable_content_rect().IsEmpty())
391 layer->drawable_content_rect();
393 if (!layer->render_target()->render_surface()->clip_rect().IsEmpty()) {
394 // The |layer| L has a target T which owns a surface Ts. The surface Ts
397 // In this case the target surface Ts does clip the layer L that contributes
402 // layer.
412 gfx::Rect(layer->content_bounds()),
414 layer->draw_transform());
417 static inline bool TransformToParentIsKnown(LayerImpl* layer) { return true; }
419 static inline bool TransformToParentIsKnown(Layer* layer) {
420 return !layer->TransformIsAnimating();
423 static inline bool TransformToScreenIsKnown(LayerImpl* layer) { return true; }
425 static inline bool TransformToScreenIsKnown(Layer* layer) {
426 return !layer->screen_space_transform_is_animating();
430 static bool LayerShouldBeSkipped(LayerType* layer, bool layer_is_drawn) {
437 // - the layer is not double-sided, but its back face is visible.
441 // - the intersection of render_surface content and layer clip_rect is empty
444 // Note, if the layer should not have been drawn due to being fully
451 if (!layer->DrawsContent() || layer->bounds().IsEmpty())
454 LayerType* backface_test_layer = layer;
455 if (layer->use_parent_backface_visibility()) {
456 DCHECK(layer->parent());
457 DCHECK(!layer->parent()->use_parent_backface_visibility());
458 backface_test_layer = layer->parent();
461 // The layer should not be drawn if (1) it is not double-sided and (2) the
462 // back of the layer is known to be facing the screen.
472 static bool HasInvertibleOrAnimatedTransform(LayerType* layer) {
473 return layer->transform_is_invertible() || layer->TransformIsAnimating();
476 static inline bool SubtreeShouldBeSkipped(LayerImpl* layer,
478 // If the layer transform is not invertible, it should not be drawn.
482 if (!HasInvertibleOrAnimatedTransform(layer))
485 // When we need to do a readback/copy of a layer's output, we can not skip
487 if (layer->draw_properties().layer_or_descendant_has_copy_request)
492 if (layer->draw_properties().layer_or_descendant_has_input_handler)
495 // If the layer is not drawn, then skip it and its subtree.
499 // If layer is on the pending tree and opacity is being animated then
501 // include tiles for this layer when deciding if tree can be activated.
502 if (layer->layer_tree_impl()->IsPendingTree() && layer->OpacityIsAnimating())
505 // The opacity of a layer always applies to its children (either implicitly
507 // entire subtree can be skipped if this layer is fully transparent.
508 return !layer->opacity();
511 static inline bool SubtreeShouldBeSkipped(Layer* layer, bool layer_is_drawn) {
512 // If the layer transform is not invertible, it should not be drawn.
513 if (!layer->transform_is_invertible() && !layer->TransformIsAnimating())
516 // When we need to do a readback/copy of a layer's output, we can not skip
518 if (layer->draw_properties().layer_or_descendant_has_copy_request)
523 if (layer->draw_properties().layer_or_descendant_has_input_handler)
526 // If the layer is not drawn, then skip it and its subtree.
536 return !layer->opacity() && !layer->OpacityIsAnimating() &&
537 !layer->OpacityCanAnimateOnImplThread();
540 static inline void SavePaintPropertiesLayer(LayerImpl* layer) {}
542 static inline void SavePaintPropertiesLayer(Layer* layer) {
543 layer->SavePaintProperties();
545 if (layer->mask_layer())
546 layer->mask_layer()->SavePaintProperties();
547 if (layer->replica_layer() && layer->replica_layer()->mask_layer())
548 layer->replica_layer()->mask_layer()->SavePaintProperties();
553 LayerType* layer,
556 // A layer and its descendants should render onto a new RenderSurfaceImpl if
560 // The root layer owns a render surface, but it never acts as a contributing
562 // a contributing surface can not be applied to the root layer. In order to
564 // in order to act as a contributing surface to the root layer's surface.
565 bool is_root = IsRootLayer(layer);
567 // If the layer uses a mask.
568 if (layer->mask_layer()) {
573 // If the layer has a reflection.
574 if (layer->replica_layer()) {
579 // If the layer uses a CSS filter.
580 if (!layer->filters().IsEmpty() || !layer->background_filters().IsEmpty()) {
586 layer->draw_properties().num_descendants_that_draw_content;
588 // If the layer flattens its subtree, but it is treated as a 3D object by its
590 if (LayerIsInExisting3DRenderingContext(layer) &&
591 layer->should_flatten_transform() &&
601 // If the layer has blending.
605 if (!layer->uses_default_blend_mode()) {
614 // If the layer clips its descendants but it is not axis-aligned with respect
617 LayerClipsSubtree(layer) || layer->HasDelegatedContent();
628 // If the layer has some translucency and does not have a preserves-3d
630 // layers in the subtree overlap. But checking layer overlaps is unnecessarily
635 (layer->DrawsContent() || num_descendants_that_draw_content > 1);
637 if (layer->opacity() != 1.f && layer->should_flatten_transform() &&
647 // The root layer should always have a render_surface.
656 // If the layer has isolation.
658 // the blending descendants might have access to the content behind this layer
659 // (layer has transparent background or descendants overflow).
661 if (layer->is_root_for_isolated_group()) {
670 if (layer->force_render_surface())
673 // If we'll make a copy of the layer's contents.
674 if (layer->HasCopyRequest())
681 // that's in the layer's target surface coordinate, while the position offset is
682 // specified in some ancestor layer's coordinate.
684 LayerImpl* layer,
689 // To apply a translate in the container's layer space,
694 // container's layer space
701 for (LayerImpl* current_target_surface = NextTargetSurface(layer);
720 // the container render surface to the container layer.
733 // projection. For example ScaleZ(0) is non-invertible but the layer is
749 Layer* layer,
750 Layer* container,
754 LayerImpl* layer,
758 if (!layer->position_constraint().is_fixed_position())
761 // Special case: this layer is a composited fixed-position layer; we need to
763 // this layer fixed correctly.
769 // the layer should relocate itself if the container changes its size.
771 layer->position_constraint().is_fixed_to_right_edge();
773 layer->position_constraint().is_fixed_to_bottom_edge();
783 ComputeSizeDeltaCompensation(layer, container, position_offset));
790 // For every layer that has non-zero scroll_delta, we have to compute a
792 // want this matrix to premultiply a fixed-position layer's parent_matrix, so
805 // space. So this matrix can pre-multiply any fixed-position layer's
807 // layer is fixed onto the same render_target as this scrolling_layer.
826 Layer* current_layer,
830 // The main thread (i.e. Layer) does not need to worry about scroll
836 LayerImpl* layer,
841 // scroll_delta translations that occurred since the nearest container layer,
846 // - A layer that is both a fixed-position and container should not be its
849 // - A layer that is a fixed-position container and has a render_surface
852 // - A layer that does not have an explicit container is simply fixed to the
854 // - If the fixed-position layer has its own render_surface, then the
862 // - the current layer is a container for fixed-position descendants
863 // - the current layer is fixed-position itself, so any fixed-position
864 // descendants are positioned with respect to this layer. Thus, any
866 // that occur below this layer.
868 layer->IsContainerForFixedPositionLayers() ||
869 layer->position_constraint().is_fixed_position();
875 scroll_delta.IsZero() && !layer->render_surface())
881 // If this layer does not reset scroll compensation, then it inherits the
886 // If the current layer has a non-zero scroll_delta, then we should compute
892 layer, parent_matrix, scroll_delta);
897 // If the layer created its own render_surface, we have to adjust
904 if (layer->render_surface() &&
908 if (!layer->render_surface()->draw_transform().GetInverse(
915 layer->render_surface()->draw_transform();
923 LayerType* layer,
928 layer->draw_properties().ideal_contents_scale = ideal_contents_scale;
929 layer->draw_properties().maximum_animation_contents_scale =
931 layer->draw_properties().page_scale_factor = page_scale_factor;
932 layer->draw_properties().device_scale_factor = device_scale_factor;
936 LayerImpl* layer,
947 Layer* layer,
953 layer->CalculateContentsScale(contents_scale,
958 &layer->draw_properties().contents_scale_x,
959 &layer->draw_properties().contents_scale_y,
960 &layer->draw_properties().content_bounds);
962 Layer* mask_layer = layer->mask_layer();
975 Layer* replica_mask_layer =
976 layer->replica_layer() ? layer->replica_layer()->mask_layer() : NULL;
991 LayerImpl* layer,
998 CalculateContentsScale(layer,
1007 Layer* layer,
1018 bool need_to_set_raster_scale = layer->raster_scale_is_unknown();
1022 if (!need_to_set_raster_scale && layer->raster_scale() != 1.f &&
1023 ideal_raster_scale != layer->raster_scale()) {
1032 layer->set_raster_scale(ideal_raster_scale);
1037 if (!layer->raster_scale_is_unknown())
1038 raster_scale = layer->raster_scale();
1040 gfx::Size old_content_bounds = layer->content_bounds();
1041 float old_contents_scale_x = layer->contents_scale_x();
1042 float old_contents_scale_y = layer->contents_scale_y();
1045 CalculateContentsScale(layer,
1052 if (layer->content_bounds() != old_content_bounds ||
1053 layer->contents_scale_x() != old_contents_scale_x ||
1054 layer->contents_scale_y() != old_contents_scale_y)
1055 layer->SetNeedsPushProperties();
1059 Layer* layer,
1071 LayerImpl* layer,
1100 !layer->layer_animation_controller()->HasOnlyTranslationTransforms();
1119 // At this point, we know either the layer or an ancestor, but not both,
1124 MathUtil::ComputeTransform2dScaleComponents(layer->transform(), 0.f);
1132 if (!layer->layer_animation_controller()->MaximumScale(
1146 LayerType* layer) {
1147 if (!layer->render_surface()) {
1148 layer->CreateRenderSurface();
1149 return layer->render_surface();
1152 layer->render_surface()->ClearLayerLists();
1153 return layer->render_surface();
1158 LayerTypePtr layer,
1160 layer->draw_properties().last_drawn_render_surface_layer_list_id =
1166 LayerTypePtr layer,
1168 if (layer->mask_layer()) {
1169 MarkLayerWithRenderSurfaceLayerListId(layer->mask_layer(),
1172 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) {
1173 MarkLayerWithRenderSurfaceLayerListId(layer->replica_layer()->mask_layer(),
1197 // Technically, we know that the layer we want to remove should be
1239 // Recursively walks the layer tree to compute any information that is needed
1243 LayerType* layer,
1245 bool has_delegated_content = layer->HasDelegatedContent();
1248 layer->draw_properties().sorted_for_recursion = false;
1249 layer->draw_properties().has_child_with_a_scroll_parent = false;
1251 if (!HasInvertibleOrAnimatedTransform(layer)) {
1265 if (layer->clip_parent())
1268 for (size_t i = 0; i < layer->children().size(); ++i) {
1270 LayerTreeHostCommon::get_layer_as_raw_ptr(layer->children(), i);
1280 layer->draw_properties().has_child_with_a_scroll_parent = true;
1284 if (layer->clip_children()) {
1285 int num_clip_children = layer->clip_children()->size();
1290 if (layer->HasCopyRequest())
1293 if (!layer->touch_event_handler_region().IsEmpty() ||
1294 layer->have_wheel_event_handlers())
1297 layer->draw_properties().num_descendants_that_draw_content =
1299 layer->draw_properties().num_unclipped_descendants =
1301 layer->draw_properties().layer_or_descendant_has_copy_request =
1303 layer->draw_properties().layer_or_descendant_has_input_handler =
1325 // The accumulated sequence of transforms a layer will use to determine its
1329 // The accumulated sequence of transforms a layer will use to determine its
1334 // fixed-position layer and its container, so that the layer actually does
1345 // When the layer's children want to compute their visible content rect, they
1350 // this value redundantly for each child layer, it is computed only once
1351 // while dealing with the parent layer, and then this precomputed value is
1355 // The maximum amount by which this layer will be scaled during the lifetime
1370 LayerType* layer) {
1371 for (LayerType* ancestor = layer; ancestor; ancestor = ancestor->parent()) {
1382 LayerType* layer) {
1388 // Take for example this layer tree:
1407 // So our first task at this step of the recursion is to determine the layer
1409 // containing |layer|.
1410 LayerType* child = GetChildContainingLayer(parent, layer);
1443 static void GetNewDescendantsStartIndexAndCount(LayerType* layer,
1446 *start_index = layer->draw_properties().index_of_first_descendants_addition;
1447 *count = layer->draw_properties().num_descendants_added;
1451 static void GetNewRenderSurfacesStartIndexAndCount(LayerType* layer,
1454 *start_index = layer->draw_properties()
1456 *count = layer->draw_properties().num_render_surfaces_added;
1494 // Recursively walks the layer tree starting at the given node and computes all
1498 LayerType* layer,
1506 // layer and all its descendants. It also computes the appropriate render
1513 // 1. In our terminology, the "layer origin" refers to the top-left corner of
1514 // a layer, and the positive Y-axis points downwards. This interpretation is
1519 // layer space", where the bounds of the layer map to [0, 1]. However, as a
1520 // Transform object, the transform to the anchor point is specified in "layer
1521 // space", where the bounds of the layer map to [bounds.width(),
1532 // this layer's origin.
1534 // Tr[origin2anchor] is the translation from the layer's origin to its
1537 // Tr[origin2center] is the translation from the layer's origin to its
1540 // M[layer] is the layer's matrix (applied at the anchor point)
1542 // S[layer2content] is the ratio of a layer's content_bounds() to its
1547 // composite_layer_transform = Tr[origin2anchor] * M[layer] *
1550 // 4. When a layer (or render surface) is drawn, it is drawn into a "target
1552 // transform from screen space to local layer space. Instead, the draw
1554 // local layer space. Note that render surfaces, except for the root, also
1561 // The draw transform for the layer is:
1563 // S[layer2content] = M[parent] * Tr[layer->position() + anchor] *
1564 // M[layer] * Tr[anchor2origin] * S[layer2content]
1567 // layer's render surface to the origin of the layer in content space.
1572 // = M[root] * Tr[layer->position() + anchor] * M[layer]
1576 // render surface's content space to the origin of the layer in content
1583 // = M[parent] * Tr[layer->position() + anchor] *
1584 // M[layer] * Tr[anchor2origin]
1589 // Finally, note that the final matrix used by the shader for the layer is P *
1593 // layer's size)
1595 // When a render surface has a replica layer, that layer's transform is used
1598 // replica layer.
1621 // which layer roots the subtree the scale is applied to.
1640 !layer->hide_layer_and_subtree();
1641 const bool layer_is_drawn = layer_is_visible || layer->HasCopyRequest();
1643 // The root layer cannot skip CalcDrawProperties.
1644 if (!IsRootLayer(layer) && SubtreeShouldBeSkipped(layer, layer_is_drawn)) {
1645 if (layer->render_surface())
1646 layer->ClearRenderSurfaceLayerList();
1653 // separate the clipping hierarchy from the layer hierarchy.
1662 layer, &ancestor_clip_rect_in_target_space, &ancestor_clips_subtree);
1665 // layer that actually get computed. To avoid unnecessary copies
1668 DrawProperties<LayerType>& layer_draw_properties = layer->draw_properties();
1674 // the surface's clip rect redundantly for every layer. This value is the
1680 float accumulated_draw_opacity = layer->opacity();
1681 bool animating_opacity_to_target = layer->OpacityIsAnimating();
1683 if (layer->parent()) {
1684 accumulated_draw_opacity *= layer->parent()->draw_opacity();
1685 animating_opacity_to_target |= layer->parent()->draw_opacity_is_animating();
1687 layer->parent()->screen_space_opacity_is_animating();
1690 bool animating_transform_to_target = layer->TransformIsAnimating();
1692 if (layer->parent()) {
1694 layer->parent()->draw_transform_is_animating();
1696 layer->parent()->screen_space_transform_is_animating();
1698 gfx::Point3F transform_origin = layer->transform_origin();
1699 gfx::Vector2dF scroll_offset = GetEffectiveTotalScrollOffset(layer);
1700 gfx::PointF position = layer->position() - scroll_offset;
1702 if (!layer->transform().IsIdentity()) {
1707 // LT = Tr[origin] * Tr[origin2origin] * M[layer]
1708 combined_transform.PreconcatTransform(layer->transform());
1709 // LT = Tr[origin] * Tr[origin2origin] * M[layer] *
1717 gfx::Vector2dF effective_scroll_delta = GetEffectiveScrollDelta(layer);
1718 if (!animating_transform_to_target && layer->scrollable() &&
1720 // Align the scrollable layer's position to screen space pixels to avoid
1731 // the layer's transform). For example, if we have a total scale factor of
1742 ApplyPositionAdjustment(layer, data_from_ancestor.fixed_container,
1749 layer,
1762 // surface. From there, we can decide on a contents scale for the layer.
1777 layer,
1788 layer,
1796 LayerType* mask_layer = layer->mask_layer();
1809 layer->replica_layer() ? layer->replica_layer()->mask_layer() : NULL;
1821 // The draw_transform that gets computed below is effectively the layer's
1822 // draw_transform, unless the layer itself creates a render_surface. In that
1827 SK_MScalar1 / layer->contents_scale_x(),
1828 SK_MScalar1 / layer->contents_scale_y());
1830 // The layer's screen_space_transform represents the transform between root
1831 // layer's "screen space" and local content space.
1834 if (layer->should_flatten_transform())
1851 gfx::Rect content_rect(layer->content_bounds());
1855 // space. next_hierarchy_matrix will only change if this layer uses a new
1860 // If the subtree will scale layer contents by the transform hierarchy, then
1871 layer, combined_transform.Preserves2dAxisAlignment());
1873 render_to_separate_surface = IsRootLayer(layer);
1878 if (!layer->double_sided() && TransformToParentIsKnown(layer) &&
1879 IsSurfaceBackFaceVisible(layer, combined_transform)) {
1880 layer->ClearRenderSurfaceLayerList();
1885 CreateOrReuseRenderSurface(layer);
1887 if (IsRootLayer(layer)) {
1888 // The root layer's render surface size is predetermined and so the root
1889 // layer can't directly support non-identity transforms. It should just
1895 layer->render_surface()->set_contributes_to_drawn_surface(false);
1897 // The owning layer's draw transform has a scale from content to layer
1905 // The owning layer's transform was re-parented by the surface, so the
1906 // layer's new draw_transform only needs to scale the layer to surface
1910 Scale(render_surface_sublayer_scale.x() / layer->contents_scale_x(),
1911 render_surface_sublayer_scale.y() / layer->contents_scale_y());
1913 // Inside the surface's subtree, we scale everything to the owning layer's
1914 // scale. The sublayer matrix transforms layer rects into target surface
1917 // but we apply it explicitly to the owning layer and the remainder of the
1925 layer->render_surface()->set_contributes_to_drawn_surface(
1929 // The opacity value is moved from the layer to its surface, so that the
1954 if (layer->mask_layer()) {
1956 layer->mask_layer()->draw_properties();
1957 mask_layer_draw_properties.render_target = layer;
1959 gfx::Rect(layer->content_bounds());
1962 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) {
1964 layer->replica_layer()->mask_layer()->draw_properties();
1965 replica_mask_draw_properties.render_target = layer;
1967 gfx::Rect(layer->content_bounds());
1973 // where both layer and the replica are occluded, but this seems like an
1977 if (layer->HasCopyRequest() ||
1978 layer->has_replica() ||
1979 layer->filters().HasReferenceFilter() ||
1980 layer->filters().HasFilterThatMovesPixels()) {
1989 // It may be the layer or the surface doing the clipping of the subtree,
2007 // layer clipping for correctess. NB: since we can only encounter
2026 DCHECK(layer->render_surface());
2027 DCHECK(!layer->parent() || layer->parent()->render_target() ==
2031 AccumulatedSurfaceState<LayerType>(layer));
2045 render_surface_layer_list->push_back(layer);
2047 DCHECK(layer->parent());
2061 layer->ClearRenderSurface();
2078 layer_draw_properties.render_target = layer->parent()->render_target();
2085 MathUtil::MapEnclosingClippedRect(layer->draw_transform(), content_rect);
2087 if (LayerClipsSubtree(layer)) {
2089 if (ancestor_clips_subtree && !layer->render_surface()) {
2090 // A layer without render surface shares the same target as its ancestor.
2099 // Tell the layer the rect that it's clipped by. In theory we could use a
2109 // layer, just in case clipping is still accidentally used.
2114 (layer->render_surface() ? layer->render_surface()->layer_list()
2117 // Any layers that are appended after this point are in the layer's subtree
2121 if (!LayerShouldBeSkipped(layer, layer_is_drawn)) {
2122 MarkLayerWithRenderSurfaceLayerListId(layer,
2124 descendants.push_back(layer);
2133 if (!layer->children().empty()) {
2134 if (layer == globals.page_scale_application_layer) {
2141 // Flatten to 2D if the layer doesn't preserve 3D.
2142 if (layer->should_flatten_transform())
2147 layer,
2152 layer->IsContainerForFixedPositionLayers() ?
2153 layer : data_from_ancestor.fixed_container;
2168 child_order_changed = SortChildrenForRecursion(&sorted_children, *layer);
2170 for (size_t i = 0; i < layer->children().size(); ++i) {
2171 // If one of layer's children has a scroll parent, then we may have to
2174 // layer's list of children.
2178 : LayerTreeHostCommon::get_layer_as_raw_ptr(layer->children(), i);
2197 // we need to mark just the mask layer (and replica mask layer)
2213 // Add the unsorted layer list contributions, if necessary.
2216 *layer,
2222 *layer,
2232 if (layer->render_surface()) {
2233 DCHECK(accumulated_surface_state->back().render_target == layer);
2237 if (layer->render_surface() && !IsRootLayer(layer) &&
2238 layer->render_surface()->layer_list().empty()) {
2239 RemoveSurfaceForEarlyExit(layer, render_surface_layer_list);
2243 // Compute the layer's drawable content rect (the rect is in target surface
2250 if (layer->DrawsContent()) {
2255 // Compute the layer's visible content rect (the rect is in content space).
2257 layer, clip_rect_of_target_surface_in_target_space, rect_in_target_space);
2259 // Compute the remaining properties for the render surface, if the layer has
2261 if (IsRootLayer(layer)) {
2262 // The root layer's surface's content_rect is always the entire viewport.
2263 DCHECK(layer->render_surface());
2264 layer->render_surface()->SetContentRect(
2266 } else if (layer->render_surface()) {
2268 layer->render_surface();
2271 // Don't clip if the layer is reflected as the reflection shouldn't be
2272 // clipped. If the layer is animating, then the surface's transform to
2275 if (!layer->replica_layer() && TransformToParentIsKnown(layer)) {
2277 // here, because we are looking at this layer's render_surface, not the
2278 // layer itself.
2296 RemoveSurfaceForEarlyExit(layer, render_surface_layer_list);
2302 // either root_for_isolated_group, or the root of the layer tree.
2303 // Otherwise, this layer will use an incomplete backdrop, limited to its
2305 DCHECK(layer->uses_default_blend_mode() || IsRootLayer(layer) ||
2306 !layer->parent()->render_target() ||
2307 IsRootLayer(layer->parent()->render_target()) ||
2308 layer->parent()->render_target()->is_root_for_isolated_group());
2312 // The owning layer's screen_space_transform has a scale from content to
2313 // layer space which we need to undo and replace with a scale from the
2314 // surface's subtree into layer space.
2315 gfx::Transform screen_space_transform = layer->screen_space_transform();
2317 layer->contents_scale_x() / render_surface_sublayer_scale.x(),
2318 layer->contents_scale_y() / render_surface_sublayer_scale.y());
2321 if (layer->replica_layer()) {
2326 layer->replica_layer()->position().x() +
2327 layer
2328 layer->replica_layer()->position().y() +
2329 layer->replica_layer()->transform_origin().y());
2331 layer->replica_layer()->transform());
2333 -layer->replica_layer()->transform_origin().x(),
2334 -layer->replica_layer()->transform_origin().y());
2342 layer->render_surface()->draw_transform() *
2349 layer->render_surface()->screen_space_transform() *
2356 SavePaintPropertiesLayer(layer);
2358 // If neither this layer nor any of its children were added, early out.
2360 DCHECK(!layer->render_surface() || IsRootLayer(layer));
2368 if (globals.layer_sorter && descendants.size() && layer->Is3dSorted() &&
2369 !LayerIsInExisting3DRenderingContext(layer)) {
2376 layer, local_drawable_content_rect_of_subtree, accumulated_surface_state);
2378 if (layer->HasContributingDelegatedRenderPasses()) {
2379 layer->render_target()->render_surface()->
2380 AddContributingDelegatedRenderPassLayer(layer);
2397 // The root layer's render_surface should receive the device viewport as the
2441 SubtreeGlobals<Layer> globals;
2442 DataForRecursion<Layer> data_for_recursion;
2447 std::vector<AccumulatedSurfaceState<Layer> > accumulated_surface_state;
2448 CalculateDrawPropertiesInternal<Layer>(
2457 // The dummy layer list should not have been used.
2459 // A root layer render_surface should always exist after
2487 // The dummy layer list should not have been used.
2489 // A root layer render_surface should always exist after