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

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

Issue 2859483006: cc: Enable composited border-radius scrolling.
Patch Set: test-rebaseline Created 3 years, 6 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 7304 matching lines...) Expand 10 before | Expand all | Expand 10 after
7315 } 7315 }
7316 7316
7317 void AfterTest() override {} 7317 void AfterTest() override {}
7318 7318
7319 int mask_layer_id_; 7319 int mask_layer_id_;
7320 FakeContentLayerClient client_; 7320 FakeContentLayerClient client_;
7321 }; 7321 };
7322 7322
7323 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskWithNonExactTextureSize); 7323 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMaskWithNonExactTextureSize);
7324 7324
7325 class LayerTreeTestSolidColorMaskLayer : public LayerTreeTest {
7326 protected:
7327 void SetupTree() override {
7328 // Root
7329 // |
7330 // +-- Content Layer
7331 // +--Mask
7332 scoped_refptr<Layer> root = Layer::Create();
7333 scoped_refptr<FakePictureLayer> content_layer =
7334 FakePictureLayer::Create(&client_);
7335 root->AddChild(content_layer);
7336 gfx::Size content_size(100, 100);
7337 std::unique_ptr<RecordingSource> recording_source =
7338 FakeRecordingSource::CreateFilledRecordingSource(content_size);
7339 PaintFlags paint;
7340 static_cast<FakeRecordingSource*>(recording_source.get())
7341 ->add_draw_rect_with_flags(gfx::Rect(content_size), paint);
7342
7343 client_.set_fill_with_nonsolid_color(true);
7344 static_cast<FakeRecordingSource*>(recording_source.get())->Rerecord();
7345 scoped_refptr<FakePictureLayer> mask_layer =
7346 FakePictureLayer::CreateWithRecordingSource(
7347 &client_, std::move(recording_source));
7348 content_layer->SetMaskLayer(mask_layer.get());
7349 gfx::Size root_size(100, 100);
7350 root->SetBounds(root_size);
7351 content_layer->SetBounds(content_size);
7352
7353 mask_layer->SetBounds(content_size);
7354 mask_layer->SetLayerMaskType(Layer::LayerMaskType::MULTI_TEXTURE_MASK);
7355
7356 layer_tree_host()->SetRootLayer(root);
7357 LayerTreeTest::SetupTree();
7358 client_.set_bounds(root->bounds());
7359 }
7360
7361 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
7362
7363 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
7364 LayerTreeHostImpl::FrameData* frame_data,
7365 DrawResult draw_result) override {
7366 EXPECT_EQ(2u, frame_data->render_passes.size());
7367 RenderPass* root_pass = frame_data->render_passes.back().get();
7368 EXPECT_EQ(2u, root_pass->quad_list.size());
7369
7370 // There's a solid color quad under everything.
7371 EXPECT_EQ(DrawQuad::SOLID_COLOR, root_pass->quad_list.back()->material);
7372
7373 // Mask layer tiles should not be skipped even if the mask layer is solid
7374 // color.
7375 EXPECT_EQ(DrawQuad::RENDER_PASS, root_pass->quad_list.front()->material);
7376 const RenderPassDrawQuad* render_pass_quad =
7377 RenderPassDrawQuad::MaterialCast(root_pass->quad_list.front());
7378 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(),
7379 render_pass_quad->rect.ToString());
7380 EXPECT_EQ(gfx::RectF().ToString(),
7381
7382 render_pass_quad->mask_uv_rect.ToString());
7383 EndTest();
7384 return draw_result;
7385 }
7386
7387 void AfterTest() override {}
7388
7389 FakeContentLayerClient client_;
7390 };
7391
7392 class LayerTreeTestSingleTextureSolidColorMaskLayer
7393 : public LayerTreeTestSolidColorMaskLayer {
7394 public:
7395 void InitializeSettings(LayerTreeSettings* settings) override {
7396 settings->enable_mask_tiling = false;
7397 }
7398 };
7399
7400 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestSingleTextureSolidColorMaskLayer);
7401
7402 class LayerTreeTestMultiTextureSolidColorMaskLayer
7403 : public LayerTreeTestSolidColorMaskLayer {
7404 public:
7405 void InitializeSettings(LayerTreeSettings* settings) override {
7406 settings->enable_mask_tiling = true;
7407 }
7408 };
7409
7410 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeTestMultiTextureSolidColorMaskLayer);
7411
7325 class LayerTreeTestPageScaleFlags : public LayerTreeTest { 7412 class LayerTreeTestPageScaleFlags : public LayerTreeTest {
7326 protected: 7413 protected:
7327 void SetupTree() override { 7414 void SetupTree() override {
7328 // -root 7415 // -root
7329 // -pre page scale 7416 // -pre page scale
7330 // -page scale 7417 // -page scale
7331 // -inner viewport scroll 7418 // -inner viewport scroll
7332 // -page scale grandchild 7419 // -page scale grandchild
7333 // -post page scale 7420 // -post page scale
7334 7421
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
7940 void AfterTest() override {} 8027 void AfterTest() override {}
7941 8028
7942 private: 8029 private:
7943 bool received_ack_ = false; 8030 bool received_ack_ = false;
7944 }; 8031 };
7945 8032
7946 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease); 8033 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease);
7947 8034
7948 } // namespace 8035 } // namespace
7949 } // namespace cc 8036 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698