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

Unified Diff: cc/trees/draw_property_utils.cc

Issue 2345793003: Include viewport clip in visible rect of unclipped surfaces (2) (Closed)
Patch Set: . Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/draw_property_utils.cc
diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc
index 86678778a60430f52a7e3e9fe79d9a00353e42e4..c0252bd0a3a4ff2d3cae36ef16fe962e687c2b0f 100644
--- a/cc/trees/draw_property_utils.cc
+++ b/cc/trees/draw_property_utils.cc
@@ -427,13 +427,29 @@ void CalculateVisibleRects(const LayerImplList& visible_layer_list,
continue;
}
- // When both the layer and the target are unclipped, the entire layer
- // content rect is visible.
+ // When both the layer and the target are unclipped, we only have to apply
+ // the viewport clip.
const bool fully_visible =
!clip_node->layers_are_clipped && !clip_node->target_is_clipped;
if (fully_visible) {
- layer->set_visible_layer_rect(gfx::Rect(layer_bounds));
+ if (!transform_node->ancestors_are_invertible) {
+ // An animated singular transform may become non-singular during the
+ // animation, so we still need to compute a visible rect. In this
+ // situation, we treat the entire layer as visible.
+ layer->set_visible_layer_rect(gfx::Rect(layer_bounds));
+ } else {
+ gfx::Transform from_screen;
+ from_screen.Translate(-layer->offset_to_transform_parent().x(),
+ -layer->offset_to_transform_parent().y());
+ from_screen.PreconcatTransform(
+ property_trees->transform_tree.FromScreen(transform_node->id));
+ gfx::Rect visible_rect =
+ gfx::ToEnclosingRect(MathUtil::ProjectClippedRect(
+ from_screen, property_trees->clip_tree.ViewportClip()));
+ visible_rect.Intersect(gfx::Rect(layer_bounds));
+ layer->set_visible_layer_rect(visible_rect);
+ }
continue;
}
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_common_unittest.cc » ('j') | cc/trees/layer_tree_host_common_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698