| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
| 8 #include "cc/layers/content_layer.h" | 8 #include "cc/layers/content_layer.h" |
| 9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
| 10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest { | 25 class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest { |
| 26 public: | 26 public: |
| 27 LayerTreeHostScrollTestScrollSimple() | 27 LayerTreeHostScrollTestScrollSimple() |
| 28 : initial_scroll_(10, 20), | 28 : initial_scroll_(10, 20), |
| 29 second_scroll_(40, 5), | 29 second_scroll_(40, 5), |
| 30 scroll_amount_(2, -1), | 30 scroll_amount_(2, -1), |
| 31 num_scrolls_(0) {} | 31 num_scrolls_(0) {} |
| 32 | 32 |
| 33 virtual void BeginTest() OVERRIDE { | 33 virtual void BeginTest() OVERRIDE { |
| 34 layer_tree_host()->root_layer()->SetScrollable(true); | 34 // layer_tree_host()->root_layer()->SetScrollable(true); // WJM |
| 35 layer_tree_host()->root_layer() | 35 // layer_tree_host()->root_layer() |
| 36 ->SetMaxScrollOffset(gfx::Vector2d(100, 100)); | 36 // ->SetMaxScrollOffset(gfx::Vector2d(100, 100)); |
| 37 layer_tree_host()->root_layer()->SetScrollOffset(initial_scroll_); | 37 layer_tree_host()->root_layer()->SetScrollOffset(initial_scroll_); |
| 38 PostSetNeedsCommitToMainThread(); | 38 PostSetNeedsCommitToMainThread(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 virtual void Layout() OVERRIDE { | 41 virtual void Layout() OVERRIDE { |
| 42 Layer* root = layer_tree_host()->root_layer(); | 42 Layer* root = layer_tree_host()->root_layer(); |
| 43 if (!layer_tree_host()->source_frame_number()) { | 43 if (!layer_tree_host()->source_frame_number()) { |
| 44 EXPECT_VECTOR_EQ(initial_scroll_, root->scroll_offset()); | 44 EXPECT_VECTOR_EQ(initial_scroll_, root->scroll_offset()); |
| 45 } else { | 45 } else { |
| 46 EXPECT_VECTOR_EQ(initial_scroll_ + scroll_amount_, root->scroll_offset()); | 46 EXPECT_VECTOR_EQ(initial_scroll_ + scroll_amount_, root->scroll_offset()); |
| 47 | 47 |
| 48 // Pretend like Javascript updated the scroll position itself. | 48 // Pretend like Javascript updated the scroll position itself. |
| 49 root->SetScrollOffset(second_scroll_); | 49 root->SetScrollOffset(second_scroll_); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 53 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 54 LayerImpl* root = impl->active_tree()->root_layer(); | 54 LayerImpl* root = impl->active_tree()->root_layer(); |
| 55 EXPECT_VECTOR_EQ(gfx::Vector2d(), root->ScrollDelta()); | 55 EXPECT_VECTOR_EQ(gfx::Vector2d(), root->ScrollDelta()); |
| 56 | 56 |
| 57 root->SetScrollable(true); | 57 // root->SetScrollable(true); // WJM |
| 58 root->SetMaxScrollOffset(gfx::Vector2d(100, 100)); | 58 // root->SetMaxScrollOffset(gfx::Vector2d(100, 100)); |
| 59 root->ScrollBy(scroll_amount_); | 59 root->ScrollBy(scroll_amount_); |
| 60 | 60 |
| 61 switch (impl->active_tree()->source_frame_number()) { | 61 switch (impl->active_tree()->source_frame_number()) { |
| 62 case 0: | 62 case 0: |
| 63 EXPECT_VECTOR_EQ(initial_scroll_, root->scroll_offset()); | 63 EXPECT_VECTOR_EQ(initial_scroll_, root->scroll_offset()); |
| 64 EXPECT_VECTOR_EQ(scroll_amount_, root->ScrollDelta()); | 64 EXPECT_VECTOR_EQ(scroll_amount_, root->ScrollDelta()); |
| 65 PostSetNeedsCommitToMainThread(); | 65 PostSetNeedsCommitToMainThread(); |
| 66 break; | 66 break; |
| 67 case 1: | 67 case 1: |
| 68 EXPECT_VECTOR_EQ(root->scroll_offset(), second_scroll_); | 68 EXPECT_VECTOR_EQ(root->scroll_offset(), second_scroll_); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 88 | 88 |
| 89 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollSimple); | 89 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollSimple); |
| 90 | 90 |
| 91 class LayerTreeHostScrollTestScrollMultipleRedraw | 91 class LayerTreeHostScrollTestScrollMultipleRedraw |
| 92 : public LayerTreeHostScrollTest { | 92 : public LayerTreeHostScrollTest { |
| 93 public: | 93 public: |
| 94 LayerTreeHostScrollTestScrollMultipleRedraw() | 94 LayerTreeHostScrollTestScrollMultipleRedraw() |
| 95 : initial_scroll_(40, 10), scroll_amount_(-3, 17), num_scrolls_(0) {} | 95 : initial_scroll_(40, 10), scroll_amount_(-3, 17), num_scrolls_(0) {} |
| 96 | 96 |
| 97 virtual void BeginTest() OVERRIDE { | 97 virtual void BeginTest() OVERRIDE { |
| 98 layer_tree_host()->root_layer()->SetScrollable(true); | 98 // layer_tree_host()->root_layer()->SetScrollable(true); // WJM |
| 99 layer_tree_host()->root_layer()->SetScrollOffset(initial_scroll_); | 99 layer_tree_host()->root_layer()->SetScrollOffset(initial_scroll_); |
| 100 layer_tree_host()->root_layer()->SetBounds(gfx::Size(200, 200)); | 100 layer_tree_host()->root_layer()->SetBounds(gfx::Size(200, 200)); |
| 101 layer_tree_host()->root_layer() | 101 // layer_tree_host()->root_layer() |
| 102 ->SetMaxScrollOffset(gfx::Vector2d(100, 100)); | 102 // ->SetMaxScrollOffset(gfx::Vector2d(100, 100)); |
| 103 PostSetNeedsCommitToMainThread(); | 103 PostSetNeedsCommitToMainThread(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 virtual void BeginCommitOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 106 virtual void BeginCommitOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 107 Layer* root = layer_tree_host()->root_layer(); | 107 Layer* root = layer_tree_host()->root_layer(); |
| 108 switch (layer_tree_host()->source_frame_number()) { | 108 switch (layer_tree_host()->source_frame_number()) { |
| 109 case 0: | 109 case 0: |
| 110 EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_); | 110 EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_); |
| 111 break; | 111 break; |
| 112 case 1: | 112 case 1: |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 num_will_commits_(0), | 177 num_will_commits_(0), |
| 178 num_did_commits_(0), | 178 num_did_commits_(0), |
| 179 num_impl_commits_(0), | 179 num_impl_commits_(0), |
| 180 num_impl_scrolls_(0) {} | 180 num_impl_scrolls_(0) {} |
| 181 | 181 |
| 182 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 182 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 183 | 183 |
| 184 virtual void SetupTree() OVERRIDE { | 184 virtual void SetupTree() OVERRIDE { |
| 185 LayerTreeHostScrollTest::SetupTree(); | 185 LayerTreeHostScrollTest::SetupTree(); |
| 186 scoped_refptr<Layer> root_scroll_layer = Layer::Create(); | 186 scoped_refptr<Layer> root_scroll_layer = Layer::Create(); |
| 187 root_scroll_layer->SetScrollable(true); | 187 // root_scroll_layer->SetScrollable(true); // WJM |
| 188 root_scroll_layer->SetScrollOffset(initial_scroll_); | 188 root_scroll_layer->SetScrollOffset(initial_scroll_); |
| 189 root_scroll_layer->SetBounds(gfx::Size(200, 200)); | 189 root_scroll_layer->SetBounds(gfx::Size(200, 200)); |
| 190 root_scroll_layer->SetMaxScrollOffset(gfx::Vector2d(100, 100)); | 190 // root_scroll_layer->SetMaxScrollOffset(gfx::Vector2d(100, 100)); |
| 191 root_scroll_layer->SetIsDrawable(true); | 191 root_scroll_layer->SetIsDrawable(true); |
| 192 layer_tree_host()->root_layer()->AddChild(root_scroll_layer); | 192 layer_tree_host()->root_layer()->AddChild(root_scroll_layer); |
| 193 | 193 |
| 194 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f); | 194 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f); |
| 195 } | 195 } |
| 196 | 196 |
| 197 virtual void WillBeginMainFrame() OVERRIDE { | 197 virtual void WillBeginMainFrame() OVERRIDE { |
| 198 num_will_begin_main_frames_++; | 198 num_will_begin_main_frames_++; |
| 199 Layer* root_scroll_layer = layer_tree_host()->root_layer()->children()[0]; | 199 Layer* root_scroll_layer = layer_tree_host()->root_layer()->children()[0]; |
| 200 switch (num_will_begin_main_frames_) { | 200 switch (num_will_begin_main_frames_) { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 int num_impl_scrolls_; | 338 int num_impl_scrolls_; |
| 339 }; | 339 }; |
| 340 | 340 |
| 341 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommit); | 341 MULTI_THREAD_TEST_F(LayerTreeHostScrollTestScrollAbortedCommit); |
| 342 | 342 |
| 343 class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest { | 343 class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest { |
| 344 public: | 344 public: |
| 345 LayerTreeHostScrollTestFractionalScroll() : scroll_amount_(1.75, 0) {} | 345 LayerTreeHostScrollTestFractionalScroll() : scroll_amount_(1.75, 0) {} |
| 346 | 346 |
| 347 virtual void BeginTest() OVERRIDE { | 347 virtual void BeginTest() OVERRIDE { |
| 348 layer_tree_host()->root_layer()->SetScrollable(true); | 348 // layer_tree_host()->root_layer()->SetScrollable(true); // WJM |
| 349 layer_tree_host()->root_layer() | 349 // layer_tree_host()->root_layer() |
| 350 ->SetMaxScrollOffset(gfx::Vector2d(100, 100)); | 350 // ->SetMaxScrollOffset(gfx::Vector2d(100, 100)); |
| 351 PostSetNeedsCommitToMainThread(); | 351 PostSetNeedsCommitToMainThread(); |
| 352 } | 352 } |
| 353 | 353 |
| 354 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 354 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 355 LayerImpl* root = impl->active_tree()->root_layer(); | 355 LayerImpl* root = impl->active_tree()->root_layer(); |
| 356 | 356 |
| 357 // Check that a fractional scroll delta is correctly accumulated over | 357 // Check that a fractional scroll delta is correctly accumulated over |
| 358 // multiple commits. | 358 // multiple commits. |
| 359 switch (impl->active_tree()->source_frame_number()) { | 359 switch (impl->active_tree()->source_frame_number()) { |
| 360 case 0: | 360 case 0: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 scoped_refptr<Layer> root_layer = Layer::Create(); | 404 scoped_refptr<Layer> root_layer = Layer::Create(); |
| 405 root_layer->SetBounds(gfx::Size(10, 10)); | 405 root_layer->SetBounds(gfx::Size(10, 10)); |
| 406 | 406 |
| 407 root_scroll_layer_ = ContentLayer::Create(&fake_content_layer_client_); | 407 root_scroll_layer_ = ContentLayer::Create(&fake_content_layer_client_); |
| 408 root_scroll_layer_->SetBounds(gfx::Size(110, 110)); | 408 root_scroll_layer_->SetBounds(gfx::Size(110, 110)); |
| 409 | 409 |
| 410 root_scroll_layer_->SetPosition(gfx::Point()); | 410 root_scroll_layer_->SetPosition(gfx::Point()); |
| 411 root_scroll_layer_->SetAnchorPoint(gfx::PointF()); | 411 root_scroll_layer_->SetAnchorPoint(gfx::PointF()); |
| 412 | 412 |
| 413 root_scroll_layer_->SetIsDrawable(true); | 413 root_scroll_layer_->SetIsDrawable(true); |
| 414 root_scroll_layer_->SetScrollable(true); | 414 // root_scroll_layer_->SetScrollable(true); // WJM |
| 415 root_scroll_layer_->SetMaxScrollOffset(gfx::Vector2d(100, 100)); | 415 // root_scroll_layer_->SetMaxScrollOffset(gfx::Vector2d(100, 100)); |
| 416 root_layer->AddChild(root_scroll_layer_); | 416 root_layer->AddChild(root_scroll_layer_); |
| 417 | 417 |
| 418 child_layer_ = ContentLayer::Create(&fake_content_layer_client_); | 418 child_layer_ = ContentLayer::Create(&fake_content_layer_client_); |
| 419 child_layer_->set_did_scroll_callback( | 419 child_layer_->set_did_scroll_callback( |
| 420 base::Bind(&LayerTreeHostScrollTestCaseWithChild::DidScroll, | 420 base::Bind(&LayerTreeHostScrollTestCaseWithChild::DidScroll, |
| 421 base::Unretained(this))); | 421 base::Unretained(this))); |
| 422 child_layer_->SetBounds(gfx::Size(110, 110)); | 422 child_layer_->SetBounds(gfx::Size(110, 110)); |
| 423 | 423 |
| 424 if (scroll_child_layer_) { | 424 if (scroll_child_layer_) { |
| 425 // Scrolls on the child layer will happen at 5, 5. If they are treated | 425 // Scrolls on the child layer will happen at 5, 5. If they are treated |
| 426 // like device pixels, and device scale factor is 2, then they will | 426 // like device pixels, and device scale factor is 2, then they will |
| 427 // be considered at 2.5, 2.5 in logical pixels, and will miss this layer. | 427 // be considered at 2.5, 2.5 in logical pixels, and will miss this layer. |
| 428 child_layer_->SetPosition(gfx::Point(5, 5)); | 428 child_layer_->SetPosition(gfx::Point(5, 5)); |
| 429 } else { | 429 } else { |
| 430 // Adjust the child layer horizontally so that scrolls will never hit it. | 430 // Adjust the child layer horizontally so that scrolls will never hit it. |
| 431 child_layer_->SetPosition(gfx::Point(60, 5)); | 431 child_layer_->SetPosition(gfx::Point(60, 5)); |
| 432 } | 432 } |
| 433 child_layer_->SetAnchorPoint(gfx::PointF()); | 433 child_layer_->SetAnchorPoint(gfx::PointF()); |
| 434 | 434 |
| 435 child_layer_->SetIsDrawable(true); | 435 child_layer_->SetIsDrawable(true); |
| 436 child_layer_->SetScrollable(true); | 436 // child_layer_->SetScrollable(true); // WJM |
| 437 child_layer_->SetMaxScrollOffset(gfx::Vector2d(100, 100)); | 437 // child_layer_->SetMaxScrollOffset(gfx::Vector2d(100, 100)); |
| 438 root_scroll_layer_->AddChild(child_layer_); | 438 root_scroll_layer_->AddChild(child_layer_); |
| 439 | 439 |
| 440 if (scroll_child_layer_) { | 440 if (scroll_child_layer_) { |
| 441 expected_scroll_layer_ = child_layer_; | 441 expected_scroll_layer_ = child_layer_; |
| 442 expected_no_scroll_layer_ = root_scroll_layer_; | 442 expected_no_scroll_layer_ = root_scroll_layer_; |
| 443 } else { | 443 } else { |
| 444 expected_scroll_layer_ = root_scroll_layer_; | 444 expected_scroll_layer_ = root_scroll_layer_; |
| 445 expected_no_scroll_layer_ = child_layer_; | 445 expected_no_scroll_layer_ = child_layer_; |
| 446 } | 446 } |
| 447 | 447 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest { | 718 class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest { |
| 719 public: | 719 public: |
| 720 ImplSidePaintingScrollTestSimple() | 720 ImplSidePaintingScrollTestSimple() |
| 721 : initial_scroll_(10, 20), | 721 : initial_scroll_(10, 20), |
| 722 main_thread_scroll_(40, 5), | 722 main_thread_scroll_(40, 5), |
| 723 impl_thread_scroll1_(2, -1), | 723 impl_thread_scroll1_(2, -1), |
| 724 impl_thread_scroll2_(-3, 10), | 724 impl_thread_scroll2_(-3, 10), |
| 725 num_scrolls_(0) {} | 725 num_scrolls_(0) {} |
| 726 | 726 |
| 727 virtual void BeginTest() OVERRIDE { | 727 virtual void BeginTest() OVERRIDE { |
| 728 layer_tree_host()->root_layer()->SetScrollable(true); | 728 // layer_tree_host()->root_layer()->SetScrollable(true); // WJM |
| 729 layer_tree_host()->root_layer() | 729 // layer_tree_host()->root_layer() |
| 730 ->SetMaxScrollOffset(gfx::Vector2d(100, 100)); | 730 // ->SetMaxScrollOffset(gfx::Vector2d(100, 100)); |
| 731 layer_tree_host()->root_layer()->SetScrollOffset(initial_scroll_); | 731 layer_tree_host()->root_layer()->SetScrollOffset(initial_scroll_); |
| 732 PostSetNeedsCommitToMainThread(); | 732 PostSetNeedsCommitToMainThread(); |
| 733 } | 733 } |
| 734 | 734 |
| 735 virtual void Layout() OVERRIDE { | 735 virtual void Layout() OVERRIDE { |
| 736 Layer* root = layer_tree_host()->root_layer(); | 736 Layer* root = layer_tree_host()->root_layer(); |
| 737 if (!layer_tree_host()->source_frame_number()) { | 737 if (!layer_tree_host()->source_frame_number()) { |
| 738 EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_); | 738 EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_); |
| 739 } else { | 739 } else { |
| 740 EXPECT_VECTOR_EQ(root->scroll_offset(), | 740 EXPECT_VECTOR_EQ(root->scroll_offset(), |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 // beginning a commit and finishing a commit (aka scroll deltas not | 826 // beginning a commit and finishing a commit (aka scroll deltas not |
| 827 // included in sent scroll delta) still apply to layers that don't | 827 // included in sent scroll delta) still apply to layers that don't |
| 828 // push properties. | 828 // push properties. |
| 829 class ImplSidePaintingScrollTestImplOnlyScroll | 829 class ImplSidePaintingScrollTestImplOnlyScroll |
| 830 : public ImplSidePaintingScrollTest { | 830 : public ImplSidePaintingScrollTest { |
| 831 public: | 831 public: |
| 832 ImplSidePaintingScrollTestImplOnlyScroll() | 832 ImplSidePaintingScrollTestImplOnlyScroll() |
| 833 : initial_scroll_(20, 10), impl_thread_scroll_(-2, 3) {} | 833 : initial_scroll_(20, 10), impl_thread_scroll_(-2, 3) {} |
| 834 | 834 |
| 835 virtual void BeginTest() OVERRIDE { | 835 virtual void BeginTest() OVERRIDE { |
| 836 layer_tree_host()->root_layer()->SetScrollable(true); | 836 // layer_tree_host()->root_layer()->SetScrollable(true); // WJM |
| 837 layer_tree_host()->root_layer()->SetMaxScrollOffset( | 837 // layer_tree_host()->root_layer()->SetMaxScrollOffset( |
| 838 gfx::Vector2d(100, 100)); | 838 // gfx::Vector2d(100, 100)); |
| 839 layer_tree_host()->root_layer()->SetScrollOffset(initial_scroll_); | 839 layer_tree_host()->root_layer()->SetScrollOffset(initial_scroll_); |
| 840 PostSetNeedsCommitToMainThread(); | 840 PostSetNeedsCommitToMainThread(); |
| 841 } | 841 } |
| 842 | 842 |
| 843 virtual void WillCommit() OVERRIDE { | 843 virtual void WillCommit() OVERRIDE { |
| 844 Layer* root = layer_tree_host()->root_layer(); | 844 Layer* root = layer_tree_host()->root_layer(); |
| 845 switch (layer_tree_host()->source_frame_number()) { | 845 switch (layer_tree_host()->source_frame_number()) { |
| 846 case 0: | 846 case 0: |
| 847 EXPECT_TRUE(root->needs_push_properties()); | 847 EXPECT_TRUE(root->needs_push_properties()); |
| 848 break; | 848 break; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 | 932 |
| 933 class LayerTreeHostScrollTestScrollZeroMaxScrollOffset | 933 class LayerTreeHostScrollTestScrollZeroMaxScrollOffset |
| 934 : public LayerTreeHostScrollTest { | 934 : public LayerTreeHostScrollTest { |
| 935 public: | 935 public: |
| 936 LayerTreeHostScrollTestScrollZeroMaxScrollOffset() {} | 936 LayerTreeHostScrollTestScrollZeroMaxScrollOffset() {} |
| 937 | 937 |
| 938 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 938 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 939 | 939 |
| 940 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 940 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 941 LayerImpl* root = impl->active_tree()->root_layer(); | 941 LayerImpl* root = impl->active_tree()->root_layer(); |
| 942 root->SetScrollable(true); | 942 // root->SetScrollable(true); // WJM |
| 943 | 943 |
| 944 root->SetMaxScrollOffset(gfx::Vector2d(100, 100)); | 944 // root->SetMaxScrollOffset(gfx::Vector2d(100, 100)); |
| 945 EXPECT_EQ(InputHandler::ScrollStarted, | 945 EXPECT_EQ(InputHandler::ScrollStarted, |
| 946 root->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture)); | 946 root->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture)); |
| 947 | 947 |
| 948 root->SetMaxScrollOffset(gfx::Vector2d(0, 0)); | 948 // root->SetMaxScrollOffset(gfx::Vector2d(0, 0)); |
| 949 EXPECT_EQ(InputHandler::ScrollIgnored, | 949 EXPECT_EQ(InputHandler::ScrollIgnored, |
| 950 root->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture)); | 950 root->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture)); |
| 951 | 951 |
| 952 root->SetMaxScrollOffset(gfx::Vector2d(-100, -100)); | 952 // root->SetMaxScrollOffset(gfx::Vector2d(-100, -100)); |
| 953 EXPECT_EQ(InputHandler::ScrollIgnored, | 953 EXPECT_EQ(InputHandler::ScrollIgnored, |
| 954 root->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture)); | 954 root->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::Gesture)); |
| 955 | 955 |
| 956 EndTest(); | 956 EndTest(); |
| 957 } | 957 } |
| 958 | 958 |
| 959 virtual void AfterTest() OVERRIDE {} | 959 virtual void AfterTest() OVERRIDE {} |
| 960 }; | 960 }; |
| 961 | 961 |
| 962 SINGLE_AND_MULTI_THREAD_TEST_F( | 962 SINGLE_AND_MULTI_THREAD_TEST_F( |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 Layer* layer_; | 1086 Layer* layer_; |
| 1087 }; | 1087 }; |
| 1088 | 1088 |
| 1089 Layer* CreateScrollLayer(Layer* parent, FakeLayerScrollClient* client) { | 1089 Layer* CreateScrollLayer(Layer* parent, FakeLayerScrollClient* client) { |
| 1090 scoped_refptr<Layer> scroll_layer = | 1090 scoped_refptr<Layer> scroll_layer = |
| 1091 ContentLayer::Create(&fake_content_layer_client_); | 1091 ContentLayer::Create(&fake_content_layer_client_); |
| 1092 scroll_layer->SetBounds(gfx::Size(110, 110)); | 1092 scroll_layer->SetBounds(gfx::Size(110, 110)); |
| 1093 scroll_layer->SetPosition(gfx::Point(0, 0)); | 1093 scroll_layer->SetPosition(gfx::Point(0, 0)); |
| 1094 scroll_layer->SetAnchorPoint(gfx::PointF()); | 1094 scroll_layer->SetAnchorPoint(gfx::PointF()); |
| 1095 scroll_layer->SetIsDrawable(true); | 1095 scroll_layer->SetIsDrawable(true); |
| 1096 scroll_layer->SetScrollable(true); | 1096 // scroll_layer->SetScrollable(true); // WJM |
| 1097 scroll_layer->SetMaxScrollOffset(gfx::Vector2d(100, 100)); | 1097 // scroll_layer->SetMaxScrollOffset(gfx::Vector2d(100, 100)); |
| 1098 scroll_layer->set_did_scroll_callback(base::Bind( | 1098 scroll_layer->set_did_scroll_callback(base::Bind( |
| 1099 &FakeLayerScrollClient::DidScroll, base::Unretained(client))); | 1099 &FakeLayerScrollClient::DidScroll, base::Unretained(client))); |
| 1100 client->owner_ = this; | 1100 client->owner_ = this; |
| 1101 client->layer_ = scroll_layer.get(); | 1101 client->layer_ = scroll_layer.get(); |
| 1102 parent->AddChild(scroll_layer); | 1102 parent->AddChild(scroll_layer); |
| 1103 return scroll_layer.get(); | 1103 return scroll_layer.get(); |
| 1104 } | 1104 } |
| 1105 | 1105 |
| 1106 FakeLayerScrollClient root_scroll_layer_client_; | 1106 FakeLayerScrollClient root_scroll_layer_client_; |
| 1107 FakeLayerScrollClient sibling_scroll_layer_client_; | 1107 FakeLayerScrollClient sibling_scroll_layer_client_; |
| 1108 FakeLayerScrollClient child_scroll_layer_client_; | 1108 FakeLayerScrollClient child_scroll_layer_client_; |
| 1109 | 1109 |
| 1110 FakeContentLayerClient fake_content_layer_client_; | 1110 FakeContentLayerClient fake_content_layer_client_; |
| 1111 | 1111 |
| 1112 bool scroll_destroy_whole_tree_; | 1112 bool scroll_destroy_whole_tree_; |
| 1113 }; | 1113 }; |
| 1114 | 1114 |
| 1115 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyLayer) { | 1115 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyLayer) { |
| 1116 RunTest(true, false, false); | 1116 RunTest(true, false, false); |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { | 1119 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { |
| 1120 scroll_destroy_whole_tree_ = true; | 1120 scroll_destroy_whole_tree_ = true; |
| 1121 RunTest(true, false, false); | 1121 RunTest(true, false, false); |
| 1122 } | 1122 } |
| 1123 | 1123 |
| 1124 } // namespace | 1124 } // namespace |
| 1125 } // namespace cc | 1125 } // namespace cc |
| OLD | NEW |