| 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/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
| 6 | 6 |
| 7 #include "cc/layers/painted_scrollbar_layer_impl.h" | 7 #include "cc/layers/painted_scrollbar_layer_impl.h" |
| 8 #include "cc/output/filter_operation.h" | 8 #include "cc/output/filter_operation.h" |
| 9 #include "cc/output/filter_operations.h" | 9 #include "cc/output/filter_operations.h" |
| 10 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 | 675 |
| 676 TEST_F(LayerImplScrollTest, SetNewScrollbarParameters) { | 676 TEST_F(LayerImplScrollTest, SetNewScrollbarParameters) { |
| 677 gfx::ScrollOffset scroll_offset(10, 5); | 677 gfx::ScrollOffset scroll_offset(10, 5); |
| 678 layer()->SetScrollOffset(scroll_offset); | 678 layer()->SetScrollOffset(scroll_offset); |
| 679 | 679 |
| 680 scoped_ptr<PaintedScrollbarLayerImpl> vertical_scrollbar( | 680 scoped_ptr<PaintedScrollbarLayerImpl> vertical_scrollbar( |
| 681 PaintedScrollbarLayerImpl::Create(tree(), 100, VERTICAL)); | 681 PaintedScrollbarLayerImpl::Create(tree(), 100, VERTICAL)); |
| 682 vertical_scrollbar->SetScrollLayerAndClipLayerByIds( | 682 vertical_scrollbar->SetScrollLayerAndClipLayerByIds( |
| 683 layer()->id(), tree()->root_layer()->id()); | 683 layer()->id(), tree()->root_layer()->id()); |
| 684 | 684 |
| 685 int expected_vertical_maximum = | 685 float expected_vertical_maximum = |
| 686 layer()->bounds().height() - tree()->root_layer()->bounds().height(); | 686 layer()->bounds().height() - tree()->root_layer()->bounds().height(); |
| 687 EXPECT_EQ(expected_vertical_maximum, vertical_scrollbar->maximum()); | 687 EXPECT_EQ(expected_vertical_maximum, vertical_scrollbar->maximum()); |
| 688 EXPECT_EQ(scroll_offset.y(), vertical_scrollbar->current_pos()); | 688 EXPECT_EQ(scroll_offset.y(), vertical_scrollbar->current_pos()); |
| 689 | 689 |
| 690 scoped_ptr<PaintedScrollbarLayerImpl> horizontal_scrollbar( | 690 scoped_ptr<PaintedScrollbarLayerImpl> horizontal_scrollbar( |
| 691 PaintedScrollbarLayerImpl::Create(tree(), 101, HORIZONTAL)); | 691 PaintedScrollbarLayerImpl::Create(tree(), 101, HORIZONTAL)); |
| 692 horizontal_scrollbar->SetScrollLayerAndClipLayerByIds( | 692 horizontal_scrollbar->SetScrollLayerAndClipLayerByIds( |
| 693 layer()->id(), tree()->root_layer()->id()); | 693 layer()->id(), tree()->root_layer()->id()); |
| 694 | 694 |
| 695 int expected_horizontal_maximum = | 695 float expected_horizontal_maximum = |
| 696 layer()->bounds().width() - tree()->root_layer()->bounds().width(); | 696 layer()->bounds().width() - tree()->root_layer()->bounds().width(); |
| 697 EXPECT_EQ(expected_horizontal_maximum, horizontal_scrollbar->maximum()); | 697 EXPECT_EQ(expected_horizontal_maximum, horizontal_scrollbar->maximum()); |
| 698 EXPECT_EQ(scroll_offset.x(), horizontal_scrollbar->current_pos()); | 698 EXPECT_EQ(scroll_offset.x(), horizontal_scrollbar->current_pos()); |
| 699 } | 699 } |
| 700 | 700 |
| 701 } // namespace | 701 } // namespace |
| 702 } // namespace cc | 702 } // namespace cc |
| OLD | NEW |