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 2441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2452 scroll_layer->id(), | 2452 scroll_layer->id(), |
2453 wheel_scroll_delta); | 2453 wheel_scroll_delta); |
2454 } | 2454 } |
2455 | 2455 |
2456 class TestScrollOffsetDelegate : public LayerScrollOffsetDelegate { | 2456 class TestScrollOffsetDelegate : public LayerScrollOffsetDelegate { |
2457 public: | 2457 public: |
2458 TestScrollOffsetDelegate() : page_scale_factor_(0.f) {} | 2458 TestScrollOffsetDelegate() : page_scale_factor_(0.f) {} |
2459 | 2459 |
2460 virtual ~TestScrollOffsetDelegate() {} | 2460 virtual ~TestScrollOffsetDelegate() {} |
2461 | 2461 |
2462 virtual void SetMaxScrollOffset(gfx::Vector2dF max_scroll_offset) OVERRIDE { | 2462 virtual void SetMaxScrollOffset( |
| 2463 const gfx::Vector2dF& max_scroll_offset) OVERRIDE { |
2463 max_scroll_offset_ = max_scroll_offset; | 2464 max_scroll_offset_ = max_scroll_offset; |
2464 } | 2465 } |
2465 | 2466 |
2466 virtual void SetTotalScrollOffset(gfx::Vector2dF new_value) OVERRIDE { | 2467 virtual void SetTotalScrollOffset(const gfx::Vector2dF& new_value) OVERRIDE { |
2467 last_set_scroll_offset_ = new_value; | 2468 last_set_scroll_offset_ = new_value; |
2468 } | 2469 } |
2469 | 2470 |
2470 virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE { | 2471 virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE { |
2471 return getter_return_value_; | 2472 return getter_return_value_; |
2472 } | 2473 } |
2473 | 2474 |
2474 virtual bool IsExternalFlingActive() const OVERRIDE { return false; } | 2475 virtual bool IsExternalFlingActive() const OVERRIDE { return false; } |
2475 | 2476 |
2476 virtual void SetTotalPageScaleFactor(float page_scale_factor) OVERRIDE { | 2477 virtual void SetTotalPageScaleFactor(float page_scale_factor) OVERRIDE { |
2477 page_scale_factor_ = page_scale_factor; | 2478 page_scale_factor_ = page_scale_factor; |
2478 } | 2479 } |
2479 | 2480 |
2480 virtual void SetScrollableSize(const gfx::SizeF& scrollable_size) OVERRIDE { | 2481 virtual void SetScrollableSize(const gfx::SizeF& scrollable_size) OVERRIDE { |
2481 scrollable_size_ = scrollable_size; | 2482 scrollable_size_ = scrollable_size; |
2482 } | 2483 } |
2483 | 2484 |
2484 gfx::Vector2dF last_set_scroll_offset() { | 2485 gfx::Vector2dF last_set_scroll_offset() { |
2485 return last_set_scroll_offset_; | 2486 return last_set_scroll_offset_; |
2486 } | 2487 } |
2487 | 2488 |
2488 void set_getter_return_value(gfx::Vector2dF value) { | 2489 void set_getter_return_value(const gfx::Vector2dF& value) { |
2489 getter_return_value_ = value; | 2490 getter_return_value_ = value; |
2490 } | 2491 } |
2491 | 2492 |
2492 gfx::Vector2dF max_scroll_offset() const { | 2493 gfx::Vector2dF max_scroll_offset() const { |
2493 return max_scroll_offset_; | 2494 return max_scroll_offset_; |
2494 } | 2495 } |
2495 | 2496 |
2496 gfx::SizeF scrollable_size() const { | 2497 gfx::SizeF scrollable_size() const { |
2497 return scrollable_size_; | 2498 return scrollable_size_; |
2498 } | 2499 } |
(...skipping 2957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5456 &set_needs_redraw_count)); | 5457 &set_needs_redraw_count)); |
5457 // Empty damage rect won't signal the monitor. | 5458 // Empty damage rect won't signal the monitor. |
5458 host_impl_->SetNeedsRedrawRect(gfx::Rect()); | 5459 host_impl_->SetNeedsRedrawRect(gfx::Rect()); |
5459 EXPECT_EQ(0, set_needs_commit_count); | 5460 EXPECT_EQ(0, set_needs_commit_count); |
5460 EXPECT_EQ(2, set_needs_redraw_count); | 5461 EXPECT_EQ(2, set_needs_redraw_count); |
5461 } | 5462 } |
5462 } | 5463 } |
5463 | 5464 |
5464 } // namespace | 5465 } // namespace |
5465 } // namespace cc | 5466 } // namespace cc |
OLD | NEW |