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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 &proxy_, | 175 &proxy_, |
176 &stats_instrumentation_, | 176 &stats_instrumentation_, |
177 shared_bitmap_manager_.get(), | 177 shared_bitmap_manager_.get(), |
178 0); | 178 0); |
179 bool init = host_impl_->InitializeRenderer(output_surface.Pass()); | 179 bool init = host_impl_->InitializeRenderer(output_surface.Pass()); |
180 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 180 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
181 return init; | 181 return init; |
182 } | 182 } |
183 | 183 |
184 void SetupRootLayerImpl(scoped_ptr<LayerImpl> root) { | 184 void SetupRootLayerImpl(scoped_ptr<LayerImpl> root) { |
185 root->SetAnchorPoint(gfx::PointF()); | 185 root->SetTransformOrigin(gfx::Point3F()); |
186 root->SetPosition(gfx::PointF()); | 186 root->SetPosition(gfx::PointF()); |
187 root->SetBounds(gfx::Size(10, 10)); | 187 root->SetBounds(gfx::Size(10, 10)); |
188 root->SetContentBounds(gfx::Size(10, 10)); | 188 root->SetContentBounds(gfx::Size(10, 10)); |
189 root->SetDrawsContent(true); | 189 root->SetDrawsContent(true); |
190 root->draw_properties().visible_content_rect = gfx::Rect(0, 0, 10, 10); | 190 root->draw_properties().visible_content_rect = gfx::Rect(0, 0, 10, 10); |
191 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 191 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
192 } | 192 } |
193 | 193 |
194 static void ExpectClearedScrollDeltasRecursive(LayerImpl* layer) { | 194 static void ExpectClearedScrollDeltasRecursive(LayerImpl* layer) { |
195 ASSERT_EQ(layer->ScrollDelta(), gfx::Vector2d()); | 195 ASSERT_EQ(layer->ScrollDelta(), gfx::Vector2d()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 LayerImpl* CreateScrollAndContentsLayers(LayerTreeImpl* layer_tree_impl, | 227 LayerImpl* CreateScrollAndContentsLayers(LayerTreeImpl* layer_tree_impl, |
228 const gfx::Size& content_size) { | 228 const gfx::Size& content_size) { |
229 const int kInnerViewportScrollLayerId = 2; | 229 const int kInnerViewportScrollLayerId = 2; |
230 const int kInnerViewportClipLayerId = 4; | 230 const int kInnerViewportClipLayerId = 4; |
231 const int kPageScaleLayerId = 5; | 231 const int kPageScaleLayerId = 5; |
232 scoped_ptr<LayerImpl> root = | 232 scoped_ptr<LayerImpl> root = |
233 LayerImpl::Create(layer_tree_impl, 1); | 233 LayerImpl::Create(layer_tree_impl, 1); |
234 root->SetBounds(content_size); | 234 root->SetBounds(content_size); |
235 root->SetContentBounds(content_size); | 235 root->SetContentBounds(content_size); |
236 root->SetPosition(gfx::PointF()); | 236 root->SetPosition(gfx::PointF()); |
237 root->SetAnchorPoint(gfx::PointF()); | 237 root->SetTransformOrigin(gfx::Point3F()); |
238 | 238 |
239 scoped_ptr<LayerImpl> scroll = | 239 scoped_ptr<LayerImpl> scroll = |
240 LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); | 240 LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); |
241 LayerImpl* scroll_layer = scroll.get(); | 241 LayerImpl* scroll_layer = scroll.get(); |
242 scroll->SetIsContainerForFixedPositionLayers(true); | 242 scroll->SetIsContainerForFixedPositionLayers(true); |
243 scroll->SetScrollOffset(gfx::Vector2d()); | 243 scroll->SetScrollOffset(gfx::Vector2d()); |
244 | 244 |
245 scoped_ptr<LayerImpl> clip = | 245 scoped_ptr<LayerImpl> clip = |
246 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); | 246 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); |
247 clip->SetBounds( | 247 clip->SetBounds( |
248 gfx::Size(content_size.width() / 2, content_size.height() / 2)); | 248 gfx::Size(content_size.width() / 2, content_size.height() / 2)); |
249 | 249 |
250 scoped_ptr<LayerImpl> page_scale = | 250 scoped_ptr<LayerImpl> page_scale = |
251 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); | 251 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); |
252 | 252 |
253 scroll->SetScrollClipLayer(clip->id()); | 253 scroll->SetScrollClipLayer(clip->id()); |
254 scroll->SetBounds(content_size); | 254 scroll->SetBounds(content_size); |
255 scroll->SetContentBounds(content_size); | 255 scroll->SetContentBounds(content_size); |
256 scroll->SetPosition(gfx::PointF()); | 256 scroll->SetPosition(gfx::PointF()); |
257 scroll->SetAnchorPoint(gfx::PointF()); | 257 scroll->SetTransformOrigin(gfx::Point3F()); |
258 scroll->SetIsContainerForFixedPositionLayers(true); | 258 scroll->SetIsContainerForFixedPositionLayers(true); |
259 | 259 |
260 scoped_ptr<LayerImpl> contents = | 260 scoped_ptr<LayerImpl> contents = |
261 LayerImpl::Create(layer_tree_impl, 3); | 261 LayerImpl::Create(layer_tree_impl, 3); |
262 contents->SetDrawsContent(true); | 262 contents->SetDrawsContent(true); |
263 contents->SetBounds(content_size); | 263 contents->SetBounds(content_size); |
264 contents->SetContentBounds(content_size); | 264 contents->SetContentBounds(content_size); |
265 contents->SetPosition(gfx::PointF()); | 265 contents->SetPosition(gfx::PointF()); |
266 contents->SetAnchorPoint(gfx::PointF()); | 266 contents->SetTransformOrigin(gfx::Point3F()); |
267 | 267 |
268 scroll->AddChild(contents.Pass()); | 268 scroll->AddChild(contents.Pass()); |
269 page_scale->AddChild(scroll.Pass()); | 269 page_scale->AddChild(scroll.Pass()); |
270 clip->AddChild(page_scale.Pass()); | 270 clip->AddChild(page_scale.Pass()); |
271 root->AddChild(clip.Pass()); | 271 root->AddChild(clip.Pass()); |
272 | 272 |
273 layer_tree_impl->SetRootLayer(root.Pass()); | 273 layer_tree_impl->SetRootLayer(root.Pass()); |
274 layer_tree_impl->SetViewportLayersFromIds( | 274 layer_tree_impl->SetViewportLayersFromIds( |
275 kPageScaleLayerId, kInnerViewportScrollLayerId, Layer::INVALID_ID); | 275 kPageScaleLayerId, kInnerViewportScrollLayerId, Layer::INVALID_ID); |
276 | 276 |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 host_impl_->SetViewportSize(gfx::Size(100, 100)); | 838 host_impl_->SetViewportSize(gfx::Size(100, 100)); |
839 | 839 |
840 gfx::Size overflow_size(400, 400); | 840 gfx::Size overflow_size(400, 400); |
841 ASSERT_EQ(1u, scroll_layer->children().size()); | 841 ASSERT_EQ(1u, scroll_layer->children().size()); |
842 LayerImpl* overflow = scroll_layer->children()[0]; | 842 LayerImpl* overflow = scroll_layer->children()[0]; |
843 overflow->SetBounds(overflow_size); | 843 overflow->SetBounds(overflow_size); |
844 overflow->SetContentBounds(overflow_size); | 844 overflow->SetContentBounds(overflow_size); |
845 overflow->SetScrollClipLayer(scroll_layer->parent()->id()); | 845 overflow->SetScrollClipLayer(scroll_layer->parent()->id()); |
846 overflow->SetScrollOffset(gfx::Vector2d()); | 846 overflow->SetScrollOffset(gfx::Vector2d()); |
847 overflow->SetPosition(gfx::PointF()); | 847 overflow->SetPosition(gfx::PointF()); |
848 overflow->SetAnchorPoint(gfx::PointF()); | 848 overflow->SetTransformOrigin(gfx::Point3F()); |
849 | 849 |
850 DrawFrame(); | 850 DrawFrame(); |
851 gfx::Point scroll_position(10, 10); | 851 gfx::Point scroll_position(10, 10); |
852 | 852 |
853 EXPECT_EQ(InputHandler::ScrollStarted, | 853 EXPECT_EQ(InputHandler::ScrollStarted, |
854 host_impl_->ScrollBegin(scroll_position, InputHandler::Wheel)); | 854 host_impl_->ScrollBegin(scroll_position, InputHandler::Wheel)); |
855 EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->TotalScrollOffset()); | 855 EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->TotalScrollOffset()); |
856 EXPECT_VECTOR_EQ(gfx::Vector2dF(), overflow->TotalScrollOffset()); | 856 EXPECT_VECTOR_EQ(gfx::Vector2dF(), overflow->TotalScrollOffset()); |
857 | 857 |
858 gfx::Vector2dF scroll_delta(10, 10); | 858 gfx::Vector2dF scroll_delta(10, 10); |
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1684 did_draw_called_ = false; | 1684 did_draw_called_ = false; |
1685 } | 1685 } |
1686 | 1686 |
1687 protected: | 1687 protected: |
1688 DidDrawCheckLayer(LayerTreeImpl* tree_impl, int id) | 1688 DidDrawCheckLayer(LayerTreeImpl* tree_impl, int id) |
1689 : TiledLayerImpl(tree_impl, id), | 1689 : TiledLayerImpl(tree_impl, id), |
1690 will_draw_returns_false_(false), | 1690 will_draw_returns_false_(false), |
1691 will_draw_called_(false), | 1691 will_draw_called_(false), |
1692 append_quads_called_(false), | 1692 append_quads_called_(false), |
1693 did_draw_called_(false) { | 1693 did_draw_called_(false) { |
1694 SetAnchorPoint(gfx::PointF()); | 1694 SetTransformOrigin(gfx::Point3F()); |
1695 SetBounds(gfx::Size(10, 10)); | 1695 SetBounds(gfx::Size(10, 10)); |
1696 SetContentBounds(gfx::Size(10, 10)); | 1696 SetContentBounds(gfx::Size(10, 10)); |
1697 SetDrawsContent(true); | 1697 SetDrawsContent(true); |
1698 set_skips_draw(false); | 1698 set_skips_draw(false); |
1699 draw_properties().visible_content_rect = gfx::Rect(0, 0, 10, 10); | 1699 draw_properties().visible_content_rect = gfx::Rect(0, 0, 10, 10); |
1700 | 1700 |
1701 scoped_ptr<LayerTilingData> tiler = | 1701 scoped_ptr<LayerTilingData> tiler = |
1702 LayerTilingData::Create(gfx::Size(100, 100), | 1702 LayerTilingData::Create(gfx::Size(100, 100), |
1703 LayerTilingData::HAS_BORDER_TEXELS); | 1703 LayerTilingData::HAS_BORDER_TEXELS); |
1704 tiler->SetTilingRect(gfx::Rect(content_bounds())); | 1704 tiler->SetTilingRect(gfx::Rect(content_bounds())); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2128 | 2128 |
2129 scoped_ptr<LayerImpl> root = | 2129 scoped_ptr<LayerImpl> root = |
2130 LayerImpl::Create(host_impl_->active_tree(), 1); | 2130 LayerImpl::Create(host_impl_->active_tree(), 1); |
2131 scoped_ptr<LayerImpl> root_clip = | 2131 scoped_ptr<LayerImpl> root_clip = |
2132 LayerImpl::Create(host_impl_->active_tree(), 2); | 2132 LayerImpl::Create(host_impl_->active_tree(), 2); |
2133 root_clip->SetBounds(clip_size_); | 2133 root_clip->SetBounds(clip_size_); |
2134 root->SetScrollClipLayer(root_clip->id()); | 2134 root->SetScrollClipLayer(root_clip->id()); |
2135 root->SetBounds(layer_size_); | 2135 root->SetBounds(layer_size_); |
2136 root->SetContentBounds(layer_size_); | 2136 root->SetContentBounds(layer_size_); |
2137 root->SetPosition(gfx::PointF()); | 2137 root->SetPosition(gfx::PointF()); |
2138 root->SetAnchorPoint(gfx::PointF()); | 2138 root->SetTransformOrigin(gfx::Point3F()); |
2139 root->SetDrawsContent(false); | 2139 root->SetDrawsContent(false); |
2140 root->SetIsContainerForFixedPositionLayers(true); | 2140 root->SetIsContainerForFixedPositionLayers(true); |
2141 int inner_viewport_scroll_layer_id = root->id(); | 2141 int inner_viewport_scroll_layer_id = root->id(); |
2142 int page_scale_layer_id = root_clip->id(); | 2142 int page_scale_layer_id = root_clip->id(); |
2143 root_clip->AddChild(root.Pass()); | 2143 root_clip->AddChild(root.Pass()); |
2144 host_impl_->active_tree()->SetRootLayer(root_clip.Pass()); | 2144 host_impl_->active_tree()->SetRootLayer(root_clip.Pass()); |
2145 host_impl_->active_tree()->SetViewportLayersFromIds( | 2145 host_impl_->active_tree()->SetViewportLayersFromIds( |
2146 page_scale_layer_id, inner_viewport_scroll_layer_id, Layer::INVALID_ID); | 2146 page_scale_layer_id, inner_viewport_scroll_layer_id, Layer::INVALID_ID); |
2147 // Set a viewport size that is large enough to contain both the top controls | 2147 // Set a viewport size that is large enough to contain both the top controls |
2148 // and some content. | 2148 // and some content. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2267 TEST_F(LayerTreeHostImplTest, ScrollNonCompositedRoot) { | 2267 TEST_F(LayerTreeHostImplTest, ScrollNonCompositedRoot) { |
2268 // Test the configuration where a non-composited root layer is embedded in a | 2268 // Test the configuration where a non-composited root layer is embedded in a |
2269 // scrollable outer layer. | 2269 // scrollable outer layer. |
2270 gfx::Size surface_size(10, 10); | 2270 gfx::Size surface_size(10, 10); |
2271 gfx::Size contents_size(20, 20); | 2271 gfx::Size contents_size(20, 20); |
2272 | 2272 |
2273 scoped_ptr<LayerImpl> content_layer = | 2273 scoped_ptr<LayerImpl> content_layer = |
2274 LayerImpl::Create(host_impl_->active_tree(), 1); | 2274 LayerImpl::Create(host_impl_->active_tree(), 1); |
2275 content_layer->SetDrawsContent(true); | 2275 content_layer->SetDrawsContent(true); |
2276 content_layer->SetPosition(gfx::PointF()); | 2276 content_layer->SetPosition(gfx::PointF()); |
2277 content_layer->SetAnchorPoint(gfx::PointF()); | 2277 content_layer->SetTransformOrigin(gfx::Point3F()); |
2278 content_layer->SetBounds(contents_size); | 2278 content_layer->SetBounds(contents_size); |
2279 content_layer->SetContentBounds(contents_size); | 2279 content_layer->SetContentBounds(contents_size); |
2280 content_layer->SetContentsScale(2.f, 2.f); | 2280 content_layer->SetContentsScale(2.f, 2.f); |
2281 | 2281 |
2282 scoped_ptr<LayerImpl> scroll_clip_layer = | 2282 scoped_ptr<LayerImpl> scroll_clip_layer = |
2283 LayerImpl::Create(host_impl_->active_tree(), 3); | 2283 LayerImpl::Create(host_impl_->active_tree(), 3); |
2284 scroll_clip_layer->SetBounds(surface_size); | 2284 scroll_clip_layer->SetBounds(surface_size); |
2285 | 2285 |
2286 scoped_ptr<LayerImpl> scroll_layer = | 2286 scoped_ptr<LayerImpl> scroll_layer = |
2287 LayerImpl::Create(host_impl_->active_tree(), 2); | 2287 LayerImpl::Create(host_impl_->active_tree(), 2); |
2288 scroll_layer->SetScrollClipLayer(3); | 2288 scroll_layer->SetScrollClipLayer(3); |
2289 scroll_layer->SetBounds(contents_size); | 2289 scroll_layer->SetBounds(contents_size); |
2290 scroll_layer->SetContentBounds(contents_size); | 2290 scroll_layer->SetContentBounds(contents_size); |
2291 scroll_layer->SetPosition(gfx::PointF()); | 2291 scroll_layer->SetPosition(gfx::PointF()); |
2292 scroll_layer->SetAnchorPoint(gfx::PointF()); | 2292 scroll_layer->SetTransformOrigin(gfx::Point3F()); |
2293 scroll_layer->AddChild(content_layer.Pass()); | 2293 scroll_layer->AddChild(content_layer.Pass()); |
2294 scroll_clip_layer->AddChild(scroll_layer.Pass()); | 2294 scroll_clip_layer->AddChild(scroll_layer.Pass()); |
2295 | 2295 |
2296 host_impl_->active_tree()->SetRootLayer(scroll_clip_layer.Pass()); | 2296 host_impl_->active_tree()->SetRootLayer(scroll_clip_layer.Pass()); |
2297 host_impl_->SetViewportSize(surface_size); | 2297 host_impl_->SetViewportSize(surface_size); |
2298 DrawFrame(); | 2298 DrawFrame(); |
2299 | 2299 |
2300 EXPECT_EQ(InputHandler::ScrollStarted, | 2300 EXPECT_EQ(InputHandler::ScrollStarted, |
2301 host_impl_->ScrollBegin(gfx::Point(5, 5), | 2301 host_impl_->ScrollBegin(gfx::Point(5, 5), |
2302 InputHandler::Wheel)); | 2302 InputHandler::Wheel)); |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2893 child_layer_id, scroll_layer->content_bounds(), clip_layer.get()); | 2893 child_layer_id, scroll_layer->content_bounds(), clip_layer.get()); |
2894 gfx::Transform rotate_transform; | 2894 gfx::Transform rotate_transform; |
2895 rotate_transform.Translate(-50.0, -50.0); | 2895 rotate_transform.Translate(-50.0, -50.0); |
2896 rotate_transform.Rotate(child_layer_angle); | 2896 rotate_transform.Rotate(child_layer_angle); |
2897 rotate_transform.Translate(50.0, 50.0); | 2897 rotate_transform.Translate(50.0, 50.0); |
2898 clip_layer->SetTransform(rotate_transform); | 2898 clip_layer->SetTransform(rotate_transform); |
2899 | 2899 |
2900 // Only allow vertical scrolling. | 2900 // Only allow vertical scrolling. |
2901 clip_layer->SetBounds( | 2901 clip_layer->SetBounds( |
2902 gfx::Size(child->bounds().width(), child->bounds().height() / 2)); | 2902 gfx::Size(child->bounds().width(), child->bounds().height() / 2)); |
2903 // The rotation depends on the layer's anchor point, and the child layer is a | 2903 // The rotation depends on the layer's transform origin, and the child layer |
2904 // different size than the clip, so make sure the clip layer's anchor lines | 2904 // is a different size than the clip, so make sure the clip layer's origin |
2905 // up over the child. | 2905 // lines up over the child. |
2906 clip_layer->SetAnchorPoint(gfx::PointF(0.5, 1.0)); | 2906 clip_layer->SetTransformOrigin(gfx::Point3F( |
| 2907 clip_layer->bounds().width() * 0.5f, clip_layer->bounds().height(), 0.f)); |
2907 LayerImpl* child_ptr = child.get(); | 2908 LayerImpl* child_ptr = child.get(); |
2908 clip_layer->AddChild(child.Pass()); | 2909 clip_layer->AddChild(child.Pass()); |
2909 scroll_layer->AddChild(clip_layer.Pass()); | 2910 scroll_layer->AddChild(clip_layer.Pass()); |
2910 | 2911 |
2911 gfx::Size surface_size(50, 50); | 2912 gfx::Size surface_size(50, 50); |
2912 host_impl_->SetViewportSize(surface_size); | 2913 host_impl_->SetViewportSize(surface_size); |
2913 DrawFrame(); | 2914 DrawFrame(); |
2914 { | 2915 { |
2915 // Scroll down in screen coordinates with a gesture. | 2916 // Scroll down in screen coordinates with a gesture. |
2916 gfx::Vector2d gesture_scroll_delta(0, 10); | 2917 gfx::Vector2d gesture_scroll_delta(0, 10); |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3488 has_render_surface_(false), | 3489 has_render_surface_(false), |
3489 quads_appended_(false), | 3490 quads_appended_(false), |
3490 quad_rect_(5, 5, 5, 5), | 3491 quad_rect_(5, 5, 5, 5), |
3491 quad_visible_rect_(5, 5, 5, 5), | 3492 quad_visible_rect_(5, 5, 5, 5), |
3492 resource_id_(resource_provider->CreateResource( | 3493 resource_id_(resource_provider->CreateResource( |
3493 gfx::Size(1, 1), | 3494 gfx::Size(1, 1), |
3494 GL_CLAMP_TO_EDGE, | 3495 GL_CLAMP_TO_EDGE, |
3495 ResourceProvider::TextureUsageAny, | 3496 ResourceProvider::TextureUsageAny, |
3496 RGBA_8888)) { | 3497 RGBA_8888)) { |
3497 resource_provider->AllocateForTesting(resource_id_); | 3498 resource_provider->AllocateForTesting(resource_id_); |
3498 SetAnchorPoint(gfx::PointF()); | 3499 SetTransformOrigin(gfx::Point3F()); |
3499 SetBounds(gfx::Size(10, 10)); | 3500 SetBounds(gfx::Size(10, 10)); |
3500 SetContentBounds(gfx::Size(10, 10)); | 3501 SetContentBounds(gfx::Size(10, 10)); |
3501 SetDrawsContent(true); | 3502 SetDrawsContent(true); |
3502 } | 3503 } |
3503 | 3504 |
3504 bool blend_; | 3505 bool blend_; |
3505 bool has_render_surface_; | 3506 bool has_render_surface_; |
3506 bool quads_appended_; | 3507 bool quads_appended_; |
3507 gfx::Rect quad_rect_; | 3508 gfx::Rect quad_rect_; |
3508 gfx::Rect opaque_content_rect_; | 3509 gfx::Rect opaque_content_rect_; |
3509 gfx::Rect quad_visible_rect_; | 3510 gfx::Rect quad_visible_rect_; |
3510 ResourceProvider::ResourceId resource_id_; | 3511 ResourceProvider::ResourceId resource_id_; |
3511 }; | 3512 }; |
3512 | 3513 |
3513 TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { | 3514 TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
3514 { | 3515 { |
3515 scoped_ptr<LayerImpl> root = | 3516 scoped_ptr<LayerImpl> root = |
3516 LayerImpl::Create(host_impl_->active_tree(), 1); | 3517 LayerImpl::Create(host_impl_->active_tree(), 1); |
3517 root->SetAnchorPoint(gfx::PointF()); | 3518 root->SetTransformOrigin(gfx::Point3F()); |
3518 root->SetBounds(gfx::Size(10, 10)); | 3519 root->SetBounds(gfx::Size(10, 10)); |
3519 root->SetContentBounds(root->bounds()); | 3520 root->SetContentBounds(root->bounds()); |
3520 root->SetDrawsContent(false); | 3521 root->SetDrawsContent(false); |
3521 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 3522 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
3522 } | 3523 } |
3523 LayerImpl* root = host_impl_->active_tree()->root_layer(); | 3524 LayerImpl* root = host_impl_->active_tree()->root_layer(); |
3524 | 3525 |
3525 root->AddChild( | 3526 root->AddChild( |
3526 BlendStateCheckLayer::Create(host_impl_->active_tree(), | 3527 BlendStateCheckLayer::Create(host_impl_->active_tree(), |
3527 2, | 3528 2, |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4034 // can leave the window at the wrong size if we never draw and the proper | 4035 // can leave the window at the wrong size if we never draw and the proper |
4035 // viewport size is never set. | 4036 // viewport size is never set. |
4036 TEST_F(LayerTreeHostImplTest, ReshapeNotCalledUntilDraw) { | 4037 TEST_F(LayerTreeHostImplTest, ReshapeNotCalledUntilDraw) { |
4037 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); | 4038 scoped_refptr<TestContextProvider> provider(TestContextProvider::Create()); |
4038 scoped_ptr<OutputSurface> output_surface( | 4039 scoped_ptr<OutputSurface> output_surface( |
4039 FakeOutputSurface::Create3d(provider)); | 4040 FakeOutputSurface::Create3d(provider)); |
4040 CreateHostImpl(DefaultSettings(), output_surface.Pass()); | 4041 CreateHostImpl(DefaultSettings(), output_surface.Pass()); |
4041 | 4042 |
4042 scoped_ptr<LayerImpl> root = | 4043 scoped_ptr<LayerImpl> root = |
4043 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 1); | 4044 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 1); |
4044 root->SetAnchorPoint(gfx::PointF()); | 4045 root->SetTransformOrigin(gfx::Point3F()); |
4045 root->SetBounds(gfx::Size(10, 10)); | 4046 root->SetBounds(gfx::Size(10, 10)); |
4046 root->SetContentBounds(gfx::Size(10, 10)); | 4047 root->SetContentBounds(gfx::Size(10, 10)); |
4047 root->SetDrawsContent(true); | 4048 root->SetDrawsContent(true); |
4048 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 4049 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
4049 EXPECT_FALSE(provider->TestContext3d()->reshape_called()); | 4050 EXPECT_FALSE(provider->TestContext3d()->reshape_called()); |
4050 provider->TestContext3d()->clear_reshape_called(); | 4051 provider->TestContext3d()->clear_reshape_called(); |
4051 | 4052 |
4052 LayerTreeHostImpl::FrameData frame; | 4053 LayerTreeHostImpl::FrameData frame; |
4053 host_impl_->SetViewportSize(gfx::Size(10, 10)); | 4054 host_impl_->SetViewportSize(gfx::Size(10, 10)); |
4054 host_impl_->SetDeviceScaleFactor(1.f); | 4055 host_impl_->SetDeviceScaleFactor(1.f); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4107 shared_bitmap_manager.get(), | 4108 shared_bitmap_manager.get(), |
4108 0); | 4109 0); |
4109 layer_tree_host_impl->InitializeRenderer(output_surface.Pass()); | 4110 layer_tree_host_impl->InitializeRenderer(output_surface.Pass()); |
4110 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); | 4111 layer_tree_host_impl->SetViewportSize(gfx::Size(500, 500)); |
4111 | 4112 |
4112 scoped_ptr<LayerImpl> root = | 4113 scoped_ptr<LayerImpl> root = |
4113 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); | 4114 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1); |
4114 scoped_ptr<LayerImpl> child = | 4115 scoped_ptr<LayerImpl> child = |
4115 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); | 4116 FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2); |
4116 child->SetPosition(gfx::PointF(12.f, 13.f)); | 4117 child->SetPosition(gfx::PointF(12.f, 13.f)); |
4117 child->SetAnchorPoint(gfx::PointF()); | 4118 child->SetTransformOrigin(gfx::Point3F()); |
4118 child->SetBounds(gfx::Size(14, 15)); | 4119 child->SetBounds(gfx::Size(14, 15)); |
4119 child->SetContentBounds(gfx::Size(14, 15)); | 4120 child->SetContentBounds(gfx::Size(14, 15)); |
4120 child->SetDrawsContent(true); | 4121 child->SetDrawsContent(true); |
4121 root->SetAnchorPoint(gfx::PointF()); | 4122 root->SetTransformOrigin(gfx::Point3F()); |
4122 root->SetBounds(gfx::Size(500, 500)); | 4123 root->SetBounds(gfx::Size(500, 500)); |
4123 root->SetContentBounds(gfx::Size(500, 500)); | 4124 root->SetContentBounds(gfx::Size(500, 500)); |
4124 root->SetDrawsContent(true); | 4125 root->SetDrawsContent(true); |
4125 root->AddChild(child.Pass()); | 4126 root->AddChild(child.Pass()); |
4126 layer_tree_host_impl->active_tree()->SetRootLayer(root.Pass()); | 4127 layer_tree_host_impl->active_tree()->SetRootLayer(root.Pass()); |
4127 | 4128 |
4128 LayerTreeHostImpl::FrameData frame; | 4129 LayerTreeHostImpl::FrameData frame; |
4129 | 4130 |
4130 // First frame, the entire screen should get swapped. | 4131 // First frame, the entire screen should get swapped. |
4131 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame)); | 4132 EXPECT_EQ(DRAW_SUCCESS, layer_tree_host_impl->PrepareToDraw(&frame)); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4167 | 4168 |
4168 EXPECT_EQ(TestContextSupport::SWAP, | 4169 EXPECT_EQ(TestContextSupport::SWAP, |
4169 context_provider->support()->last_swap_type()); | 4170 context_provider->support()->last_swap_type()); |
4170 } | 4171 } |
4171 | 4172 |
4172 TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) { | 4173 TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) { |
4173 scoped_ptr<LayerImpl> root = | 4174 scoped_ptr<LayerImpl> root = |
4174 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 1); | 4175 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 1); |
4175 scoped_ptr<LayerImpl> child = | 4176 scoped_ptr<LayerImpl> child = |
4176 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 2); | 4177 FakeDrawableLayerImpl::Create(host_impl_->active_tree(), 2); |
4177 child->SetAnchorPoint(gfx::PointF()); | 4178 child->SetTransformOrigin(gfx::Point3F()); |
4178 child->SetBounds(gfx::Size(10, 10)); | 4179 child->SetBounds(gfx::Size(10, 10)); |
4179 child->SetContentBounds(gfx::Size(10, 10)); | 4180 child->SetContentBounds(gfx::Size(10, 10)); |
4180 child->SetDrawsContent(true); | 4181 child->SetDrawsContent(true); |
4181 root->SetAnchorPoint(gfx::PointF()); | 4182 root->SetTransformOrigin(gfx::Point3F()); |
4182 root->SetBounds(gfx::Size(10, 10)); | 4183 root->SetBounds(gfx::Size(10, 10)); |
4183 root->SetContentBounds(gfx::Size(10, 10)); | 4184 root->SetContentBounds(gfx::Size(10, 10)); |
4184 root->SetDrawsContent(true); | 4185 root->SetDrawsContent(true); |
4185 root->SetForceRenderSurface(true); | 4186 root->SetForceRenderSurface(true); |
4186 root->AddChild(child.Pass()); | 4187 root->AddChild(child.Pass()); |
4187 | 4188 |
4188 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 4189 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
4189 | 4190 |
4190 LayerTreeHostImpl::FrameData frame; | 4191 LayerTreeHostImpl::FrameData frame; |
4191 | 4192 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4427 scoped_ptr<LayerImpl> child = | 4428 scoped_ptr<LayerImpl> child = |
4428 LayerImpl::Create(my_host_impl->active_tree(), 2); | 4429 LayerImpl::Create(my_host_impl->active_tree(), 2); |
4429 scoped_ptr<LayerImpl> grand_child = | 4430 scoped_ptr<LayerImpl> grand_child = |
4430 FakeLayerWithQuads::Create(my_host_impl->active_tree(), 3); | 4431 FakeLayerWithQuads::Create(my_host_impl->active_tree(), 3); |
4431 | 4432 |
4432 gfx::Rect root_rect(0, 0, 100, 100); | 4433 gfx::Rect root_rect(0, 0, 100, 100); |
4433 gfx::Rect child_rect(10, 10, 50, 50); | 4434 gfx::Rect child_rect(10, 10, 50, 50); |
4434 gfx::Rect grand_child_rect(5, 5, 150, 150); | 4435 gfx::Rect grand_child_rect(5, 5, 150, 150); |
4435 | 4436 |
4436 root->CreateRenderSurface(); | 4437 root->CreateRenderSurface(); |
4437 root->SetAnchorPoint(gfx::PointF()); | 4438 root->SetTransformOrigin(gfx::Point3F()); |
4438 root->SetPosition(root_rect.origin()); | 4439 root->SetPosition(root_rect.origin()); |
4439 root->SetBounds(root_rect.size()); | 4440 root->SetBounds(root_rect.size()); |
4440 root->SetContentBounds(root->bounds()); | 4441 root->SetContentBounds(root->bounds()); |
4441 root->draw_properties().visible_content_rect = root_rect; | 4442 root->draw_properties().visible_content_rect = root_rect; |
4442 root->SetDrawsContent(false); | 4443 root->SetDrawsContent(false); |
4443 root->render_surface()->SetContentRect(gfx::Rect(root_rect.size())); | 4444 root->render_surface()->SetContentRect(gfx::Rect(root_rect.size())); |
4444 | 4445 |
4445 child->SetAnchorPoint(gfx::PointF()); | 4446 child->SetTransformOrigin(gfx::Point3F()); |
4446 child->SetPosition(gfx::PointF(child_rect.x(), child_rect.y())); | 4447 child->SetPosition(gfx::PointF(child_rect.x(), child_rect.y())); |
4447 child->SetOpacity(0.5f); | 4448 child->SetOpacity(0.5f); |
4448 child->SetBounds(gfx::Size(child_rect.width(), child_rect.height())); | 4449 child->SetBounds(gfx::Size(child_rect.width(), child_rect.height())); |
4449 child->SetContentBounds(child->bounds()); | 4450 child->SetContentBounds(child->bounds()); |
4450 child->draw_properties().visible_content_rect = child_rect; | 4451 child->draw_properties().visible_content_rect = child_rect; |
4451 child->SetDrawsContent(false); | 4452 child->SetDrawsContent(false); |
4452 child->SetForceRenderSurface(true); | 4453 child->SetForceRenderSurface(true); |
4453 | 4454 |
4454 grand_child->SetAnchorPoint(gfx::PointF()); | 4455 grand_child->SetTransformOrigin(gfx::Point3F()); |
4455 grand_child->SetPosition(grand_child_rect.origin()); | 4456 grand_child->SetPosition(grand_child_rect.origin()); |
4456 grand_child->SetBounds(grand_child_rect.size()); | 4457 grand_child->SetBounds(grand_child_rect.size()); |
4457 grand_child->SetContentBounds(grand_child->bounds()); | 4458 grand_child->SetContentBounds(grand_child->bounds()); |
4458 grand_child->draw_properties().visible_content_rect = grand_child_rect; | 4459 grand_child->draw_properties().visible_content_rect = grand_child_rect; |
4459 grand_child->SetDrawsContent(true); | 4460 grand_child->SetDrawsContent(true); |
4460 | 4461 |
4461 child->AddChild(grand_child.Pass()); | 4462 child->AddChild(grand_child.Pass()); |
4462 root->AddChild(child.Pass()); | 4463 root->AddChild(child.Pass()); |
4463 | 4464 |
4464 my_host_impl->active_tree()->SetRootLayer(root.Pass()); | 4465 my_host_impl->active_tree()->SetRootLayer(root.Pass()); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4523 scoped_ptr<TestWebGraphicsContext3D> context = | 4524 scoped_ptr<TestWebGraphicsContext3D> context = |
4524 TestWebGraphicsContext3D::Create(); | 4525 TestWebGraphicsContext3D::Create(); |
4525 TestWebGraphicsContext3D* context3d = context.get(); | 4526 TestWebGraphicsContext3D* context3d = context.get(); |
4526 scoped_ptr<OutputSurface> output_surface( | 4527 scoped_ptr<OutputSurface> output_surface( |
4527 FakeOutputSurface::Create3d(context.Pass())); | 4528 FakeOutputSurface::Create3d(context.Pass())); |
4528 CreateHostImpl(DefaultSettings(), output_surface.Pass()); | 4529 CreateHostImpl(DefaultSettings(), output_surface.Pass()); |
4529 | 4530 |
4530 scoped_ptr<LayerImpl> root_layer = | 4531 scoped_ptr<LayerImpl> root_layer = |
4531 LayerImpl::Create(host_impl_->active_tree(), 1); | 4532 LayerImpl::Create(host_impl_->active_tree(), 1); |
4532 root_layer->SetBounds(gfx::Size(10, 10)); | 4533 root_layer->SetBounds(gfx::Size(10, 10)); |
4533 root_layer->SetAnchorPoint(gfx::PointF()); | 4534 root_layer->SetTransformOrigin(gfx::Point3F()); |
4534 | 4535 |
4535 scoped_refptr<VideoFrame> softwareFrame = | 4536 scoped_refptr<VideoFrame> softwareFrame = |
4536 media::VideoFrame::CreateColorFrame( | 4537 media::VideoFrame::CreateColorFrame( |
4537 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); | 4538 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); |
4538 FakeVideoFrameProvider provider; | 4539 FakeVideoFrameProvider provider; |
4539 provider.set_frame(softwareFrame); | 4540 provider.set_frame(softwareFrame); |
4540 scoped_ptr<VideoLayerImpl> video_layer = | 4541 scoped_ptr<VideoLayerImpl> video_layer = |
4541 VideoLayerImpl::Create(host_impl_->active_tree(), 4, &provider); | 4542 VideoLayerImpl::Create(host_impl_->active_tree(), 4, &provider); |
4542 video_layer->SetBounds(gfx::Size(10, 10)); | 4543 video_layer->SetBounds(gfx::Size(10, 10)); |
4543 video_layer->SetAnchorPoint(gfx::PointF()); | 4544 video_layer->SetTransformOrigin(gfx::Point3F()); |
4544 video_layer->SetContentBounds(gfx::Size(10, 10)); | 4545 video_layer->SetContentBounds(gfx::Size(10, 10)); |
4545 video_layer->SetDrawsContent(true); | 4546 video_layer->SetDrawsContent(true); |
4546 root_layer->AddChild(video_layer.PassAs<LayerImpl>()); | 4547 root_layer->AddChild(video_layer.PassAs<LayerImpl>()); |
4547 | 4548 |
4548 scoped_ptr<IOSurfaceLayerImpl> io_surface_layer = | 4549 scoped_ptr<IOSurfaceLayerImpl> io_surface_layer = |
4549 IOSurfaceLayerImpl::Create(host_impl_->active_tree(), 5); | 4550 IOSurfaceLayerImpl::Create(host_impl_->active_tree(), 5); |
4550 io_surface_layer->SetBounds(gfx::Size(10, 10)); | 4551 io_surface_layer->SetBounds(gfx::Size(10, 10)); |
4551 io_surface_layer->SetAnchorPoint(gfx::PointF()); | 4552 io_surface_layer->SetTransformOrigin(gfx::Point3F()); |
4552 io_surface_layer->SetContentBounds(gfx::Size(10, 10)); | 4553 io_surface_layer->SetContentBounds(gfx::Size(10, 10)); |
4553 io_surface_layer->SetDrawsContent(true); | 4554 io_surface_layer->SetDrawsContent(true); |
4554 io_surface_layer->SetIOSurfaceProperties(1, gfx::Size(10, 10)); | 4555 io_surface_layer->SetIOSurfaceProperties(1, gfx::Size(10, 10)); |
4555 root_layer->AddChild(io_surface_layer.PassAs<LayerImpl>()); | 4556 root_layer->AddChild(io_surface_layer.PassAs<LayerImpl>()); |
4556 | 4557 |
4557 host_impl_->active_tree()->SetRootLayer(root_layer.Pass()); | 4558 host_impl_->active_tree()->SetRootLayer(root_layer.Pass()); |
4558 | 4559 |
4559 EXPECT_EQ(0u, context3d->NumTextures()); | 4560 EXPECT_EQ(0u, context3d->NumTextures()); |
4560 | 4561 |
4561 LayerTreeHostImpl::FrameData frame; | 4562 LayerTreeHostImpl::FrameData frame; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4698 | 4699 |
4699 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 4700 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
4700 host_impl_->DidDrawAllLayers(frame); | 4701 host_impl_->DidDrawAllLayers(frame); |
4701 EXPECT_EQ(expect_to_draw, host_impl_->SwapBuffers(frame)); | 4702 EXPECT_EQ(expect_to_draw, host_impl_->SwapBuffers(frame)); |
4702 } | 4703 } |
4703 }; | 4704 }; |
4704 | 4705 |
4705 TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) { | 4706 TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) { |
4706 scoped_ptr<SolidColorLayerImpl> root = | 4707 scoped_ptr<SolidColorLayerImpl> root = |
4707 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); | 4708 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); |
4708 root->SetAnchorPoint(gfx::PointF()); | 4709 root->SetTransformOrigin(gfx::Point3F()); |
4709 root->SetPosition(gfx::PointF()); | 4710 root->SetPosition(gfx::PointF()); |
4710 root->SetBounds(gfx::Size(10, 10)); | 4711 root->SetBounds(gfx::Size(10, 10)); |
4711 root->SetContentBounds(gfx::Size(10, 10)); | 4712 root->SetContentBounds(gfx::Size(10, 10)); |
4712 root->SetDrawsContent(true); | 4713 root->SetDrawsContent(true); |
4713 | 4714 |
4714 // Child layer is in the bottom right corner. | 4715 // Child layer is in the bottom right corner. |
4715 scoped_ptr<SolidColorLayerImpl> child = | 4716 scoped_ptr<SolidColorLayerImpl> child = |
4716 SolidColorLayerImpl::Create(host_impl_->active_tree(), 2); | 4717 SolidColorLayerImpl::Create(host_impl_->active_tree(), 2); |
4717 child->SetAnchorPoint(gfx::PointF(0.f, 0.f)); | 4718 child->SetTransformOrigin(gfx::Point3F(0.f, 0.f, 0.f)); |
4718 child->SetPosition(gfx::PointF(9.f, 9.f)); | 4719 child->SetPosition(gfx::PointF(9.f, 9.f)); |
4719 child->SetBounds(gfx::Size(1, 1)); | 4720 child->SetBounds(gfx::Size(1, 1)); |
4720 child->SetContentBounds(gfx::Size(1, 1)); | 4721 child->SetContentBounds(gfx::Size(1, 1)); |
4721 child->SetDrawsContent(true); | 4722 child->SetDrawsContent(true); |
4722 root->AddChild(child.PassAs<LayerImpl>()); | 4723 root->AddChild(child.PassAs<LayerImpl>()); |
4723 | 4724 |
4724 host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>()); | 4725 host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>()); |
4725 | 4726 |
4726 // Draw a frame. In the first frame, the entire viewport should be damaged. | 4727 // Draw a frame. In the first frame, the entire viewport should be damaged. |
4727 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); | 4728 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4790 | 4791 |
4791 scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = | 4792 scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = |
4792 FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4); | 4793 FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4); |
4793 FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); | 4794 FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); |
4794 content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); | 4795 content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); |
4795 | 4796 |
4796 gfx::Size root_size(100, 100); | 4797 gfx::Size root_size(100, 100); |
4797 root->SetBounds(root_size); | 4798 root->SetBounds(root_size); |
4798 root->SetContentBounds(root_size); | 4799 root->SetContentBounds(root_size); |
4799 root->SetPosition(gfx::PointF()); | 4800 root->SetPosition(gfx::PointF()); |
4800 root->SetAnchorPoint(gfx::PointF()); | 4801 root->SetTransformOrigin(gfx::Point3F()); |
4801 | 4802 |
4802 gfx::Size scaling_layer_size(50, 50); | 4803 gfx::Size scaling_layer_size(50, 50); |
4803 scaling_layer->SetBounds(scaling_layer_size); | 4804 scaling_layer->SetBounds(scaling_layer_size); |
4804 scaling_layer->SetContentBounds(scaling_layer_size); | 4805 scaling_layer->SetContentBounds(scaling_layer_size); |
4805 scaling_layer->SetPosition(gfx::PointF()); | 4806 scaling_layer->SetPosition(gfx::PointF()); |
4806 scaling_layer->SetAnchorPoint(gfx::PointF()); | 4807 scaling_layer->SetTransformOrigin(gfx::Point3F()); |
4807 gfx::Transform scale; | 4808 gfx::Transform scale; |
4808 scale.Scale(2.f, 2.f); | 4809 scale.Scale(2.f, 2.f); |
4809 scaling_layer->SetTransform(scale); | 4810 scaling_layer->SetTransform(scale); |
4810 | 4811 |
4811 content_layer->SetBounds(scaling_layer_size); | 4812 content_layer->SetBounds(scaling_layer_size); |
4812 content_layer->SetContentBounds(scaling_layer_size); | 4813 content_layer->SetContentBounds(scaling_layer_size); |
4813 content_layer->SetPosition(gfx::PointF()); | 4814 content_layer->SetPosition(gfx::PointF()); |
4814 content_layer->SetAnchorPoint(gfx::PointF()); | 4815 content_layer->SetTransformOrigin(gfx::Point3F()); |
4815 content_layer->SetDrawsContent(true); | 4816 content_layer->SetDrawsContent(true); |
4816 | 4817 |
4817 mask_layer->SetBounds(scaling_layer_size); | 4818 mask_layer->SetBounds(scaling_layer_size); |
4818 mask_layer->SetContentBounds(scaling_layer_size); | 4819 mask_layer->SetContentBounds(scaling_layer_size); |
4819 mask_layer->SetPosition(gfx::PointF()); | 4820 mask_layer->SetPosition(gfx::PointF()); |
4820 mask_layer->SetAnchorPoint(gfx::PointF()); | 4821 mask_layer->SetTransformOrigin(gfx::Point3F()); |
4821 mask_layer->SetDrawsContent(true); | 4822 mask_layer->SetDrawsContent(true); |
4822 | 4823 |
4823 | 4824 |
4824 // Check that the tree scaling is correctly taken into account for the mask, | 4825 // Check that the tree scaling is correctly taken into account for the mask, |
4825 // that should fully map onto the quad. | 4826 // that should fully map onto the quad. |
4826 float device_scale_factor = 1.f; | 4827 float device_scale_factor = 1.f; |
4827 host_impl_->SetViewportSize(root_size); | 4828 host_impl_->SetViewportSize(root_size); |
4828 host_impl_->SetDeviceScaleFactor(device_scale_factor); | 4829 host_impl_->SetDeviceScaleFactor(device_scale_factor); |
4829 { | 4830 { |
4830 LayerTreeHostImpl::FrameData frame; | 4831 LayerTreeHostImpl::FrameData frame; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4920 | 4921 |
4921 scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = | 4922 scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = |
4922 FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4); | 4923 FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4); |
4923 FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); | 4924 FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); |
4924 content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); | 4925 content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); |
4925 | 4926 |
4926 gfx::Size root_size(100, 100); | 4927 gfx::Size root_size(100, 100); |
4927 root->SetBounds(root_size); | 4928 root->SetBounds(root_size); |
4928 root->SetContentBounds(root_size); | 4929 root->SetContentBounds(root_size); |
4929 root->SetPosition(gfx::PointF()); | 4930 root->SetPosition(gfx::PointF()); |
4930 root->SetAnchorPoint(gfx::PointF()); | 4931 root->SetTransformOrigin(gfx::Point3F()); |
4931 | 4932 |
4932 gfx::Size layer_size(50, 50); | 4933 gfx::Size layer_size(50, 50); |
4933 content_layer->SetBounds(layer_size); | 4934 content_layer->SetBounds(layer_size); |
4934 content_layer->SetContentBounds(layer_size); | 4935 content_layer->SetContentBounds(layer_size); |
4935 content_layer->SetPosition(gfx::PointF()); | 4936 content_layer->SetPosition(gfx::PointF()); |
4936 content_layer->SetAnchorPoint(gfx::PointF()); | 4937 content_layer->SetTransformOrigin(gfx::Point3F()); |
4937 content_layer->SetDrawsContent(true); | 4938 content_layer->SetDrawsContent(true); |
4938 | 4939 |
4939 gfx::Size mask_size(100, 100); | 4940 gfx::Size mask_size(100, 100); |
4940 mask_layer->SetBounds(mask_size); | 4941 mask_layer->SetBounds(mask_size); |
4941 mask_layer->SetContentBounds(mask_size); | 4942 mask_layer->SetContentBounds(mask_size); |
4942 mask_layer->SetPosition(gfx::PointF()); | 4943 mask_layer->SetPosition(gfx::PointF()); |
4943 mask_layer->SetAnchorPoint(gfx::PointF()); | 4944 mask_layer->SetTransformOrigin(gfx::Point3F()); |
4944 mask_layer->SetDrawsContent(true); | 4945 mask_layer->SetDrawsContent(true); |
4945 | 4946 |
4946 // Check that the mask fills the surface. | 4947 // Check that the mask fills the surface. |
4947 float device_scale_factor = 1.f; | 4948 float device_scale_factor = 1.f; |
4948 host_impl_->SetViewportSize(root_size); | 4949 host_impl_->SetViewportSize(root_size); |
4949 host_impl_->SetDeviceScaleFactor(device_scale_factor); | 4950 host_impl_->SetDeviceScaleFactor(device_scale_factor); |
4950 { | 4951 { |
4951 LayerTreeHostImpl::FrameData frame; | 4952 LayerTreeHostImpl::FrameData frame; |
4952 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 4953 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
4953 | 4954 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5070 | 5071 |
5071 scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = | 5072 scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = |
5072 FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4); | 5073 FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4); |
5073 FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); | 5074 FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); |
5074 replica_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); | 5075 replica_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); |
5075 | 5076 |
5076 gfx::Size root_size(100, 100); | 5077 gfx::Size root_size(100, 100); |
5077 root->SetBounds(root_size); | 5078 root->SetBounds(root_size); |
5078 root->SetContentBounds(root_size); | 5079 root->SetContentBounds(root_size); |
5079 root->SetPosition(gfx::PointF()); | 5080 root->SetPosition(gfx::PointF()); |
5080 root->SetAnchorPoint(gfx::PointF()); | 5081 root->SetTransformOrigin(gfx::Point3F()); |
5081 | 5082 |
5082 gfx::Size layer_size(50, 50); | 5083 gfx::Size layer_size(50, 50); |
5083 content_layer->SetBounds(layer_size); | 5084 content_layer->SetBounds(layer_size); |
5084 content_layer->SetContentBounds(layer_size); | 5085 content_layer->SetContentBounds(layer_size); |
5085 content_layer->SetPosition(gfx::PointF()); | 5086 content_layer->SetPosition(gfx::PointF()); |
5086 content_layer->SetAnchorPoint(gfx::PointF()); | 5087 content_layer->SetTransformOrigin(gfx::Point3F()); |
5087 content_layer->SetDrawsContent(true); | 5088 content_layer->SetDrawsContent(true); |
5088 | 5089 |
5089 gfx::Size mask_size(100, 100); | 5090 gfx::Size mask_size(100, 100); |
5090 mask_layer->SetBounds(mask_size); | 5091 mask_layer->SetBounds(mask_size); |
5091 mask_layer->SetContentBounds(mask_size); | 5092 mask_layer->SetContentBounds(mask_size); |
5092 mask_layer->SetPosition(gfx::PointF()); | 5093 mask_layer->SetPosition(gfx::PointF()); |
5093 mask_layer->SetAnchorPoint(gfx::PointF()); | 5094 mask_layer->SetTransformOrigin(gfx::Point3F()); |
5094 mask_layer->SetDrawsContent(true); | 5095 mask_layer->SetDrawsContent(true); |
5095 | 5096 |
5096 // Check that the mask fills the surface. | 5097 // Check that the mask fills the surface. |
5097 float device_scale_factor = 1.f; | 5098 float device_scale_factor = 1.f; |
5098 host_impl_->SetViewportSize(root_size); | 5099 host_impl_->SetViewportSize(root_size); |
5099 host_impl_->SetDeviceScaleFactor(device_scale_factor); | 5100 host_impl_->SetDeviceScaleFactor(device_scale_factor); |
5100 { | 5101 { |
5101 LayerTreeHostImpl::FrameData frame; | 5102 LayerTreeHostImpl::FrameData frame; |
5102 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 5103 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
5103 | 5104 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5229 | 5230 |
5230 scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = | 5231 scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = |
5231 FakeMaskLayerImpl::Create(host_impl_->active_tree(), 5); | 5232 FakeMaskLayerImpl::Create(host_impl_->active_tree(), 5); |
5232 FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); | 5233 FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); |
5233 replica_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); | 5234 replica_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); |
5234 | 5235 |
5235 gfx::Size root_size(100, 100); | 5236 gfx::Size root_size(100, 100); |
5236 root->SetBounds(root_size); | 5237 root->SetBounds(root_size); |
5237 root->SetContentBounds(root_size); | 5238 root->SetContentBounds(root_size); |
5238 root->SetPosition(gfx::PointF()); | 5239 root->SetPosition(gfx::PointF()); |
5239 root->SetAnchorPoint(gfx::PointF()); | 5240 root->SetTransformOrigin(gfx::Point3F()); |
5240 | 5241 |
5241 gfx::Size layer_size(50, 50); | 5242 gfx::Size layer_size(50, 50); |
5242 content_layer->SetBounds(layer_size); | 5243 content_layer->SetBounds(layer_size); |
5243 content_layer->SetContentBounds(layer_size); | 5244 content_layer->SetContentBounds(layer_size); |
5244 content_layer->SetPosition(gfx::PointF()); | 5245 content_layer->SetPosition(gfx::PointF()); |
5245 content_layer->SetAnchorPoint(gfx::PointF()); | 5246 content_layer->SetTransformOrigin(gfx::Point3F()); |
5246 content_layer->SetDrawsContent(true); | 5247 content_layer->SetDrawsContent(true); |
5247 | 5248 |
5248 gfx::Size child_size(50, 50); | 5249 gfx::Size child_size(50, 50); |
5249 content_child_layer->SetBounds(child_size); | 5250 content_child_layer->SetBounds(child_size); |
5250 content_child_layer->SetContentBounds(child_size); | 5251 content_child_layer->SetContentBounds(child_size); |
5251 content_child_layer->SetPosition(gfx::Point(50, 0)); | 5252 content_child_layer->SetPosition(gfx::Point(50, 0)); |
5252 content_child_layer->SetAnchorPoint(gfx::PointF()); | 5253 content_child_layer->SetTransformOrigin(gfx::Point3F()); |
5253 content_child_layer->SetDrawsContent(true); | 5254 content_child_layer->SetDrawsContent(true); |
5254 | 5255 |
5255 gfx::Size mask_size(50, 50); | 5256 gfx::Size mask_size(50, 50); |
5256 mask_layer->SetBounds(mask_size); | 5257 mask_layer->SetBounds(mask_size); |
5257 mask_layer->SetContentBounds(mask_size); | 5258 mask_layer->SetContentBounds(mask_size); |
5258 mask_layer->SetPosition(gfx::PointF()); | 5259 mask_layer->SetPosition(gfx::PointF()); |
5259 mask_layer->SetAnchorPoint(gfx::PointF()); | 5260 mask_layer->SetTransformOrigin(gfx::Point3F()); |
5260 mask_layer->SetDrawsContent(true); | 5261 mask_layer->SetDrawsContent(true); |
5261 | 5262 |
5262 float device_scale_factor = 1.f; | 5263 float device_scale_factor = 1.f; |
5263 host_impl_->SetViewportSize(root_size); | 5264 host_impl_->SetViewportSize(root_size); |
5264 host_impl_->SetDeviceScaleFactor(device_scale_factor); | 5265 host_impl_->SetDeviceScaleFactor(device_scale_factor); |
5265 { | 5266 { |
5266 LayerTreeHostImpl::FrameData frame; | 5267 LayerTreeHostImpl::FrameData frame; |
5267 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 5268 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
5268 | 5269 |
5269 ASSERT_EQ(1u, frame.render_passes.size()); | 5270 ASSERT_EQ(1u, frame.render_passes.size()); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5355 | 5356 |
5356 scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = | 5357 scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer = |
5357 FakeMaskLayerImpl::Create(host_impl_->active_tree(), 6); | 5358 FakeMaskLayerImpl::Create(host_impl_->active_tree(), 6); |
5358 FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); | 5359 FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get(); |
5359 content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); | 5360 content_layer->SetMaskLayer(scoped_mask_layer.PassAs<LayerImpl>()); |
5360 | 5361 |
5361 gfx::Size root_size(100, 100); | 5362 gfx::Size root_size(100, 100); |
5362 root->SetBounds(root_size); | 5363 root->SetBounds(root_size); |
5363 root->SetContentBounds(root_size); | 5364 root->SetContentBounds(root_size); |
5364 root->SetPosition(gfx::PointF()); | 5365 root->SetPosition(gfx::PointF()); |
5365 root->SetAnchorPoint(gfx::PointF()); | 5366 root->SetTransformOrigin(gfx::Point3F()); |
5366 | 5367 |
5367 gfx::Rect clipping_rect(20, 10, 10, 20); | 5368 gfx::Rect clipping_rect(20, 10, 10, 20); |
5368 clipping_layer->SetBounds(clipping_rect.size()); | 5369 clipping_layer->SetBounds(clipping_rect.size()); |
5369 clipping_layer->SetContentBounds(clipping_rect.size()); | 5370 clipping_layer->SetContentBounds(clipping_rect.size()); |
5370 clipping_layer->SetPosition(clipping_rect.origin()); | 5371 clipping_layer->SetPosition(clipping_rect.origin()); |
5371 clipping_layer->SetAnchorPoint(gfx::PointF()); | 5372 clipping_layer->SetTransformOrigin(gfx::Point3F()); |
5372 clipping_layer->SetMasksToBounds(true); | 5373 clipping_layer->SetMasksToBounds(true); |
5373 | 5374 |
5374 gfx::Size layer_size(50, 50); | 5375 gfx::Size layer_size(50, 50); |
5375 content_layer->SetBounds(layer_size); | 5376 content_layer->SetBounds(layer_size); |
5376 content_layer->SetContentBounds(layer_size); | 5377 content_layer->SetContentBounds(layer_size); |
5377 content_layer->SetPosition(gfx::Point() - clipping_rect.OffsetFromOrigin()); | 5378 content_layer->SetPosition(gfx::Point() - clipping_rect.OffsetFromOrigin()); |
5378 content_layer->SetAnchorPoint(gfx::PointF()); | 5379 content_layer->SetTransformOrigin(gfx::Point3F()); |
5379 content_layer->SetDrawsContent(true); | 5380 content_layer->SetDrawsContent(true); |
5380 | 5381 |
5381 gfx::Size child_size(50, 50); | 5382 gfx::Size child_size(50, 50); |
5382 content_child_layer->SetBounds(child_size); | 5383 content_child_layer->SetBounds(child_size); |
5383 content_child_layer->SetContentBounds(child_size); | 5384 content_child_layer->SetContentBounds(child_size); |
5384 content_child_layer->SetPosition(gfx::Point(50, 0)); | 5385 content_child_layer->SetPosition(gfx::Point(50, 0)); |
5385 content_child_layer->SetAnchorPoint(gfx::PointF()); | 5386 content_child_layer->SetTransformOrigin(gfx::Point3F()); |
5386 content_child_layer->SetDrawsContent(true); | 5387 content_child_layer->SetDrawsContent(true); |
5387 | 5388 |
5388 gfx::Size mask_size(100, 100); | 5389 gfx::Size mask_size(100, 100); |
5389 mask_layer->SetBounds(mask_size); | 5390 mask_layer->SetBounds(mask_size); |
5390 mask_layer->SetContentBounds(mask_size); | 5391 mask_layer->SetContentBounds(mask_size); |
5391 mask_layer->SetPosition(gfx::PointF()); | 5392 mask_layer->SetPosition(gfx::PointF()); |
5392 mask_layer->SetAnchorPoint(gfx::PointF()); | 5393 mask_layer->SetTransformOrigin(gfx::Point3F()); |
5393 mask_layer->SetDrawsContent(true); | 5394 mask_layer->SetDrawsContent(true); |
5394 | 5395 |
5395 float device_scale_factor = 1.f; | 5396 float device_scale_factor = 1.f; |
5396 host_impl_->SetViewportSize(root_size); | 5397 host_impl_->SetViewportSize(root_size); |
5397 host_impl_->SetDeviceScaleFactor(device_scale_factor); | 5398 host_impl_->SetDeviceScaleFactor(device_scale_factor); |
5398 { | 5399 { |
5399 LayerTreeHostImpl::FrameData frame; | 5400 LayerTreeHostImpl::FrameData frame; |
5400 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 5401 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
5401 | 5402 |
5402 ASSERT_EQ(1u, frame.render_passes.size()); | 5403 ASSERT_EQ(1u, frame.render_passes.size()); |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6091 LayerImpl* page_scale_layer = | 6092 LayerImpl* page_scale_layer = |
6092 host_impl_->active_tree()->LayerById(page_scale_layer_id); | 6093 host_impl_->active_tree()->LayerById(page_scale_layer_id); |
6093 | 6094 |
6094 int occluder_layer_id = 6; | 6095 int occluder_layer_id = 6; |
6095 scoped_ptr<LayerImpl> occluder_layer = | 6096 scoped_ptr<LayerImpl> occluder_layer = |
6096 LayerImpl::Create(host_impl_->active_tree(), occluder_layer_id); | 6097 LayerImpl::Create(host_impl_->active_tree(), occluder_layer_id); |
6097 occluder_layer->SetDrawsContent(true); | 6098 occluder_layer->SetDrawsContent(true); |
6098 occluder_layer->SetBounds(content_size); | 6099 occluder_layer->SetBounds(content_size); |
6099 occluder_layer->SetContentBounds(content_size); | 6100 occluder_layer->SetContentBounds(content_size); |
6100 occluder_layer->SetPosition(gfx::PointF()); | 6101 occluder_layer->SetPosition(gfx::PointF()); |
6101 occluder_layer->SetAnchorPoint(gfx::PointF()); | 6102 occluder_layer->SetTransformOrigin(gfx::Point3F()); |
6102 | 6103 |
6103 // The parent of the occluder is *above* the scroller. | 6104 // The parent of the occluder is *above* the scroller. |
6104 page_scale_layer->AddChild(occluder_layer.Pass()); | 6105 page_scale_layer->AddChild(occluder_layer.Pass()); |
6105 | 6106 |
6106 DrawFrame(); | 6107 DrawFrame(); |
6107 | 6108 |
6108 EXPECT_EQ(InputHandler::ScrollUnknown, | 6109 EXPECT_EQ(InputHandler::ScrollUnknown, |
6109 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel)); | 6110 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel)); |
6110 } | 6111 } |
6111 | 6112 |
6112 TEST_F(LayerTreeHostImplTest, ScrollUnknownScrollAncestorMismatch) { | 6113 TEST_F(LayerTreeHostImplTest, ScrollUnknownScrollAncestorMismatch) { |
6113 // If we ray cast a scroller this is on the first layer's ancestor chain, but | 6114 // If we ray cast a scroller this is on the first layer's ancestor chain, but |
6114 // is not the first scroller we encounter when walking up from the layer, we | 6115 // is not the first scroller we encounter when walking up from the layer, we |
6115 // should also return ScrollUnknown. | 6116 // should also return ScrollUnknown. |
6116 gfx::Size content_size(100, 100); | 6117 gfx::Size content_size(100, 100); |
6117 SetupScrollAndContentsLayers(content_size); | 6118 SetupScrollAndContentsLayers(content_size); |
6118 | 6119 |
6119 int scroll_layer_id = 2; | 6120 int scroll_layer_id = 2; |
6120 LayerImpl* scroll_layer = | 6121 LayerImpl* scroll_layer = |
6121 host_impl_->active_tree()->LayerById(scroll_layer_id); | 6122 host_impl_->active_tree()->LayerById(scroll_layer_id); |
6122 scroll_layer->SetDrawsContent(true); | 6123 scroll_layer->SetDrawsContent(true); |
6123 | 6124 |
6124 int occluder_layer_id = 6; | 6125 int occluder_layer_id = 6; |
6125 scoped_ptr<LayerImpl> occluder_layer = | 6126 scoped_ptr<LayerImpl> occluder_layer = |
6126 LayerImpl::Create(host_impl_->active_tree(), occluder_layer_id); | 6127 LayerImpl::Create(host_impl_->active_tree(), occluder_layer_id); |
6127 occluder_layer->SetDrawsContent(true); | 6128 occluder_layer->SetDrawsContent(true); |
6128 occluder_layer->SetBounds(content_size); | 6129 occluder_layer->SetBounds(content_size); |
6129 occluder_layer->SetContentBounds(content_size); | 6130 occluder_layer->SetContentBounds(content_size); |
6130 occluder_layer->SetPosition(gfx::PointF(-10.f, -10.f)); | 6131 occluder_layer->SetPosition(gfx::PointF(-10.f, -10.f)); |
6131 occluder_layer->SetAnchorPoint(gfx::PointF()); | 6132 occluder_layer->SetTransformOrigin(gfx::Point3F()); |
6132 | 6133 |
6133 int child_scroll_clip_layer_id = 7; | 6134 int child_scroll_clip_layer_id = 7; |
6134 scoped_ptr<LayerImpl> child_scroll_clip = | 6135 scoped_ptr<LayerImpl> child_scroll_clip = |
6135 LayerImpl::Create(host_impl_->active_tree(), child_scroll_clip_layer_id); | 6136 LayerImpl::Create(host_impl_->active_tree(), child_scroll_clip_layer_id); |
6136 | 6137 |
6137 int child_scroll_layer_id = 8; | 6138 int child_scroll_layer_id = 8; |
6138 scoped_ptr<LayerImpl> child_scroll = CreateScrollableLayer( | 6139 scoped_ptr<LayerImpl> child_scroll = CreateScrollableLayer( |
6139 child_scroll_layer_id, content_size, child_scroll_clip.get()); | 6140 child_scroll_layer_id, content_size, child_scroll_clip.get()); |
6140 | 6141 |
6141 child_scroll->SetPosition(gfx::PointF(10.f, 10.f)); | 6142 child_scroll->SetPosition(gfx::PointF(10.f, 10.f)); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6195 host_impl_->active_tree()->LayerById(scroll_layer_id); | 6196 host_impl_->active_tree()->LayerById(scroll_layer_id); |
6196 | 6197 |
6197 int scroll_child_id = 6; | 6198 int scroll_child_id = 6; |
6198 scoped_ptr<LayerImpl> scroll_child = | 6199 scoped_ptr<LayerImpl> scroll_child = |
6199 LayerImpl::Create(host_impl_->active_tree(), scroll_child_id); | 6200 LayerImpl::Create(host_impl_->active_tree(), scroll_child_id); |
6200 scroll_child->SetDrawsContent(true); | 6201 scroll_child->SetDrawsContent(true); |
6201 scroll_child->SetBounds(content_size); | 6202 scroll_child->SetBounds(content_size); |
6202 scroll_child->SetContentBounds(content_size); | 6203 scroll_child->SetContentBounds(content_size); |
6203 // Move the scroll child so it's not hit by our test point. | 6204 // Move the scroll child so it's not hit by our test point. |
6204 scroll_child->SetPosition(gfx::PointF(10.f, 10.f)); | 6205 scroll_child->SetPosition(gfx::PointF(10.f, 10.f)); |
6205 scroll_child->SetAnchorPoint(gfx::PointF()); | 6206 scroll_child->SetTransformOrigin(gfx::Point3F()); |
6206 | 6207 |
6207 int invisible_scroll_layer_id = 7; | 6208 int invisible_scroll_layer_id = 7; |
6208 scoped_ptr<LayerImpl> invisible_scroll = | 6209 scoped_ptr<LayerImpl> invisible_scroll = |
6209 CreateScrollableLayer(invisible_scroll_layer_id, content_size, root); | 6210 CreateScrollableLayer(invisible_scroll_layer_id, content_size, root); |
6210 invisible_scroll->SetDrawsContent(false); | 6211 invisible_scroll->SetDrawsContent(false); |
6211 | 6212 |
6212 int container_id = 8; | 6213 int container_id = 8; |
6213 scoped_ptr<LayerImpl> container = | 6214 scoped_ptr<LayerImpl> container = |
6214 LayerImpl::Create(host_impl_->active_tree(), container_id); | 6215 LayerImpl::Create(host_impl_->active_tree(), container_id); |
6215 | 6216 |
(...skipping 20 matching lines...) Expand all Loading... |
6236 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel)); | 6237 host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel)); |
6237 | 6238 |
6238 EXPECT_EQ(7, host_impl_->CurrentlyScrollingLayer()->id()); | 6239 EXPECT_EQ(7, host_impl_->CurrentlyScrollingLayer()->id()); |
6239 } | 6240 } |
6240 | 6241 |
6241 // Make sure LatencyInfo carried by LatencyInfoSwapPromise are passed | 6242 // Make sure LatencyInfo carried by LatencyInfoSwapPromise are passed |
6242 // to CompositorFrameMetadata after SwapBuffers(); | 6243 // to CompositorFrameMetadata after SwapBuffers(); |
6243 TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) { | 6244 TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) { |
6244 scoped_ptr<SolidColorLayerImpl> root = | 6245 scoped_ptr<SolidColorLayerImpl> root = |
6245 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); | 6246 SolidColorLayerImpl::Create(host_impl_->active_tree(), 1); |
6246 root->SetAnchorPoint(gfx::PointF()); | 6247 root->SetTransformOrigin(gfx::Point3F()); |
6247 root->SetPosition(gfx::PointF()); | 6248 root->SetPosition(gfx::PointF()); |
6248 root->SetBounds(gfx::Size(10, 10)); | 6249 root->SetBounds(gfx::Size(10, 10)); |
6249 root->SetContentBounds(gfx::Size(10, 10)); | 6250 root->SetContentBounds(gfx::Size(10, 10)); |
6250 root->SetDrawsContent(true); | 6251 root->SetDrawsContent(true); |
6251 | 6252 |
6252 host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>()); | 6253 host_impl_->active_tree()->SetRootLayer(root.PassAs<LayerImpl>()); |
6253 | 6254 |
6254 FakeOutputSurface* fake_output_surface = | 6255 FakeOutputSurface* fake_output_surface = |
6255 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); | 6256 static_cast<FakeOutputSurface*>(host_impl_->output_surface()); |
6256 | 6257 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6453 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); | 6454 LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); |
6454 inner_clip->SetBounds(inner_viewport); | 6455 inner_clip->SetBounds(inner_viewport); |
6455 | 6456 |
6456 scoped_ptr<LayerImpl> page_scale = | 6457 scoped_ptr<LayerImpl> page_scale = |
6457 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); | 6458 LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); |
6458 | 6459 |
6459 inner_scroll->SetScrollClipLayer(inner_clip->id()); | 6460 inner_scroll->SetScrollClipLayer(inner_clip->id()); |
6460 inner_scroll->SetBounds(outer_viewport); | 6461 inner_scroll->SetBounds(outer_viewport); |
6461 inner_scroll->SetContentBounds(outer_viewport); | 6462 inner_scroll->SetContentBounds(outer_viewport); |
6462 inner_scroll->SetPosition(gfx::PointF()); | 6463 inner_scroll->SetPosition(gfx::PointF()); |
6463 inner_scroll->SetAnchorPoint(gfx::PointF()); | 6464 inner_scroll->SetTransformOrigin(gfx::Point3F()); |
6464 | 6465 |
6465 scoped_ptr<LayerImpl> outer_clip = | 6466 scoped_ptr<LayerImpl> outer_clip = |
6466 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); | 6467 LayerImpl::Create(layer_tree_impl, kOuterViewportClipLayerId); |
6467 outer_clip->SetBounds(outer_viewport); | 6468 outer_clip->SetBounds(outer_viewport); |
6468 outer_clip->SetIsContainerForFixedPositionLayers(true); | 6469 outer_clip->SetIsContainerForFixedPositionLayers(true); |
6469 | 6470 |
6470 scoped_ptr<LayerImpl> outer_scroll = | 6471 scoped_ptr<LayerImpl> outer_scroll = |
6471 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); | 6472 LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); |
6472 outer_scroll->SetScrollClipLayer(outer_clip->id()); | 6473 outer_scroll->SetScrollClipLayer(outer_clip->id()); |
6473 outer_scroll->SetScrollOffset(gfx::Vector2d()); | 6474 outer_scroll->SetScrollOffset(gfx::Vector2d()); |
6474 outer_scroll->SetBounds(content_size); | 6475 outer_scroll->SetBounds(content_size); |
6475 outer_scroll->SetContentBounds(content_size); | 6476 outer_scroll->SetContentBounds(content_size); |
6476 outer_scroll->SetPosition(gfx::PointF()); | 6477 outer_scroll->SetPosition(gfx::PointF()); |
6477 outer_scroll->SetAnchorPoint(gfx::PointF()); | 6478 outer_scroll->SetTransformOrigin(gfx::Point3F()); |
6478 | 6479 |
6479 scoped_ptr<LayerImpl> contents = | 6480 scoped_ptr<LayerImpl> contents = |
6480 LayerImpl::Create(layer_tree_impl, 8); | 6481 LayerImpl::Create(layer_tree_impl, 8); |
6481 contents->SetDrawsContent(true); | 6482 contents->SetDrawsContent(true); |
6482 contents->SetBounds(content_size); | 6483 contents->SetBounds(content_size); |
6483 contents->SetContentBounds(content_size); | 6484 contents->SetContentBounds(content_size); |
6484 contents->SetPosition(gfx::PointF()); | 6485 contents->SetPosition(gfx::PointF()); |
6485 contents->SetAnchorPoint(gfx::PointF()); | 6486 contents->SetTransformOrigin(gfx::Point3F()); |
6486 | 6487 |
6487 outer_scroll->AddChild(contents.Pass()); | 6488 outer_scroll->AddChild(contents.Pass()); |
6488 outer_clip->AddChild(outer_scroll.Pass()); | 6489 outer_clip->AddChild(outer_scroll.Pass()); |
6489 inner_scroll->AddChild(outer_clip.Pass()); | 6490 inner_scroll->AddChild(outer_clip.Pass()); |
6490 page_scale->AddChild(inner_scroll.Pass()); | 6491 page_scale->AddChild(inner_scroll.Pass()); |
6491 inner_clip->AddChild(page_scale.Pass()); | 6492 inner_clip->AddChild(page_scale.Pass()); |
6492 | 6493 |
6493 layer_tree_impl->SetRootLayer(inner_clip.Pass()); | 6494 layer_tree_impl->SetRootLayer(inner_clip.Pass()); |
6494 layer_tree_impl->SetViewportLayersFromIds(kPageScaleLayerId, | 6495 layer_tree_impl->SetViewportLayersFromIds(kPageScaleLayerId, |
6495 kInnerViewportScrollLayerId, kOuterViewportScrollLayerId); | 6496 kInnerViewportScrollLayerId, kOuterViewportScrollLayerId); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6616 FakePictureLayerImpl* active_mask_content = | 6617 FakePictureLayerImpl* active_mask_content = |
6617 static_cast<FakePictureLayerImpl*>( | 6618 static_cast<FakePictureLayerImpl*>( |
6618 host_impl_->active_tree()->root_layer()->children()[0]->mask_layer()); | 6619 host_impl_->active_tree()->root_layer()->children()[0]->mask_layer()); |
6619 gfx::Rect r2 = active_mask_content->visible_rect_for_tile_priority(); | 6620 gfx::Rect r2 = active_mask_content->visible_rect_for_tile_priority(); |
6620 | 6621 |
6621 ASSERT_TRUE(!r2.IsEmpty()); | 6622 ASSERT_TRUE(!r2.IsEmpty()); |
6622 } | 6623 } |
6623 | 6624 |
6624 } // namespace | 6625 } // namespace |
6625 } // namespace cc | 6626 } // namespace cc |
OLD | NEW |