| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "cc/layers/heads_up_display_layer_impl.h" | 9 #include "cc/layers/heads_up_display_layer_impl.h" |
| 10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
| (...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 host_impl().active_tree()->RegisterSelection(input); | 1927 host_impl().active_tree()->RegisterSelection(input); |
| 1928 host_impl().active_tree()->GetViewportSelection(&output); | 1928 host_impl().active_tree()->GetViewportSelection(&output); |
| 1929 EXPECT_EQ(input.start.type, output.start.type()); | 1929 EXPECT_EQ(input.start.type, output.start.type()); |
| 1930 EXPECT_EQ(gfx::PointF(input.start.edge_bottom), output.start.edge_bottom()); | 1930 EXPECT_EQ(gfx::PointF(input.start.edge_bottom), output.start.edge_bottom()); |
| 1931 EXPECT_EQ(gfx::PointF(input.start.edge_top), output.start.edge_top()); | 1931 EXPECT_EQ(gfx::PointF(input.start.edge_top), output.start.edge_top()); |
| 1932 EXPECT_TRUE(output.start.visible()); | 1932 EXPECT_TRUE(output.start.visible()); |
| 1933 EXPECT_EQ(input.end.type, output.end.type()); | 1933 EXPECT_EQ(input.end.type, output.end.type()); |
| 1934 EXPECT_EQ(gfx::PointF(input.end.edge_bottom), output.end.edge_bottom()); | 1934 EXPECT_EQ(gfx::PointF(input.end.edge_bottom), output.end.edge_bottom()); |
| 1935 EXPECT_EQ(gfx::PointF(input.end.edge_top), output.end.edge_top()); | 1935 EXPECT_EQ(gfx::PointF(input.end.edge_top), output.end.edge_top()); |
| 1936 EXPECT_TRUE(output.end.visible()); | 1936 EXPECT_TRUE(output.end.visible()); |
| 1937 EXPECT_EQ(input.is_editable, output.is_editable); | |
| 1938 EXPECT_EQ(input.is_empty_text_form_control, | |
| 1939 output.is_empty_text_form_control); | |
| 1940 | 1937 |
| 1941 // Insertion bounds should produce identical left and right bounds. | 1938 // Insertion bounds should produce identical left and right bounds. |
| 1942 LayerSelection insertion_input; | 1939 LayerSelection insertion_input; |
| 1943 insertion_input.start.type = gfx::SelectionBound::CENTER; | 1940 insertion_input.start.type = gfx::SelectionBound::CENTER; |
| 1944 insertion_input.start.edge_top = gfx::Point(15, 10); | 1941 insertion_input.start.edge_top = gfx::Point(15, 10); |
| 1945 insertion_input.start.edge_bottom = gfx::Point(15, 30); | 1942 insertion_input.start.edge_bottom = gfx::Point(15, 30); |
| 1946 insertion_input.start.layer_id = root->id(); | 1943 insertion_input.start.layer_id = root->id(); |
| 1947 insertion_input.is_editable = true; | |
| 1948 insertion_input.is_empty_text_form_control = true; | |
| 1949 insertion_input.end = insertion_input.start; | 1944 insertion_input.end = insertion_input.start; |
| 1950 host_impl().active_tree()->RegisterSelection(insertion_input); | 1945 host_impl().active_tree()->RegisterSelection(insertion_input); |
| 1951 host_impl().active_tree()->GetViewportSelection(&output); | 1946 host_impl().active_tree()->GetViewportSelection(&output); |
| 1952 EXPECT_EQ(insertion_input.start.type, output.start.type()); | 1947 EXPECT_EQ(insertion_input.start.type, output.start.type()); |
| 1953 EXPECT_EQ(gfx::PointF(insertion_input.start.edge_bottom), | 1948 EXPECT_EQ(gfx::PointF(insertion_input.start.edge_bottom), |
| 1954 output.start.edge_bottom()); | 1949 output.start.edge_bottom()); |
| 1955 EXPECT_EQ(gfx::PointF(insertion_input.start.edge_top), | 1950 EXPECT_EQ(gfx::PointF(insertion_input.start.edge_top), |
| 1956 output.start.edge_top()); | 1951 output.start.edge_top()); |
| 1957 EXPECT_EQ(insertion_input.is_editable, output.is_editable); | |
| 1958 EXPECT_EQ(insertion_input.is_empty_text_form_control, | |
| 1959 output.is_empty_text_form_control); | |
| 1960 EXPECT_TRUE(output.start.visible()); | 1952 EXPECT_TRUE(output.start.visible()); |
| 1961 EXPECT_EQ(output.start, output.end); | 1953 EXPECT_EQ(output.start, output.end); |
| 1962 } | 1954 } |
| 1963 | 1955 |
| 1964 TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) { | 1956 TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) { |
| 1965 LayerImpl* root = root_layer(); | 1957 LayerImpl* root = root_layer(); |
| 1966 root->SetDrawsContent(true); | 1958 root->SetDrawsContent(true); |
| 1967 root->SetBounds(gfx::Size(100, 100)); | 1959 root->SetBounds(gfx::Size(100, 100)); |
| 1968 | 1960 |
| 1969 int clip_layer_id = 1234; | 1961 int clip_layer_id = 1234; |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2409 auto weak_promise = promise->AsWeakPtr(); | 2401 auto weak_promise = promise->AsWeakPtr(); |
| 2410 host_impl().active_tree()->QueueSwapPromise(std::move(promise)); | 2402 host_impl().active_tree()->QueueSwapPromise(std::move(promise)); |
| 2411 host_impl().active_tree()->BreakSwapPromises( | 2403 host_impl().active_tree()->BreakSwapPromises( |
| 2412 SwapPromise::DidNotSwapReason::SWAP_FAILS); | 2404 SwapPromise::DidNotSwapReason::SWAP_FAILS); |
| 2413 EXPECT_FALSE(weak_promise); | 2405 EXPECT_FALSE(weak_promise); |
| 2414 } | 2406 } |
| 2415 } | 2407 } |
| 2416 | 2408 |
| 2417 } // namespace | 2409 } // namespace |
| 2418 } // namespace cc | 2410 } // namespace cc |
| OLD | NEW |