Lines Matching refs:layer

12 #include "cc/layers/layer.h"
44 static gfx::Vector2dF GetEffectiveScrollDelta(LayerType* layer) {
45 gfx::Vector2dF scroll_delta = layer->ScrollDelta();
47 // compositor thread since the commit for this layer tree's source frame.
50 if (layer->scroll_parent())
51 scroll_delta += layer->scroll_parent()->ScrollDelta();
56 static gfx::Vector2dF GetEffectiveTotalScrollOffset(LayerType* layer) {
57 gfx::Vector2dF offset = layer->TotalScrollOffset();
60 // scroll children's positions by the main thread layer positioning code.
61 if (layer->scroll_parent())
62 offset += layer->scroll_parent()->ScrollDelta();
74 // Is this layer fully contained within the target surface?
78 // If the layer doesn't fill up the entire surface, then find the part of
79 // the surface rect where the layer could be visible. This avoids trying to
87 // Project the corners of the target surface rect into the layer space.
95 // the layer is visible, we must conservatively assume the full layer is
117 static LayerType* NextTargetSurface(LayerType* layer) {
118 return layer->parent() ? layer->parent()->render_target() : 0;
167 // Attempts to update the clip rects for the given layer. If the layer has a
171 const LayerType* layer,
174 // If the layer has no clip_parent, or the ancestor is the same as its actual
177 const LayerType* clip_parent = layer->scroll_parent();
180 clip_parent = layer->clip_parent();
182 if (!clip_parent || clip_parent == layer->parent())
185 // The root layer is never a clip child.
186 DCHECK(layer->parent());
198 if (clip_parent == layer->clip_parent()) {
201 *layer->parent(),
210 TranslateRectToTargetSpace<LayerType>(*layer->parent(),
218 // Typically, a layer will contribute to only one surface, the surface
223 // NB: we accumulate the layer's *clipped* drawable content rect.
242 LayerType* layer,
246 if (IsRootLayer(layer))
256 LayerType* render_target = layer->clip_parent()
257 ? layer->clip_parent()->render_target()
258 : layer->parent()->render_target();
260 // If the layer owns a surface, then the content rect is in the wrong space.
264 if (layer->render_surface()) {
266 gfx::ToEnclosedRect(layer->render_surface()->DrawableContentRect());
271 // If the layer has a clip parent, the clip rect may be in the wrong space,
273 if (layer->clip_parent()) {
275 *layer->clip_parent(),
276 *layer,
325 template <typename LayerType> static inline bool IsRootLayer(LayerType* layer) {
326 return !layer->parent();
330 static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) {
331 // According to current W3C spec on CSS transforms, a layer is part of an
334 return layer->parent() && layer->parent()->preserves_3d();
338 static bool IsRootLayerOfNewRenderingContext(LayerType* layer) {
339 // According to current W3C spec on CSS transforms (Section 6.1), a layer is
341 // transform-style: preserve-3d, but this layer itself does.
342 if (layer->parent())
343 return !layer->parent()->preserves_3d() && layer->preserves_3d();
345 return layer->preserves_3d();
349 static bool IsLayerBackFaceVisible(LayerType* layer) {
351 // be determined differently depending on whether the layer is in a "3d
355 if (LayerIsInExisting3DRenderingContext(layer))
356 return layer->draw_transform().IsBackFaceVisible();
358 // In this case, either the layer establishes a new 3d rendering context, or
360 return layer->transform().IsBackFaceVisible();
364 static bool IsSurfaceBackFaceVisible(LayerType* layer,
366 if (LayerIsInExisting3DRenderingContext(layer))
369 if (IsRootLayerOfNewRenderingContext(layer))
370 return layer->transform().IsBackFaceVisible();
379 static inline bool LayerClipsSubtree(LayerType* layer) {
380 return layer->masks_to_bounds() || layer->mask_layer();
385 LayerType* layer,
388 DCHECK(layer->render_target());
390 // Nothing is visible if the layer bounds are empty.
391 if (!layer->DrawsContent() || layer->content_bounds().IsEmpty() ||
392 layer->drawable_content_rect().IsEmpty())
397 layer->drawable_content_rect();
399 if (!layer->render_target()->render_surface()->clip_rect().IsEmpty()) {
400 // The |layer| L has a target T which owns a surface Ts. The surface Ts
403 // In this case the target surface Ts does clip the layer L that contributes
408 // layer.
418 gfx::Rect(layer->content_bounds()),
420 layer->draw_transform());
423 static inline bool TransformToParentIsKnown(LayerImpl* layer) { return true; }
425 static inline bool TransformToParentIsKnown(Layer* layer) {
426 return !layer->TransformIsAnimating();
429 static inline bool TransformToScreenIsKnown(LayerImpl* layer) { return true; }
431 static inline bool TransformToScreenIsKnown(Layer* layer) {
432 return !layer->screen_space_transform_is_animating();
436 static bool LayerShouldBeSkipped(LayerType* layer,
441 // - the layer is not double-sided, but its back face is visible.
447 // - the intersection of render_surface content and layer clip_rect is empty
450 // Note, if the layer should not have been drawn due to being fully
457 if (layer->bounds().IsEmpty())
460 LayerType* backface_test_layer = layer;
461 if (layer->use_parent_backface_visibility()) {
462 DCHECK(layer->parent());
463 DCHECK(!layer->parent()->use_parent_backface_visibility());
464 backface_test_layer = layer->parent();
467 // The layer should not be drawn if (1) it is not double-sided and (2) the
468 // back of the layer is known to be facing the screen.
474 // The layer is visible to events. If it's subject to hit testing, then
476 bool can_accept_input = !layer->touch_event_handler_region().IsEmpty() ||
477 layer->have_wheel_event_handlers();
478 if (!layer->DrawsContent() && !can_accept_input)
484 static inline bool SubtreeShouldBeSkipped(LayerImpl* layer,
486 // When we need to do a readback/copy of a layer's output, we can not skip
488 if (layer->draw_properties().layer_or_descendant_has_copy_request)
491 // If the layer is not visible, then skip it and its subtree.
495 // If layer is on the pending tree and opacity is being animated then
497 // include tiles for this layer when deciding if tree can be activated.
498 if (layer->layer_tree_impl()->IsPendingTree() && layer->OpacityIsAnimating())
501 // The opacity of a layer always applies to its children (either implicitly
503 // entire subtree can be skipped if this layer is fully transparent.
505 return !layer->opacity();
508 static inline bool SubtreeShouldBeSkipped(Layer* layer,
510 // When we need to do a readback/copy of a layer's output, we can not skip
512 if (layer->draw_properties().layer_or_descendant_has_copy_request)
515 // If the layer is not visible, then skip it and its subtree.
526 return !layer->opacity() && !layer->OpacityIsAnimating() &&
527 !layer->OpacityCanAnimateOnImplThread();
530 static inline void SavePaintPropertiesLayer(LayerImpl* layer) {}
532 static inline void SavePaintPropertiesLayer(Layer* layer) {
533 layer->SavePaintProperties();
535 if (layer->mask_layer())
536 layer->mask_layer()->SavePaintProperties();
537 if (layer->replica_layer() && layer->replica_layer()->mask_layer())
538 layer->replica_layer()->mask_layer()->SavePaintProperties();
543 LayerType* layer,
546 // A layer and its descendants should render onto a new RenderSurfaceImpl if
550 // The root layer owns a render surface, but it never acts as a contributing
552 // a contributing surface can not be applied to the root layer. In order to
554 // in order to act as a contributing surface to the root layer's surface.
555 bool is_root = IsRootLayer(layer);
557 // If the layer uses a mask.
558 if (layer->mask_layer()) {
563 // If the layer has a reflection.
564 if (layer->replica_layer()) {
569 // If the layer uses a CSS filter.
570 if (!layer->filters().IsEmpty() || !layer->background_filters().IsEmpty()) {
576 layer->draw_properties().num_descendants_that_draw_content;
578 // If the layer flattens its subtree (i.e. the layer doesn't preserve-3d), but
580 if (LayerIsInExisting3DRenderingContext(layer) && !layer->preserves_3d() &&
590 // If the layer has blending.
594 if (!layer->uses_default_blend_mode()) {
603 // If the layer clips its descendants but it is not axis-aligned with respect
606 LayerClipsSubtree(layer) || layer->HasDelegatedContent();
617 // If the layer has some translucency and does not have a preserves-3d
619 // layers in the subtree overlap. But checking layer overlaps is unnecessarily
624 (layer->DrawsContent() || num_descendants_that_draw_content > 1);
626 if (layer->opacity() != 1.f && !layer->preserves_3d() &&
636 // The root layer should always have a render_surface.
645 // If the layer has isolation.
647 // the blending descendants might have access to the content behind this layer
648 // (layer has transparent background or descendants overflow).
650 if (layer->is_root_for_isolated_group()) {
659 if (layer->force_render_surface())
662 // If we'll make a copy of the layer's contents.
663 if (layer->HasCopyRequest())
670 // that's in the layer's target surface coordinate, while the position offset is
671 // specified in some ancestor layer's coordinate.
673 LayerImpl* layer,
678 // To apply a translate in the container's layer space,
683 // container's layer space
690 for (LayerImpl* current_target_surface = NextTargetSurface(layer);
709 // the container render surface to the container layer.
722 // projection. For example ScaleZ(0) is non-invertible but the layer is
738 Layer* layer,
743 LayerImpl* layer,
747 if (!layer->position_constraint().is_fixed_position())
750 // Special case: this layer is a composited fixed-position layer; we need to
752 // this layer fixed correctly.
758 // the layer should relocate itself if the container changes its size.
760 layer->position_constraint().is_fixed_to_right_edge();
762 layer->position_constraint().is_fixed_to_bottom_edge();
772 ComputeSizeDeltaCompensation(layer, container, position_offset));
779 // For every layer that has non-zero scroll_delta, we have to compute a
781 // want this matrix to premultiply a fixed-position layer's parent_matrix, so
794 // space. So this matrix can pre-multiply any fixed-position layer's
796 // layer is fixed onto the same render_target as this scrolling_layer.
825 LayerImpl* layer,
830 // scroll_delta translations that occurred since the nearest container layer,
835 // - A layer that is both a fixed-position and container should not be its
838 // - A layer that is a fixed-position container and has a render_surface
841 // - A layer that does not have an explicit container is simply fixed to the
843 // - If the fixed-position layer has its own render_surface, then the
851 // - the current layer is a container for fixed-position descendants
852 // - the current layer is fixed-position itself, so any fixed-position
853 // descendants are positioned with respect to this layer. Thus, any
855 // that occur below this layer.
857 layer->IsContainerForFixedPositionLayers() ||
858 layer->position_constraint().is_fixed_position();
864 scroll_delta.IsZero() && !layer->render_surface())
870 // If this layer does not reset scroll compensation, then it inherits the
875 // If the current layer has a non-zero scroll_delta, then we should compute
881 layer, parent_matrix, scroll_delta);
886 // If the layer created its own render_surface, we have to adjust
893 if (layer->render_surface() &&
897 if (!layer->render_surface()->draw_transform().GetInverse(
904 layer->render_surface()->draw_transform();
911 static inline void CalculateContentsScale(LayerType* layer,
916 layer->CalculateContentsScale(contents_scale,
920 &layer->draw_properties().contents_scale_x,
921 &layer->draw_properties().contents_scale_y,
922 &layer->draw_properties().content_bounds);
924 LayerType* mask_layer = layer->mask_layer();
937 layer->replica_layer() ? layer->replica_layer()->mask_layer() : NULL;
951 LayerImpl* layer,
957 CalculateContentsScale(layer,
965 Layer* layer,
975 bool need_to_set_raster_scale = layer->raster_scale_is_unknown();
979 if (!need_to_set_raster_scale && layer->raster_scale() != 1.f &&
980 ideal_raster_scale != layer->raster_scale()) {
989 layer->set_raster_scale(ideal_raster_scale);
994 if (!layer->raster_scale_is_unknown())
995 raster_scale = layer->raster_scale();
999 CalculateContentsScale(layer,
1006 static inline RenderSurface* CreateOrReuseRenderSurface(Layer* layer) {
1010 DCHECK(!layer->render_surface());
1011 layer->CreateRenderSurface();
1012 return layer->render_surface();
1015 static inline RenderSurfaceImpl* CreateOrReuseRenderSurface(LayerImpl* layer) {
1016 if (!layer->render_surface()) {
1017 layer->CreateRenderSurface();
1018 return layer->render_surface();
1021 layer->render_surface()->ClearLayerLists();
1022 return layer->render_surface();
1030 // Technically, we know that the layer we want to remove should be
1061 // Recursively walks the layer tree to compute any information that is needed
1065 LayerType* layer,
1067 bool has_delegated_content = layer->HasDelegatedContent();
1078 layer->draw_properties().sorted_for_recursion = false;
1079 layer->draw_properties().has_child_with_a_scroll_parent = false;
1081 if (layer->clip_parent())
1084 for (size_t i = 0; i < layer->children().size(); ++i) {
1086 LayerTreeHostCommon::get_child_as_raw_ptr(layer->children(), i);
1096 layer->draw_properties().has_child_with_a_scroll_parent = true;
1100 if (layer->clip_children()) {
1101 int num_clip_children = layer->clip_children()->size();
1106 if (layer->HasCopyRequest())
1109 layer->draw_properties().num_descendants_that_draw_content =
1111 layer->draw_properties().num_unclipped_descendants =
1113 layer->draw_properties().layer_or_descendant_has_copy_request =
1135 // The accumulated sequence of transforms a layer will use to determine its
1139 // The accumulated sequence of transforms a layer will use to determine its
1144 // fixed-position layer and its container, so that the layer actually does
1155 // When the layer's children want to compute their visible content rect, they
1160 // this value redundantly for each child layer, it is computed only once
1161 // while dealing with the parent layer, and then this precomputed value is
1175 LayerType* layer) {
1176 for (LayerType* ancestor = layer; ancestor; ancestor = ancestor->parent()) {
1187 LayerType* layer) {
1193 // Take for example this layer tree:
1212 // So our first task at this step of the recursion is to determine the layer
1214 // containing |layer|.
1215 LayerType* child = GetChildContainingLayer(parent, layer);
1248 static void GetNewDescendantsStartIndexAndCount(LayerType* layer,
1251 *start_index = layer->draw_properties().index_of_first_descendants_addition;
1252 *count = layer->draw_properties().num_descendants_added;
1256 static void GetNewRenderSurfacesStartIndexAndCount(LayerType* layer,
1259 *start_index = layer->draw_properties()
1261 *count = layer->draw_properties().num_render_surfaces_added;
1291 // Recursively walks the layer tree starting at the given node and computes all
1295 LayerType* layer,
1303 // layer and all its descendants. It also computes the appropriate render
1310 // 1. In our terminology, the "layer origin" refers to the top-left corner of
1311 // a layer, and the positive Y-axis points downwards. This interpretation is
1316 // layer space", where the bounds of the layer map to [0, 1]. However, as a
1317 // Transform object, the transform to the anchor point is specified in "layer
1318 // space", where the bounds of the layer map to [bounds.width(),
1329 // this layer's origin.
1331 // Tr[origin2anchor] is the translation from the layer's origin to its
1334 // Tr[origin2center] is the translation from the layer's origin to its
1337 // M[layer] is the layer's matrix (applied at the anchor point)
1339 // M[sublayer] is the layer's sublayer transform (also applied at the
1340 // layer's anchor point)
1342 // S[layer2content] is the ratio of a layer's content_bounds() to its
1347 // composite_layer_transform = Tr[origin2anchor] * M[layer] *
1353 // 4. When a layer (or render surface) is drawn, it is drawn into a "target
1355 // transform from screen space to local layer space. Instead, the draw
1357 // local layer space. Note that render surfaces, except for the root, also
1364 // The draw transform for the layer is:
1366 // S[layer2content] = M[parent] * Tr[layer->position() + anchor] *
1367 // M[layer] * Tr[anchor2origin] * S[layer2content]
1370 // layer's render surface to the origin of the layer in content space.
1375 // = M[root] * Tr[layer->position() + anchor] * M[layer]
1379 // render surface's content space to the origin of the layer in content
1386 // = M[parent] * Tr[layer->position() + anchor] *
1387 // M[layer] * Tr[anchor2origin] *
1393 // Finally, note that the final matrix used by the shader for the layer is P *
1397 // layer's size)
1399 // When a render surface has a replica layer, that layer's transform is used
1402 // replica layer.
1425 // which layer roots the subtree the scale is applied to.
1443 !layer->hide_layer_and_subtree();
1444 if (layer->HasCopyRequest())
1447 // The root layer cannot skip CalcDrawProperties.
1448 if (!IsRootLayer(layer) && SubtreeShouldBeSkipped(layer, layer_is_visible)) {
1449 if (layer->render_surface())
1450 layer->ClearRenderSurface();
1457 // separate the clipping hierarchy from the layer hierarchy.
1466 layer, &ancestor_clip_rect_in_target_space, &ancestor_clips_subtree);
1469 // layer that actually get computed. To avoid unnecessary copies
1472 DrawProperties<LayerType>& layer_draw_properties = layer->draw_properties();
1478 // the surface's clip rect redundantly for every layer. This value is the
1484 float accumulated_draw_opacity = layer->opacity();
1485 bool animating_opacity_to_target = layer->OpacityIsAnimating();
1487 if (layer->parent()) {
1488 accumulated_draw_opacity *= layer->parent()->draw_opacity();
1489 animating_opacity_to_target |= layer->parent()->draw_opacity_is_animating();
1491 layer->parent()->screen_space_opacity_is_animating();
1494 bool animating_transform_to_target = layer->TransformIsAnimating();
1496 if (layer->parent()) {
1498 layer->parent()->draw_transform_is_animating();
1500 layer->parent()->screen_space_transform_is_animating();
1503 gfx::Size bounds = layer->bounds();
1504 gfx::PointF anchor_point = layer->anchor_point();
1505 gfx::Vector2dF scroll_offset = GetEffectiveTotalScrollOffset(layer);
1506 gfx::PointF position = layer->position() - scroll_offset;
1509 if (!layer->transform().IsIdentity()) {
1514 layer->anchor_point_z());
1515 // LT = Tr[origin] * Tr[origin2anchor] * M[layer]
1516 combined_transform.PreconcatTransform(layer->transform());
1517 // LT = Tr[origin] * Tr[origin2anchor] * M[layer] * Tr[anchor2origin]
1520 -layer->anchor_point_z());
1525 gfx::Vector2dF effective_scroll_delta = GetEffectiveScrollDelta(layer);
1526 if (!animating_transform_to_target && layer->scrollable() &&
1528 // Align the scrollable layer's position to screen space pixels to avoid
1541 ApplyPositionAdjustment(layer, data_from_ancestor.fixed_container,
1545 // surface. From there, we can decide on a contents scale for the layer.
1560 layer,
1568 // The draw_transform that gets computed below is effectively the layer's
1569 // draw_transform, unless the layer itself creates a render_surface. In that
1574 SK_MScalar1 / layer->contents_scale_x(),
1575 SK_MScalar1 / layer->contents_scale_y());
1577 // The layer's screen_space_transform represents the transform between root
1578 // layer's "screen space" and local content space.
1581 if (!layer->preserves_3d())
1598 gfx::RectF content_rect(layer->content_bounds());
1602 // space. next_hierarchy_matrix will only change if this layer uses a new
1607 // If the subtree will scale layer contents by the transform hierarchy, then
1618 layer, combined_transform.Preserves2dAxisAlignment());
1620 render_to_separate_surface = IsRootLayer(layer);
1625 if (!layer->double_sided() && TransformToParentIsKnown(layer) &&
1626 IsSurfaceBackFaceVisible(layer, combined_transform)) {
1627 layer->ClearRenderSurface();
1632 CreateOrReuseRenderSurface(layer);
1634 if (IsRootLayer(layer)) {
1635 // The root layer's render surface size is predetermined and so the root
1636 // layer can't directly support non-identity transforms. It should just
1642 layer->render_surface()->set_contributes_to_drawn_surface(false);
1644 // The owning layer's draw transform has a scale from content to layer
1652 // The owning layer's transform was re-parented by the surface, so the
1653 // layer's new draw_transform only needs to scale the layer to surface
1657 Scale(render_surface_sublayer_scale.x() / layer->contents_scale_x(),
1658 render_surface_sublayer_scale.y() / layer->contents_scale_y());
1660 // Inside the surface's subtree, we scale everything to the owning layer's
1661 // scale. The sublayer matrix transforms layer rects into target surface
1664 // but we apply it explicitly to the owning layer and the remainder of the
1670 layer->render_surface()->set_contributes_to_drawn_surface(
1675 // The opacity value is moved from the layer to its surface, so that the
1700 if (layer->mask_layer()) {
1702 layer->mask_layer()->draw_properties();
1703 mask_layer_draw_properties.render_target = layer;
1705 gfx::Rect(layer->content_bounds());
1708 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) {
1710 layer->replica_layer()->mask_layer()->draw_properties();
1711 replica_mask_draw_properties.render_target = layer;
1713 gfx::Rect(layer->content_bounds());
1719 // where both layer and the replica are occluded, but this seems like an
1723 if (layer->HasCopyRequest() ||
1724 layer->has_replica() ||
1725 layer->filters().HasReferenceFilter() ||
1726 layer->filters().HasFilterThatMovesPixels()) {
1735 // It may be the layer or the surface doing the clipping of the subtree,
1754 // layer clipping for correctess. NB: since we can only encounter
1773 DCHECK(layer->render_surface());
1774 DCHECK(!layer->parent() || layer->parent()->render_target() ==
1778 AccumulatedSurfaceState<LayerType>(layer));
1792 render_surface_layer_list->push_back(layer);
1794 DCHECK(layer->parent());
1808 layer->ClearRenderSurface();
1825 layer_draw_properties.render_target = layer->parent()->render_target();
1832 MathUtil::MapClippedRect(layer->draw_transform(), content_rect));
1834 if (LayerClipsSubtree(layer)) {
1836 if (ancestor_clips_subtree && !layer->render_surface()) {
1837 // A layer without render surface shares the same target as its ancestor.
1846 // Tell the layer the rect that it's clipped by. In theory we could use a
1856 // layer, just in case clipping is still accidentally used.
1861 (layer->render_surface() ? layer->render_surface()->layer_list()
1864 // Any layers that are appended after this point are in the layer's subtree
1868 if (!LayerShouldBeSkipped(layer, layer_is_visible))
1869 descendants.push_back(layer);
1877 if (!layer->children().empty()) {
1878 if (layer == globals.page_scale_application_layer) {
1885 // Flatten to 2D if the layer doesn't preserve 3D.
1886 if (!layer->preserves_3d())
1889 // Apply the sublayer transform at the anchor point of the layer.
1890 if (!layer->sublayer_transform().IsIdentity()) {
1892 layer->anchor_point().x() * bounds.width(),
1893 layer->anchor_point().y() * bounds.height());
1895 layer->sublayer_transform());
1897 -layer->anchor_point().x() * bounds.width(),
1898 -layer->anchor_point().y() * bounds.height());
1903 layer,
1908 layer->IsContainerForFixedPositionLayers() ?
1909 layer : data_from_ancestor.fixed_container;
1924 child_order_changed = SortChildrenForRecursion(&sorted_children, *layer);
1926 for (size_t i = 0; i < layer->children().size(); ++i) {
1927 // If one of layer's children has a scroll parent, then we may have to
1930 // layer's list of children.
1934 : LayerTreeHostCommon::get_child_as_raw_ptr(layer->children(), i);
1961 // Add the unsorted layer list contributions, if necessary.
1964 *layer,
1970 *layer,
1980 if (layer->render_surface()) {
1981 DCHECK(accumulated_surface_state->back().render_target == layer);
1985 if (layer->render_surface() && !IsRootLayer(layer) &&
1986 layer->render_surface()->layer_list().empty()) {
1987 RemoveSurfaceForEarlyExit(layer, render_surface_layer_list);
1991 // Compute the layer's drawable content rect (the rect is in target surface
1998 if (layer->DrawsContent()) {
2003 // Compute the layer's visible content rect (the rect is in content space).
2005 layer, clip_rect_of_target_surface_in_target_space, rect_in_target_space);
2007 // Compute the remaining properties for the render surface, if the layer has
2009 if (IsRootLayer(layer)) {
2010 // The root layer's surface's content_rect is always the entire viewport.
2011 DCHECK(layer->render_surface());
2012 layer->render_surface()->SetContentRect(
2014 } else if (layer->render_surface()) {
2016 layer->render_surface();
2019 // Don't clip if the layer is reflected as the reflection shouldn't be
2020 // clipped. If the layer is animating, then the surface's transform to
2023 if (!layer->replica_layer() && TransformToParentIsKnown(layer)) {
2025 // here, because we are looking at this layer's render_surface, not the
2026 // layer itself.
2044 RemoveSurfaceForEarlyExit(layer, render_surface_layer_list);
2050 // either root_for_isolated_group, or the root of the layer tree.
2051 // Otherwise, this layer will use an incomplete backdrop, limited to its
2053 DCHECK(layer->uses_default_blend_mode() || IsRootLayer(layer) ||
2054 !layer->parent()->render_target() ||
2055 IsRootLayer(layer->parent()->render_target()) ||
2056 layer->parent()->render_target()->is_root_for_isolated_group());
2060 // The owning layer's screen_space_transform has a scale from content to
2061 // layer space which we need to undo and replace with a scale from the
2062 // surface's subtree into layer space.
2063 gfx::Transform screen_space_transform = layer->screen_space_transform();
2065 layer->contents_scale_x() / render_surface_sublayer_scale.x(),
2066 layer->contents_scale_y() / render_surface_sublayer_scale.y());
2069 if (layer->replica_layer()) {
2074 layer->replica_layer()->position().x() +
2075 layer->replica_layer()->anchor_point().x() * bounds.width(),
2076 layer->replica_layer()->position().y() +
2077 layer->replica_layer()->anchor_point().y() * bounds.height());
2079 layer->replica_layer()->transform());
2081 -layer->replica_layer()->anchor_point().x() * bounds.width(),
2082 -layer->replica_layer()->anchor_point().y() * bounds.height());
2090 layer->render_surface()->draw_transform() *
2097 layer->render_surface()->screen_space_transform() *
2104 SavePaintPropertiesLayer(layer);
2106 // If neither this layer nor any of its children were added, early out.
2108 DCHECK(!layer->render_surface() || IsRootLayer(layer));
2116 if (globals.layer_sorter && descendants.size() && layer->preserves_3d() &&
2117 (!layer->parent() || !layer->parent()->preserves_3d())) {
2124 layer, local_drawable_content_rect_of_subtree, accumulated_surface_state);
2126 if (layer->HasContributingDelegatedRenderPasses()) {
2127 layer->render_target()->render_surface()->
2128 AddContributingDelegatedRenderPassLayer(layer);
2143 // The root layer's render_surface should receive the device viewport as the
2181 // The dummy layer list should not have been used.
2183 // A root layer render_surface should always exist after
2201 // The root layer's render_surface should receive the device viewport as the
2240 // The dummy layer list should not have been used.
2242 // A root layer render_surface should always exist after
2305 LayerImpl* layer) {
2306 LayerImpl* current_layer = layer;
2308 // Walk up the layer tree and hit-test any render_surfaces and any layer
2364 // At this point, we think the point does hit the layer, but we need to walk
2365 // up the parents to ensure that the layer was not clipped in such a way
2366 // that the hit point actually should not hit the layer.
2370 // Skip the HUD layer.
2379 // not successfully hit test any layers, not even the root layer.
2386 // First find out which layer was hit from the saved list of visible layers
2392 // Walk up the hierarchy and look for a layer with a touch event handler
2417 // on the layer, but we need to walk up the parents to ensure that the layer
2419 // the layer.