OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.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 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1632 return true; | 1632 return true; |
1633 | 1633 |
1634 for (const ClipNode* clip_node = clip_tree.Node(layer->clip_tree_index()); | 1634 for (const ClipNode* clip_node = clip_tree.Node(layer->clip_tree_index()); |
1635 clip_node->id > 1; clip_node = clip_tree.parent(clip_node)) { | 1635 clip_node->id > 1; clip_node = clip_tree.parent(clip_node)) { |
1636 if (clip_node->data.applies_local_clip) { | 1636 if (clip_node->data.applies_local_clip) { |
1637 const TransformNode* transform_node = | 1637 const TransformNode* transform_node = |
1638 transform_tree.Node(clip_node->data.target_id); | 1638 transform_tree.Node(clip_node->data.target_id); |
1639 gfx::Rect combined_clip_in_target_space = | 1639 gfx::Rect combined_clip_in_target_space = |
1640 gfx::ToEnclosingRect(clip_node->data.combined_clip_in_target_space); | 1640 gfx::ToEnclosingRect(clip_node->data.combined_clip_in_target_space); |
1641 | 1641 |
1642 if (!PointHitsRect(screen_space_point, transform_node->data.to_screen, | 1642 const LayerImpl* target_layer = |
1643 combined_clip_in_target_space, NULL)) | 1643 layer->layer_tree_impl()->LayerById(transform_node->owner_id); |
1644 DCHECK(!target_layer || target_layer->render_surface()); | |
ajuma
2016/04/25 23:58:17
When is target_layer null here? (That is, when the
jaydasika
2016/04/26 00:49:32
For the root transform node (transform node with i
| |
1645 gfx::Transform surface_screen_space_transform = | |
1646 target_layer | |
1647 ? SurfaceScreenSpaceTransform(target_layer, transform_tree) | |
1648 : gfx::Transform(); | |
1649 if (!PointHitsRect(screen_space_point, surface_screen_space_transform, | |
1650 combined_clip_in_target_space, NULL)) { | |
1644 return true; | 1651 return true; |
1652 } | |
1645 } | 1653 } |
1646 const LayerImpl* clip_node_owner = | 1654 const LayerImpl* clip_node_owner = |
1647 layer->layer_tree_impl()->LayerById(clip_node->owner_id); | 1655 layer->layer_tree_impl()->LayerById(clip_node->owner_id); |
1648 if (clip_node_owner->render_surface() && | 1656 if (clip_node_owner->render_surface() && |
1649 !PointHitsRect( | 1657 !PointHitsRect( |
1650 screen_space_point, | 1658 screen_space_point, |
1651 SurfaceScreenSpaceTransform(clip_node_owner, transform_tree), | 1659 SurfaceScreenSpaceTransform(clip_node_owner, transform_tree), |
1652 clip_node_owner->render_surface()->content_rect(), NULL)) { | 1660 clip_node_owner->render_surface()->content_rect(), NULL)) { |
1653 return true; | 1661 return true; |
1654 } | 1662 } |
(...skipping 12 matching lines...) Expand all Loading... | |
1667 transform_tree); | 1675 transform_tree); |
1668 } | 1676 } |
1669 | 1677 |
1670 static bool PointHitsLayer(const LayerImpl* layer, | 1678 static bool PointHitsLayer(const LayerImpl* layer, |
1671 const gfx::PointF& screen_space_point, | 1679 const gfx::PointF& screen_space_point, |
1672 float* distance_to_intersection, | 1680 float* distance_to_intersection, |
1673 const TransformTree& transform_tree, | 1681 const TransformTree& transform_tree, |
1674 const ClipTree& clip_tree) { | 1682 const ClipTree& clip_tree) { |
1675 gfx::Rect content_rect(layer->bounds()); | 1683 gfx::Rect content_rect(layer->bounds()); |
1676 if (!PointHitsRect(screen_space_point, layer->ScreenSpaceTransform(), | 1684 if (!PointHitsRect(screen_space_point, layer->ScreenSpaceTransform(), |
1677 content_rect, distance_to_intersection)) | 1685 content_rect, distance_to_intersection)) { |
1678 return false; | 1686 return false; |
1687 } | |
1679 | 1688 |
1680 // At this point, we think the point does hit the layer, but we need to walk | 1689 // At this point, we think the point does hit the layer, but we need to walk |
1681 // up the parents to ensure that the layer was not clipped in such a way | 1690 // up the parents to ensure that the layer was not clipped in such a way |
1682 // that the hit point actually should not hit the layer. | 1691 // that the hit point actually should not hit the layer. |
1683 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer, | 1692 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer, |
1684 transform_tree, clip_tree)) | 1693 transform_tree, clip_tree)) |
1685 return false; | 1694 return false; |
1686 | 1695 |
1687 // Skip the HUD layer. | 1696 // Skip the HUD layer. |
1688 if (layer == layer->layer_tree_impl()->hud_layer()) | 1697 if (layer == layer->layer_tree_impl()->hud_layer()) |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2078 } | 2087 } |
2079 | 2088 |
2080 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { | 2089 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { |
2081 layers_that_should_push_properties_.clear(); | 2090 layers_that_should_push_properties_.clear(); |
2082 for (auto* layer : *this) | 2091 for (auto* layer : *this) |
2083 layer->ResetChangeTracking(); | 2092 layer->ResetChangeTracking(); |
2084 property_trees_.ResetAllChangeTracking(flag); | 2093 property_trees_.ResetAllChangeTracking(flag); |
2085 } | 2094 } |
2086 | 2095 |
2087 } // namespace cc | 2096 } // namespace cc |
OLD | NEW |