| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/surfaces/surface.h" | 8 #include "cc/surfaces/surface.h" |
| 9 #include "cc/surfaces/surface_factory.h" | 9 #include "cc/surfaces/surface_factory.h" |
| 10 #include "cc/surfaces/surface_factory_client.h" | 10 #include "cc/surfaces/surface_factory_client.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 SurfaceFactory root_factory(root_frame_sink_id, &manager, &client); | 67 SurfaceFactory root_factory(root_frame_sink_id, &manager, &client); |
| 68 | 68 |
| 69 // Creates a root surface. | 69 // Creates a root surface. |
| 70 gfx::Rect root_rect(300, 300); | 70 gfx::Rect root_rect(300, 300); |
| 71 RenderPass* root_pass = nullptr; | 71 RenderPass* root_pass = nullptr; |
| 72 CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass); | 72 CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass); |
| 73 | 73 |
| 74 // Add a reference to a non-existant child surface on the root surface. | 74 // Add a reference to a non-existant child surface on the root surface. |
| 75 SurfaceId child_surface_id( | 75 SurfaceId child_surface_id( |
| 76 kArbitraryFrameSinkId, | 76 kArbitraryFrameSinkId, |
| 77 LocalFrameId(0xdeadbeef, base::UnguessableToken::Create())); | 77 LocalSurfaceId(0xdeadbeef, base::UnguessableToken::Create())); |
| 78 gfx::Rect child_rect(200, 200); | 78 gfx::Rect child_rect(200, 200); |
| 79 CreateSurfaceDrawQuad(root_pass, | 79 CreateSurfaceDrawQuad(root_pass, |
| 80 gfx::Transform(), | 80 gfx::Transform(), |
| 81 root_rect, | 81 root_rect, |
| 82 child_rect, | 82 child_rect, |
| 83 child_surface_id); | 83 child_surface_id); |
| 84 | 84 |
| 85 // Submit the root frame. | 85 // Submit the root frame. |
| 86 SurfaceIdAllocator root_allocator; | 86 SurfaceIdAllocator root_allocator; |
| 87 LocalFrameId root_local_frame_id = root_allocator.GenerateId(); | 87 LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); |
| 88 SurfaceId root_surface_id(root_frame_sink_id, root_local_frame_id); | 88 SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); |
| 89 root_factory.SubmitCompositorFrame(root_local_frame_id, std::move(root_frame), | 89 root_factory.SubmitCompositorFrame(root_local_surface_id, |
| 90 std::move(root_frame), |
| 90 SurfaceFactory::DrawCallback()); | 91 SurfaceFactory::DrawCallback()); |
| 91 | 92 |
| 92 { | 93 { |
| 93 SurfaceHittest hittest(nullptr, &manager); | 94 SurfaceHittest hittest(nullptr, &manager); |
| 94 // It is expected this test will complete without crashes. | 95 // It is expected this test will complete without crashes. |
| 95 gfx::Transform transform; | 96 gfx::Transform transform; |
| 96 EXPECT_EQ(root_surface_id, | 97 EXPECT_EQ(root_surface_id, |
| 97 hittest.GetTargetSurfaceAtPoint( | 98 hittest.GetTargetSurfaceAtPoint( |
| 98 root_surface_id, gfx::Point(100, 100), &transform)); | 99 root_surface_id, gfx::Point(100, 100), &transform)); |
| 99 } | 100 } |
| 100 | 101 |
| 101 root_factory.EvictSurface(); | 102 root_factory.EvictSurface(); |
| 102 } | 103 } |
| 103 | 104 |
| 104 TEST(SurfaceHittestTest, Hittest_SingleSurface) { | 105 TEST(SurfaceHittestTest, Hittest_SingleSurface) { |
| 105 SurfaceManager manager; | 106 SurfaceManager manager; |
| 106 | 107 |
| 107 // Set up root FrameSink. | 108 // Set up root FrameSink. |
| 108 EmptySurfaceFactoryClient root_client; | 109 EmptySurfaceFactoryClient root_client; |
| 109 FrameSinkId root_frame_sink_id(1, 1); | 110 FrameSinkId root_frame_sink_id(1, 1); |
| 110 SurfaceFactory root_factory(root_frame_sink_id, &manager, &root_client); | 111 SurfaceFactory root_factory(root_frame_sink_id, &manager, &root_client); |
| 111 | 112 |
| 112 // Creates a root surface. | 113 // Creates a root surface. |
| 113 gfx::Rect root_rect(300, 300); | 114 gfx::Rect root_rect(300, 300); |
| 114 RenderPass* root_pass = nullptr; | 115 RenderPass* root_pass = nullptr; |
| 115 CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass); | 116 CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass); |
| 116 | 117 |
| 117 // Submit the root frame. | 118 // Submit the root frame. |
| 118 SurfaceIdAllocator root_allocator; | 119 SurfaceIdAllocator root_allocator; |
| 119 LocalFrameId root_local_frame_id = root_allocator.GenerateId(); | 120 LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); |
| 120 SurfaceId root_surface_id(root_frame_sink_id, root_local_frame_id); | 121 SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); |
| 121 root_factory.SubmitCompositorFrame(root_local_frame_id, std::move(root_frame), | 122 root_factory.SubmitCompositorFrame(root_local_surface_id, |
| 123 std::move(root_frame), |
| 122 SurfaceFactory::DrawCallback()); | 124 SurfaceFactory::DrawCallback()); |
| 123 TestCase tests[] = { | 125 TestCase tests[] = { |
| 124 { | 126 { |
| 125 root_surface_id, | 127 root_surface_id, |
| 126 gfx::Point(100, 100), | 128 gfx::Point(100, 100), |
| 127 root_surface_id, | 129 root_surface_id, |
| 128 gfx::Point(100, 100) | 130 gfx::Point(100, 100) |
| 129 }, | 131 }, |
| 130 }; | 132 }; |
| 131 | 133 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 147 FrameSinkId child_frame_sink_id(2, 2); | 149 FrameSinkId child_frame_sink_id(2, 2); |
| 148 SurfaceFactory child_factory(child_frame_sink_id, &manager, &child_client); | 150 SurfaceFactory child_factory(child_frame_sink_id, &manager, &child_client); |
| 149 | 151 |
| 150 // Creates a root surface. | 152 // Creates a root surface. |
| 151 gfx::Rect root_rect(300, 300); | 153 gfx::Rect root_rect(300, 300); |
| 152 RenderPass* root_pass = nullptr; | 154 RenderPass* root_pass = nullptr; |
| 153 CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass); | 155 CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass); |
| 154 | 156 |
| 155 // Add a reference to the child surface on the root surface. | 157 // Add a reference to the child surface on the root surface. |
| 156 SurfaceIdAllocator child_allocator; | 158 SurfaceIdAllocator child_allocator; |
| 157 LocalFrameId child_local_frame_id = child_allocator.GenerateId(); | 159 LocalSurfaceId child_local_surface_id = child_allocator.GenerateId(); |
| 158 SurfaceId child_surface_id(child_frame_sink_id, child_local_frame_id); | 160 SurfaceId child_surface_id(child_frame_sink_id, child_local_surface_id); |
| 159 gfx::Rect child_rect(200, 200); | 161 gfx::Rect child_rect(200, 200); |
| 160 CreateSurfaceDrawQuad(root_pass, | 162 CreateSurfaceDrawQuad(root_pass, |
| 161 gfx::Transform(1.0f, 0.0f, 0.0f, 50.0f, | 163 gfx::Transform(1.0f, 0.0f, 0.0f, 50.0f, |
| 162 0.0f, 1.0f, 0.0f, 50.0f, | 164 0.0f, 1.0f, 0.0f, 50.0f, |
| 163 0.0f, 0.0f, 1.0f, 0.0f, | 165 0.0f, 0.0f, 1.0f, 0.0f, |
| 164 0.0f, 0.0f, 0.0f, 1.0f), | 166 0.0f, 0.0f, 0.0f, 1.0f), |
| 165 root_rect, | 167 root_rect, |
| 166 child_rect, | 168 child_rect, |
| 167 child_surface_id); | 169 child_surface_id); |
| 168 | 170 |
| 169 // Submit the root frame. | 171 // Submit the root frame. |
| 170 SurfaceIdAllocator root_allocator; | 172 SurfaceIdAllocator root_allocator; |
| 171 LocalFrameId root_local_frame_id = root_allocator.GenerateId(); | 173 LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); |
| 172 SurfaceId root_surface_id(root_frame_sink_id, root_local_frame_id); | 174 SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); |
| 173 root_factory.SubmitCompositorFrame(root_local_frame_id, std::move(root_frame), | 175 root_factory.SubmitCompositorFrame(root_local_surface_id, |
| 176 std::move(root_frame), |
| 174 SurfaceFactory::DrawCallback()); | 177 SurfaceFactory::DrawCallback()); |
| 175 | 178 |
| 176 // Creates a child surface. | 179 // Creates a child surface. |
| 177 RenderPass* child_pass = nullptr; | 180 RenderPass* child_pass = nullptr; |
| 178 CompositorFrame child_frame = CreateCompositorFrame(child_rect, &child_pass); | 181 CompositorFrame child_frame = CreateCompositorFrame(child_rect, &child_pass); |
| 179 | 182 |
| 180 // Add a solid quad in the child surface. | 183 // Add a solid quad in the child surface. |
| 181 gfx::Rect child_solid_quad_rect(100, 100); | 184 gfx::Rect child_solid_quad_rect(100, 100); |
| 182 CreateSolidColorDrawQuad( | 185 CreateSolidColorDrawQuad( |
| 183 child_pass, | 186 child_pass, |
| 184 gfx::Transform(1.0f, 0.0f, 0.0f, 50.0f, | 187 gfx::Transform(1.0f, 0.0f, 0.0f, 50.0f, |
| 185 0.0f, 1.0f, 0.0f, 50.0f, | 188 0.0f, 1.0f, 0.0f, 50.0f, |
| 186 0.0f, 0.0f, 1.0f, 0.0f, | 189 0.0f, 0.0f, 1.0f, 0.0f, |
| 187 0.0f, 0.0f, 0.0f, 1.0f), | 190 0.0f, 0.0f, 0.0f, 1.0f), |
| 188 root_rect, child_solid_quad_rect); | 191 root_rect, child_solid_quad_rect); |
| 189 | 192 |
| 190 // Submit the frame. | 193 // Submit the frame. |
| 191 child_factory.SubmitCompositorFrame(child_local_frame_id, | 194 child_factory.SubmitCompositorFrame(child_local_surface_id, |
| 192 std::move(child_frame), | 195 std::move(child_frame), |
| 193 SurfaceFactory::DrawCallback()); | 196 SurfaceFactory::DrawCallback()); |
| 194 | 197 |
| 195 TestCase tests[] = { | 198 TestCase tests[] = { |
| 196 { | 199 { |
| 197 root_surface_id, | 200 root_surface_id, |
| 198 gfx::Point(10, 10), | 201 gfx::Point(10, 10), |
| 199 root_surface_id, | 202 root_surface_id, |
| 200 gfx::Point(10, 10) | 203 gfx::Point(10, 10) |
| 201 }, | 204 }, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // Submit another root frame, with a slightly perturbed child Surface. | 239 // Submit another root frame, with a slightly perturbed child Surface. |
| 237 root_frame = CreateCompositorFrame(root_rect, &root_pass); | 240 root_frame = CreateCompositorFrame(root_rect, &root_pass); |
| 238 CreateSurfaceDrawQuad(root_pass, | 241 CreateSurfaceDrawQuad(root_pass, |
| 239 gfx::Transform(1.0f, 0.0f, 0.0f, 75.0f, | 242 gfx::Transform(1.0f, 0.0f, 0.0f, 75.0f, |
| 240 0.0f, 1.0f, 0.0f, 75.0f, | 243 0.0f, 1.0f, 0.0f, 75.0f, |
| 241 0.0f, 0.0f, 1.0f, 0.0f, | 244 0.0f, 0.0f, 1.0f, 0.0f, |
| 242 0.0f, 0.0f, 0.0f, 1.0f), | 245 0.0f, 0.0f, 0.0f, 1.0f), |
| 243 root_rect, | 246 root_rect, |
| 244 child_rect, | 247 child_rect, |
| 245 child_surface_id); | 248 child_surface_id); |
| 246 root_factory.SubmitCompositorFrame(root_local_frame_id, std::move(root_frame), | 249 root_factory.SubmitCompositorFrame(root_local_surface_id, |
| 250 std::move(root_frame), |
| 247 SurfaceFactory::DrawCallback()); | 251 SurfaceFactory::DrawCallback()); |
| 248 | 252 |
| 249 // Verify that point (100, 100) no longer falls on the child surface. | 253 // Verify that point (100, 100) no longer falls on the child surface. |
| 250 // Verify that the transform to the child surface's space has also shifted. | 254 // Verify that the transform to the child surface's space has also shifted. |
| 251 { | 255 { |
| 252 SurfaceHittest hittest(nullptr, &manager); | 256 SurfaceHittest hittest(nullptr, &manager); |
| 253 | 257 |
| 254 gfx::Point point(100, 100); | 258 gfx::Point point(100, 100); |
| 255 gfx::Transform transform; | 259 gfx::Transform transform; |
| 256 EXPECT_EQ(root_surface_id, | 260 EXPECT_EQ(root_surface_id, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 RenderPass* root_pass = nullptr; | 296 RenderPass* root_pass = nullptr; |
| 293 CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass); | 297 CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass); |
| 294 | 298 |
| 295 // Create a RenderPassDrawQuad to a non-existant RenderPass. | 299 // Create a RenderPassDrawQuad to a non-existant RenderPass. |
| 296 int invalid_render_pass_id = 1337; | 300 int invalid_render_pass_id = 1337; |
| 297 CreateRenderPassDrawQuad(root_pass, gfx::Transform(), root_rect, root_rect, | 301 CreateRenderPassDrawQuad(root_pass, gfx::Transform(), root_rect, root_rect, |
| 298 invalid_render_pass_id); | 302 invalid_render_pass_id); |
| 299 | 303 |
| 300 // Add a reference to the child surface on the root surface. | 304 // Add a reference to the child surface on the root surface. |
| 301 SurfaceIdAllocator child_allocator; | 305 SurfaceIdAllocator child_allocator; |
| 302 LocalFrameId child_local_frame_id = child_allocator.GenerateId(); | 306 LocalSurfaceId child_local_surface_id = child_allocator.GenerateId(); |
| 303 SurfaceId child_surface_id(child_frame_sink_id, child_local_frame_id); | 307 SurfaceId child_surface_id(child_frame_sink_id, child_local_surface_id); |
| 304 gfx::Rect child_rect(200, 200); | 308 gfx::Rect child_rect(200, 200); |
| 305 CreateSurfaceDrawQuad(root_pass, | 309 CreateSurfaceDrawQuad(root_pass, |
| 306 gfx::Transform(1.0f, 0.0f, 0.0f, 50.0f, | 310 gfx::Transform(1.0f, 0.0f, 0.0f, 50.0f, |
| 307 0.0f, 1.0f, 0.0f, 50.0f, | 311 0.0f, 1.0f, 0.0f, 50.0f, |
| 308 0.0f, 0.0f, 1.0f, 0.0f, | 312 0.0f, 0.0f, 1.0f, 0.0f, |
| 309 0.0f, 0.0f, 0.0f, 1.0f), | 313 0.0f, 0.0f, 0.0f, 1.0f), |
| 310 root_rect, | 314 root_rect, |
| 311 child_rect, | 315 child_rect, |
| 312 child_surface_id); | 316 child_surface_id); |
| 313 | 317 |
| 314 // Submit the root frame. | 318 // Submit the root frame. |
| 315 SurfaceIdAllocator root_allocator; | 319 SurfaceIdAllocator root_allocator; |
| 316 LocalFrameId root_local_frame_id = root_allocator.GenerateId(); | 320 LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); |
| 317 SurfaceId root_surface_id(root_frame_sink_id, root_local_frame_id); | 321 SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); |
| 318 root_factory.SubmitCompositorFrame(root_local_frame_id, std::move(root_frame), | 322 root_factory.SubmitCompositorFrame(root_local_surface_id, |
| 323 std::move(root_frame), |
| 319 SurfaceFactory::DrawCallback()); | 324 SurfaceFactory::DrawCallback()); |
| 320 | 325 |
| 321 // Creates a child surface. | 326 // Creates a child surface. |
| 322 RenderPass* child_pass = nullptr; | 327 RenderPass* child_pass = nullptr; |
| 323 CompositorFrame child_frame = CreateCompositorFrame(child_rect, &child_pass); | 328 CompositorFrame child_frame = CreateCompositorFrame(child_rect, &child_pass); |
| 324 | 329 |
| 325 // Add a solid quad in the child surface. | 330 // Add a solid quad in the child surface. |
| 326 gfx::Rect child_solid_quad_rect(100, 100); | 331 gfx::Rect child_solid_quad_rect(100, 100); |
| 327 CreateSolidColorDrawQuad(child_pass, | 332 CreateSolidColorDrawQuad(child_pass, |
| 328 gfx::Transform(1.0f, 0.0f, 0.0f, 50.0f, | 333 gfx::Transform(1.0f, 0.0f, 0.0f, 50.0f, |
| 329 0.0f, 1.0f, 0.0f, 50.0f, | 334 0.0f, 1.0f, 0.0f, 50.0f, |
| 330 0.0f, 0.0f, 1.0f, 0.0f, | 335 0.0f, 0.0f, 1.0f, 0.0f, |
| 331 0.0f, 0.0f, 0.0f, 1.0f), | 336 0.0f, 0.0f, 0.0f, 1.0f), |
| 332 root_rect, | 337 root_rect, |
| 333 child_solid_quad_rect); | 338 child_solid_quad_rect); |
| 334 | 339 |
| 335 // Submit the frame. | 340 // Submit the frame. |
| 336 child_factory.SubmitCompositorFrame(child_local_frame_id, | 341 child_factory.SubmitCompositorFrame(child_local_surface_id, |
| 337 std::move(child_frame), | 342 std::move(child_frame), |
| 338 SurfaceFactory::DrawCallback()); | 343 SurfaceFactory::DrawCallback()); |
| 339 | 344 |
| 340 TestCase tests[] = { | 345 TestCase tests[] = { |
| 341 { | 346 { |
| 342 root_surface_id, | 347 root_surface_id, |
| 343 gfx::Point(10, 10), | 348 gfx::Point(10, 10), |
| 344 root_surface_id, | 349 root_surface_id, |
| 345 gfx::Point(10, 10) | 350 gfx::Point(10, 10) |
| 346 }, | 351 }, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 // Add a solid quad in the child render pass. | 428 // Add a solid quad in the child render pass. |
| 424 RenderPass* child_render_pass = root_frame.render_pass_list.front().get(); | 429 RenderPass* child_render_pass = root_frame.render_pass_list.front().get(); |
| 425 gfx::Rect child_solid_quad_rect(100, 100); | 430 gfx::Rect child_solid_quad_rect(100, 100); |
| 426 CreateSolidColorDrawQuad(child_render_pass, | 431 CreateSolidColorDrawQuad(child_render_pass, |
| 427 gfx::Transform(), | 432 gfx::Transform(), |
| 428 gfx::Rect(100, 100), | 433 gfx::Rect(100, 100), |
| 429 child_solid_quad_rect); | 434 child_solid_quad_rect); |
| 430 | 435 |
| 431 // Submit the root frame. | 436 // Submit the root frame. |
| 432 SurfaceIdAllocator root_allocator; | 437 SurfaceIdAllocator root_allocator; |
| 433 LocalFrameId root_local_frame_id = root_allocator.GenerateId(); | 438 LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); |
| 434 SurfaceId root_surface_id(root_frame_sink_id, root_local_frame_id); | 439 SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); |
| 435 factory.SubmitCompositorFrame(root_local_frame_id, std::move(root_frame), | 440 factory.SubmitCompositorFrame(root_local_surface_id, std::move(root_frame), |
| 436 SurfaceFactory::DrawCallback()); | 441 SurfaceFactory::DrawCallback()); |
| 437 | 442 |
| 438 TestCase tests[] = { | 443 TestCase tests[] = { |
| 439 // These tests just miss the RenderPassDrawQuad. | 444 // These tests just miss the RenderPassDrawQuad. |
| 440 { | 445 { |
| 441 root_surface_id, | 446 root_surface_id, |
| 442 gfx::Point(49, 49), | 447 gfx::Point(49, 49), |
| 443 root_surface_id, | 448 root_surface_id, |
| 444 gfx::Point(49, 49) | 449 gfx::Point(49, 49) |
| 445 }, | 450 }, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 FrameSinkId child_frame_sink_id(2, 2); | 502 FrameSinkId child_frame_sink_id(2, 2); |
| 498 SurfaceFactory child_factory(child_frame_sink_id, &manager, &child_client); | 503 SurfaceFactory child_factory(child_frame_sink_id, &manager, &child_client); |
| 499 | 504 |
| 500 // Creates a root surface. | 505 // Creates a root surface. |
| 501 gfx::Rect root_rect(300, 300); | 506 gfx::Rect root_rect(300, 300); |
| 502 RenderPass* root_pass = nullptr; | 507 RenderPass* root_pass = nullptr; |
| 503 CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass); | 508 CompositorFrame root_frame = CreateCompositorFrame(root_rect, &root_pass); |
| 504 | 509 |
| 505 // Add a reference to the child surface on the root surface. | 510 // Add a reference to the child surface on the root surface. |
| 506 SurfaceIdAllocator child_allocator; | 511 SurfaceIdAllocator child_allocator; |
| 507 LocalFrameId child_local_frame_id = child_allocator.GenerateId(); | 512 LocalSurfaceId child_local_surface_id = child_allocator.GenerateId(); |
| 508 SurfaceId child_surface_id(child_frame_sink_id, child_local_frame_id); | 513 SurfaceId child_surface_id(child_frame_sink_id, child_local_surface_id); |
| 509 gfx::Rect child_rect(200, 200); | 514 gfx::Rect child_rect(200, 200); |
| 510 CreateSurfaceDrawQuad( | 515 CreateSurfaceDrawQuad( |
| 511 root_pass, | 516 root_pass, |
| 512 gfx::Transform(1.0f, 0.0f, 0.0f, 50.0f, | 517 gfx::Transform(1.0f, 0.0f, 0.0f, 50.0f, |
| 513 0.0f, 1.0f, 0.0f, 50.0f, | 518 0.0f, 1.0f, 0.0f, 50.0f, |
| 514 0.0f, 0.0f, 1.0f, 0.0f, | 519 0.0f, 0.0f, 1.0f, 0.0f, |
| 515 0.0f, 0.0f, 0.0f, 1.0f), | 520 0.0f, 0.0f, 0.0f, 1.0f), |
| 516 root_rect, child_rect, child_surface_id); | 521 root_rect, child_rect, child_surface_id); |
| 517 | 522 |
| 518 // Submit the root frame. | 523 // Submit the root frame. |
| 519 SurfaceIdAllocator root_allocator; | 524 SurfaceIdAllocator root_allocator; |
| 520 LocalFrameId root_local_frame_id = root_allocator.GenerateId(); | 525 LocalSurfaceId root_local_surface_id = root_allocator.GenerateId(); |
| 521 SurfaceId root_surface_id(root_frame_sink_id, root_local_frame_id); | 526 SurfaceId root_surface_id(root_frame_sink_id, root_local_surface_id); |
| 522 root_factory.SubmitCompositorFrame(root_local_frame_id, std::move(root_frame), | 527 root_factory.SubmitCompositorFrame(root_local_surface_id, |
| 528 std::move(root_frame), |
| 523 SurfaceFactory::DrawCallback()); | 529 SurfaceFactory::DrawCallback()); |
| 524 | 530 |
| 525 // Creates a child surface. | 531 // Creates a child surface. |
| 526 RenderPass* child_pass = nullptr; | 532 RenderPass* child_pass = nullptr; |
| 527 CompositorFrame child_frame = CreateCompositorFrame(child_rect, &child_pass); | 533 CompositorFrame child_frame = CreateCompositorFrame(child_rect, &child_pass); |
| 528 | 534 |
| 529 // Add a solid quad in the child surface. | 535 // Add a solid quad in the child surface. |
| 530 gfx::Rect child_solid_quad_rect(190, 190); | 536 gfx::Rect child_solid_quad_rect(190, 190); |
| 531 CreateSolidColorDrawQuad( | 537 CreateSolidColorDrawQuad( |
| 532 child_pass, | 538 child_pass, |
| 533 gfx::Transform(1.0f, 0.0f, 0.0f, 5.0f, 0.0f, 1.0f, 0.0f, 5.0f, 0.0f, 0.0f, | 539 gfx::Transform(1.0f, 0.0f, 0.0f, 5.0f, 0.0f, 1.0f, 0.0f, 5.0f, 0.0f, 0.0f, |
| 534 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f), | 540 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f), |
| 535 root_rect, child_solid_quad_rect); | 541 root_rect, child_solid_quad_rect); |
| 536 | 542 |
| 537 // Submit the frame. | 543 // Submit the frame. |
| 538 child_factory.SubmitCompositorFrame(child_local_frame_id, | 544 child_factory.SubmitCompositorFrame(child_local_surface_id, |
| 539 std::move(child_frame), | 545 std::move(child_frame), |
| 540 SurfaceFactory::DrawCallback()); | 546 SurfaceFactory::DrawCallback()); |
| 541 | 547 |
| 542 TestCase test_expectations_without_insets[] = { | 548 TestCase test_expectations_without_insets[] = { |
| 543 {root_surface_id, gfx::Point(55, 55), child_surface_id, gfx::Point(5, 5)}, | 549 {root_surface_id, gfx::Point(55, 55), child_surface_id, gfx::Point(5, 5)}, |
| 544 {root_surface_id, gfx::Point(60, 60), child_surface_id, | 550 {root_surface_id, gfx::Point(60, 60), child_surface_id, |
| 545 gfx::Point(10, 10)}, | 551 gfx::Point(10, 10)}, |
| 546 {root_surface_id, gfx::Point(239, 239), child_surface_id, | 552 {root_surface_id, gfx::Point(239, 239), child_surface_id, |
| 547 gfx::Point(189, 189)}, | 553 gfx::Point(189, 189)}, |
| 548 {root_surface_id, gfx::Point(244, 244), child_surface_id, | 554 {root_surface_id, gfx::Point(244, 244), child_surface_id, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 | 620 |
| 615 // Verify that insets have affected hit targeting. | 621 // Verify that insets have affected hit targeting. |
| 616 EXPECT_EQ(0, accept_delegate.reject_target_overrides()); | 622 EXPECT_EQ(0, accept_delegate.reject_target_overrides()); |
| 617 EXPECT_EQ(2, accept_delegate.accept_target_overrides()); | 623 EXPECT_EQ(2, accept_delegate.accept_target_overrides()); |
| 618 | 624 |
| 619 root_factory.EvictSurface(); | 625 root_factory.EvictSurface(); |
| 620 child_factory.EvictSurface(); | 626 child_factory.EvictSurface(); |
| 621 } | 627 } |
| 622 | 628 |
| 623 } // namespace cc | 629 } // namespace cc |
| OLD | NEW |