summaryrefslogtreecommitdiffstats
path: root/cc/trees/layer_tree_host_common.cc
diff options
context:
space:
mode:
authorajuma <ajuma@chromium.org>2015-11-09 14:24:46 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-09 22:25:32 +0000
commitaa0d38670f55033607bc4d2513f877db516a4b1c (patch)
tree0c15d8fbe66414d97258a8ebb8730afea58b1f4d /cc/trees/layer_tree_host_common.cc
parent153f9f5aa796294694df4fdbb5ed3653cce3905a (diff)
downloadchromium_src-aa0d38670f55033607bc4d2513f877db516a4b1c.zip
chromium_src-aa0d38670f55033607bc4d2513f877db516a4b1c.tar.gz
chromium_src-aa0d38670f55033607bc4d2513f877db516a4b1c.tar.bz2
cc: Fix computation of layer backfacing-ness when using property trees
When using property trees, layers whose transform is tested for backfacing-ness might not have up-to-date draw properties (e.g., such layers might not draw content). This means that instead of using the layer's draw_transform() draw property, we need to call DrawTransformFromPropertyTrees. BUG=553580 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1422453007 Cr-Commit-Position: refs/heads/master@{#358683}
Diffstat (limited to 'cc/trees/layer_tree_host_common.cc')
-rw-r--r--cc/trees/layer_tree_host_common.cc26
1 files changed, 20 insertions, 6 deletions
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 649f6c2..345182c 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -445,14 +445,22 @@ static bool IsRootLayerOfNewRenderingContext(LayerImpl* layer) {
return layer->Is3dSorted();
}
-static bool IsLayerBackFaceVisible(LayerImpl* layer) {
+static bool IsLayerBackFaceVisible(LayerImpl* layer,
+ bool use_property_trees,
+ const TransformTree& transform_tree) {
// The current W3C spec on CSS transforms says that backface visibility should
// be determined differently depending on whether the layer is in a "3d
// rendering context" or not. For Chromium code, we can determine whether we
// are in a 3d rendering context by checking if the parent preserves 3d.
- if (LayerIsInExisting3DRenderingContext(layer))
- return layer->draw_transform().IsBackFaceVisible();
+ if (LayerIsInExisting3DRenderingContext(layer)) {
+ if (use_property_trees) {
+ return DrawTransformFromPropertyTrees(layer, transform_tree)
+ .IsBackFaceVisible();
+ } else {
+ return layer->draw_transform().IsBackFaceVisible();
+ }
+ }
// In this case, either the layer establishes a new 3d rendering context, or
// is not in a 3d rendering context at all.
@@ -519,7 +527,10 @@ static gfx::Rect CalculateVisibleLayerRect(
layer_rect_in_target_space, layer->draw_transform());
}
-static bool LayerShouldBeSkipped(LayerImpl* layer, bool layer_is_drawn) {
+static bool LayerShouldBeSkipped(LayerImpl* layer,
+ bool layer_is_drawn,
+ bool use_property_trees,
+ const TransformTree& transform_tree) {
// Layers can be skipped if any of these conditions are met.
// - is not drawn due to it or one of its ancestors being hidden (or having
// no copy requests).
@@ -553,7 +564,8 @@ static bool LayerShouldBeSkipped(LayerImpl* layer, bool layer_is_drawn) {
// The layer should not be drawn if (1) it is not double-sided and (2) the
// back of the layer is known to be facing the screen.
if (!backface_test_layer->double_sided() &&
- IsLayerBackFaceVisible(backface_test_layer))
+ IsLayerBackFaceVisible(backface_test_layer, use_property_trees,
+ transform_tree))
return true;
return false;
@@ -2542,7 +2554,9 @@ void CalculateRenderSurfaceLayerListInternal(
size_t descendants_size = descendants->size();
- bool layer_should_be_skipped = LayerShouldBeSkipped(layer, layer_is_drawn);
+ bool layer_should_be_skipped =
+ LayerShouldBeSkipped(layer, layer_is_drawn, use_property_trees,
+ property_trees->transform_tree);
if (!layer_should_be_skipped) {
MarkLayerWithRenderSurfaceLayerListId(layer,
current_render_surface_layer_list_id);