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

Side by Side Diff: cc/trees/layer_tree_host_unittest_damage.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-gfx: . Created 5 years, 2 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
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 "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDamageTestNoDamageDoesNotSwap); 238 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDamageTestNoDamageDoesNotSwap);
239 239
240 class LayerTreeHostDamageTestForcedFullDamage : public LayerTreeHostDamageTest { 240 class LayerTreeHostDamageTestForcedFullDamage : public LayerTreeHostDamageTest {
241 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 241 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
242 242
243 void SetupTree() override { 243 void SetupTree() override {
244 root_ = FakePictureLayer::Create(layer_settings(), &client_); 244 root_ = FakePictureLayer::Create(layer_settings(), &client_);
245 child_ = FakePictureLayer::Create(layer_settings(), &client_); 245 child_ = FakePictureLayer::Create(layer_settings(), &client_);
246 246
247 root_->SetBounds(gfx::Size(500, 500)); 247 root_->SetBounds(gfx::Size(500, 500));
248 child_->SetPosition(gfx::Point(100, 100)); 248 child_->SetPosition(gfx::PointF(100.f, 100.f));
249 child_->SetBounds(gfx::Size(30, 30)); 249 child_->SetBounds(gfx::Size(30, 30));
250 250
251 root_->AddChild(child_); 251 root_->AddChild(child_);
252 layer_tree_host()->SetRootLayer(root_); 252 layer_tree_host()->SetRootLayer(root_);
253 LayerTreeHostDamageTest::SetupTree(); 253 LayerTreeHostDamageTest::SetupTree();
254 } 254 }
255 255
256 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 256 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
257 LayerTreeHostImpl::FrameData* frame_data, 257 LayerTreeHostImpl::FrameData* frame_data,
258 DrawResult draw_result) override { 258 DrawResult draw_result) override {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 content_layer->SetBounds(gfx::Size(100, 200)); 344 content_layer->SetBounds(gfx::Size(100, 200));
345 content_layer->SetIsDrawable(true); 345 content_layer->SetIsDrawable(true);
346 scroll_clip_layer->SetBounds( 346 scroll_clip_layer->SetBounds(
347 gfx::Size(content_layer->bounds().width() - 30, 347 gfx::Size(content_layer->bounds().width() - 30,
348 content_layer->bounds().height() - 50)); 348 content_layer->bounds().height() - 50));
349 scroll_clip_layer->AddChild(content_layer); 349 scroll_clip_layer->AddChild(content_layer);
350 root_layer->AddChild(scroll_clip_layer); 350 root_layer->AddChild(scroll_clip_layer);
351 351
352 scoped_refptr<Layer> scrollbar_layer = FakePaintedScrollbarLayer::Create( 352 scoped_refptr<Layer> scrollbar_layer = FakePaintedScrollbarLayer::Create(
353 layer_settings(), false, true, content_layer->id()); 353 layer_settings(), false, true, content_layer->id());
354 scrollbar_layer->SetPosition(gfx::Point(300, 300)); 354 scrollbar_layer->SetPosition(gfx::PointF(300.f, 300.f));
355 scrollbar_layer->SetBounds(gfx::Size(10, 100)); 355 scrollbar_layer->SetBounds(gfx::Size(10, 100));
356 scrollbar_layer->ToScrollbarLayer()->SetClipLayer(scroll_clip_layer->id()); 356 scrollbar_layer->ToScrollbarLayer()->SetClipLayer(scroll_clip_layer->id());
357 scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(content_layer->id()); 357 scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(content_layer->id());
358 root_layer->AddChild(scrollbar_layer); 358 root_layer->AddChild(scrollbar_layer);
359 359
360 gfx::RectF content_rect(content_layer->position(), 360 gfx::RectF content_rect(content_layer->position(),
361 gfx::SizeF(content_layer->bounds())); 361 gfx::SizeF(content_layer->bounds()));
362 gfx::RectF scrollbar_rect(scrollbar_layer->position(), 362 gfx::RectF scrollbar_rect(scrollbar_layer->position(),
363 gfx::SizeF(scrollbar_layer->bounds())); 363 gfx::SizeF(scrollbar_layer->bounds()));
364 EXPECT_FALSE(content_rect.Intersects(scrollbar_rect)); 364 EXPECT_FALSE(content_rect.Intersects(scrollbar_rect));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 base::Unretained(this))); 435 base::Unretained(this)));
436 break; 436 break;
437 } 437 }
438 } 438 }
439 439
440 void ModifyContentLayerPosition() { 440 void ModifyContentLayerPosition() {
441 EXPECT_EQ(1, did_swaps_); 441 EXPECT_EQ(1, did_swaps_);
442 Layer* root = layer_tree_host()->root_layer(); 442 Layer* root = layer_tree_host()->root_layer();
443 Layer* scroll_clip_layer = root->child_at(0); 443 Layer* scroll_clip_layer = root->child_at(0);
444 Layer* scroll_layer = scroll_clip_layer->child_at(0); 444 Layer* scroll_layer = scroll_clip_layer->child_at(0);
445 scroll_layer->SetPosition(gfx::Point(10, 10)); 445 scroll_layer->SetPosition(gfx::PointF(10.f, 10.f));
446 } 446 }
447 447
448 void ResizeScrollLayer() { 448 void ResizeScrollLayer() {
449 EXPECT_EQ(3, did_swaps_); 449 EXPECT_EQ(3, did_swaps_);
450 Layer* root = layer_tree_host()->root_layer(); 450 Layer* root = layer_tree_host()->root_layer();
451 Layer* scroll_clip_layer = root->child_at(0); 451 Layer* scroll_clip_layer = root->child_at(0);
452 Layer* scroll_layer = scroll_clip_layer->child_at(0); 452 Layer* scroll_layer = scroll_clip_layer->child_at(0);
453 scroll_layer->SetBounds( 453 scroll_layer->SetBounds(
454 gfx::Size(root->bounds().width() + 60, root->bounds().height() + 100)); 454 gfx::Size(root->bounds().width() + 60, root->bounds().height() + 100));
455 } 455 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 529
530 void AfterTest() override { EXPECT_EQ(3, did_swaps_); } 530 void AfterTest() override { EXPECT_EQ(3, did_swaps_); }
531 531
532 int did_swaps_; 532 int did_swaps_;
533 }; 533 };
534 534
535 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestScrollbarCommitDoesNoDamage); 535 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestScrollbarCommitDoesNoDamage);
536 536
537 } // namespace 537 } // namespace
538 } // namespace cc 538 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698