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

Unified Diff: cc/layer_tree_host_common.cc

Issue 11567034: Changes subtreeShouldRenderToSeparateSurface logic to account for explicit clipping (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: very minor change Created 7 years, 11 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
« no previous file with comments | « cc/layer_impl.cc ('k') | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_common.cc
diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc
index 5af7a69732f6b133c510066ef6529b25d576b582..c320d7a6ab83ea3bceadb7516c335b2cd55aa459 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -291,7 +291,8 @@ static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlig
}
// If the layer clips its descendants but it is not axis-aligned with respect to its parent.
- if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && numDescendantsThatDrawContent > 0) {
+ if (layerClipsSubtree(layer) && !axisAlignedWithRespectToParent && !layer->drawProperties().descendants_can_clip_selves)
+ {
TRACE_EVENT_INSTANT0("cc", "LayerTreeHostCommon::requireSurface clipping");
return true;
}
@@ -495,15 +496,25 @@ template<typename LayerType>
static void preCalculateMetaInformation(LayerType* layer)
{
int numDescendantsThatDrawContent = 0;
+ bool descendantsCanClipSelves = true;
+ bool sublayerTransformPreventsClip = !layer->sublayerTransform().IsPositiveScaleOrTranslation();
for (size_t i = 0; i < layer->children().size(); ++i) {
LayerType* childLayer = layer->children()[i];
preCalculateMetaInformation<LayerType>(childLayer);
+
numDescendantsThatDrawContent += childLayer->drawsContent() ? 1 : 0;
numDescendantsThatDrawContent += childLayer->drawProperties().num_descendants_that_draw_content;
+
+ if ((childLayer->drawsContent() && !childLayer->canClipSelf()) ||
+ !childLayer->drawProperties().descendants_can_clip_selves ||
+ sublayerTransformPreventsClip ||
+ !childLayer->transform().IsPositiveScaleOrTranslation())
+ descendantsCanClipSelves = false;
}
layer->drawProperties().num_descendants_that_draw_content = numDescendantsThatDrawContent;
+ layer->drawProperties().descendants_can_clip_selves = descendantsCanClipSelves;
}
// Recursively walks the layer tree starting at the given node and computes all the
« no previous file with comments | « cc/layer_impl.cc ('k') | cc/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698