summaryrefslogtreecommitdiffstats
path: root/cc/trees/layer_tree_impl_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc/trees/layer_tree_impl_unittest.cc')
-rw-r--r--cc/trees/layer_tree_impl_unittest.cc80
1 files changed, 54 insertions, 26 deletions
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index 7c917e0..a0dd11a 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -2098,12 +2098,14 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForSingleLayer) {
LayerSelectionBound left_input;
left_input.type = SELECTION_BOUND_LEFT;
- left_input.layer_rect = gfx::RectF(10, 10, 5, 20);
+ left_input.edge_top = gfx::PointF(10, 10);
+ left_input.edge_bottom = gfx::PointF(10, 20);
left_input.layer_id = root_layer_id;
LayerSelectionBound right_input;
right_input.type = SELECTION_BOUND_RIGHT;
- right_input.layer_rect = gfx::RectF(50, 10, 5, 20);
+ right_input.edge_top = gfx::PointF(50, 10);
+ right_input.edge_bottom = gfx::PointF(50, 30);
right_input.layer_id = root_layer_id;
ViewportSelectionBound left_output, right_output;
@@ -2117,22 +2119,26 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForSingleLayer) {
host_impl().active_tree()->RegisterSelection(left_input, right_input);
host_impl().active_tree()->GetViewportSelection(&left_output, &right_output);
EXPECT_EQ(left_input.type, left_output.type);
- EXPECT_EQ(left_input.layer_rect, left_output.viewport_rect);
+ EXPECT_EQ(left_input.edge_bottom, left_output.edge_bottom);
+ EXPECT_EQ(left_input.edge_top, left_output.edge_top);
EXPECT_TRUE(left_output.visible);
EXPECT_EQ(right_input.type, right_output.type);
- EXPECT_EQ(right_input.layer_rect, right_output.viewport_rect);
+ EXPECT_EQ(right_input.edge_bottom, right_output.edge_bottom);
+ EXPECT_EQ(right_input.edge_top, right_output.edge_top);
EXPECT_TRUE(right_output.visible);
// Insertion bounds should produce identical left and right bounds.
LayerSelectionBound insertion_input;
insertion_input.type = SELECTION_BOUND_CENTER;
- insertion_input.layer_rect = gfx::RectF(10, 10, 5, 20);
+ insertion_input.edge_top = gfx::PointF(15, 10);
+ insertion_input.edge_bottom = gfx::PointF(15, 30);
insertion_input.layer_id = root_layer_id;
host_impl().active_tree()->RegisterSelection(insertion_input,
LayerSelectionBound());
host_impl().active_tree()->GetViewportSelection(&left_output, &right_output);
EXPECT_EQ(insertion_input.type, left_output.type);
- EXPECT_EQ(insertion_input.layer_rect, left_output.viewport_rect);
+ EXPECT_EQ(insertion_input.edge_bottom, left_output.edge_bottom);
+ EXPECT_EQ(insertion_input.edge_top, left_output.edge_top);
EXPECT_TRUE(left_output.visible);
EXPECT_EQ(left_output, right_output);
}
@@ -2198,12 +2204,14 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) {
LayerSelectionBound left_input;
left_input.type = SELECTION_BOUND_LEFT;
- left_input.layer_rect = gfx::RectF(25, 10, 5, 20);
+ left_input.edge_top = gfx::PointF(25, 10);
+ left_input.edge_bottom = gfx::PointF(25, 30);
left_input.layer_id = clipped_layer_id;
LayerSelectionBound right_input;
right_input.type = SELECTION_BOUND_RIGHT;
- right_input.layer_rect = gfx::RectF(75, 10, 5, 20);
+ right_input.edge_top = gfx::PointF(75, 10);
+ right_input.edge_bottom = gfx::PointF(75, 30);
right_input.layer_id = clipped_layer_id;
host_impl().active_tree()->RegisterSelection(left_input, right_input);
@@ -2211,29 +2219,38 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) {
ViewportSelectionBound left_output, right_output;
host_impl().active_tree()->GetViewportSelection(&left_output, &right_output);
EXPECT_EQ(left_input.type, left_output.type);
- gfx::RectF expected_left_output_rect = left_input.layer_rect;
- expected_left_output_rect.Offset(clipping_offset);
- EXPECT_EQ(expected_left_output_rect, left_output.viewport_rect);
+ gfx::PointF expected_left_output_top = left_input.edge_top;
+ gfx::PointF expected_left_output_bottom = left_input.edge_bottom;
+ expected_left_output_top.Offset(clipping_offset.x(), clipping_offset.y());
+ expected_left_output_bottom.Offset(clipping_offset.x(), clipping_offset.y());
+ EXPECT_EQ(expected_left_output_top, left_output.edge_top);
+ EXPECT_EQ(expected_left_output_bottom, left_output.edge_bottom);
EXPECT_TRUE(left_output.visible);
EXPECT_EQ(right_input.type, right_output.type);
- gfx::RectF expected_right_output_rect = right_input.layer_rect;
- expected_right_output_rect.Offset(clipping_offset);
- EXPECT_EQ(expected_right_output_rect, right_output.viewport_rect);
+ gfx::PointF expected_right_output_top = right_input.edge_top;
+ gfx::PointF expected_right_output_bottom = right_input.edge_bottom;
+ expected_right_output_bottom.Offset(clipping_offset.x(), clipping_offset.y());
+ expected_right_output_top.Offset(clipping_offset.x(), clipping_offset.y());
+ EXPECT_EQ(expected_right_output_top, right_output.edge_top);
+ EXPECT_EQ(expected_right_output_bottom, right_output.edge_bottom);
EXPECT_FALSE(right_output.visible);
// Handles outside the viewport bounds should be marked invisible.
- left_input.layer_rect = gfx::RectF(-25, 0, 5, 20);
+ left_input.edge_top = gfx::PointF(-25, 0);
+ left_input.edge_bottom = gfx::PointF(-25, 20);
host_impl().active_tree()->RegisterSelection(left_input, right_input);
host_impl().active_tree()->GetViewportSelection(&left_output, &right_output);
EXPECT_FALSE(left_output.visible);
- left_input.layer_rect = gfx::RectF(0, -25, 5, 20);
+ left_input.edge_top = gfx::PointF(0, -25);
+ left_input.edge_bottom = gfx::PointF(0, -5);
host_impl().active_tree()->RegisterSelection(left_input, right_input);
host_impl().active_tree()->GetViewportSelection(&left_output, &right_output);
EXPECT_FALSE(left_output.visible);
// If the handle bottom is partially visible, the handle is marked visible.
- left_input.layer_rect = gfx::RectF(0, -20, 5, 21);
+ left_input.edge_top = gfx::PointF(0, -20);
+ left_input.edge_bottom = gfx::PointF(0, 1);
host_impl().active_tree()->RegisterSelection(left_input, right_input);
host_impl().active_tree()->GetViewportSelection(&left_output, &right_output);
EXPECT_TRUE(left_output.visible);
@@ -2293,12 +2310,14 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
LayerSelectionBound left_input;
left_input.type = SELECTION_BOUND_LEFT;
- left_input.layer_rect = gfx::RectF(10, 10, 5, 20);
+ left_input.edge_top = gfx::PointF(10, 10);
+ left_input.edge_bottom = gfx::PointF(10, 30);
left_input.layer_id = root_layer_id;
LayerSelectionBound right_input;
right_input.type = SELECTION_BOUND_RIGHT;
- right_input.layer_rect = gfx::RectF(0, 0, 5, 20);
+ right_input.edge_top = gfx::PointF(0, 0);
+ right_input.edge_bottom = gfx::PointF(0, 20);
right_input.layer_id = sub_layer_id;
host_impl().active_tree()->RegisterSelection(left_input, right_input);
@@ -2307,15 +2326,24 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
ViewportSelectionBound left_output, right_output;
host_impl().active_tree()->GetViewportSelection(&left_output, &right_output);
EXPECT_EQ(left_input.type, left_output.type);
- gfx::RectF expected_left_output_rect = left_input.layer_rect;
- expected_left_output_rect.Scale(page_scale_factor);
- EXPECT_EQ(left_input.layer_rect, left_output.viewport_rect);
+ gfx::PointF expected_left_output_top = left_input.edge_top;
+ gfx::PointF expected_left_output_bottom = left_input.edge_bottom;
+ expected_left_output_top.Scale(page_scale_factor);
+ expected_left_output_bottom.Scale(page_scale_factor);
+ EXPECT_EQ(left_input.edge_top, left_output.edge_top);
+ EXPECT_EQ(left_input.edge_bottom, left_output.edge_bottom);
EXPECT_TRUE(left_output.visible);
EXPECT_EQ(right_input.type, right_output.type);
- gfx::RectF expected_right_output_rect = right_input.layer_rect;
- expected_right_output_rect.Offset(sub_layer_offset);
- expected_right_output_rect.Scale(page_scale_factor);
- EXPECT_EQ(expected_right_output_rect, right_output.viewport_rect);
+
+ gfx::PointF expected_right_output_top = right_input.edge_top;
+ gfx::PointF expected_right_output_bottom = right_input.edge_bottom;
+ expected_right_output_top.Offset(sub_layer_offset.x(), sub_layer_offset.y());
+ expected_right_output_bottom.Offset(sub_layer_offset.x(),
+ sub_layer_offset.y());
+ expected_right_output_top.Scale(page_scale_factor);
+ expected_right_output_bottom.Scale(page_scale_factor);
+ EXPECT_EQ(expected_right_output_top, right_output.edge_top);
+ EXPECT_EQ(expected_right_output_bottom, right_output.edge_bottom);
EXPECT_TRUE(right_output.visible);
}