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

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

Issue 2859483006: cc: Enable composited border-radius scrolling.
Patch Set: Make respect-clip-for-non-composited-scrollers-when-prefering-compositing-to-lcd-text.html not a re… Created 3 years, 7 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 // Test that when mask layers switches layers, this gets pushed onto impl. 1682 // Test that when mask layers switches layers, this gets pushed onto impl.
1683 // Also test that mask layer is in the layer update list even if its owning 1683 // Also test that mask layer is in the layer update list even if its owning
1684 // layer isn't. 1684 // layer isn't.
1685 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest { 1685 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest {
1686 protected: 1686 protected:
1687 void SetupTree() override { 1687 void SetupTree() override {
1688 scoped_refptr<Layer> root = Layer::Create(); 1688 scoped_refptr<Layer> root = Layer::Create();
1689 root->SetBounds(gfx::Size(10, 10)); 1689 root->SetBounds(gfx::Size(10, 10));
1690 child_layer_ = make_scoped_refptr(new UpdateCountingLayer); 1690 child_layer_ = make_scoped_refptr(new UpdateCountingLayer);
1691 mask_layer_ = make_scoped_refptr(new UpdateCountingLayer); 1691 mask_layer_ = make_scoped_refptr(new UpdateCountingLayer);
1692 child_layer_->SetBounds(gfx::Size(10, 10));
1692 mask_layer_->SetBounds(gfx::Size(10, 10)); 1693 mask_layer_->SetBounds(gfx::Size(10, 10));
1693 child_layer_->SetMaskLayer(mask_layer_.get()); 1694 child_layer_->SetMaskLayer(mask_layer_.get());
1694 root->AddChild(child_layer_); 1695 root->AddChild(child_layer_);
1695 layer_tree_host()->SetRootLayer(root); 1696 layer_tree_host()->SetRootLayer(root);
1696 LayerTreeHostTest::SetupTree(); 1697 LayerTreeHostTest::SetupTree();
1697 } 1698 }
1698 1699
1699 void BeginTest() override { 1700 void BeginTest() override {
1700 index_ = 0; 1701 index_ = 0;
1701 PostSetNeedsCommitToMainThread(); 1702 PostSetNeedsCommitToMainThread();
(...skipping 5653 matching lines...) Expand 10 before | Expand all | Expand 10 after
7355 } 7356 }
7356 7357
7357 void AfterTest() override {} 7358 void AfterTest() override {}
7358 7359
7359 int mask_layer_id_; 7360 int mask_layer_id_;
7360 FakeContentLayerClient client_; 7361 FakeContentLayerClient client_;
7361 }; 7362 };
7362 7363
7363 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskWithNonExactTextureSize); 7364 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskWithNonExactTextureSize);
7364 7365
7366 class LayerTreeTestSolidColorMaskLayer : public LayerTreeTest {
7367 protected:
7368 void SetupTree() override {
7369 // Root
7370 // |
7371 // +-- Content Layer
7372 // +--Mask
7373
7374 scoped_refptr<Layer> root = Layer::Create();
7375
7376 scoped_refptr<FakePictureLayer> content_layer =
7377 FakePictureLayer::Create(&client_);
7378 root->AddChild(content_layer);
7379
7380 gfx::Size content_size(100, 100);
7381 std::unique_ptr<RecordingSource> recording_source =
7382 FakeRecordingSource::CreateFilledRecordingSource(content_size);
7383 PaintFlags paint;
7384 static_cast<FakeRecordingSource*>(recording_source.get())
7385 ->add_draw_rect_with_flags(gfx::Rect(content_size), paint);
7386 client_.set_fill_with_nonsolid_color(true);
7387 static_cast<FakeRecordingSource*>(recording_source.get())->Rerecord();
7388
7389 scoped_refptr<FakePictureLayer> mask_layer =
7390 FakePictureLayer::CreateWithRecordingSource(
7391 &client_, std::move(recording_source));
7392 content_layer->SetMaskLayer(mask_layer.get());
7393
7394 gfx::Size root_size(100, 100);
7395 root->SetBounds(root_size);
7396
7397 content_layer->SetBounds(content_size);
7398
7399 mask_layer->SetBounds(content_size);
7400 mask_layer->SetLayerMaskType(Layer::LayerMaskType::MULTI_TEXTURE_MASK);
7401
7402 layer_tree_host()->SetRootLayer(root);
7403 LayerTreeTest::SetupTree();
7404 client_.set_bounds(root->bounds());
7405 }
7406
7407 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
7408
7409 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
7410 LayerTreeHostImpl::FrameData* frame_data,
7411 DrawResult draw_result) override {
7412 EXPECT_EQ(2u, frame_data->render_passes.size());
7413 RenderPass* root_pass = frame_data->render_passes.back().get();
7414 EXPECT_EQ(2u, root_pass->quad_list.size());
7415
7416 // There's a solid color quad under everything.
7417 EXPECT_EQ(DrawQuad::SOLID_COLOR, root_pass->quad_list.back()->material);
7418
7419 // Mask layer tiles should not be skipped even if the mask layer is solid
7420 // color.
7421 EXPECT_EQ(DrawQuad::RENDER_PASS, root_pass->quad_list.front()->material);
7422 const RenderPassDrawQuad* render_pass_quad =
7423 RenderPassDrawQuad::MaterialCast(root_pass->quad_list.front());
7424 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(),
7425 render_pass_quad->rect.ToString());
7426 EXPECT_EQ(gfx::RectF().ToString(),
7427 render_pass_quad->mask_uv_rect.ToString());
7428 EndTest();
7429 return draw_result;
7430 }
7431
7432 void AfterTest() override {}
7433
7434 FakeContentLayerClient client_;
7435 };
7436
7437 class LayerTreeTestSingleTextureSolidColorMaskLayer
7438 : public LayerTreeTestSolidColorMaskLayer {
7439 public:
7440 void InitializeSettings(LayerTreeSettings* settings) override {
7441 settings->enable_mask_tiling = false;
7442 }
7443 };
7444
7445 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestSingleTextureSolidColorMaskLayer);
7446
7447 class LayerTreeTestMultiTextureSolidColorMaskLayer
7448 : public LayerTreeTestSolidColorMaskLayer {
7449 public:
7450 void InitializeSettings(LayerTreeSettings* settings) override {
7451 settings->enable_mask_tiling = true;
7452 }
7453 };
7454
7455 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMultiTextureSolidColorMaskLayer);
7456
7365 class LayerTreeTestPageScaleFlags : public LayerTreeTest { 7457 class LayerTreeTestPageScaleFlags : public LayerTreeTest {
7366 protected: 7458 protected:
7367 void SetupTree() override { 7459 void SetupTree() override {
7368 // -root 7460 // -root
7369 // -pre page scale 7461 // -pre page scale
7370 // -page scale 7462 // -page scale
7371 // -page scale child1 7463 // -page scale child1
7372 // -page scale grandchild 7464 // -page scale grandchild
7373 // -page scale child2 7465 // -page scale child2
7374 // -post page scale 7466 // -post page scale
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
7961 void AfterTest() override {} 8053 void AfterTest() override {}
7962 8054
7963 private: 8055 private:
7964 bool received_ack_ = false; 8056 bool received_ack_ = false;
7965 }; 8057 };
7966 8058
7967 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); 8059 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease);
7968 8060
7969 } // namespace 8061 } // namespace
7970 } // namespace cc 8062 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698