Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: cc/trees/layer_tree_impl.cc

Issue 1939283002: cc: Fix sublayer scale bug in hit testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/trees/layer_tree_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 return true; 1650 return true;
1651 1651
1652 for (const ClipNode* clip_node = clip_tree.Node(layer->clip_tree_index()); 1652 for (const ClipNode* clip_node = clip_tree.Node(layer->clip_tree_index());
1653 clip_node->id > 1; clip_node = clip_tree.parent(clip_node)) { 1653 clip_node->id > 1; clip_node = clip_tree.parent(clip_node)) {
1654 if (clip_node->data.applies_local_clip) { 1654 if (clip_node->data.applies_local_clip) {
1655 const TransformNode* transform_node = 1655 const TransformNode* transform_node =
1656 transform_tree.Node(clip_node->data.target_id); 1656 transform_tree.Node(clip_node->data.target_id);
1657 gfx::Rect combined_clip_in_target_space = 1657 gfx::Rect combined_clip_in_target_space =
1658 gfx::ToEnclosingRect(clip_node->data.combined_clip_in_target_space); 1658 gfx::ToEnclosingRect(clip_node->data.combined_clip_in_target_space);
1659 1659
1660 if (!PointHitsRect(screen_space_point, transform_node->data.to_screen, 1660 const LayerImpl* target_layer =
1661 combined_clip_in_target_space, NULL)) 1661 layer->layer_tree_impl()->LayerById(transform_node->owner_id);
1662 DCHECK(transform_node->id == 0 || target_layer->render_surface());
1663 gfx::Transform surface_screen_space_transform =
1664 transform_node->id == 0
1665 ? gfx::Transform()
1666 : SurfaceScreenSpaceTransform(target_layer, transform_tree);
1667 if (!PointHitsRect(screen_space_point, surface_screen_space_transform,
1668 combined_clip_in_target_space, NULL)) {
1662 return true; 1669 return true;
1670 }
1663 } 1671 }
1664 const LayerImpl* clip_node_owner = 1672 const LayerImpl* clip_node_owner =
1665 layer->layer_tree_impl()->LayerById(clip_node->owner_id); 1673 layer->layer_tree_impl()->LayerById(clip_node->owner_id);
1666 if (clip_node_owner->render_surface() && 1674 if (clip_node_owner->render_surface() &&
1667 !PointHitsRect( 1675 !PointHitsRect(
1668 screen_space_point, 1676 screen_space_point,
1669 SurfaceScreenSpaceTransform(clip_node_owner, transform_tree), 1677 SurfaceScreenSpaceTransform(clip_node_owner, transform_tree),
1670 clip_node_owner->render_surface()->content_rect(), NULL)) { 1678 clip_node_owner->render_surface()->content_rect(), NULL)) {
1671 return true; 1679 return true;
1672 } 1680 }
(...skipping 12 matching lines...) Expand all
1685 transform_tree); 1693 transform_tree);
1686 } 1694 }
1687 1695
1688 static bool PointHitsLayer(const LayerImpl* layer, 1696 static bool PointHitsLayer(const LayerImpl* layer,
1689 const gfx::PointF& screen_space_point, 1697 const gfx::PointF& screen_space_point,
1690 float* distance_to_intersection, 1698 float* distance_to_intersection,
1691 const TransformTree& transform_tree, 1699 const TransformTree& transform_tree,
1692 const ClipTree& clip_tree) { 1700 const ClipTree& clip_tree) {
1693 gfx::Rect content_rect(layer->bounds()); 1701 gfx::Rect content_rect(layer->bounds());
1694 if (!PointHitsRect(screen_space_point, layer->ScreenSpaceTransform(), 1702 if (!PointHitsRect(screen_space_point, layer->ScreenSpaceTransform(),
1695 content_rect, distance_to_intersection)) 1703 content_rect, distance_to_intersection)) {
1696 return false; 1704 return false;
1705 }
1697 1706
1698 // At this point, we think the point does hit the layer, but we need to walk 1707 // At this point, we think the point does hit the layer, but we need to walk
1699 // up the parents to ensure that the layer was not clipped in such a way 1708 // up the parents to ensure that the layer was not clipped in such a way
1700 // that the hit point actually should not hit the layer. 1709 // that the hit point actually should not hit the layer.
1701 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer, 1710 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer,
1702 transform_tree, clip_tree)) 1711 transform_tree, clip_tree))
1703 return false; 1712 return false;
1704 1713
1705 // Skip the HUD layer. 1714 // Skip the HUD layer.
1706 if (layer == layer->layer_tree_impl()->hud_layer()) 1715 if (layer == layer->layer_tree_impl()->hud_layer())
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 } 2113 }
2105 2114
2106 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { 2115 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) {
2107 layers_that_should_push_properties_.clear(); 2116 layers_that_should_push_properties_.clear();
2108 for (auto* layer : *this) 2117 for (auto* layer : *this)
2109 layer->ResetChangeTracking(); 2118 layer->ResetChangeTracking();
2110 property_trees_.ResetAllChangeTracking(flag); 2119 property_trees_.ResetAllChangeTracking(flag);
2111 } 2120 }
2112 2121
2113 } // namespace cc 2122 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698