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

Unified Diff: cc/trees/layer_tree_impl_unittest.cc

Issue 465853004: Moving RenderSurface creation outside of CalcDrawProps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/layer_tree_impl_unittest.cc
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index a0dd11a266eada46c256831cf66693453ff6b633..95617f2ce1b9f21a2a213462580f19d348035a1c 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -57,7 +57,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) {
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
host_impl().SetViewportSize(root->bounds());
@@ -109,7 +110,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayerAndHud) {
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
// Create hud and add it as a child of root.
@@ -120,6 +122,7 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayerAndHud) {
position,
hud_bounds,
true,
+ false,
false);
hud->SetDrawsContent(true);
@@ -181,7 +184,8 @@ TEST_F(LayerTreeImplTest, HitTestingForUninvertibleTransform) {
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
host_impl().SetViewportSize(root->bounds());
@@ -247,7 +251,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSinglePositionedLayer) {
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
host_impl().SetViewportSize(root->bounds());
@@ -303,7 +308,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleRotatedLayer) {
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
host_impl().SetViewportSize(root->bounds());
@@ -372,7 +378,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSinglePerspectiveLayer) {
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
host_impl().SetViewportSize(root->bounds());
@@ -433,7 +440,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayerWithScaledContents) {
gfx::PointF(),
gfx::Size(100, 100),
true,
- false);
+ false,
+ true);
{
gfx::PointF position(25.f, 25.f);
gfx::Size bounds(50, 50);
@@ -445,6 +453,7 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayerWithScaledContents) {
position,
bounds,
true,
+ false,
false);
// override content bounds and contents scale
@@ -513,7 +522,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSimpleClippedLayer) {
gfx::PointF(),
gfx::Size(100, 100),
true,
- false);
+ false,
+ true);
{
scoped_ptr<LayerImpl> clipping_layer =
LayerImpl::Create(host_impl().active_tree(), 123);
@@ -527,6 +537,7 @@ TEST_F(LayerTreeImplTest, HitTestingForSimpleClippedLayer) {
position,
bounds,
true,
+ false,
false);
clipping_layer->SetMasksToBounds(true);
@@ -540,6 +551,7 @@ TEST_F(LayerTreeImplTest, HitTestingForSimpleClippedLayer) {
position,
bounds,
true,
+ false,
false);
child->SetDrawsContent(true);
clipping_layer->AddChild(child.Pass());
@@ -608,7 +620,8 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetMasksToBounds(true);
{
scoped_ptr<LayerImpl> child =
@@ -626,6 +639,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
position,
bounds,
true,
+ false,
false);
child->SetMasksToBounds(true);
@@ -643,6 +657,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
position,
bounds,
true,
+ false,
false);
danakj 2014/09/03 19:30:35 isn't this one supposed to have a surface based on
awoloszyn 2014/09/09 15:31:37 We could create a surface, but the sanity check is
grand_child->SetMasksToBounds(true);
@@ -663,6 +678,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
position,
bounds,
true,
+ false,
false);
rotated_leaf->SetDrawsContent(true);
@@ -675,27 +691,6 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
host_impl().active_tree()->SetRootLayer(root.Pass());
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
- // Sanity check the scenario we just created.
- // The grand_child is expected to create a render surface because it
- // MasksToBounds and is not axis aligned.
- ASSERT_EQ(2u, RenderSurfaceLayerList().size());
- ASSERT_EQ(
- 1u,
- RenderSurfaceLayerList().at(0)->render_surface()->layer_list().size());
- ASSERT_EQ(789,
- RenderSurfaceLayerList()
- .at(0)
- ->render_surface()
- ->layer_list()
- .at(0)
- ->id()); // grand_child's surface.
- ASSERT_EQ(
- 1u,
- RenderSurfaceLayerList().at(1)->render_surface()->layer_list().size());
- ASSERT_EQ(
- 2468,
- RenderSurfaceLayerList()[1]->render_surface()->layer_list().at(0)->id());
-
// (11, 89) is close to the the bottom left corner within the clip, but it is
// not inside the layer.
gfx::Point test_point(11, 89);
@@ -756,7 +751,8 @@ TEST_F(LayerTreeImplTest, HitTestingForNonClippingIntermediateLayer) {
gfx::PointF(),
gfx::Size(100, 100),
true,
- false);
+ false,
+ true);
{
scoped_ptr<LayerImpl> intermediate_layer =
LayerImpl::Create(host_impl().active_tree(), 123);
@@ -770,6 +766,7 @@ TEST_F(LayerTreeImplTest, HitTestingForNonClippingIntermediateLayer) {
position,
bounds,
true,
+ false,
false);
// Sanity check the intermediate layer should not clip.
ASSERT_FALSE(intermediate_layer->masks_to_bounds());
@@ -788,6 +785,7 @@ TEST_F(LayerTreeImplTest, HitTestingForNonClippingIntermediateLayer) {
position,
bounds,
true,
+ false,
false);
child->SetDrawsContent(true);
intermediate_layer->AddChild(child.Pass());
@@ -841,7 +839,8 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) {
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
{
// child 1 and child2 are initialized to overlap between x=50 and x=60.
@@ -865,6 +864,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) {
position,
bounds,
true,
+ false,
false);
child1->SetDrawsContent(true);
@@ -876,6 +876,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) {
position,
bounds,
true,
+ false,
false);
child2->SetDrawsContent(true);
@@ -890,6 +891,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) {
position,
bounds,
true,
+ false,
false);
grand_child1->SetDrawsContent(true);
@@ -980,7 +982,8 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
root->SetShouldFlattenTransform(false);
root->Set3dSortingContextId(1);
@@ -1006,6 +1009,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
position,
bounds,
true,
+ false,
false);
child1->SetDrawsContent(true);
child1->SetShouldFlattenTransform(false);
@@ -1021,6 +1025,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
position,
bounds,
true,
+ false,
false);
child2->SetDrawsContent(true);
child2->SetShouldFlattenTransform(false);
@@ -1037,6 +1042,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
position,
bounds,
true,
+ false,
false);
grand_child1->SetDrawsContent(true);
grand_child1->SetShouldFlattenTransform(false);
@@ -1129,7 +1135,8 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsClipParents) {
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
{
scoped_ptr<LayerImpl> child =
@@ -1145,6 +1152,7 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsClipParents) {
position,
bounds,
true,
+ false,
false);
child->SetDrawsContent(true);
child->SetMasksToBounds(true);
@@ -1157,9 +1165,10 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsClipParents) {
position,
bounds,
true,
+ false,
false);
grand_child->SetDrawsContent(true);
- grand_child->SetForceRenderSurface(true);
+ grand_child->SetHasRenderSurface(true);
// This should let |grand_child| "escape" |child|'s clip.
grand_child->SetClipParent(root.get());
@@ -1191,7 +1200,8 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) {
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
{
scoped_ptr<LayerImpl> child =
@@ -1209,6 +1219,7 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) {
position,
bounds,
true,
+ false,
false);
child->SetDrawsContent(true);
child->SetMasksToBounds(true);
@@ -1221,6 +1232,7 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) {
position,
bounds,
true,
+ false,
false);
scroll_child->SetDrawsContent(true);
@@ -1234,9 +1246,10 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) {
position,
bounds,
true,
+ false,
false);
grand_child->SetDrawsContent(true);
- grand_child->SetForceRenderSurface(true);
+ grand_child->SetHasRenderSurface(true);
scroll_child->AddChild(grand_child.Pass());
root->AddChild(scroll_child.Pass());
@@ -1272,7 +1285,8 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
{
// child 1 and child2 are initialized to overlap between x=50 and x=60.
@@ -1296,9 +1310,10 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
position,
bounds,
true,
+ false,
false);
child1->SetDrawsContent(true);
- child1->SetForceRenderSurface(true);
+ child1->SetHasRenderSurface(true);
position = gfx::PointF(50.f, 10.f);
bounds = gfx::Size(50, 50);
@@ -1308,9 +1323,10 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
position,
bounds,
true,
+ false,
false);
child2->SetDrawsContent(true);
- child2->SetForceRenderSurface(true);
+ child2->SetHasRenderSurface(true);
// Remember that grand_child is positioned with respect to its parent (i.e.
// child1). In screen space, the intended position is (10, 50), with size
@@ -1323,9 +1339,10 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
position,
bounds,
true,
+ false,
false);
grand_child1->SetDrawsContent(true);
- grand_child1->SetForceRenderSurface(true);
+ grand_child1->SetHasRenderSurface(true);
child1->AddChild(grand_child1.Pass());
root->AddChild(child1.Pass());
@@ -1423,7 +1440,8 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
host_impl().SetViewportSize(root->bounds());
@@ -1511,7 +1529,8 @@ TEST_F(LayerTreeImplTest,
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
root->SetTouchEventHandlerRegion(touch_handler_region);
@@ -1589,7 +1608,8 @@ TEST_F(LayerTreeImplTest,
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
root->SetTouchEventHandlerRegion(touch_handler_region);
@@ -1665,7 +1685,8 @@ TEST_F(LayerTreeImplTest,
gfx::PointF(),
gfx::Size(100, 100),
true,
- false);
+ false,
+ true);
{
Region touch_handler_region(gfx::Rect(10, 10, 30, 30));
gfx::PointF position(25.f, 25.f);
@@ -1678,6 +1699,7 @@ TEST_F(LayerTreeImplTest,
position,
bounds,
true,
+ false,
false);
// override content bounds and contents scale
@@ -1769,7 +1791,8 @@ TEST_F(LayerTreeImplTest,
gfx::PointF(),
gfx::Size(100, 100),
true,
- false);
+ false,
+ true);
{
Region touch_handler_region(gfx::Rect(10, 10, 30, 30));
gfx::PointF position(25.f, 25.f);
@@ -1782,6 +1805,7 @@ TEST_F(LayerTreeImplTest,
position,
bounds,
true,
+ false,
false);
test_layer->SetDrawsContent(true);
@@ -1893,7 +1917,8 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSimpleClippedLayer) {
gfx::PointF(),
gfx::Size(100, 100),
true,
- false);
+ false,
+ true);
{
scoped_ptr<LayerImpl> clipping_layer =
LayerImpl::Create(host_impl().active_tree(), 123);
@@ -1907,6 +1932,7 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSimpleClippedLayer) {
position,
bounds,
true,
+ false,
false);
clipping_layer->SetMasksToBounds(true);
@@ -1921,6 +1947,7 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSimpleClippedLayer) {
position,
bounds,
true,
+ false,
false);
child->SetDrawsContent(true);
child->SetTouchEventHandlerRegion(touch_handler_region);
@@ -1988,7 +2015,8 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerOverlappingRegions) {
gfx::PointF(),
gfx::Size(100, 100),
true,
- false);
+ false,
+ true);
{
scoped_ptr<LayerImpl> touch_layer =
LayerImpl::Create(host_impl().active_tree(), 123);
@@ -2002,6 +2030,7 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerOverlappingRegions) {
position,
bounds,
true,
+ false,
false);
touch_layer->SetDrawsContent(true);
touch_layer->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 50, 50));
@@ -2021,6 +2050,7 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerOverlappingRegions) {
position,
bounds,
true,
+ false,
false);
notouch_layer->SetDrawsContent(true);
root->AddChild(notouch_layer.Pass());
@@ -2085,7 +2115,8 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForSingleLayer) {
position,
bounds,
true,
- false);
+ false,
+ true);
root->SetDrawsContent(true);
host_impl().SetViewportSize(root->bounds());
@@ -2161,7 +2192,8 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) {
position,
bounds,
true,
- false);
+ false,
+ true);
gfx::Vector2dF clipping_offset(10, 10);
{
@@ -2176,6 +2208,7 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) {
position,
bounds,
true,
+ false,
false);
clipping_layer->SetMasksToBounds(true);
@@ -2189,6 +2222,7 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) {
position,
bounds,
true,
+ false,
false);
clipped_layer->SetDrawsContent(true);
clipping_layer->AddChild(clipped_layer.Pass());
@@ -2273,7 +2307,8 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
position,
bounds,
true,
- false);
+ false,
+ true);
gfx::Vector2dF sub_layer_offset(10, 0);
{
@@ -2287,6 +2322,7 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
position,
bounds,
true,
+ false,
false);
sub_layer->SetDrawsContent(true);
root->AddChild(sub_layer.Pass());

Powered by Google App Engine
This is Rietveld 408576698