Commit 43daf599 authored by vollick's avatar vollick Committed by Commit bot

[compositor-worker] Create property tree nodes for proxies.

BUG=430155
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel

Review-Url: https://codereview.chromium.org/2254623002
Cr-Commit-Position: refs/heads/master@{#412518}
parent 0f2a0e2b
......@@ -15,6 +15,7 @@ struct MutableProperty {
enum : uint32_t { kScrollLeft = 1 << 1 };
enum : uint32_t { kScrollTop = 1 << 2 };
enum : uint32_t { kTransform = 1 << 3 };
enum : uint32_t { kTransformRelated = kTransform | kScrollLeft | kScrollTop };
enum : int { kNumProperties = 4 };
};
......
......@@ -4,6 +4,8 @@
#include "cc/trees/layer_tree_impl.h"
#include "base/macros.h"
#include "cc/animation/mutable_properties.h"
#include "cc/layers/heads_up_display_layer_impl.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/geometry_test_utils.h"
......@@ -2016,6 +2018,52 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) {
EXPECT_TRUE(output.start.visible());
}
TEST_F(LayerTreeImplTest, NodesiesForProxies) {
LayerImpl* root = root_layer();
root->SetDrawsContent(true);
root->SetBounds(gfx::Size(100, 100));
uint32_t properties[] = {
MutableProperty::kOpacity, MutableProperty::kScrollLeft,
MutableProperty::kScrollTop, MutableProperty::kTransform,
};
for (size_t i = 0; i < arraysize(properties); ++i) {
int sub_layer_id = i + 2;
std::unique_ptr<LayerImpl> sub_layer =
LayerImpl::Create(host_impl().active_tree(), sub_layer_id);
sub_layer->SetBounds(gfx::Size(50, 50));
sub_layer->SetDrawsContent(true);
sub_layer->SetMutableProperties(properties[i]);
root->test_properties()->AddChild(std::move(sub_layer));
}
host_impl().active_tree()->BuildPropertyTreesForTesting();
for (size_t i = 0; i < arraysize(properties); ++i) {
LayerImpl* layer = host_impl().active_tree()->LayerById(i + 2);
switch (properties[i]) {
case MutableProperty::kOpacity:
DCHECK_EQ(root->transform_tree_index(), layer->transform_tree_index());
DCHECK_NE(root->effect_tree_index(), layer->effect_tree_index());
break;
case MutableProperty::kScrollLeft:
case MutableProperty::kScrollTop:
case MutableProperty::kTransform:
DCHECK_EQ(root->effect_tree_index(), layer->effect_tree_index());
DCHECK_NE(root->transform_tree_index(), layer->transform_tree_index());
for (size_t j = 0; j < arraysize(properties); ++j) {
if (j == i)
continue;
LayerImpl* other = host_impl().active_tree()->LayerById(j + 2);
DCHECK_NE(other->transform_tree_index(),
layer->transform_tree_index());
}
break;
}
}
}
TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
LayerImpl* root = root_layer();
root->SetDrawsContent(true);
......
......@@ -10,6 +10,7 @@
#include <set>
#include "cc/animation/animation_host.h"
#include "cc/animation/mutable_properties.h"
#include "cc/base/math_util.h"
#include "cc/layers/layer.h"
#include "cc/layers/layer_impl.h"
......@@ -498,6 +499,9 @@ bool AddTransformNodeIfNeeded(
const bool has_any_transform_animation =
HasAnyAnimationTargetingProperty(layer, TargetProperty::TRANSFORM);
const bool has_proxied_transform_related_property =
!!(layer->mutable_properties() & MutableProperty::kTransformRelated);
const bool has_surface = created_render_surface;
// A transform node is needed to change the render target for subtree when
......@@ -514,6 +518,7 @@ bool AddTransformNodeIfNeeded(
bool requires_node = is_root || is_scrollable || has_significant_transform ||
has_any_transform_animation || has_surface || is_fixed ||
is_page_scale_layer || is_overscroll_elasticity_layer ||
has_proxied_transform_related_property ||
scroll_child_has_different_target ||
is_at_boundary_of_3d_rendering_context;
......@@ -941,6 +946,8 @@ bool AddEffectNodeIfNeeded(
HasPotentialOpacityAnimation(layer);
const bool has_potential_filter_animation =
HasPotentiallyRunningFilterAnimation(layer);
const bool has_proxied_opacity =
!!(layer->mutable_properties() & MutableProperty::kOpacity);
const bool should_create_render_surface = ShouldCreateRenderSurface(
layer, data_from_ancestor.compound_transform_since_render_target,
data_from_ancestor.axis_align_since_render_target);
......@@ -948,7 +955,7 @@ bool AddEffectNodeIfNeeded(
AnimationsPreserveAxisAlignment(layer);
bool requires_node = is_root || has_transparency ||
has_potential_opacity_animation ||
has_potential_opacity_animation || has_proxied_opacity ||
should_create_render_surface;
int parent_id = data_from_ancestor.effect_tree_parent;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment