| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <unordered_map> | 7 #include <unordered_map> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 root_layer->SetBounds(gfx::Size(100, 50)); | 301 root_layer->SetBounds(gfx::Size(100, 50)); |
| 302 content_layer->SetBounds(gfx::Size(100, 50)); | 302 content_layer->SetBounds(gfx::Size(100, 50)); |
| 303 | 303 |
| 304 layer_tree_host_->SetRootLayer(root_clip_layer); | 304 layer_tree_host_->SetRootLayer(root_clip_layer); |
| 305 root_clip_layer->AddChild(root_layer); | 305 root_clip_layer->AddChild(root_layer); |
| 306 root_layer->AddChild(content_layer); | 306 root_layer->AddChild(content_layer); |
| 307 root_layer->AddChild(scrollbar_layer); | 307 root_layer->AddChild(scrollbar_layer); |
| 308 | 308 |
| 309 root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0)); | 309 root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0)); |
| 310 scrollbar_layer->SetBounds(gfx::Size(70, 10)); | 310 scrollbar_layer->SetBounds(gfx::Size(70, 10)); |
| 311 scrollbar_layer->SetScrollLayer(root_layer->id()); | |
| 312 scrollbar_layer->fake_scrollbar()->set_location(gfx::Point(20, 10)); | 311 scrollbar_layer->fake_scrollbar()->set_location(gfx::Point(20, 10)); |
| 313 scrollbar_layer->fake_scrollbar()->set_track_rect(gfx::Rect(30, 10, 50, 10)); | 312 scrollbar_layer->fake_scrollbar()->set_track_rect(gfx::Rect(30, 10, 50, 10)); |
| 314 scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10); | 313 scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10); |
| 315 scrollbar_layer->fake_scrollbar()->set_thumb_length(4); | 314 scrollbar_layer->fake_scrollbar()->set_thumb_length(4); |
| 316 LayerImpl* root_clip_layer_impl = nullptr; | 315 LayerImpl* root_clip_layer_impl = nullptr; |
| 317 PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr; | 316 PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr; |
| 318 | 317 |
| 319 UPDATE_AND_EXTRACT_LAYER_POINTERS(); | 318 UPDATE_AND_EXTRACT_LAYER_POINTERS(); |
| 320 EXPECT_EQ(gfx::Rect(10, 0, 4, 10).ToString(), | 319 EXPECT_EQ(gfx::Rect(10, 0, 4, 10).ToString(), |
| 321 scrollbar_layer_impl->ComputeThumbQuadRect().ToString()); | 320 scrollbar_layer_impl->ComputeThumbQuadRect().ToString()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 340 root_layer->SetBounds(gfx::Size(100, 50)); | 339 root_layer->SetBounds(gfx::Size(100, 50)); |
| 341 content_layer->SetBounds(gfx::Size(100, 50)); | 340 content_layer->SetBounds(gfx::Size(100, 50)); |
| 342 | 341 |
| 343 layer_tree_host_->SetRootLayer(root_clip_layer); | 342 layer_tree_host_->SetRootLayer(root_clip_layer); |
| 344 root_clip_layer->AddChild(root_layer); | 343 root_clip_layer->AddChild(root_layer); |
| 345 root_layer->AddChild(content_layer); | 344 root_layer->AddChild(content_layer); |
| 346 root_layer->AddChild(scrollbar_layer); | 345 root_layer->AddChild(scrollbar_layer); |
| 347 | 346 |
| 348 root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0)); | 347 root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0)); |
| 349 scrollbar_layer->SetBounds(gfx::Size(70, 10)); | 348 scrollbar_layer->SetBounds(gfx::Size(70, 10)); |
| 350 scrollbar_layer->SetScrollLayer(root_layer->id()); | |
| 351 scrollbar_layer->fake_scrollbar()->set_location(gfx::Point(20, 10)); | 349 scrollbar_layer->fake_scrollbar()->set_location(gfx::Point(20, 10)); |
| 352 scrollbar_layer->fake_scrollbar()->set_track_rect(gfx::Rect(30, 10, 50, 10)); | 350 scrollbar_layer->fake_scrollbar()->set_track_rect(gfx::Rect(30, 10, 50, 10)); |
| 353 scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10); | 351 scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10); |
| 354 scrollbar_layer->fake_scrollbar()->set_thumb_length(4); | 352 scrollbar_layer->fake_scrollbar()->set_thumb_length(4); |
| 355 layer_tree_host_->UpdateLayers(); | 353 layer_tree_host_->UpdateLayers(); |
| 356 LayerImpl* root_clip_layer_impl = nullptr; | 354 LayerImpl* root_clip_layer_impl = nullptr; |
| 357 PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr; | 355 PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr; |
| 358 | 356 |
| 359 // Thumb is at the edge of the scrollbar (should be inset to | 357 // Thumb is at the edge of the scrollbar (should be inset to |
| 360 // the start of the track within the scrollbar layer's | 358 // the start of the track within the scrollbar layer's |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 root_layer->SetScrollClipLayerId(root_clip_layer->id()); | 412 root_layer->SetScrollClipLayerId(root_clip_layer->id()); |
| 415 root_clip_layer->SetBounds(gfx::Size(50, 20)); | 413 root_clip_layer->SetBounds(gfx::Size(50, 20)); |
| 416 root_layer->SetBounds(gfx::Size(50, 100)); | 414 root_layer->SetBounds(gfx::Size(50, 100)); |
| 417 | 415 |
| 418 layer_tree_host_->SetRootLayer(root_clip_layer); | 416 layer_tree_host_->SetRootLayer(root_clip_layer); |
| 419 root_clip_layer->AddChild(root_layer); | 417 root_clip_layer->AddChild(root_layer); |
| 420 root_layer->AddChild(scrollbar_layer); | 418 root_layer->AddChild(scrollbar_layer); |
| 421 | 419 |
| 422 root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0)); | 420 root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0)); |
| 423 scrollbar_layer->SetBounds(gfx::Size(10, 20)); | 421 scrollbar_layer->SetBounds(gfx::Size(10, 20)); |
| 424 scrollbar_layer->SetScrollLayer(root_layer->id()); | |
| 425 scrollbar_layer->fake_scrollbar()->set_track_rect(gfx::Rect(0, 0, 10, 20)); | 422 scrollbar_layer->fake_scrollbar()->set_track_rect(gfx::Rect(0, 0, 10, 20)); |
| 426 scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10); | 423 scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10); |
| 427 scrollbar_layer->fake_scrollbar()->set_thumb_length(4); | 424 scrollbar_layer->fake_scrollbar()->set_thumb_length(4); |
| 428 layer_tree_host_->UpdateLayers(); | 425 layer_tree_host_->UpdateLayers(); |
| 429 LayerImpl* root_clip_layer_impl = nullptr; | 426 LayerImpl* root_clip_layer_impl = nullptr; |
| 430 PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr; | 427 PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr; |
| 431 | 428 |
| 432 // Thumb is at the edge of the scrollbar (should be inset to | 429 // Thumb is at the edge of the scrollbar (should be inset to |
| 433 // the start of the track within the scrollbar layer's | 430 // the start of the track within the scrollbar layer's |
| 434 // position). | 431 // position). |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); | 1164 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); |
| 1168 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); | 1165 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); |
| 1169 | 1166 |
| 1170 // Horizontal Scrollbars. | 1167 // Horizontal Scrollbars. |
| 1171 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); | 1168 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); |
| 1172 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); | 1169 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); |
| 1173 } | 1170 } |
| 1174 | 1171 |
| 1175 } // namespace | 1172 } // namespace |
| 1176 } // namespace cc | 1173 } // namespace cc |
| OLD | NEW |