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 <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 6327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6338 FakeOutputSurface* fake_output_surface = | 6338 FakeOutputSurface* fake_output_surface = |
6339 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); | 6339 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); |
6340 const ViewportSelectionBound& selection_start_before = | 6340 const ViewportSelectionBound& selection_start_before = |
6341 fake_output_surface->last_sent_frame().metadata.selection_start; | 6341 fake_output_surface->last_sent_frame().metadata.selection_start; |
6342 const ViewportSelectionBound& selection_end_before = | 6342 const ViewportSelectionBound& selection_end_before = |
6343 fake_output_surface->last_sent_frame().metadata.selection_end; | 6343 fake_output_surface->last_sent_frame().metadata.selection_end; |
6344 EXPECT_EQ(ViewportSelectionBound(), selection_start_before); | 6344 EXPECT_EQ(ViewportSelectionBound(), selection_start_before); |
6345 EXPECT_EQ(ViewportSelectionBound(), selection_end_before); | 6345 EXPECT_EQ(ViewportSelectionBound(), selection_end_before); |
6346 | 6346 |
6347 // Plumb the layer-local selection bounds. | 6347 // Plumb the layer-local selection bounds. |
6348 gfx::Rect selection_rect(5, 0, 0, 5); | 6348 gfx::PointF selection_top(5, 0); |
| 6349 gfx::PointF selection_bottom(5, 5); |
6349 LayerSelectionBound start, end; | 6350 LayerSelectionBound start, end; |
6350 start.type = SELECTION_BOUND_CENTER; | 6351 start.type = SELECTION_BOUND_CENTER; |
6351 start.layer_id = root_layer_id; | 6352 start.layer_id = root_layer_id; |
6352 start.layer_rect = selection_rect; | 6353 start.edge_bottom = selection_bottom; |
| 6354 start.edge_top = selection_top; |
6353 end = start; | 6355 end = start; |
6354 host_impl_->active_tree()->RegisterSelection(start, end); | 6356 host_impl_->active_tree()->RegisterSelection(start, end); |
6355 | 6357 |
6356 // Trigger a draw-swap sequence. | 6358 // Trigger a draw-swap sequence. |
6357 host_impl_->SetNeedsRedraw(); | 6359 host_impl_->SetNeedsRedraw(); |
6358 | 6360 |
6359 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); | 6361 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); |
6360 LayerTreeHostImpl::FrameData frame; | 6362 LayerTreeHostImpl::FrameData frame; |
6361 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 6363 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
6362 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 6364 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
6363 host_impl_->DidDrawAllLayers(frame); | 6365 host_impl_->DidDrawAllLayers(frame); |
6364 EXPECT_TRUE(host_impl_->SwapBuffers(frame)); | 6366 EXPECT_TRUE(host_impl_->SwapBuffers(frame)); |
6365 | 6367 |
6366 // Ensure the selection bounds have propagated to the frame metadata. | 6368 // Ensure the selection bounds have propagated to the frame metadata. |
6367 const ViewportSelectionBound& selection_start_after = | 6369 const ViewportSelectionBound& selection_start_after = |
6368 fake_output_surface->last_sent_frame().metadata.selection_start; | 6370 fake_output_surface->last_sent_frame().metadata.selection_start; |
6369 const ViewportSelectionBound& selection_end_after = | 6371 const ViewportSelectionBound& selection_end_after = |
6370 fake_output_surface->last_sent_frame().metadata.selection_end; | 6372 fake_output_surface->last_sent_frame().metadata.selection_end; |
6371 EXPECT_EQ(start.type, selection_start_after.type); | 6373 EXPECT_EQ(start.type, selection_start_after.type); |
6372 EXPECT_EQ(end.type, selection_end_after.type); | 6374 EXPECT_EQ(end.type, selection_end_after.type); |
6373 EXPECT_EQ(selection_rect, selection_start_after.viewport_rect); | 6375 EXPECT_EQ(selection_bottom, selection_start_after.edge_bottom); |
6374 EXPECT_EQ(selection_rect, selection_start_after.viewport_rect); | 6376 EXPECT_EQ(selection_top, selection_start_after.edge_top); |
6375 EXPECT_TRUE(selection_start_after.visible); | 6377 EXPECT_TRUE(selection_start_after.visible); |
6376 EXPECT_TRUE(selection_start_after.visible); | 6378 EXPECT_TRUE(selection_start_after.visible); |
6377 } | 6379 } |
6378 | 6380 |
6379 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { | 6381 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { |
6380 public: | 6382 public: |
6381 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, | 6383 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, |
6382 LayerTreeHostImpl* layer_tree_host_impl, | 6384 LayerTreeHostImpl* layer_tree_host_impl, |
6383 int* set_needs_commit_count, | 6385 int* set_needs_commit_count, |
6384 int* set_needs_redraw_count, | 6386 int* set_needs_redraw_count, |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7025 host_impl_->DidLoseOutputSurface(); | 7027 host_impl_->DidLoseOutputSurface(); |
7026 EXPECT_TRUE(host_impl_->IsContextLost()); | 7028 EXPECT_TRUE(host_impl_->IsContextLost()); |
7027 EXPECT_EQ(1, num_lost_surfaces_); | 7029 EXPECT_EQ(1, num_lost_surfaces_); |
7028 host_impl_->DidLoseOutputSurface(); | 7030 host_impl_->DidLoseOutputSurface(); |
7029 EXPECT_TRUE(host_impl_->IsContextLost()); | 7031 EXPECT_TRUE(host_impl_->IsContextLost()); |
7030 EXPECT_EQ(1, num_lost_surfaces_); | 7032 EXPECT_EQ(1, num_lost_surfaces_); |
7031 } | 7033 } |
7032 | 7034 |
7033 } // namespace | 7035 } // namespace |
7034 } // namespace cc | 7036 } // namespace cc |
OLD | NEW |