| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 DrawFrame(); | 728 DrawFrame(); |
| 729 | 729 |
| 730 // Create two child scrollable layers | 730 // Create two child scrollable layers |
| 731 LayerImpl* child1 = 0; | 731 LayerImpl* child1 = 0; |
| 732 { | 732 { |
| 733 scoped_ptr<LayerImpl> scrollable_child_clip_1 = | 733 scoped_ptr<LayerImpl> scrollable_child_clip_1 = |
| 734 LayerImpl::Create(host_impl_->active_tree(), 6); | 734 LayerImpl::Create(host_impl_->active_tree(), 6); |
| 735 scoped_ptr<LayerImpl> scrollable_child_1 = CreateScrollableLayer( | 735 scoped_ptr<LayerImpl> scrollable_child_1 = CreateScrollableLayer( |
| 736 7, gfx::Size(10, 10), scrollable_child_clip_1.get()); | 736 7, gfx::Size(10, 10), scrollable_child_clip_1.get()); |
| 737 child1 = scrollable_child_1.get(); | 737 child1 = scrollable_child_1.get(); |
| 738 scrollable_child_1->SetPosition(gfx::Point(5, 5)); | 738 scrollable_child_1->SetPosition(gfx::PointF(5.f, 5.f)); |
| 739 scrollable_child_1->SetHaveWheelEventHandlers(true); | 739 scrollable_child_1->SetHaveWheelEventHandlers(true); |
| 740 scrollable_child_1->SetHaveScrollEventHandlers(true); | 740 scrollable_child_1->SetHaveScrollEventHandlers(true); |
| 741 scrollable_child_clip_1->AddChild(scrollable_child_1.Pass()); | 741 scrollable_child_clip_1->AddChild(scrollable_child_1.Pass()); |
| 742 root_child->AddChild(scrollable_child_clip_1.Pass()); | 742 root_child->AddChild(scrollable_child_clip_1.Pass()); |
| 743 } | 743 } |
| 744 | 744 |
| 745 LayerImpl* child2 = 0; | 745 LayerImpl* child2 = 0; |
| 746 { | 746 { |
| 747 scoped_ptr<LayerImpl> scrollable_child_clip_2 = | 747 scoped_ptr<LayerImpl> scrollable_child_clip_2 = |
| 748 LayerImpl::Create(host_impl_->active_tree(), 8); | 748 LayerImpl::Create(host_impl_->active_tree(), 8); |
| 749 scoped_ptr<LayerImpl> scrollable_child_2 = CreateScrollableLayer( | 749 scoped_ptr<LayerImpl> scrollable_child_2 = CreateScrollableLayer( |
| 750 9, gfx::Size(10, 10), scrollable_child_clip_2.get()); | 750 9, gfx::Size(10, 10), scrollable_child_clip_2.get()); |
| 751 child2 = scrollable_child_2.get(); | 751 child2 = scrollable_child_2.get(); |
| 752 scrollable_child_2->SetPosition(gfx::Point(5, 20)); | 752 scrollable_child_2->SetPosition(gfx::PointF(5.f, 20.f)); |
| 753 scrollable_child_2->SetHaveWheelEventHandlers(true); | 753 scrollable_child_2->SetHaveWheelEventHandlers(true); |
| 754 scrollable_child_2->SetHaveScrollEventHandlers(true); | 754 scrollable_child_2->SetHaveScrollEventHandlers(true); |
| 755 scrollable_child_clip_2->AddChild(scrollable_child_2.Pass()); | 755 scrollable_child_clip_2->AddChild(scrollable_child_2.Pass()); |
| 756 root_child->AddChild(scrollable_child_clip_2.Pass()); | 756 root_child->AddChild(scrollable_child_clip_2.Pass()); |
| 757 } | 757 } |
| 758 | 758 |
| 759 // Scroll-blocks-on on a layer affects scrolls that hit that layer. | 759 // Scroll-blocks-on on a layer affects scrolls that hit that layer. |
| 760 EXPECT_EQ(InputHandler::SCROLL_STARTED, | 760 EXPECT_EQ(InputHandler::SCROLL_STARTED, |
| 761 host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::GESTURE)); | 761 host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::GESTURE)); |
| 762 host_impl_->ScrollEnd(); | 762 host_impl_->ScrollEnd(); |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1528 parent = scroll_parent.get(); | 1528 parent = scroll_parent.get(); |
| 1529 scroll_parent_clip->AddChild(scroll_parent.Pass()); | 1529 scroll_parent_clip->AddChild(scroll_parent.Pass()); |
| 1530 | 1530 |
| 1531 viewport_scroll->AddChild(scroll_parent_clip.Pass()); | 1531 viewport_scroll->AddChild(scroll_parent_clip.Pass()); |
| 1532 | 1532 |
| 1533 scoped_ptr<LayerImpl> scroll_child_clip = | 1533 scoped_ptr<LayerImpl> scroll_child_clip = |
| 1534 LayerImpl::Create(host_impl_->active_tree(), 8); | 1534 LayerImpl::Create(host_impl_->active_tree(), 8); |
| 1535 scoped_ptr<LayerImpl> scroll_child = CreateScrollableLayer( | 1535 scoped_ptr<LayerImpl> scroll_child = CreateScrollableLayer( |
| 1536 9, gfx::Size(10, 10), scroll_child_clip.get()); | 1536 9, gfx::Size(10, 10), scroll_child_clip.get()); |
| 1537 child = scroll_child.get(); | 1537 child = scroll_child.get(); |
| 1538 scroll_child->SetPosition(gfx::Point(20, 20)); | 1538 scroll_child->SetPosition(gfx::PointF(20.f, 20.f)); |
| 1539 scroll_child_clip->AddChild(scroll_child.Pass()); | 1539 scroll_child_clip->AddChild(scroll_child.Pass()); |
| 1540 | 1540 |
| 1541 child_clip = scroll_child_clip.get(); | 1541 child_clip = scroll_child_clip.get(); |
| 1542 viewport_scroll->AddChild(scroll_child_clip.Pass()); | 1542 viewport_scroll->AddChild(scroll_child_clip.Pass()); |
| 1543 | 1543 |
| 1544 child_clip->SetScrollParent(parent); | 1544 child_clip->SetScrollParent(parent); |
| 1545 | 1545 |
| 1546 DrawFrame(); | 1546 DrawFrame(); |
| 1547 | 1547 |
| 1548 { | 1548 { |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2339 scoped_ptr<LayerImpl> contents = | 2339 scoped_ptr<LayerImpl> contents = |
| 2340 LayerImpl::Create(host_impl_->active_tree(), 3); | 2340 LayerImpl::Create(host_impl_->active_tree(), 3); |
| 2341 contents->SetDrawsContent(true); | 2341 contents->SetDrawsContent(true); |
| 2342 contents->SetBounds(content_size); | 2342 contents->SetBounds(content_size); |
| 2343 | 2343 |
| 2344 // The scrollbar is on the right side. | 2344 // The scrollbar is on the right side. |
| 2345 scoped_ptr<PaintedScrollbarLayerImpl> scrollbar = | 2345 scoped_ptr<PaintedScrollbarLayerImpl> scrollbar = |
| 2346 PaintedScrollbarLayerImpl::Create(host_impl_->active_tree(), 5, VERTICAL); | 2346 PaintedScrollbarLayerImpl::Create(host_impl_->active_tree(), 5, VERTICAL); |
| 2347 scrollbar->SetDrawsContent(true); | 2347 scrollbar->SetDrawsContent(true); |
| 2348 scrollbar->SetBounds(gfx::Size(15, viewport_size.height())); | 2348 scrollbar->SetBounds(gfx::Size(15, viewport_size.height())); |
| 2349 scrollbar->SetPosition(gfx::Point(285, 0)); | 2349 scrollbar->SetPosition(gfx::PointF(285.f, 0.f)); |
| 2350 | 2350 |
| 2351 scroll->AddChild(contents.Pass()); | 2351 scroll->AddChild(contents.Pass()); |
| 2352 root->AddChild(scroll.Pass()); | 2352 root->AddChild(scroll.Pass()); |
| 2353 scrollbar->SetScrollLayerAndClipLayerByIds(2, 1); | 2353 scrollbar->SetScrollLayerAndClipLayerByIds(2, 1); |
| 2354 root->AddChild(scrollbar.Pass()); | 2354 root->AddChild(scrollbar.Pass()); |
| 2355 | 2355 |
| 2356 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 2356 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
| 2357 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 2, | 2357 host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 2, |
| 2358 Layer::INVALID_ID); | 2358 Layer::INVALID_ID); |
| 2359 host_impl_->active_tree()->DidBecomeActive(); | 2359 host_impl_->active_tree()->DidBecomeActive(); |
| (...skipping 3020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5380 host_impl_->resource_provider())); | 5380 host_impl_->resource_provider())); |
| 5381 child_ = static_cast<BlendStateCheckLayer*>( | 5381 child_ = static_cast<BlendStateCheckLayer*>( |
| 5382 host_impl_->active_tree()->root_layer()->children()[0]); | 5382 host_impl_->active_tree()->root_layer()->children()[0]); |
| 5383 child_->SetExpectation(false, false); | 5383 child_->SetExpectation(false, false); |
| 5384 child_->SetContentsOpaque(true); | 5384 child_->SetContentsOpaque(true); |
| 5385 } | 5385 } |
| 5386 | 5386 |
| 5387 // Expect no gutter rects. | 5387 // Expect no gutter rects. |
| 5388 void TestLayerCoversFullViewport() { | 5388 void TestLayerCoversFullViewport() { |
| 5389 gfx::Rect layer_rect(viewport_size_); | 5389 gfx::Rect layer_rect(viewport_size_); |
| 5390 child_->SetPosition(layer_rect.origin()); | 5390 child_->SetPosition(gfx::PointF(layer_rect.origin())); |
| 5391 child_->SetBounds(layer_rect.size()); | 5391 child_->SetBounds(layer_rect.size()); |
| 5392 child_->SetQuadRect(gfx::Rect(layer_rect.size())); | 5392 child_->SetQuadRect(gfx::Rect(layer_rect.size())); |
| 5393 child_->SetQuadVisibleRect(gfx::Rect(layer_rect.size())); | 5393 child_->SetQuadVisibleRect(gfx::Rect(layer_rect.size())); |
| 5394 | 5394 |
| 5395 LayerTreeHostImpl::FrameData frame; | 5395 LayerTreeHostImpl::FrameData frame; |
| 5396 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 5396 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 5397 ASSERT_EQ(1u, frame.render_passes.size()); | 5397 ASSERT_EQ(1u, frame.render_passes.size()); |
| 5398 | 5398 |
| 5399 EXPECT_EQ(0u, CountGutterQuads(frame.render_passes[0]->quad_list)); | 5399 EXPECT_EQ(0u, CountGutterQuads(frame.render_passes[0]->quad_list)); |
| 5400 EXPECT_EQ(1u, frame.render_passes[0]->quad_list.size()); | 5400 EXPECT_EQ(1u, frame.render_passes[0]->quad_list.size()); |
| 5401 ValidateTextureDrawQuads(frame.render_passes[0]->quad_list); | 5401 ValidateTextureDrawQuads(frame.render_passes[0]->quad_list); |
| 5402 | 5402 |
| 5403 VerifyQuadsExactlyCoverViewport(frame.render_passes[0]->quad_list); | 5403 VerifyQuadsExactlyCoverViewport(frame.render_passes[0]->quad_list); |
| 5404 host_impl_->DidDrawAllLayers(frame); | 5404 host_impl_->DidDrawAllLayers(frame); |
| 5405 } | 5405 } |
| 5406 | 5406 |
| 5407 // Expect fullscreen gutter rect. | 5407 // Expect fullscreen gutter rect. |
| 5408 void TestEmptyLayer() { | 5408 void TestEmptyLayer() { |
| 5409 gfx::Rect layer_rect(0, 0, 0, 0); | 5409 gfx::Rect layer_rect(0, 0, 0, 0); |
| 5410 child_->SetPosition(layer_rect.origin()); | 5410 child_->SetPosition(gfx::PointF(layer_rect.origin())); |
| 5411 child_->SetBounds(layer_rect.size()); | 5411 child_->SetBounds(layer_rect.size()); |
| 5412 child_->SetQuadRect(gfx::Rect(layer_rect.size())); | 5412 child_->SetQuadRect(gfx::Rect(layer_rect.size())); |
| 5413 child_->SetQuadVisibleRect(gfx::Rect(layer_rect.size())); | 5413 child_->SetQuadVisibleRect(gfx::Rect(layer_rect.size())); |
| 5414 | 5414 |
| 5415 LayerTreeHostImpl::FrameData frame; | 5415 LayerTreeHostImpl::FrameData frame; |
| 5416 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 5416 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 5417 ASSERT_EQ(1u, frame.render_passes.size()); | 5417 ASSERT_EQ(1u, frame.render_passes.size()); |
| 5418 | 5418 |
| 5419 EXPECT_EQ(1u, CountGutterQuads(frame.render_passes[0]->quad_list)); | 5419 EXPECT_EQ(1u, CountGutterQuads(frame.render_passes[0]->quad_list)); |
| 5420 EXPECT_EQ(1u, frame.render_passes[0]->quad_list.size()); | 5420 EXPECT_EQ(1u, frame.render_passes[0]->quad_list.size()); |
| 5421 ValidateTextureDrawQuads(frame.render_passes[0]->quad_list); | 5421 ValidateTextureDrawQuads(frame.render_passes[0]->quad_list); |
| 5422 | 5422 |
| 5423 VerifyQuadsExactlyCoverViewport(frame.render_passes[0]->quad_list); | 5423 VerifyQuadsExactlyCoverViewport(frame.render_passes[0]->quad_list); |
| 5424 host_impl_->DidDrawAllLayers(frame); | 5424 host_impl_->DidDrawAllLayers(frame); |
| 5425 } | 5425 } |
| 5426 | 5426 |
| 5427 // Expect four surrounding gutter rects. | 5427 // Expect four surrounding gutter rects. |
| 5428 void TestLayerInMiddleOfViewport() { | 5428 void TestLayerInMiddleOfViewport() { |
| 5429 gfx::Rect layer_rect(500, 500, 200, 200); | 5429 gfx::Rect layer_rect(500, 500, 200, 200); |
| 5430 child_->SetPosition(layer_rect.origin()); | 5430 child_->SetPosition(gfx::PointF(layer_rect.origin())); |
| 5431 child_->SetBounds(layer_rect.size()); | 5431 child_->SetBounds(layer_rect.size()); |
| 5432 child_->SetQuadRect(gfx::Rect(layer_rect.size())); | 5432 child_->SetQuadRect(gfx::Rect(layer_rect.size())); |
| 5433 child_->SetQuadVisibleRect(gfx::Rect(layer_rect.size())); | 5433 child_->SetQuadVisibleRect(gfx::Rect(layer_rect.size())); |
| 5434 | 5434 |
| 5435 LayerTreeHostImpl::FrameData frame; | 5435 LayerTreeHostImpl::FrameData frame; |
| 5436 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 5436 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 5437 ASSERT_EQ(1u, frame.render_passes.size()); | 5437 ASSERT_EQ(1u, frame.render_passes.size()); |
| 5438 | 5438 |
| 5439 EXPECT_EQ(4u, CountGutterQuads(frame.render_passes[0]->quad_list)); | 5439 EXPECT_EQ(4u, CountGutterQuads(frame.render_passes[0]->quad_list)); |
| 5440 EXPECT_EQ(5u, frame.render_passes[0]->quad_list.size()); | 5440 EXPECT_EQ(5u, frame.render_passes[0]->quad_list.size()); |
| 5441 ValidateTextureDrawQuads(frame.render_passes[0]->quad_list); | 5441 ValidateTextureDrawQuads(frame.render_passes[0]->quad_list); |
| 5442 | 5442 |
| 5443 VerifyQuadsExactlyCoverViewport(frame.render_passes[0]->quad_list); | 5443 VerifyQuadsExactlyCoverViewport(frame.render_passes[0]->quad_list); |
| 5444 host_impl_->DidDrawAllLayers(frame); | 5444 host_impl_->DidDrawAllLayers(frame); |
| 5445 } | 5445 } |
| 5446 | 5446 |
| 5447 // Expect no gutter rects. | 5447 // Expect no gutter rects. |
| 5448 void TestLayerIsLargerThanViewport() { | 5448 void TestLayerIsLargerThanViewport() { |
| 5449 gfx::Rect layer_rect(viewport_size_.width() + 10, | 5449 gfx::Rect layer_rect(viewport_size_.width() + 10, |
| 5450 viewport_size_.height() + 10); | 5450 viewport_size_.height() + 10); |
| 5451 child_->SetPosition(layer_rect.origin()); | 5451 child_->SetPosition(gfx::PointF(layer_rect.origin())); |
| 5452 child_->SetBounds(layer_rect.size()); | 5452 child_->SetBounds(layer_rect.size()); |
| 5453 child_->SetQuadRect(gfx::Rect(layer_rect.size())); | 5453 child_->SetQuadRect(gfx::Rect(layer_rect.size())); |
| 5454 child_->SetQuadVisibleRect(gfx::Rect(layer_rect.size())); | 5454 child_->SetQuadVisibleRect(gfx::Rect(layer_rect.size())); |
| 5455 | 5455 |
| 5456 LayerTreeHostImpl::FrameData frame; | 5456 LayerTreeHostImpl::FrameData frame; |
| 5457 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 5457 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 5458 ASSERT_EQ(1u, frame.render_passes.size()); | 5458 ASSERT_EQ(1u, frame.render_passes.size()); |
| 5459 | 5459 |
| 5460 EXPECT_EQ(0u, CountGutterQuads(frame.render_passes[0]->quad_list)); | 5460 EXPECT_EQ(0u, CountGutterQuads(frame.render_passes[0]->quad_list)); |
| 5461 EXPECT_EQ(1u, frame.render_passes[0]->quad_list.size()); | 5461 EXPECT_EQ(1u, frame.render_passes[0]->quad_list.size()); |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5987 scoped_ptr<LayerImpl> child = | 5987 scoped_ptr<LayerImpl> child = |
| 5988 LayerImpl::Create(my_host_impl->active_tree(), 2); | 5988 LayerImpl::Create(my_host_impl->active_tree(), 2); |
| 5989 scoped_ptr<LayerImpl> grand_child = | 5989 scoped_ptr<LayerImpl> grand_child = |
| 5990 FakeLayerWithQuads::Create(my_host_impl->active_tree(), 3); | 5990 FakeLayerWithQuads::Create(my_host_impl->active_tree(), 3); |
| 5991 | 5991 |
| 5992 gfx::Rect root_rect(0, 0, 100, 100); | 5992 gfx::Rect root_rect(0, 0, 100, 100); |
| 5993 gfx::Rect child_rect(10, 10, 50, 50); | 5993 gfx::Rect child_rect(10, 10, 50, 50); |
| 5994 gfx::Rect grand_child_rect(5, 5, 150, 150); | 5994 gfx::Rect grand_child_rect(5, 5, 150, 150); |
| 5995 | 5995 |
| 5996 root->SetHasRenderSurface(true); | 5996 root->SetHasRenderSurface(true); |
| 5997 root->SetPosition(root_rect.origin()); | 5997 root->SetPosition(gfx::PointF(root_rect.origin())); |
| 5998 root->SetBounds(root_rect.size()); | 5998 root->SetBounds(root_rect.size()); |
| 5999 root->draw_properties().visible_layer_rect = root_rect; | 5999 root->draw_properties().visible_layer_rect = root_rect; |
| 6000 root->SetDrawsContent(false); | 6000 root->SetDrawsContent(false); |
| 6001 root->render_surface()->SetContentRect(gfx::Rect(root_rect.size())); | 6001 root->render_surface()->SetContentRect(gfx::Rect(root_rect.size())); |
| 6002 | 6002 |
| 6003 child->SetPosition(gfx::PointF(child_rect.x(), child_rect.y())); | 6003 child->SetPosition(gfx::PointF(child_rect.x(), child_rect.y())); |
| 6004 child->SetOpacity(0.5f); | 6004 child->SetOpacity(0.5f); |
| 6005 child->SetBounds(gfx::Size(child_rect.width(), child_rect.height())); | 6005 child->SetBounds(gfx::Size(child_rect.width(), child_rect.height())); |
| 6006 child->draw_properties().visible_layer_rect = child_rect; | 6006 child->draw_properties().visible_layer_rect = child_rect; |
| 6007 child->SetDrawsContent(false); | 6007 child->SetDrawsContent(false); |
| 6008 child->SetHasRenderSurface(true); | 6008 child->SetHasRenderSurface(true); |
| 6009 | 6009 |
| 6010 grand_child->SetPosition(grand_child_rect.origin()); | 6010 grand_child->SetPosition(gfx::PointF(grand_child_rect.origin())); |
| 6011 grand_child->SetBounds(grand_child_rect.size()); | 6011 grand_child->SetBounds(grand_child_rect.size()); |
| 6012 grand_child->draw_properties().visible_layer_rect = grand_child_rect; | 6012 grand_child->draw_properties().visible_layer_rect = grand_child_rect; |
| 6013 grand_child->SetDrawsContent(true); | 6013 grand_child->SetDrawsContent(true); |
| 6014 | 6014 |
| 6015 child->AddChild(grand_child.Pass()); | 6015 child->AddChild(grand_child.Pass()); |
| 6016 root->AddChild(child.Pass()); | 6016 root->AddChild(child.Pass()); |
| 6017 | 6017 |
| 6018 my_host_impl->active_tree()->SetRootLayer(root.Pass()); | 6018 my_host_impl->active_tree()->SetRootLayer(root.Pass()); |
| 6019 return my_host_impl.Pass(); | 6019 return my_host_impl.Pass(); |
| 6020 } | 6020 } |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7065 | 7065 |
| 7066 // Ensure the default frame selection bounds are empty. | 7066 // Ensure the default frame selection bounds are empty. |
| 7067 FakeOutputSurface* fake_output_surface = | 7067 FakeOutputSurface* fake_output_surface = |
| 7068 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); | 7068 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); |
| 7069 const ViewportSelection& selection_before = | 7069 const ViewportSelection& selection_before = |
| 7070 fake_output_surface->last_sent_frame().metadata.selection; | 7070 fake_output_surface->last_sent_frame().metadata.selection; |
| 7071 EXPECT_EQ(ViewportSelectionBound(), selection_before.start); | 7071 EXPECT_EQ(ViewportSelectionBound(), selection_before.start); |
| 7072 EXPECT_EQ(ViewportSelectionBound(), selection_before.end); | 7072 EXPECT_EQ(ViewportSelectionBound(), selection_before.end); |
| 7073 | 7073 |
| 7074 // Plumb the layer-local selection bounds. | 7074 // Plumb the layer-local selection bounds. |
| 7075 gfx::PointF selection_top(5, 0); | 7075 gfx::Point selection_top(5, 0); |
| 7076 gfx::PointF selection_bottom(5, 5); | 7076 gfx::Point selection_bottom(5, 5); |
| 7077 LayerSelection selection; | 7077 LayerSelection selection; |
| 7078 selection.start.type = SELECTION_BOUND_CENTER; | 7078 selection.start.type = SELECTION_BOUND_CENTER; |
| 7079 selection.start.layer_id = root_layer_id; | 7079 selection.start.layer_id = root_layer_id; |
| 7080 selection.start.edge_bottom = selection_bottom; | 7080 selection.start.edge_bottom = selection_bottom; |
| 7081 selection.start.edge_top = selection_top; | 7081 selection.start.edge_top = selection_top; |
| 7082 selection.end = selection.start; | 7082 selection.end = selection.start; |
| 7083 host_impl_->active_tree()->RegisterSelection(selection); | 7083 host_impl_->active_tree()->RegisterSelection(selection); |
| 7084 | 7084 |
| 7085 // Trigger a draw-swap sequence. | 7085 // Trigger a draw-swap sequence. |
| 7086 host_impl_->SetNeedsRedraw(); | 7086 host_impl_->SetNeedsRedraw(); |
| 7087 | 7087 |
| 7088 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); | 7088 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); |
| 7089 LayerTreeHostImpl::FrameData frame; | 7089 LayerTreeHostImpl::FrameData frame; |
| 7090 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 7090 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 7091 host_impl_->DrawLayers(&frame); | 7091 host_impl_->DrawLayers(&frame); |
| 7092 host_impl_->DidDrawAllLayers(frame); | 7092 host_impl_->DidDrawAllLayers(frame); |
| 7093 EXPECT_TRUE(host_impl_->SwapBuffers(frame)); | 7093 EXPECT_TRUE(host_impl_->SwapBuffers(frame)); |
| 7094 | 7094 |
| 7095 // Ensure the selection bounds have propagated to the frame metadata. | 7095 // Ensure the selection bounds have propagated to the frame metadata. |
| 7096 const ViewportSelection& selection_after = | 7096 const ViewportSelection& selection_after = |
| 7097 fake_output_surface->last_sent_frame().metadata.selection; | 7097 fake_output_surface->last_sent_frame().metadata.selection; |
| 7098 EXPECT_EQ(selection.start.type, selection_after.start.type); | 7098 EXPECT_EQ(selection.start.type, selection_after.start.type); |
| 7099 EXPECT_EQ(selection.end.type, selection_after.end.type); | 7099 EXPECT_EQ(selection.end.type, selection_after.end.type); |
| 7100 EXPECT_EQ(selection_bottom, selection_after.start.edge_bottom); | 7100 EXPECT_EQ(gfx::PointF(selection_bottom), selection_after.start.edge_bottom); |
| 7101 EXPECT_EQ(selection_top, selection_after.start.edge_top); | 7101 EXPECT_EQ(gfx::PointF(selection_top), selection_after.start.edge_top); |
| 7102 EXPECT_TRUE(selection_after.start.visible); | 7102 EXPECT_TRUE(selection_after.start.visible); |
| 7103 EXPECT_TRUE(selection_after.start.visible); | 7103 EXPECT_TRUE(selection_after.start.visible); |
| 7104 } | 7104 } |
| 7105 | 7105 |
| 7106 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { | 7106 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { |
| 7107 public: | 7107 public: |
| 7108 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, | 7108 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, |
| 7109 LayerTreeHostImpl* layer_tree_host_impl, | 7109 LayerTreeHostImpl* layer_tree_host_impl, |
| 7110 int* set_needs_commit_count, | 7110 int* set_needs_commit_count, |
| 7111 int* set_needs_redraw_count, | 7111 int* set_needs_redraw_count, |
| (...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8561 // Hold an unowned pointer to the output surface to use for mock expectations. | 8561 // Hold an unowned pointer to the output surface to use for mock expectations. |
| 8562 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); | 8562 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); |
| 8563 | 8563 |
| 8564 CreateHostImpl(DefaultSettings(), output_surface.Pass()); | 8564 CreateHostImpl(DefaultSettings(), output_surface.Pass()); |
| 8565 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); | 8565 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); |
| 8566 host_impl_->BeginCommit(); | 8566 host_impl_->BeginCommit(); |
| 8567 } | 8567 } |
| 8568 | 8568 |
| 8569 } // namespace | 8569 } // namespace |
| 8570 } // namespace cc | 8570 } // namespace cc |
| OLD | NEW |