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