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

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

Issue 1736073002: cc: Move SyncedScrollOffset to scroll tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and add comment Created 4 years, 9 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/picture_layer_impl_unittest.cc ('k') | cc/proto/BUILD.gn » ('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/input/scrollbar_animation_controller.h" 10 #include "cc/input/scrollbar_animation_controller.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 layer_tree_host_->SetRootLayer(layer_tree_root); 213 layer_tree_host_->SetRootLayer(layer_tree_root);
214 layer_tree_root->AddChild(scroll_layer); 214 layer_tree_root->AddChild(scroll_layer);
215 scroll_layer->AddChild(content_layer); 215 scroll_layer->AddChild(content_layer);
216 layer_tree_root->AddChild(scrollbar_layer); 216 layer_tree_root->AddChild(scrollbar_layer);
217 scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id()); 217 scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id());
218 218
219 layer_tree_root->SavePaintProperties(); 219 layer_tree_root->SavePaintProperties();
220 content_layer->SavePaintProperties(); 220 content_layer->SavePaintProperties();
221 221
222 layer_tree_host_->UpdateLayers();
222 LayerImpl* layer_impl_tree_root = 223 LayerImpl* layer_impl_tree_root =
223 layer_tree_host_->CommitAndCreateLayerImplTree(); 224 layer_tree_host_->CommitAndCreateLayerImplTree();
224 225
225 ScrollbarLayerImplBase* cc_scrollbar_layer = 226 ScrollbarLayerImplBase* cc_scrollbar_layer =
226 static_cast<PaintedScrollbarLayerImpl*>( 227 static_cast<PaintedScrollbarLayerImpl*>(
227 layer_impl_tree_root->children()[1].get()); 228 layer_impl_tree_root->children()[1].get());
228 229
229 EXPECT_EQ(10.f, cc_scrollbar_layer->current_pos()); 230 EXPECT_EQ(10.f, cc_scrollbar_layer->current_pos());
230 EXPECT_EQ(30, cc_scrollbar_layer->scroll_layer_length() - 231 EXPECT_EQ(30, cc_scrollbar_layer->scroll_layer_length() -
231 cc_scrollbar_layer->clip_layer_length()); 232 cc_scrollbar_layer->clip_layer_length());
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 root_layer->AddChild(content_layer); 324 root_layer->AddChild(content_layer);
324 root_layer->AddChild(scrollbar_layer); 325 root_layer->AddChild(scrollbar_layer);
325 326
326 root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0)); 327 root_layer->SetScrollOffset(gfx::ScrollOffset(0, 0));
327 scrollbar_layer->SetBounds(gfx::Size(70, 10)); 328 scrollbar_layer->SetBounds(gfx::Size(70, 10));
328 scrollbar_layer->SetScrollLayer(root_layer->id()); 329 scrollbar_layer->SetScrollLayer(root_layer->id());
329 scrollbar_layer->fake_scrollbar()->set_location(gfx::Point(20, 10)); 330 scrollbar_layer->fake_scrollbar()->set_location(gfx::Point(20, 10));
330 scrollbar_layer->fake_scrollbar()->set_track_rect(gfx::Rect(30, 10, 50, 10)); 331 scrollbar_layer->fake_scrollbar()->set_track_rect(gfx::Rect(30, 10, 50, 10));
331 scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10); 332 scrollbar_layer->fake_scrollbar()->set_thumb_thickness(10);
332 scrollbar_layer->fake_scrollbar()->set_thumb_length(4); 333 scrollbar_layer->fake_scrollbar()->set_thumb_length(4);
334 layer_tree_host_->UpdateLayers();
333 LayerImpl* root_clip_layer_impl = nullptr; 335 LayerImpl* root_clip_layer_impl = nullptr;
334 LayerImpl* root_layer_impl = nullptr; 336 LayerImpl* root_layer_impl = nullptr;
335 PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr; 337 PaintedScrollbarLayerImpl* scrollbar_layer_impl = nullptr;
336 338
337 // Thumb is at the edge of the scrollbar (should be inset to 339 // Thumb is at the edge of the scrollbar (should be inset to
338 // the start of the track within the scrollbar layer's 340 // the start of the track within the scrollbar layer's
339 // position). 341 // position).
340 UPDATE_AND_EXTRACT_LAYER_POINTERS(); 342 UPDATE_AND_EXTRACT_LAYER_POINTERS();
341 EXPECT_EQ(gfx::Rect(10, 0, 4, 10).ToString(), 343 EXPECT_EQ(gfx::Rect(10, 0, 4, 10).ToString(),
342 scrollbar_layer_impl->ComputeThumbQuadRect().ToString()); 344 scrollbar_layer_impl->ComputeThumbQuadRect().ToString());
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); 1023 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f);
1022 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); 1024 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f);
1023 1025
1024 // Horizontal Scrollbars. 1026 // Horizontal Scrollbars.
1025 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); 1027 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f);
1026 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); 1028 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f);
1027 } 1029 }
1028 1030
1029 } // namespace 1031 } // namespace
1030 } // namespace cc 1032 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/proto/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698