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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PaintControllerTest.cpp

Issue 2789533003: [SPv2] Stop recording paired display items (except for subsequence markers) (Closed)
Patch Set: none Created 3 years, 8 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 | « third_party/WebKit/Source/platform/graphics/paint/CompositingRecorder.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "platform/graphics/paint/PaintController.h" 5 #include "platform/graphics/paint/PaintController.h"
6 6
7 #include "platform/RuntimeEnabledFeatures.h" 7 #include "platform/RuntimeEnabledFeatures.h"
8 #include "platform/graphics/GraphicsContext.h" 8 #include "platform/graphics/GraphicsContext.h"
9 #include "platform/graphics/paint/ClipPathDisplayItem.h" 9 #include "platform/graphics/paint/ClipPathDisplayItem.h"
10 #include "platform/graphics/paint/ClipPathRecorder.h" 10 #include "platform/graphics/paint/ClipPathRecorder.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 FakeDisplayItemClient client("client", LayoutRect(100, 100, 200, 200)); 151 FakeDisplayItemClient client("client", LayoutRect(100, 100, 200, 200));
152 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 152 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
153 getPaintController().updateCurrentPaintChunkProperties( 153 getPaintController().updateCurrentPaintChunkProperties(
154 &m_rootPaintChunkId, defaultPaintChunkProperties()); 154 &m_rootPaintChunkId, defaultPaintChunkProperties());
155 } 155 }
156 156
157 drawClippedRect(context, client, clipType, backgroundDrawingType, 157 drawClippedRect(context, client, clipType, backgroundDrawingType,
158 FloatRect(100, 100, 200, 200)); 158 FloatRect(100, 100, 200, 200));
159 getPaintController().commitNewDisplayItems(); 159 getPaintController().commitNewDisplayItems();
160 160
161 EXPECT_DISPLAY_LIST( 161 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
162 getPaintController().getDisplayItemList(), 3, 162 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 1,
163 TestDisplayItem(client, clipType), 163 TestDisplayItem(client, backgroundDrawingType));
164 TestDisplayItem(client, backgroundDrawingType),
165 TestDisplayItem(client, DisplayItem::clipTypeToEndClipType(clipType)));
166 164
167 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
168 EXPECT_EQ(1u, getPaintController().paintChunks().size()); 165 EXPECT_EQ(1u, getPaintController().paintChunks().size());
169 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, 166 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects,
170 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); 167 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect())));
168 } else {
169 EXPECT_DISPLAY_LIST(
170 getPaintController().getDisplayItemList(), 3,
171 TestDisplayItem(client, clipType),
172 TestDisplayItem(client, backgroundDrawingType),
173 TestDisplayItem(client, DisplayItem::clipTypeToEndClipType(clipType)));
171 } 174 }
172 } 175 }
173 176
174 TEST_P(PaintControllerTest, UpdateBasic) { 177 TEST_P(PaintControllerTest, UpdateBasic) {
175 FakeDisplayItemClient first("first", LayoutRect(100, 100, 300, 300)); 178 FakeDisplayItemClient first("first", LayoutRect(100, 100, 300, 300));
176 FakeDisplayItemClient second("second", LayoutRect(100, 100, 200, 200)); 179 FakeDisplayItemClient second("second", LayoutRect(100, 100, 200, 200));
177 GraphicsContext context(getPaintController()); 180 GraphicsContext context(getPaintController());
178 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 181 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
179 getPaintController().updateCurrentPaintChunkProperties( 182 getPaintController().updateCurrentPaintChunkProperties(
180 &m_rootPaintChunkId, defaultPaintChunkProperties()); 183 &m_rootPaintChunkId, defaultPaintChunkProperties());
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 getPaintController().updateCurrentPaintChunkProperties(&id, properties); 693 getPaintController().updateCurrentPaintChunkProperties(&id, properties);
691 } 694 }
692 ClipRecorder clipRecorder(context, first, clipType, IntRect(1, 1, 2, 2)); 695 ClipRecorder clipRecorder(context, first, clipType, IntRect(1, 1, 2, 2));
693 drawRect(context, first, backgroundDrawingType, 696 drawRect(context, first, backgroundDrawingType,
694 FloatRect(100, 100, 150, 150)); 697 FloatRect(100, 100, 150, 150));
695 drawRect(context, second, backgroundDrawingType, 698 drawRect(context, second, backgroundDrawingType,
696 FloatRect(100, 100, 200, 200)); 699 FloatRect(100, 100, 200, 200));
697 } 700 }
698 getPaintController().commitNewDisplayItems(); 701 getPaintController().commitNewDisplayItems();
699 702
700 EXPECT_DISPLAY_LIST( 703 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
701 getPaintController().getDisplayItemList(), 4, 704 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2,
702 TestDisplayItem(first, clipType), 705 TestDisplayItem(first, backgroundDrawingType),
703 TestDisplayItem(first, backgroundDrawingType), 706 TestDisplayItem(second, backgroundDrawingType));
704 TestDisplayItem(second, backgroundDrawingType),
705 TestDisplayItem(first, DisplayItem::clipTypeToEndClipType(clipType)));
706 707
707 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
708 getPaintController().updateCurrentPaintChunkProperties( 708 getPaintController().updateCurrentPaintChunkProperties(
709 &m_rootPaintChunkId, defaultPaintChunkProperties()); 709 &m_rootPaintChunkId, defaultPaintChunkProperties());
710 } else {
711 EXPECT_DISPLAY_LIST(
712 getPaintController().getDisplayItemList(), 4,
713 TestDisplayItem(first, clipType),
714 TestDisplayItem(first, backgroundDrawingType),
715 TestDisplayItem(second, backgroundDrawingType),
716 TestDisplayItem(first, DisplayItem::clipTypeToEndClipType(clipType)));
710 } 717 }
711 718
712 first.setDisplayItemsUncached(); 719 first.setDisplayItemsUncached();
713 drawRect(context, first, backgroundDrawingType, 720 drawRect(context, first, backgroundDrawingType,
714 FloatRect(100, 100, 150, 150)); 721 FloatRect(100, 100, 150, 150));
715 drawRect(context, second, backgroundDrawingType, 722 drawRect(context, second, backgroundDrawingType,
716 FloatRect(100, 100, 200, 200)); 723 FloatRect(100, 100, 200, 200));
717 724
718 EXPECT_EQ(1, numCachedNewItems()); 725 EXPECT_EQ(1, numCachedNewItems());
719 #ifndef NDEBUG 726 #ifndef NDEBUG
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 properties.propertyTreeState.setClip(clip2.get()); 759 properties.propertyTreeState.setClip(clip2.get());
753 760
754 getPaintController().updateCurrentPaintChunkProperties(&id, properties); 761 getPaintController().updateCurrentPaintChunkProperties(&id, properties);
755 } 762 }
756 ClipRecorder clipRecorder(context, second, clipType, IntRect(1, 1, 2, 2)); 763 ClipRecorder clipRecorder(context, second, clipType, IntRect(1, 1, 2, 2));
757 drawRect(context, second, backgroundDrawingType, 764 drawRect(context, second, backgroundDrawingType,
758 FloatRect(100, 100, 200, 200)); 765 FloatRect(100, 100, 200, 200));
759 } 766 }
760 getPaintController().commitNewDisplayItems(); 767 getPaintController().commitNewDisplayItems();
761 768
762 EXPECT_DISPLAY_LIST( 769 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
763 getPaintController().getDisplayItemList(), 4, 770 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2,
764 TestDisplayItem(first, backgroundDrawingType), 771 TestDisplayItem(first, backgroundDrawingType),
765 TestDisplayItem(second, clipType), 772 TestDisplayItem(second, backgroundDrawingType));
766 TestDisplayItem(second, backgroundDrawingType),
767 TestDisplayItem(second, DisplayItem::clipTypeToEndClipType(clipType)));
768 773
769 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
770 EXPECT_EQ(2u, getPaintController().paintChunks().size()); 774 EXPECT_EQ(2u, getPaintController().paintChunks().size());
771 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, 775 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects,
772 UnorderedElementsAre(FloatRect( 776 UnorderedElementsAre(FloatRect(
773 100, 100, 200, 777 100, 100, 200,
774 200))); // |second| disappeared from the first chunk. 778 200))); // |second| disappeared from the first chunk.
775 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRects, 779 EXPECT_THAT(getPaintController().paintChunks()[1].rasterInvalidationRects,
776 UnorderedElementsAre(FloatRect( 780 UnorderedElementsAre(FloatRect(
777 LayoutRect::infiniteIntRect()))); // This is a new chunk. 781 LayoutRect::infiniteIntRect()))); // This is a new chunk.
782 } else {
783 EXPECT_DISPLAY_LIST(
784 getPaintController().getDisplayItemList(), 4,
785 TestDisplayItem(first, backgroundDrawingType),
786 TestDisplayItem(second, clipType),
787 TestDisplayItem(second, backgroundDrawingType),
788 TestDisplayItem(second, DisplayItem::clipTypeToEndClipType(clipType)));
778 } 789 }
779 } 790 }
780 791
781 TEST_P(PaintControllerTest, CachedDisplayItems) { 792 TEST_P(PaintControllerTest, CachedDisplayItems) {
782 FakeDisplayItemClient first("first"); 793 FakeDisplayItemClient first("first");
783 FakeDisplayItemClient second("second"); 794 FakeDisplayItemClient second("second");
784 GraphicsContext context(getPaintController()); 795 GraphicsContext context(getPaintController());
785 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 796 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
786 getPaintController().updateCurrentPaintChunkProperties( 797 getPaintController().updateCurrentPaintChunkProperties(
787 &m_rootPaintChunkId, defaultPaintChunkProperties()); 798 &m_rootPaintChunkId, defaultPaintChunkProperties());
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after
2304 } 2315 }
2305 2316
2306 TEST_F(PaintControllerUnderInvalidationTest, 2317 TEST_F(PaintControllerUnderInvalidationTest,
2307 FoldCompositingDrawingInSubsequence) { 2318 FoldCompositingDrawingInSubsequence) {
2308 testFoldCompositingDrawingInSubsequence(); 2319 testFoldCompositingDrawingInSubsequence();
2309 } 2320 }
2310 2321
2311 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) 2322 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID)
2312 2323
2313 } // namespace blink 2324 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/CompositingRecorder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698