Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 1675963002: Move MaxScrollOffset to property_trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove comment. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/proto/property_tree.proto » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "cc/animation/scrollbar_animation_controller.h" 10 #include "cc/animation/scrollbar_animation_controller.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 scoped_refptr<Layer> child2; 448 scoped_refptr<Layer> child2;
449 const bool kIsLeftSideVerticalScrollbar = false; 449 const bool kIsLeftSideVerticalScrollbar = false;
450 child2 = SolidColorScrollbarLayer::Create( 450 child2 = SolidColorScrollbarLayer::Create(
451 layer_settings(), scrollbar->Orientation(), kThumbThickness, 451 layer_settings(), scrollbar->Orientation(), kThumbThickness,
452 kTrackStart, kIsLeftSideVerticalScrollbar, child1->id()); 452 kTrackStart, kIsLeftSideVerticalScrollbar, child1->id());
453 child2->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id()); 453 child2->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id());
454 scroll_layer->AddChild(child1); 454 scroll_layer->AddChild(child1);
455 scroll_layer->InsertChild(child2, 1); 455 scroll_layer->InsertChild(child2, 1);
456 layer_tree_root->AddChild(scroll_layer); 456 layer_tree_root->AddChild(scroll_layer);
457 layer_tree_host_->SetRootLayer(layer_tree_root); 457 layer_tree_host_->SetRootLayer(layer_tree_root);
458
459 // Choose layer bounds to give max_scroll_offset = (8, 8).
460 layer_tree_root->SetBounds(gfx::Size(2, 2));
461 scroll_layer->SetBounds(gfx::Size(10, 10));
462
458 layer_tree_host_->UpdateLayers(); 463 layer_tree_host_->UpdateLayers();
459 } 464 }
465
460 LayerImpl* layer_impl_tree_root = 466 LayerImpl* layer_impl_tree_root =
461 layer_tree_host_->CommitAndCreateLayerImplTree(); 467 layer_tree_host_->CommitAndCreateLayerImplTree();
462 LayerImpl* scroll_layer_impl = layer_impl_tree_root->children()[0].get(); 468 LayerImpl* scroll_layer_impl = layer_impl_tree_root->children()[0].get();
463 469
464 auto* scrollbar_layer_impl = static_cast<ScrollbarLayerImplBase*>( 470 auto* scrollbar_layer_impl = static_cast<ScrollbarLayerImplBase*>(
465 scroll_layer_impl->children()[1].get()); 471 scroll_layer_impl->children()[1].get());
466 472
467 // Choose layer bounds to give max_scroll_offset = (8, 8).
468 layer_impl_tree_root->SetBounds(gfx::Size(2, 2));
469 scroll_layer_impl->SetBounds(gfx::Size(10, 10));
470 scroll_layer_impl->ScrollBy(gfx::Vector2dF(4.f, 0.f)); 473 scroll_layer_impl->ScrollBy(gfx::Vector2dF(4.f, 0.f));
471 474
472 scrollbar_layer_impl->SetBounds(gfx::Size(kTrackLength, kThumbThickness)); 475 scrollbar_layer_impl->SetBounds(gfx::Size(kTrackLength, kThumbThickness));
473 scrollbar_layer_impl->SetCurrentPos(4.f); 476 scrollbar_layer_impl->SetCurrentPos(4.f);
474 477
475 { 478 {
476 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); 479 scoped_ptr<RenderPass> render_pass = RenderPass::Create();
477 480
478 AppendQuadsData data; 481 AppendQuadsData data;
479 scrollbar_layer_impl->AppendQuads(render_pass.get(), &data); 482 scrollbar_layer_impl->AppendQuads(render_pass.get(), &data);
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); 1012 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f);
1010 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); 1013 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f);
1011 1014
1012 // Horizontal Scrollbars. 1015 // Horizontal Scrollbars.
1013 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); 1016 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f);
1014 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); 1017 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f);
1015 } 1018 }
1016 1019
1017 } // namespace 1020 } // namespace
1018 } // namespace cc 1021 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | cc/proto/property_tree.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698