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

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

Issue 2565903002: [SPv2] Add createOpacityOnlyEffect test helper (Closed)
Patch Set: rebase && git cl format Created 4 years 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 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"
11 #include "platform/graphics/paint/ClipRecorder.h" 11 #include "platform/graphics/paint/ClipRecorder.h"
12 #include "platform/graphics/paint/CompositingRecorder.h" 12 #include "platform/graphics/paint/CompositingRecorder.h"
13 #include "platform/graphics/paint/DrawingDisplayItem.h" 13 #include "platform/graphics/paint/DrawingDisplayItem.h"
14 #include "platform/graphics/paint/DrawingRecorder.h" 14 #include "platform/graphics/paint/DrawingRecorder.h"
15 #include "platform/graphics/paint/SubsequenceRecorder.h" 15 #include "platform/graphics/paint/SubsequenceRecorder.h"
16 #include "platform/testing/FakeDisplayItemClient.h" 16 #include "platform/testing/FakeDisplayItemClient.h"
17 #include "platform/testing/PaintPropertyTestHelpers.h"
17 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 #include <memory> 20 #include <memory>
20 21
22 using blink::testing::createOpacityOnlyEffect;
23 using blink::testing::defaultPaintChunkProperties;
21 using testing::UnorderedElementsAre; 24 using testing::UnorderedElementsAre;
22 25
23 namespace blink { 26 namespace blink {
24 27
25 class PaintControllerTestBase : public testing::Test { 28 class PaintControllerTestBase : public ::testing::Test {
26 public: 29 public:
27 PaintControllerTestBase() : m_paintController(PaintController::create()) {} 30 PaintControllerTestBase() : m_paintController(PaintController::create()) {}
28 31
29 IntRect visualRect(const PaintArtifact& paintArtifact, size_t index) { 32 IntRect visualRect(const PaintArtifact& paintArtifact, size_t index) {
30 return paintArtifact.getDisplayItemList().visualRect(index); 33 return paintArtifact.getDisplayItemList().visualRect(index);
31 } 34 }
32 35
33 protected: 36 protected:
34 PaintController& getPaintController() { return *m_paintController; } 37 PaintController& getPaintController() { return *m_paintController; }
35 38
(...skipping 11 matching lines...) Expand all
47 int numIndexedItems() const { return m_paintController->m_numIndexedItems; } 50 int numIndexedItems() const { return m_paintController->m_numIndexedItems; }
48 #endif 51 #endif
49 52
50 void TearDown() override { m_featuresBackup.restore(); } 53 void TearDown() override { m_featuresBackup.restore(); }
51 54
52 private: 55 private:
53 std::unique_ptr<PaintController> m_paintController; 56 std::unique_ptr<PaintController> m_paintController;
54 RuntimeEnabledFeatures::Backup m_featuresBackup; 57 RuntimeEnabledFeatures::Backup m_featuresBackup;
55 }; 58 };
56 59
57 PaintChunkProperties rootPaintChunkProperties() {
58 PaintChunkProperties rootProperties;
59 rootProperties.transform = TransformPaintPropertyNode::root();
60 rootProperties.clip = ClipPaintPropertyNode::root();
61 rootProperties.effect = EffectPaintPropertyNode::root();
62 rootProperties.scroll = ScrollPaintPropertyNode::root();
63 return rootProperties;
64 }
65
66 const DisplayItem::Type foregroundDrawingType = 60 const DisplayItem::Type foregroundDrawingType =
67 static_cast<DisplayItem::Type>(DisplayItem::kDrawingPaintPhaseFirst + 4); 61 static_cast<DisplayItem::Type>(DisplayItem::kDrawingPaintPhaseFirst + 4);
68 const DisplayItem::Type backgroundDrawingType = 62 const DisplayItem::Type backgroundDrawingType =
69 DisplayItem::kDrawingPaintPhaseFirst; 63 DisplayItem::kDrawingPaintPhaseFirst;
70 const DisplayItem::Type clipType = DisplayItem::kClipFirst; 64 const DisplayItem::Type clipType = DisplayItem::kClipFirst;
71 65
72 class TestDisplayItem final : public DisplayItem { 66 class TestDisplayItem final : public DisplayItem {
73 public: 67 public:
74 TestDisplayItem(const FakeDisplayItemClient& client, Type type) 68 TestDisplayItem(const FakeDisplayItemClient& client, Type type)
75 : DisplayItem(client, type, sizeof(*this)) {} 69 : DisplayItem(client, type, sizeof(*this)) {}
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 SPv1, 123 SPv1,
130 SPv2, 124 SPv2,
131 UnderInvalidationCheckingSPv1, 125 UnderInvalidationCheckingSPv1,
132 UnderInvalidationCheckingSPv2, 126 UnderInvalidationCheckingSPv2,
133 }; 127 };
134 128
135 // Tests using this class will be tested with under-invalidation-checking 129 // Tests using this class will be tested with under-invalidation-checking
136 // enabled and disabled. 130 // enabled and disabled.
137 class PaintControllerTest 131 class PaintControllerTest
138 : public PaintControllerTestBase, 132 : public PaintControllerTestBase,
139 public testing::WithParamInterface<TestConfigurations> { 133 public ::testing::WithParamInterface<TestConfigurations> {
140 public: 134 public:
141 PaintControllerTest() 135 PaintControllerTest()
142 : m_rootPaintPropertyClient("root"), 136 : m_rootPaintPropertyClient("root"),
143 m_rootPaintChunkId(m_rootPaintPropertyClient, 137 m_rootPaintChunkId(m_rootPaintPropertyClient,
144 DisplayItem::kUninitializedType) {} 138 DisplayItem::kUninitializedType) {}
145 139
146 protected: 140 protected:
147 void SetUp() override { 141 void SetUp() override {
148 switch (GetParam()) { 142 switch (GetParam()) {
149 case SPv1: 143 case SPv1:
(...skipping 20 matching lines...) Expand all
170 ::testing::Values(SPv1, 164 ::testing::Values(SPv1,
171 SPv2, 165 SPv2,
172 UnderInvalidationCheckingSPv1, 166 UnderInvalidationCheckingSPv1,
173 UnderInvalidationCheckingSPv2)); 167 UnderInvalidationCheckingSPv2));
174 168
175 TEST_P(PaintControllerTest, NestedRecorders) { 169 TEST_P(PaintControllerTest, NestedRecorders) {
176 GraphicsContext context(getPaintController()); 170 GraphicsContext context(getPaintController());
177 FakeDisplayItemClient client("client", LayoutRect(100, 100, 200, 200)); 171 FakeDisplayItemClient client("client", LayoutRect(100, 100, 200, 200));
178 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 172 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
179 getPaintController().updateCurrentPaintChunkProperties( 173 getPaintController().updateCurrentPaintChunkProperties(
180 &m_rootPaintChunkId, rootPaintChunkProperties()); 174 &m_rootPaintChunkId, defaultPaintChunkProperties());
181 } 175 }
182 176
183 drawClippedRect(context, client, clipType, backgroundDrawingType, 177 drawClippedRect(context, client, clipType, backgroundDrawingType,
184 FloatRect(100, 100, 200, 200)); 178 FloatRect(100, 100, 200, 200));
185 getPaintController().commitNewDisplayItems(); 179 getPaintController().commitNewDisplayItems();
186 180
187 EXPECT_DISPLAY_LIST( 181 EXPECT_DISPLAY_LIST(
188 getPaintController().getDisplayItemList(), 3, 182 getPaintController().getDisplayItemList(), 3,
189 TestDisplayItem(client, clipType), 183 TestDisplayItem(client, clipType),
190 TestDisplayItem(client, backgroundDrawingType), 184 TestDisplayItem(client, backgroundDrawingType),
191 TestDisplayItem(client, DisplayItem::clipTypeToEndClipType(clipType))); 185 TestDisplayItem(client, DisplayItem::clipTypeToEndClipType(clipType)));
192 186
193 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 187 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
194 EXPECT_EQ(1u, getPaintController().paintChunks().size()); 188 EXPECT_EQ(1u, getPaintController().paintChunks().size());
195 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, 189 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects,
196 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); 190 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect())));
197 } 191 }
198 } 192 }
199 193
200 TEST_P(PaintControllerTest, UpdateBasic) { 194 TEST_P(PaintControllerTest, UpdateBasic) {
201 FakeDisplayItemClient first("first", LayoutRect(100, 100, 300, 300)); 195 FakeDisplayItemClient first("first", LayoutRect(100, 100, 300, 300));
202 FakeDisplayItemClient second("second", LayoutRect(100, 100, 200, 200)); 196 FakeDisplayItemClient second("second", LayoutRect(100, 100, 200, 200));
203 GraphicsContext context(getPaintController()); 197 GraphicsContext context(getPaintController());
204 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 198 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
205 getPaintController().updateCurrentPaintChunkProperties( 199 getPaintController().updateCurrentPaintChunkProperties(
206 &m_rootPaintChunkId, rootPaintChunkProperties()); 200 &m_rootPaintChunkId, defaultPaintChunkProperties());
207 } 201 }
208 202
209 drawRect(context, first, backgroundDrawingType, 203 drawRect(context, first, backgroundDrawingType,
210 FloatRect(100, 100, 300, 300)); 204 FloatRect(100, 100, 300, 300));
211 drawRect(context, second, backgroundDrawingType, 205 drawRect(context, second, backgroundDrawingType,
212 FloatRect(100, 100, 200, 200)); 206 FloatRect(100, 100, 200, 200));
213 drawRect(context, first, foregroundDrawingType, 207 drawRect(context, first, foregroundDrawingType,
214 FloatRect(100, 100, 300, 300)); 208 FloatRect(100, 100, 300, 300));
215 209
216 EXPECT_EQ(0, numCachedNewItems()); 210 EXPECT_EQ(0, numCachedNewItems());
217 211
218 getPaintController().commitNewDisplayItems(); 212 getPaintController().commitNewDisplayItems();
219 213
220 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, 214 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3,
221 TestDisplayItem(first, backgroundDrawingType), 215 TestDisplayItem(first, backgroundDrawingType),
222 TestDisplayItem(second, backgroundDrawingType), 216 TestDisplayItem(second, backgroundDrawingType),
223 TestDisplayItem(first, foregroundDrawingType)); 217 TestDisplayItem(first, foregroundDrawingType));
224 218
225 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 219 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
226 EXPECT_EQ(1u, getPaintController().paintChunks().size()); 220 EXPECT_EQ(1u, getPaintController().paintChunks().size());
227 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, 221 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects,
228 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); 222 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect())));
229 223
230 getPaintController().updateCurrentPaintChunkProperties( 224 getPaintController().updateCurrentPaintChunkProperties(
231 &m_rootPaintChunkId, rootPaintChunkProperties()); 225 &m_rootPaintChunkId, defaultPaintChunkProperties());
232 } 226 }
233 227
234 drawRect(context, first, backgroundDrawingType, 228 drawRect(context, first, backgroundDrawingType,
235 FloatRect(100, 100, 300, 300)); 229 FloatRect(100, 100, 300, 300));
236 drawRect(context, first, foregroundDrawingType, 230 drawRect(context, first, foregroundDrawingType,
237 FloatRect(100, 100, 300, 300)); 231 FloatRect(100, 100, 300, 300));
238 232
239 EXPECT_EQ(2, numCachedNewItems()); 233 EXPECT_EQ(2, numCachedNewItems());
240 #ifndef NDEBUG 234 #ifndef NDEBUG
241 EXPECT_EQ(2, numSequentialMatches()); 235 EXPECT_EQ(2, numSequentialMatches());
(...skipping 16 matching lines...) Expand all
258 } 252 }
259 } 253 }
260 254
261 TEST_P(PaintControllerTest, UpdateSwapOrder) { 255 TEST_P(PaintControllerTest, UpdateSwapOrder) {
262 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); 256 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100));
263 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); 257 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200));
264 FakeDisplayItemClient unaffected("unaffected", LayoutRect(300, 300, 10, 10)); 258 FakeDisplayItemClient unaffected("unaffected", LayoutRect(300, 300, 10, 10));
265 GraphicsContext context(getPaintController()); 259 GraphicsContext context(getPaintController());
266 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 260 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
267 getPaintController().updateCurrentPaintChunkProperties( 261 getPaintController().updateCurrentPaintChunkProperties(
268 &m_rootPaintChunkId, rootPaintChunkProperties()); 262 &m_rootPaintChunkId, defaultPaintChunkProperties());
269 } 263 }
270 264
271 drawRect(context, first, backgroundDrawingType, 265 drawRect(context, first, backgroundDrawingType,
272 FloatRect(100, 100, 100, 100)); 266 FloatRect(100, 100, 100, 100));
273 drawRect(context, first, foregroundDrawingType, 267 drawRect(context, first, foregroundDrawingType,
274 FloatRect(100, 100, 100, 100)); 268 FloatRect(100, 100, 100, 100));
275 drawRect(context, second, backgroundDrawingType, 269 drawRect(context, second, backgroundDrawingType,
276 FloatRect(100, 100, 50, 200)); 270 FloatRect(100, 100, 50, 200));
277 drawRect(context, second, foregroundDrawingType, 271 drawRect(context, second, foregroundDrawingType,
278 FloatRect(100, 100, 50, 200)); 272 FloatRect(100, 100, 50, 200));
279 drawRect(context, unaffected, backgroundDrawingType, 273 drawRect(context, unaffected, backgroundDrawingType,
280 FloatRect(300, 300, 10, 10)); 274 FloatRect(300, 300, 10, 10));
281 drawRect(context, unaffected, foregroundDrawingType, 275 drawRect(context, unaffected, foregroundDrawingType,
282 FloatRect(300, 300, 10, 10)); 276 FloatRect(300, 300, 10, 10));
283 getPaintController().commitNewDisplayItems(); 277 getPaintController().commitNewDisplayItems();
284 278
285 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 6, 279 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 6,
286 TestDisplayItem(first, backgroundDrawingType), 280 TestDisplayItem(first, backgroundDrawingType),
287 TestDisplayItem(first, foregroundDrawingType), 281 TestDisplayItem(first, foregroundDrawingType),
288 TestDisplayItem(second, backgroundDrawingType), 282 TestDisplayItem(second, backgroundDrawingType),
289 TestDisplayItem(second, foregroundDrawingType), 283 TestDisplayItem(second, foregroundDrawingType),
290 TestDisplayItem(unaffected, backgroundDrawingType), 284 TestDisplayItem(unaffected, backgroundDrawingType),
291 TestDisplayItem(unaffected, foregroundDrawingType)); 285 TestDisplayItem(unaffected, foregroundDrawingType));
292 286
293 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 287 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
294 getPaintController().updateCurrentPaintChunkProperties( 288 getPaintController().updateCurrentPaintChunkProperties(
295 &m_rootPaintChunkId, rootPaintChunkProperties()); 289 &m_rootPaintChunkId, defaultPaintChunkProperties());
296 } 290 }
297 drawRect(context, second, backgroundDrawingType, 291 drawRect(context, second, backgroundDrawingType,
298 FloatRect(100, 100, 50, 200)); 292 FloatRect(100, 100, 50, 200));
299 drawRect(context, second, foregroundDrawingType, 293 drawRect(context, second, foregroundDrawingType,
300 FloatRect(100, 100, 50, 200)); 294 FloatRect(100, 100, 50, 200));
301 drawRect(context, first, backgroundDrawingType, 295 drawRect(context, first, backgroundDrawingType,
302 FloatRect(100, 100, 100, 100)); 296 FloatRect(100, 100, 100, 100));
303 drawRect(context, first, foregroundDrawingType, 297 drawRect(context, first, foregroundDrawingType,
304 FloatRect(100, 100, 100, 100)); 298 FloatRect(100, 100, 100, 100));
305 drawRect(context, unaffected, backgroundDrawingType, 299 drawRect(context, unaffected, backgroundDrawingType,
(...skipping 26 matching lines...) Expand all
332 } 326 }
333 } 327 }
334 328
335 TEST_P(PaintControllerTest, UpdateSwapOrderWithInvalidation) { 329 TEST_P(PaintControllerTest, UpdateSwapOrderWithInvalidation) {
336 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); 330 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100));
337 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); 331 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200));
338 FakeDisplayItemClient unaffected("unaffected", LayoutRect(300, 300, 10, 10)); 332 FakeDisplayItemClient unaffected("unaffected", LayoutRect(300, 300, 10, 10));
339 GraphicsContext context(getPaintController()); 333 GraphicsContext context(getPaintController());
340 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 334 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
341 getPaintController().updateCurrentPaintChunkProperties( 335 getPaintController().updateCurrentPaintChunkProperties(
342 &m_rootPaintChunkId, rootPaintChunkProperties()); 336 &m_rootPaintChunkId, defaultPaintChunkProperties());
343 } 337 }
344 338
345 drawRect(context, first, backgroundDrawingType, 339 drawRect(context, first, backgroundDrawingType,
346 FloatRect(100, 100, 100, 100)); 340 FloatRect(100, 100, 100, 100));
347 drawRect(context, first, foregroundDrawingType, 341 drawRect(context, first, foregroundDrawingType,
348 FloatRect(100, 100, 100, 100)); 342 FloatRect(100, 100, 100, 100));
349 drawRect(context, second, backgroundDrawingType, 343 drawRect(context, second, backgroundDrawingType,
350 FloatRect(100, 100, 50, 200)); 344 FloatRect(100, 100, 50, 200));
351 drawRect(context, second, foregroundDrawingType, 345 drawRect(context, second, foregroundDrawingType,
352 FloatRect(100, 100, 50, 200)); 346 FloatRect(100, 100, 50, 200));
353 drawRect(context, unaffected, backgroundDrawingType, 347 drawRect(context, unaffected, backgroundDrawingType,
354 FloatRect(300, 300, 10, 10)); 348 FloatRect(300, 300, 10, 10));
355 drawRect(context, unaffected, foregroundDrawingType, 349 drawRect(context, unaffected, foregroundDrawingType,
356 FloatRect(300, 300, 10, 10)); 350 FloatRect(300, 300, 10, 10));
357 getPaintController().commitNewDisplayItems(); 351 getPaintController().commitNewDisplayItems();
358 352
359 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 6, 353 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 6,
360 TestDisplayItem(first, backgroundDrawingType), 354 TestDisplayItem(first, backgroundDrawingType),
361 TestDisplayItem(first, foregroundDrawingType), 355 TestDisplayItem(first, foregroundDrawingType),
362 TestDisplayItem(second, backgroundDrawingType), 356 TestDisplayItem(second, backgroundDrawingType),
363 TestDisplayItem(second, foregroundDrawingType), 357 TestDisplayItem(second, foregroundDrawingType),
364 TestDisplayItem(unaffected, backgroundDrawingType), 358 TestDisplayItem(unaffected, backgroundDrawingType),
365 TestDisplayItem(unaffected, foregroundDrawingType)); 359 TestDisplayItem(unaffected, foregroundDrawingType));
366 360
367 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 361 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
368 getPaintController().updateCurrentPaintChunkProperties( 362 getPaintController().updateCurrentPaintChunkProperties(
369 &m_rootPaintChunkId, rootPaintChunkProperties()); 363 &m_rootPaintChunkId, defaultPaintChunkProperties());
370 } 364 }
371 365
372 first.setDisplayItemsUncached(); 366 first.setDisplayItemsUncached();
373 drawRect(context, second, backgroundDrawingType, 367 drawRect(context, second, backgroundDrawingType,
374 FloatRect(100, 100, 50, 200)); 368 FloatRect(100, 100, 50, 200));
375 drawRect(context, second, foregroundDrawingType, 369 drawRect(context, second, foregroundDrawingType,
376 FloatRect(100, 100, 50, 200)); 370 FloatRect(100, 100, 50, 200));
377 drawRect(context, first, backgroundDrawingType, 371 drawRect(context, first, backgroundDrawingType,
378 FloatRect(100, 100, 100, 100)); 372 FloatRect(100, 100, 100, 100));
379 drawRect(context, first, foregroundDrawingType, 373 drawRect(context, first, foregroundDrawingType,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 405 }
412 } 406 }
413 407
414 TEST_P(PaintControllerTest, UpdateNewItemInMiddle) { 408 TEST_P(PaintControllerTest, UpdateNewItemInMiddle) {
415 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); 409 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100));
416 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); 410 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200));
417 FakeDisplayItemClient third("third", LayoutRect(125, 100, 200, 50)); 411 FakeDisplayItemClient third("third", LayoutRect(125, 100, 200, 50));
418 GraphicsContext context(getPaintController()); 412 GraphicsContext context(getPaintController());
419 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 413 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
420 getPaintController().updateCurrentPaintChunkProperties( 414 getPaintController().updateCurrentPaintChunkProperties(
421 &m_rootPaintChunkId, rootPaintChunkProperties()); 415 &m_rootPaintChunkId, defaultPaintChunkProperties());
422 } 416 }
423 417
424 drawRect(context, first, backgroundDrawingType, 418 drawRect(context, first, backgroundDrawingType,
425 FloatRect(100, 100, 100, 100)); 419 FloatRect(100, 100, 100, 100));
426 drawRect(context, second, backgroundDrawingType, 420 drawRect(context, second, backgroundDrawingType,
427 FloatRect(100, 100, 50, 200)); 421 FloatRect(100, 100, 50, 200));
428 getPaintController().commitNewDisplayItems(); 422 getPaintController().commitNewDisplayItems();
429 423
430 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, 424 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2,
431 TestDisplayItem(first, backgroundDrawingType), 425 TestDisplayItem(first, backgroundDrawingType),
432 TestDisplayItem(second, backgroundDrawingType)); 426 TestDisplayItem(second, backgroundDrawingType));
433 427
434 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 428 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
435 getPaintController().updateCurrentPaintChunkProperties( 429 getPaintController().updateCurrentPaintChunkProperties(
436 &m_rootPaintChunkId, rootPaintChunkProperties()); 430 &m_rootPaintChunkId, defaultPaintChunkProperties());
437 } 431 }
438 432
439 drawRect(context, first, backgroundDrawingType, 433 drawRect(context, first, backgroundDrawingType,
440 FloatRect(100, 100, 100, 100)); 434 FloatRect(100, 100, 100, 100));
441 drawRect(context, third, backgroundDrawingType, FloatRect(125, 100, 200, 50)); 435 drawRect(context, third, backgroundDrawingType, FloatRect(125, 100, 200, 50));
442 drawRect(context, second, backgroundDrawingType, 436 drawRect(context, second, backgroundDrawingType,
443 FloatRect(100, 100, 50, 200)); 437 FloatRect(100, 100, 50, 200));
444 438
445 EXPECT_EQ(2, numCachedNewItems()); 439 EXPECT_EQ(2, numCachedNewItems());
446 #ifndef NDEBUG 440 #ifndef NDEBUG
(...skipping 18 matching lines...) Expand all
465 } 459 }
466 } 460 }
467 461
468 TEST_P(PaintControllerTest, UpdateInvalidationWithPhases) { 462 TEST_P(PaintControllerTest, UpdateInvalidationWithPhases) {
469 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100)); 463 FakeDisplayItemClient first("first", LayoutRect(100, 100, 100, 100));
470 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200)); 464 FakeDisplayItemClient second("second", LayoutRect(100, 100, 50, 200));
471 FakeDisplayItemClient third("third", LayoutRect(300, 100, 50, 50)); 465 FakeDisplayItemClient third("third", LayoutRect(300, 100, 50, 50));
472 GraphicsContext context(getPaintController()); 466 GraphicsContext context(getPaintController());
473 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 467 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
474 getPaintController().updateCurrentPaintChunkProperties( 468 getPaintController().updateCurrentPaintChunkProperties(
475 &m_rootPaintChunkId, rootPaintChunkProperties()); 469 &m_rootPaintChunkId, defaultPaintChunkProperties());
476 } 470 }
477 471
478 drawRect(context, first, backgroundDrawingType, 472 drawRect(context, first, backgroundDrawingType,
479 FloatRect(100, 100, 100, 100)); 473 FloatRect(100, 100, 100, 100));
480 drawRect(context, second, backgroundDrawingType, 474 drawRect(context, second, backgroundDrawingType,
481 FloatRect(100, 100, 50, 200)); 475 FloatRect(100, 100, 50, 200));
482 drawRect(context, third, backgroundDrawingType, FloatRect(300, 100, 50, 50)); 476 drawRect(context, third, backgroundDrawingType, FloatRect(300, 100, 50, 50));
483 drawRect(context, first, foregroundDrawingType, 477 drawRect(context, first, foregroundDrawingType,
484 FloatRect(100, 100, 100, 100)); 478 FloatRect(100, 100, 100, 100));
485 drawRect(context, second, foregroundDrawingType, 479 drawRect(context, second, foregroundDrawingType,
486 FloatRect(100, 100, 50, 200)); 480 FloatRect(100, 100, 50, 200));
487 drawRect(context, third, foregroundDrawingType, FloatRect(300, 100, 50, 50)); 481 drawRect(context, third, foregroundDrawingType, FloatRect(300, 100, 50, 50));
488 getPaintController().commitNewDisplayItems(); 482 getPaintController().commitNewDisplayItems();
489 483
490 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 6, 484 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 6,
491 TestDisplayItem(first, backgroundDrawingType), 485 TestDisplayItem(first, backgroundDrawingType),
492 TestDisplayItem(second, backgroundDrawingType), 486 TestDisplayItem(second, backgroundDrawingType),
493 TestDisplayItem(third, backgroundDrawingType), 487 TestDisplayItem(third, backgroundDrawingType),
494 TestDisplayItem(first, foregroundDrawingType), 488 TestDisplayItem(first, foregroundDrawingType),
495 TestDisplayItem(second, foregroundDrawingType), 489 TestDisplayItem(second, foregroundDrawingType),
496 TestDisplayItem(third, foregroundDrawingType)); 490 TestDisplayItem(third, foregroundDrawingType));
497 491
498 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 492 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
499 getPaintController().updateCurrentPaintChunkProperties( 493 getPaintController().updateCurrentPaintChunkProperties(
500 &m_rootPaintChunkId, rootPaintChunkProperties()); 494 &m_rootPaintChunkId, defaultPaintChunkProperties());
501 } 495 }
502 496
503 second.setDisplayItemsUncached(); 497 second.setDisplayItemsUncached();
504 drawRect(context, first, backgroundDrawingType, 498 drawRect(context, first, backgroundDrawingType,
505 FloatRect(100, 100, 100, 100)); 499 FloatRect(100, 100, 100, 100));
506 drawRect(context, second, backgroundDrawingType, 500 drawRect(context, second, backgroundDrawingType,
507 FloatRect(100, 100, 50, 200)); 501 FloatRect(100, 100, 50, 200));
508 drawRect(context, third, backgroundDrawingType, FloatRect(300, 100, 50, 50)); 502 drawRect(context, third, backgroundDrawingType, FloatRect(300, 100, 50, 50));
509 drawRect(context, first, foregroundDrawingType, 503 drawRect(context, first, foregroundDrawingType,
510 FloatRect(100, 100, 100, 100)); 504 FloatRect(100, 100, 100, 100));
(...skipping 26 matching lines...) Expand all
537 FloatRect(100, 100, 50, 200))); // New bounds of |second|. 531 FloatRect(100, 100, 50, 200))); // New bounds of |second|.
538 } 532 }
539 } 533 }
540 534
541 TEST_P(PaintControllerTest, UpdateAddFirstOverlap) { 535 TEST_P(PaintControllerTest, UpdateAddFirstOverlap) {
542 FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150)); 536 FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150));
543 FakeDisplayItemClient second("second", LayoutRect(200, 200, 50, 50)); 537 FakeDisplayItemClient second("second", LayoutRect(200, 200, 50, 50));
544 GraphicsContext context(getPaintController()); 538 GraphicsContext context(getPaintController());
545 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 539 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
546 getPaintController().updateCurrentPaintChunkProperties( 540 getPaintController().updateCurrentPaintChunkProperties(
547 &m_rootPaintChunkId, rootPaintChunkProperties()); 541 &m_rootPaintChunkId, defaultPaintChunkProperties());
548 } 542 }
549 543
550 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)); 544 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50));
551 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)); 545 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50));
552 getPaintController().commitNewDisplayItems(); 546 getPaintController().commitNewDisplayItems();
553 547
554 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, 548 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2,
555 TestDisplayItem(second, backgroundDrawingType), 549 TestDisplayItem(second, backgroundDrawingType),
556 TestDisplayItem(second, foregroundDrawingType)); 550 TestDisplayItem(second, foregroundDrawingType));
557 551
558 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 552 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
559 getPaintController().updateCurrentPaintChunkProperties( 553 getPaintController().updateCurrentPaintChunkProperties(
560 &m_rootPaintChunkId, rootPaintChunkProperties()); 554 &m_rootPaintChunkId, defaultPaintChunkProperties());
561 } 555 }
562 556
563 first.setDisplayItemsUncached(); 557 first.setDisplayItemsUncached();
564 second.setDisplayItemsUncached(); 558 second.setDisplayItemsUncached();
565 second.setVisualRect(LayoutRect(150, 150, 100, 100)); 559 second.setVisualRect(LayoutRect(150, 150, 100, 100));
566 drawRect(context, first, backgroundDrawingType, 560 drawRect(context, first, backgroundDrawingType,
567 FloatRect(100, 100, 150, 150)); 561 FloatRect(100, 100, 150, 150));
568 drawRect(context, first, foregroundDrawingType, 562 drawRect(context, first, foregroundDrawingType,
569 FloatRect(100, 100, 150, 150)); 563 FloatRect(100, 100, 150, 150));
570 drawRect(context, second, backgroundDrawingType, 564 drawRect(context, second, backgroundDrawingType,
(...skipping 12 matching lines...) Expand all
583 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 577 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
584 EXPECT_EQ(1u, getPaintController().paintChunks().size()); 578 EXPECT_EQ(1u, getPaintController().paintChunks().size());
585 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, 579 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects,
586 UnorderedElementsAre( 580 UnorderedElementsAre(
587 FloatRect(100, 100, 150, 581 FloatRect(100, 100, 150,
588 150), // |first| newly appeared in the chunk. 582 150), // |first| newly appeared in the chunk.
589 FloatRect(200, 200, 50, 50), // Old bounds of |second|. 583 FloatRect(200, 200, 50, 50), // Old bounds of |second|.
590 FloatRect(150, 150, 100, 100))); // New bounds of |second|. 584 FloatRect(150, 150, 100, 100))); // New bounds of |second|.
591 585
592 getPaintController().updateCurrentPaintChunkProperties( 586 getPaintController().updateCurrentPaintChunkProperties(
593 &m_rootPaintChunkId, rootPaintChunkProperties()); 587 &m_rootPaintChunkId, defaultPaintChunkProperties());
594 } 588 }
595 589
596 drawRect(context, second, backgroundDrawingType, 590 drawRect(context, second, backgroundDrawingType,
597 FloatRect(150, 150, 100, 100)); 591 FloatRect(150, 150, 100, 100));
598 drawRect(context, second, foregroundDrawingType, 592 drawRect(context, second, foregroundDrawingType,
599 FloatRect(150, 150, 100, 100)); 593 FloatRect(150, 150, 100, 100));
600 594
601 EXPECT_EQ(2, numCachedNewItems()); 595 EXPECT_EQ(2, numCachedNewItems());
602 #ifndef NDEBUG 596 #ifndef NDEBUG
603 EXPECT_EQ(2, numSequentialMatches()); 597 EXPECT_EQ(2, numSequentialMatches());
(...skipping 15 matching lines...) Expand all
619 100, 100, 150, 150))); // |first| disappeared from the chunk. 613 100, 100, 150, 150))); // |first| disappeared from the chunk.
620 } 614 }
621 } 615 }
622 616
623 TEST_P(PaintControllerTest, UpdateAddLastOverlap) { 617 TEST_P(PaintControllerTest, UpdateAddLastOverlap) {
624 FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150)); 618 FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150));
625 FakeDisplayItemClient second("second", LayoutRect(200, 200, 50, 50)); 619 FakeDisplayItemClient second("second", LayoutRect(200, 200, 50, 50));
626 GraphicsContext context(getPaintController()); 620 GraphicsContext context(getPaintController());
627 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 621 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
628 getPaintController().updateCurrentPaintChunkProperties( 622 getPaintController().updateCurrentPaintChunkProperties(
629 &m_rootPaintChunkId, rootPaintChunkProperties()); 623 &m_rootPaintChunkId, defaultPaintChunkProperties());
630 } 624 }
631 625
632 drawRect(context, first, backgroundDrawingType, 626 drawRect(context, first, backgroundDrawingType,
633 FloatRect(100, 100, 150, 150)); 627 FloatRect(100, 100, 150, 150));
634 drawRect(context, first, foregroundDrawingType, 628 drawRect(context, first, foregroundDrawingType,
635 FloatRect(100, 100, 150, 150)); 629 FloatRect(100, 100, 150, 150));
636 getPaintController().commitNewDisplayItems(); 630 getPaintController().commitNewDisplayItems();
637 631
638 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, 632 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2,
639 TestDisplayItem(first, backgroundDrawingType), 633 TestDisplayItem(first, backgroundDrawingType),
640 TestDisplayItem(first, foregroundDrawingType)); 634 TestDisplayItem(first, foregroundDrawingType));
641 635
642 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 636 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
643 getPaintController().updateCurrentPaintChunkProperties( 637 getPaintController().updateCurrentPaintChunkProperties(
644 &m_rootPaintChunkId, rootPaintChunkProperties()); 638 &m_rootPaintChunkId, defaultPaintChunkProperties());
645 } 639 }
646 640
647 first.setDisplayItemsUncached(); 641 first.setDisplayItemsUncached();
648 first.setVisualRect(LayoutRect(150, 150, 100, 100)); 642 first.setVisualRect(LayoutRect(150, 150, 100, 100));
649 second.setDisplayItemsUncached(); 643 second.setDisplayItemsUncached();
650 drawRect(context, first, backgroundDrawingType, 644 drawRect(context, first, backgroundDrawingType,
651 FloatRect(150, 150, 100, 100)); 645 FloatRect(150, 150, 100, 100));
652 drawRect(context, first, foregroundDrawingType, 646 drawRect(context, first, foregroundDrawingType,
653 FloatRect(150, 150, 100, 100)); 647 FloatRect(150, 150, 100, 100));
654 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)); 648 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50));
(...skipping 10 matching lines...) Expand all
665 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 659 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
666 EXPECT_EQ(1u, getPaintController().paintChunks().size()); 660 EXPECT_EQ(1u, getPaintController().paintChunks().size());
667 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, 661 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects,
668 UnorderedElementsAre( 662 UnorderedElementsAre(
669 FloatRect(100, 100, 150, 150), // Old bounds of |first|. 663 FloatRect(100, 100, 150, 150), // Old bounds of |first|.
670 FloatRect(150, 150, 100, 100), // New bounds of |first|. 664 FloatRect(150, 150, 100, 100), // New bounds of |first|.
671 FloatRect(200, 200, 50, 665 FloatRect(200, 200, 50,
672 50))); // |second| newly appeared in the chunk. 666 50))); // |second| newly appeared in the chunk.
673 667
674 getPaintController().updateCurrentPaintChunkProperties( 668 getPaintController().updateCurrentPaintChunkProperties(
675 &m_rootPaintChunkId, rootPaintChunkProperties()); 669 &m_rootPaintChunkId, defaultPaintChunkProperties());
676 } 670 }
677 671
678 first.setDisplayItemsUncached(); 672 first.setDisplayItemsUncached();
679 first.setVisualRect(LayoutRect(100, 100, 150, 150)); 673 first.setVisualRect(LayoutRect(100, 100, 150, 150));
680 second.setDisplayItemsUncached(); 674 second.setDisplayItemsUncached();
681 drawRect(context, first, backgroundDrawingType, 675 drawRect(context, first, backgroundDrawingType,
682 FloatRect(100, 100, 150, 150)); 676 FloatRect(100, 100, 150, 150));
683 drawRect(context, first, foregroundDrawingType, 677 drawRect(context, first, foregroundDrawingType,
684 FloatRect(100, 100, 150, 150)); 678 FloatRect(100, 100, 150, 150));
685 EXPECT_EQ(0, numCachedNewItems()); 679 EXPECT_EQ(0, numCachedNewItems());
(...skipping 15 matching lines...) Expand all
701 } 695 }
702 696
703 TEST_P(PaintControllerTest, UpdateClip) { 697 TEST_P(PaintControllerTest, UpdateClip) {
704 FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150)); 698 FakeDisplayItemClient first("first", LayoutRect(100, 100, 150, 150));
705 FakeDisplayItemClient second("second", LayoutRect(100, 100, 200, 200)); 699 FakeDisplayItemClient second("second", LayoutRect(100, 100, 200, 200));
706 GraphicsContext context(getPaintController()); 700 GraphicsContext context(getPaintController());
707 701
708 { 702 {
709 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 703 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
710 PaintChunk::Id id(first, clipType); 704 PaintChunk::Id id(first, clipType);
711 PaintChunkProperties properties = rootPaintChunkProperties(); 705 PaintChunkProperties properties = defaultPaintChunkProperties();
712 properties.clip = ClipPaintPropertyNode::create( 706 properties.clip = ClipPaintPropertyNode::create(
713 nullptr, nullptr, FloatRoundedRect(1, 1, 2, 2)); 707 nullptr, nullptr, FloatRoundedRect(1, 1, 2, 2));
714 getPaintController().updateCurrentPaintChunkProperties(&id, properties); 708 getPaintController().updateCurrentPaintChunkProperties(&id, properties);
715 } 709 }
716 ClipRecorder clipRecorder(context, first, clipType, IntRect(1, 1, 2, 2)); 710 ClipRecorder clipRecorder(context, first, clipType, IntRect(1, 1, 2, 2));
717 drawRect(context, first, backgroundDrawingType, 711 drawRect(context, first, backgroundDrawingType,
718 FloatRect(100, 100, 150, 150)); 712 FloatRect(100, 100, 150, 150));
719 drawRect(context, second, backgroundDrawingType, 713 drawRect(context, second, backgroundDrawingType,
720 FloatRect(100, 100, 200, 200)); 714 FloatRect(100, 100, 200, 200));
721 } 715 }
722 getPaintController().commitNewDisplayItems(); 716 getPaintController().commitNewDisplayItems();
723 717
724 EXPECT_DISPLAY_LIST( 718 EXPECT_DISPLAY_LIST(
725 getPaintController().getDisplayItemList(), 4, 719 getPaintController().getDisplayItemList(), 4,
726 TestDisplayItem(first, clipType), 720 TestDisplayItem(first, clipType),
727 TestDisplayItem(first, backgroundDrawingType), 721 TestDisplayItem(first, backgroundDrawingType),
728 TestDisplayItem(second, backgroundDrawingType), 722 TestDisplayItem(second, backgroundDrawingType),
729 TestDisplayItem(first, DisplayItem::clipTypeToEndClipType(clipType))); 723 TestDisplayItem(first, DisplayItem::clipTypeToEndClipType(clipType)));
730 724
731 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 725 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
732 getPaintController().updateCurrentPaintChunkProperties( 726 getPaintController().updateCurrentPaintChunkProperties(
733 &m_rootPaintChunkId, rootPaintChunkProperties()); 727 &m_rootPaintChunkId, defaultPaintChunkProperties());
734 } 728 }
735 729
736 first.setDisplayItemsUncached(); 730 first.setDisplayItemsUncached();
737 drawRect(context, first, backgroundDrawingType, 731 drawRect(context, first, backgroundDrawingType,
738 FloatRect(100, 100, 150, 150)); 732 FloatRect(100, 100, 150, 150));
739 drawRect(context, second, backgroundDrawingType, 733 drawRect(context, second, backgroundDrawingType,
740 FloatRect(100, 100, 200, 200)); 734 FloatRect(100, 100, 200, 200));
741 735
742 EXPECT_EQ(1, numCachedNewItems()); 736 EXPECT_EQ(1, numCachedNewItems());
743 #ifndef NDEBUG 737 #ifndef NDEBUG
744 EXPECT_EQ(1, numSequentialMatches()); 738 EXPECT_EQ(1, numSequentialMatches());
745 EXPECT_EQ(0, numOutOfOrderMatches()); 739 EXPECT_EQ(0, numOutOfOrderMatches());
746 EXPECT_EQ(1, numIndexedItems()); 740 EXPECT_EQ(1, numIndexedItems());
747 #endif 741 #endif
748 742
749 getPaintController().commitNewDisplayItems(); 743 getPaintController().commitNewDisplayItems();
750 744
751 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, 745 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2,
752 TestDisplayItem(first, backgroundDrawingType), 746 TestDisplayItem(first, backgroundDrawingType),
753 TestDisplayItem(second, backgroundDrawingType)); 747 TestDisplayItem(second, backgroundDrawingType));
754 748
755 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 749 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
756 EXPECT_EQ(1u, getPaintController().paintChunks().size()); 750 EXPECT_EQ(1u, getPaintController().paintChunks().size());
757 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, 751 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects,
758 UnorderedElementsAre(FloatRect( 752 UnorderedElementsAre(FloatRect(
759 LayoutRect::infiniteIntRect()))); // This is a new chunk. 753 LayoutRect::infiniteIntRect()))); // This is a new chunk.
760 754
761 getPaintController().updateCurrentPaintChunkProperties( 755 getPaintController().updateCurrentPaintChunkProperties(
762 &m_rootPaintChunkId, rootPaintChunkProperties()); 756 &m_rootPaintChunkId, defaultPaintChunkProperties());
763 } 757 }
764 758
765 second.setDisplayItemsUncached(); 759 second.setDisplayItemsUncached();
766 drawRect(context, first, backgroundDrawingType, 760 drawRect(context, first, backgroundDrawingType,
767 FloatRect(100, 100, 150, 150)); 761 FloatRect(100, 100, 150, 150));
768 { 762 {
769 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 763 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
770 PaintChunk::Id id(second, clipType); 764 PaintChunk::Id id(second, clipType);
771 PaintChunkProperties properties = rootPaintChunkProperties(); 765 PaintChunkProperties properties = defaultPaintChunkProperties();
772 properties.clip = ClipPaintPropertyNode::create( 766 properties.clip = ClipPaintPropertyNode::create(
773 nullptr, nullptr, FloatRoundedRect(1, 1, 2, 2)); 767 nullptr, nullptr, FloatRoundedRect(1, 1, 2, 2));
774 getPaintController().updateCurrentPaintChunkProperties(&id, properties); 768 getPaintController().updateCurrentPaintChunkProperties(&id, properties);
775 } 769 }
776 ClipRecorder clipRecorder(context, second, clipType, IntRect(1, 1, 2, 2)); 770 ClipRecorder clipRecorder(context, second, clipType, IntRect(1, 1, 2, 2));
777 drawRect(context, second, backgroundDrawingType, 771 drawRect(context, second, backgroundDrawingType,
778 FloatRect(100, 100, 200, 200)); 772 FloatRect(100, 100, 200, 200));
779 } 773 }
780 getPaintController().commitNewDisplayItems(); 774 getPaintController().commitNewDisplayItems();
781 775
(...skipping 15 matching lines...) Expand all
797 LayoutRect::infiniteIntRect()))); // This is a new chunk. 791 LayoutRect::infiniteIntRect()))); // This is a new chunk.
798 } 792 }
799 } 793 }
800 794
801 TEST_P(PaintControllerTest, CachedDisplayItems) { 795 TEST_P(PaintControllerTest, CachedDisplayItems) {
802 FakeDisplayItemClient first("first"); 796 FakeDisplayItemClient first("first");
803 FakeDisplayItemClient second("second"); 797 FakeDisplayItemClient second("second");
804 GraphicsContext context(getPaintController()); 798 GraphicsContext context(getPaintController());
805 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 799 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
806 getPaintController().updateCurrentPaintChunkProperties( 800 getPaintController().updateCurrentPaintChunkProperties(
807 &m_rootPaintChunkId, rootPaintChunkProperties()); 801 &m_rootPaintChunkId, defaultPaintChunkProperties());
808 } 802 }
809 803
810 drawRect(context, first, backgroundDrawingType, 804 drawRect(context, first, backgroundDrawingType,
811 FloatRect(100, 100, 150, 150)); 805 FloatRect(100, 100, 150, 150));
812 drawRect(context, second, backgroundDrawingType, 806 drawRect(context, second, backgroundDrawingType,
813 FloatRect(100, 100, 150, 150)); 807 FloatRect(100, 100, 150, 150));
814 getPaintController().commitNewDisplayItems(); 808 getPaintController().commitNewDisplayItems();
815 809
816 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, 810 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2,
817 TestDisplayItem(first, backgroundDrawingType), 811 TestDisplayItem(first, backgroundDrawingType),
818 TestDisplayItem(second, backgroundDrawingType)); 812 TestDisplayItem(second, backgroundDrawingType));
819 EXPECT_TRUE(getPaintController().clientCacheIsValid(first)); 813 EXPECT_TRUE(getPaintController().clientCacheIsValid(first));
820 EXPECT_TRUE(getPaintController().clientCacheIsValid(second)); 814 EXPECT_TRUE(getPaintController().clientCacheIsValid(second));
821 const SkPicture* firstPicture = 815 const SkPicture* firstPicture =
822 static_cast<const DrawingDisplayItem&>( 816 static_cast<const DrawingDisplayItem&>(
823 getPaintController().getDisplayItemList()[0]) 817 getPaintController().getDisplayItemList()[0])
824 .picture(); 818 .picture();
825 const SkPicture* secondPicture = 819 const SkPicture* secondPicture =
826 static_cast<const DrawingDisplayItem&>( 820 static_cast<const DrawingDisplayItem&>(
827 getPaintController().getDisplayItemList()[1]) 821 getPaintController().getDisplayItemList()[1])
828 .picture(); 822 .picture();
829 823
830 first.setDisplayItemsUncached(); 824 first.setDisplayItemsUncached();
831 EXPECT_FALSE(getPaintController().clientCacheIsValid(first)); 825 EXPECT_FALSE(getPaintController().clientCacheIsValid(first));
832 EXPECT_TRUE(getPaintController().clientCacheIsValid(second)); 826 EXPECT_TRUE(getPaintController().clientCacheIsValid(second));
833 827
834 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 828 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
835 getPaintController().updateCurrentPaintChunkProperties( 829 getPaintController().updateCurrentPaintChunkProperties(
836 &m_rootPaintChunkId, rootPaintChunkProperties()); 830 &m_rootPaintChunkId, defaultPaintChunkProperties());
837 } 831 }
838 drawRect(context, first, backgroundDrawingType, 832 drawRect(context, first, backgroundDrawingType,
839 FloatRect(100, 100, 150, 150)); 833 FloatRect(100, 100, 150, 150));
840 drawRect(context, second, backgroundDrawingType, 834 drawRect(context, second, backgroundDrawingType,
841 FloatRect(100, 100, 150, 150)); 835 FloatRect(100, 100, 150, 150));
842 getPaintController().commitNewDisplayItems(); 836 getPaintController().commitNewDisplayItems();
843 837
844 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2, 838 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 2,
845 TestDisplayItem(first, backgroundDrawingType), 839 TestDisplayItem(first, backgroundDrawingType),
846 TestDisplayItem(second, backgroundDrawingType)); 840 TestDisplayItem(second, backgroundDrawingType));
(...skipping 17 matching lines...) Expand all
864 TEST_P(PaintControllerTest, UpdateSwapOrderWithChildren) { 858 TEST_P(PaintControllerTest, UpdateSwapOrderWithChildren) {
865 FakeDisplayItemClient container1("container1", 859 FakeDisplayItemClient container1("container1",
866 LayoutRect(100, 100, 100, 100)); 860 LayoutRect(100, 100, 100, 100));
867 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); 861 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200));
868 FakeDisplayItemClient container2("container2", 862 FakeDisplayItemClient container2("container2",
869 LayoutRect(100, 200, 100, 100)); 863 LayoutRect(100, 200, 100, 100));
870 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); 864 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200));
871 GraphicsContext context(getPaintController()); 865 GraphicsContext context(getPaintController());
872 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 866 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
873 getPaintController().updateCurrentPaintChunkProperties( 867 getPaintController().updateCurrentPaintChunkProperties(
874 &m_rootPaintChunkId, rootPaintChunkProperties()); 868 &m_rootPaintChunkId, defaultPaintChunkProperties());
875 } 869 }
876 870
877 drawRect(context, container1, backgroundDrawingType, 871 drawRect(context, container1, backgroundDrawingType,
878 FloatRect(100, 100, 100, 100)); 872 FloatRect(100, 100, 100, 100));
879 drawRect(context, content1, backgroundDrawingType, 873 drawRect(context, content1, backgroundDrawingType,
880 FloatRect(100, 100, 50, 200)); 874 FloatRect(100, 100, 50, 200));
881 drawRect(context, content1, foregroundDrawingType, 875 drawRect(context, content1, foregroundDrawingType,
882 FloatRect(100, 100, 50, 200)); 876 FloatRect(100, 100, 50, 200));
883 drawRect(context, container1, foregroundDrawingType, 877 drawRect(context, container1, foregroundDrawingType,
884 FloatRect(100, 100, 100, 100)); 878 FloatRect(100, 100, 100, 100));
(...skipping 12 matching lines...) Expand all
897 TestDisplayItem(content1, backgroundDrawingType), 891 TestDisplayItem(content1, backgroundDrawingType),
898 TestDisplayItem(content1, foregroundDrawingType), 892 TestDisplayItem(content1, foregroundDrawingType),
899 TestDisplayItem(container1, foregroundDrawingType), 893 TestDisplayItem(container1, foregroundDrawingType),
900 TestDisplayItem(container2, backgroundDrawingType), 894 TestDisplayItem(container2, backgroundDrawingType),
901 TestDisplayItem(content2, backgroundDrawingType), 895 TestDisplayItem(content2, backgroundDrawingType),
902 TestDisplayItem(content2, foregroundDrawingType), 896 TestDisplayItem(content2, foregroundDrawingType),
903 TestDisplayItem(container2, foregroundDrawingType)); 897 TestDisplayItem(container2, foregroundDrawingType));
904 898
905 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 899 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
906 getPaintController().updateCurrentPaintChunkProperties( 900 getPaintController().updateCurrentPaintChunkProperties(
907 &m_rootPaintChunkId, rootPaintChunkProperties()); 901 &m_rootPaintChunkId, defaultPaintChunkProperties());
908 } 902 }
909 903
910 // Simulate the situation when |container1| gets a z-index that is greater 904 // Simulate the situation when |container1| gets a z-index that is greater
911 // than that of |container2|. 905 // than that of |container2|.
912 drawRect(context, container2, backgroundDrawingType, 906 drawRect(context, container2, backgroundDrawingType,
913 FloatRect(100, 200, 100, 100)); 907 FloatRect(100, 200, 100, 100));
914 drawRect(context, content2, backgroundDrawingType, 908 drawRect(context, content2, backgroundDrawingType,
915 FloatRect(100, 200, 50, 200)); 909 FloatRect(100, 200, 50, 200));
916 drawRect(context, content2, foregroundDrawingType, 910 drawRect(context, content2, foregroundDrawingType,
917 FloatRect(100, 200, 50, 200)); 911 FloatRect(100, 200, 50, 200));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 TEST_P(PaintControllerTest, UpdateSwapOrderWithChildrenAndInvalidation) { 946 TEST_P(PaintControllerTest, UpdateSwapOrderWithChildrenAndInvalidation) {
953 FakeDisplayItemClient container1("container1", 947 FakeDisplayItemClient container1("container1",
954 LayoutRect(100, 100, 100, 100)); 948 LayoutRect(100, 100, 100, 100));
955 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); 949 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200));
956 FakeDisplayItemClient container2("container2", 950 FakeDisplayItemClient container2("container2",
957 LayoutRect(100, 200, 100, 100)); 951 LayoutRect(100, 200, 100, 100));
958 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); 952 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200));
959 GraphicsContext context(getPaintController()); 953 GraphicsContext context(getPaintController());
960 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 954 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
961 getPaintController().updateCurrentPaintChunkProperties( 955 getPaintController().updateCurrentPaintChunkProperties(
962 &m_rootPaintChunkId, rootPaintChunkProperties()); 956 &m_rootPaintChunkId, defaultPaintChunkProperties());
963 } 957 }
964 958
965 drawRect(context, container1, backgroundDrawingType, 959 drawRect(context, container1, backgroundDrawingType,
966 FloatRect(100, 100, 100, 100)); 960 FloatRect(100, 100, 100, 100));
967 drawRect(context, content1, backgroundDrawingType, 961 drawRect(context, content1, backgroundDrawingType,
968 FloatRect(100, 100, 50, 200)); 962 FloatRect(100, 100, 50, 200));
969 drawRect(context, content1, foregroundDrawingType, 963 drawRect(context, content1, foregroundDrawingType,
970 FloatRect(100, 100, 50, 200)); 964 FloatRect(100, 100, 50, 200));
971 drawRect(context, container1, foregroundDrawingType, 965 drawRect(context, container1, foregroundDrawingType,
972 FloatRect(100, 100, 100, 100)); 966 FloatRect(100, 100, 100, 100));
(...skipping 12 matching lines...) Expand all
985 TestDisplayItem(content1, backgroundDrawingType), 979 TestDisplayItem(content1, backgroundDrawingType),
986 TestDisplayItem(content1, foregroundDrawingType), 980 TestDisplayItem(content1, foregroundDrawingType),
987 TestDisplayItem(container1, foregroundDrawingType), 981 TestDisplayItem(container1, foregroundDrawingType),
988 TestDisplayItem(container2, backgroundDrawingType), 982 TestDisplayItem(container2, backgroundDrawingType),
989 TestDisplayItem(content2, backgroundDrawingType), 983 TestDisplayItem(content2, backgroundDrawingType),
990 TestDisplayItem(content2, foregroundDrawingType), 984 TestDisplayItem(content2, foregroundDrawingType),
991 TestDisplayItem(container2, foregroundDrawingType)); 985 TestDisplayItem(container2, foregroundDrawingType));
992 986
993 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 987 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
994 getPaintController().updateCurrentPaintChunkProperties( 988 getPaintController().updateCurrentPaintChunkProperties(
995 &m_rootPaintChunkId, rootPaintChunkProperties()); 989 &m_rootPaintChunkId, defaultPaintChunkProperties());
996 } 990 }
997 991
998 // Simulate the situation when |container1| gets a z-index that is greater 992 // Simulate the situation when |container1| gets a z-index that is greater
999 // than that of |container2|, and |container1| is invalidated. 993 // than that of |container2|, and |container1| is invalidated.
1000 container1.setDisplayItemsUncached(); 994 container1.setDisplayItemsUncached();
1001 drawRect(context, container2, backgroundDrawingType, 995 drawRect(context, container2, backgroundDrawingType,
1002 FloatRect(100, 200, 100, 100)); 996 FloatRect(100, 200, 100, 100));
1003 drawRect(context, content2, backgroundDrawingType, 997 drawRect(context, content2, backgroundDrawingType,
1004 FloatRect(100, 200, 50, 200)); 998 FloatRect(100, 200, 50, 200));
1005 drawRect(context, content2, foregroundDrawingType, 999 drawRect(context, content2, foregroundDrawingType,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 1036
1043 TEST_P(PaintControllerTest, CachedSubsequenceSwapOrder) { 1037 TEST_P(PaintControllerTest, CachedSubsequenceSwapOrder) {
1044 FakeDisplayItemClient container1("container1", 1038 FakeDisplayItemClient container1("container1",
1045 LayoutRect(100, 100, 100, 100)); 1039 LayoutRect(100, 100, 100, 100));
1046 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); 1040 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200));
1047 FakeDisplayItemClient container2("container2", 1041 FakeDisplayItemClient container2("container2",
1048 LayoutRect(100, 200, 100, 100)); 1042 LayoutRect(100, 200, 100, 100));
1049 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); 1043 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200));
1050 GraphicsContext context(getPaintController()); 1044 GraphicsContext context(getPaintController());
1051 1045
1052 PaintChunkProperties container1Properties = rootPaintChunkProperties(); 1046 PaintChunkProperties container1Properties = defaultPaintChunkProperties();
1053 PaintChunkProperties container2Properties = rootPaintChunkProperties(); 1047 PaintChunkProperties container2Properties = defaultPaintChunkProperties();
1054 1048
1055 { 1049 {
1056 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1050 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1057 PaintChunk::Id id(container1, backgroundDrawingType); 1051 PaintChunk::Id id(container1, backgroundDrawingType);
1058 container1Properties.effect = EffectPaintPropertyNode::create( 1052 container1Properties.effect =
1059 EffectPaintPropertyNode::root(), TransformPaintPropertyNode::root(), 1053 createOpacityOnlyEffect(EffectPaintPropertyNode::root(), 0.5);
1060 ClipPaintPropertyNode::root(), CompositorFilterOperations(), 0.5);
1061 getPaintController().updateCurrentPaintChunkProperties( 1054 getPaintController().updateCurrentPaintChunkProperties(
1062 &id, container1Properties); 1055 &id, container1Properties);
1063 } 1056 }
1064 SubsequenceRecorder r(context, container1); 1057 SubsequenceRecorder r(context, container1);
1065 drawRect(context, container1, backgroundDrawingType, 1058 drawRect(context, container1, backgroundDrawingType,
1066 FloatRect(100, 100, 100, 100)); 1059 FloatRect(100, 100, 100, 100));
1067 drawRect(context, content1, backgroundDrawingType, 1060 drawRect(context, content1, backgroundDrawingType,
1068 FloatRect(100, 100, 50, 200)); 1061 FloatRect(100, 100, 50, 200));
1069 drawRect(context, content1, foregroundDrawingType, 1062 drawRect(context, content1, foregroundDrawingType,
1070 FloatRect(100, 100, 50, 200)); 1063 FloatRect(100, 100, 50, 200));
1071 drawRect(context, container1, foregroundDrawingType, 1064 drawRect(context, container1, foregroundDrawingType,
1072 FloatRect(100, 100, 100, 100)); 1065 FloatRect(100, 100, 100, 100));
1073 } 1066 }
1074 { 1067 {
1075 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1068 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1076 PaintChunk::Id id(container2, backgroundDrawingType); 1069 PaintChunk::Id id(container2, backgroundDrawingType);
1077 container2Properties.effect = EffectPaintPropertyNode::create( 1070 container2Properties.effect =
1078 EffectPaintPropertyNode::root(), TransformPaintPropertyNode::root(), 1071 createOpacityOnlyEffect(EffectPaintPropertyNode::root(), 0.5);
1079 ClipPaintPropertyNode::root(), CompositorFilterOperations(), 0.5);
1080 getPaintController().updateCurrentPaintChunkProperties( 1072 getPaintController().updateCurrentPaintChunkProperties(
1081 &id, container2Properties); 1073 &id, container2Properties);
1082 } 1074 }
1083 SubsequenceRecorder r(context, container2); 1075 SubsequenceRecorder r(context, container2);
1084 drawRect(context, container2, backgroundDrawingType, 1076 drawRect(context, container2, backgroundDrawingType,
1085 FloatRect(100, 200, 100, 100)); 1077 FloatRect(100, 200, 100, 100));
1086 drawRect(context, content2, backgroundDrawingType, 1078 drawRect(context, content2, backgroundDrawingType,
1087 FloatRect(100, 200, 50, 200)); 1079 FloatRect(100, 200, 50, 200));
1088 drawRect(context, content2, foregroundDrawingType, 1080 drawRect(context, content2, foregroundDrawingType,
1089 FloatRect(100, 200, 50, 200)); 1081 FloatRect(100, 200, 50, 200));
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 1206
1215 TEST_P(PaintControllerTest, UpdateSwapOrderCrossingChunks) { 1207 TEST_P(PaintControllerTest, UpdateSwapOrderCrossingChunks) {
1216 FakeDisplayItemClient container1("container1", 1208 FakeDisplayItemClient container1("container1",
1217 LayoutRect(100, 100, 100, 100)); 1209 LayoutRect(100, 100, 100, 100));
1218 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); 1210 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200));
1219 FakeDisplayItemClient container2("container2", 1211 FakeDisplayItemClient container2("container2",
1220 LayoutRect(100, 200, 100, 100)); 1212 LayoutRect(100, 200, 100, 100));
1221 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); 1213 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200));
1222 GraphicsContext context(getPaintController()); 1214 GraphicsContext context(getPaintController());
1223 1215
1224 PaintChunkProperties container1Properties = rootPaintChunkProperties(); 1216 PaintChunkProperties container1Properties = defaultPaintChunkProperties();
1225 PaintChunkProperties container2Properties = rootPaintChunkProperties(); 1217 PaintChunkProperties container2Properties = defaultPaintChunkProperties();
1226 1218
1227 { 1219 {
1228 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1220 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1229 PaintChunk::Id id(container1, backgroundDrawingType); 1221 PaintChunk::Id id(container1, backgroundDrawingType);
1230 container1Properties.effect = EffectPaintPropertyNode::create( 1222 container1Properties.effect =
1231 EffectPaintPropertyNode::root(), TransformPaintPropertyNode::root(), 1223 createOpacityOnlyEffect(EffectPaintPropertyNode::root(), 0.5);
1232 ClipPaintPropertyNode::root(), CompositorFilterOperations(), 0.5);
1233 getPaintController().updateCurrentPaintChunkProperties( 1224 getPaintController().updateCurrentPaintChunkProperties(
1234 &id, container1Properties); 1225 &id, container1Properties);
1235 } 1226 }
1236 drawRect(context, container1, backgroundDrawingType, 1227 drawRect(context, container1, backgroundDrawingType,
1237 FloatRect(100, 100, 100, 100)); 1228 FloatRect(100, 100, 100, 100));
1238 drawRect(context, content1, backgroundDrawingType, 1229 drawRect(context, content1, backgroundDrawingType,
1239 FloatRect(100, 100, 50, 200)); 1230 FloatRect(100, 100, 50, 200));
1240 } 1231 }
1241 { 1232 {
1242 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1233 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1243 PaintChunk::Id id(container2, backgroundDrawingType); 1234 PaintChunk::Id id(container2, backgroundDrawingType);
1244 container2Properties.effect = EffectPaintPropertyNode::create( 1235 container2Properties.effect =
1245 EffectPaintPropertyNode::root(), TransformPaintPropertyNode::root(), 1236 createOpacityOnlyEffect(EffectPaintPropertyNode::root(), 0.5);
1246 ClipPaintPropertyNode::root(), CompositorFilterOperations(), 0.5);
1247 getPaintController().updateCurrentPaintChunkProperties( 1237 getPaintController().updateCurrentPaintChunkProperties(
1248 &id, container2Properties); 1238 &id, container2Properties);
1249 } 1239 }
1250 drawRect(context, container2, backgroundDrawingType, 1240 drawRect(context, container2, backgroundDrawingType,
1251 FloatRect(100, 200, 100, 100)); 1241 FloatRect(100, 200, 100, 100));
1252 drawRect(context, content2, backgroundDrawingType, 1242 drawRect(context, content2, backgroundDrawingType,
1253 FloatRect(100, 200, 50, 200)); 1243 FloatRect(100, 200, 50, 200));
1254 } 1244 }
1255 getPaintController().commitNewDisplayItems(); 1245 getPaintController().commitNewDisplayItems();
1256 1246
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 const DisplayItem::Type type1 = DisplayItem::kDrawingFirst; 1318 const DisplayItem::Type type1 = DisplayItem::kDrawingFirst;
1329 const DisplayItem::Type type2 = 1319 const DisplayItem::Type type2 =
1330 static_cast<DisplayItem::Type>(DisplayItem::kDrawingFirst + 1); 1320 static_cast<DisplayItem::Type>(DisplayItem::kDrawingFirst + 1);
1331 const DisplayItem::Type type3 = 1321 const DisplayItem::Type type3 =
1332 static_cast<DisplayItem::Type>(DisplayItem::kDrawingFirst + 2); 1322 static_cast<DisplayItem::Type>(DisplayItem::kDrawingFirst + 2);
1333 const DisplayItem::Type type4 = 1323 const DisplayItem::Type type4 =
1334 static_cast<DisplayItem::Type>(DisplayItem::kDrawingFirst + 3); 1324 static_cast<DisplayItem::Type>(DisplayItem::kDrawingFirst + 3);
1335 1325
1336 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1326 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1337 getPaintController().updateCurrentPaintChunkProperties( 1327 getPaintController().updateCurrentPaintChunkProperties(
1338 &m_rootPaintChunkId, rootPaintChunkProperties()); 1328 &m_rootPaintChunkId, defaultPaintChunkProperties());
1339 } 1329 }
1340 drawRect(context, client, type1, FloatRect(100, 100, 100, 100)); 1330 drawRect(context, client, type1, FloatRect(100, 100, 100, 100));
1341 drawRect(context, client, type2, FloatRect(100, 100, 50, 200)); 1331 drawRect(context, client, type2, FloatRect(100, 100, 50, 200));
1342 drawRect(context, client, type3, FloatRect(100, 100, 50, 200)); 1332 drawRect(context, client, type3, FloatRect(100, 100, 50, 200));
1343 drawRect(context, client, type4, FloatRect(100, 100, 100, 100)); 1333 drawRect(context, client, type4, FloatRect(100, 100, 100, 100));
1344 1334
1345 getPaintController().commitNewDisplayItems(); 1335 getPaintController().commitNewDisplayItems();
1346 1336
1347 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1337 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1348 getPaintController().updateCurrentPaintChunkProperties( 1338 getPaintController().updateCurrentPaintChunkProperties(
1349 &m_rootPaintChunkId, rootPaintChunkProperties()); 1339 &m_rootPaintChunkId, defaultPaintChunkProperties());
1350 } 1340 }
1351 drawRect(context, client, type2, FloatRect(100, 100, 50, 200)); 1341 drawRect(context, client, type2, FloatRect(100, 100, 50, 200));
1352 drawRect(context, client, type3, FloatRect(100, 100, 50, 200)); 1342 drawRect(context, client, type3, FloatRect(100, 100, 50, 200));
1353 drawRect(context, client, type1, FloatRect(100, 100, 100, 100)); 1343 drawRect(context, client, type1, FloatRect(100, 100, 100, 100));
1354 drawRect(context, client, type4, FloatRect(100, 100, 100, 100)); 1344 drawRect(context, client, type4, FloatRect(100, 100, 100, 100));
1355 1345
1356 getPaintController().commitNewDisplayItems(); 1346 getPaintController().commitNewDisplayItems();
1357 } 1347 }
1358 1348
1359 TEST_P(PaintControllerTest, CachedNestedSubsequenceUpdate) { 1349 TEST_P(PaintControllerTest, CachedNestedSubsequenceUpdate) {
1360 FakeDisplayItemClient container1("container1", 1350 FakeDisplayItemClient container1("container1",
1361 LayoutRect(100, 100, 100, 100)); 1351 LayoutRect(100, 100, 100, 100));
1362 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200)); 1352 FakeDisplayItemClient content1("content1", LayoutRect(100, 100, 50, 200));
1363 FakeDisplayItemClient container2("container2", 1353 FakeDisplayItemClient container2("container2",
1364 LayoutRect(100, 200, 100, 100)); 1354 LayoutRect(100, 200, 100, 100));
1365 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200)); 1355 FakeDisplayItemClient content2("content2", LayoutRect(100, 200, 50, 200));
1366 GraphicsContext context(getPaintController()); 1356 GraphicsContext context(getPaintController());
1367 1357
1368 PaintChunkProperties container1BackgroundProperties = 1358 PaintChunkProperties container1BackgroundProperties =
1369 rootPaintChunkProperties(); 1359 defaultPaintChunkProperties();
1370 PaintChunkProperties content1Properties = rootPaintChunkProperties(); 1360 PaintChunkProperties content1Properties = defaultPaintChunkProperties();
1371 PaintChunkProperties container1ForegroundProperties = 1361 PaintChunkProperties container1ForegroundProperties =
1372 rootPaintChunkProperties(); 1362 defaultPaintChunkProperties();
1373 PaintChunkProperties container2BackgroundProperties = 1363 PaintChunkProperties container2BackgroundProperties =
1374 rootPaintChunkProperties(); 1364 defaultPaintChunkProperties();
1375 PaintChunkProperties content2Properties = rootPaintChunkProperties(); 1365 PaintChunkProperties content2Properties = defaultPaintChunkProperties();
1376 1366
1377 { 1367 {
1378 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1368 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1379 PaintChunk::Id id(container1, backgroundDrawingType); 1369 PaintChunk::Id id(container1, backgroundDrawingType);
1380 container1BackgroundProperties.effect = EffectPaintPropertyNode::create( 1370 container1BackgroundProperties.effect =
1381 EffectPaintPropertyNode::root(), TransformPaintPropertyNode::root(), 1371 createOpacityOnlyEffect(EffectPaintPropertyNode::root(), 0.5);
1382 ClipPaintPropertyNode::root(), CompositorFilterOperations(), 0.5);
1383 getPaintController().updateCurrentPaintChunkProperties( 1372 getPaintController().updateCurrentPaintChunkProperties(
1384 &id, container1BackgroundProperties); 1373 &id, container1BackgroundProperties);
1385 } 1374 }
1386 SubsequenceRecorder r(context, container1); 1375 SubsequenceRecorder r(context, container1);
1387 drawRect(context, container1, backgroundDrawingType, 1376 drawRect(context, container1, backgroundDrawingType,
1388 FloatRect(100, 100, 100, 100)); 1377 FloatRect(100, 100, 100, 100));
1389 { 1378 {
1390 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1379 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1391 PaintChunk::Id id(content1, backgroundDrawingType); 1380 PaintChunk::Id id(content1, backgroundDrawingType);
1392 content1Properties.effect = EffectPaintPropertyNode::create( 1381 content1Properties.effect =
1393 EffectPaintPropertyNode::root(), TransformPaintPropertyNode::root(), 1382 createOpacityOnlyEffect(EffectPaintPropertyNode::root(), 0.6);
1394 ClipPaintPropertyNode::root(), CompositorFilterOperations(), 0.6);
1395 getPaintController().updateCurrentPaintChunkProperties( 1383 getPaintController().updateCurrentPaintChunkProperties(
1396 &id, content1Properties); 1384 &id, content1Properties);
1397 } 1385 }
1398 SubsequenceRecorder r(context, content1); 1386 SubsequenceRecorder r(context, content1);
1399 drawRect(context, content1, backgroundDrawingType, 1387 drawRect(context, content1, backgroundDrawingType,
1400 FloatRect(100, 100, 50, 200)); 1388 FloatRect(100, 100, 50, 200));
1401 drawRect(context, content1, foregroundDrawingType, 1389 drawRect(context, content1, foregroundDrawingType,
1402 FloatRect(100, 100, 50, 200)); 1390 FloatRect(100, 100, 50, 200));
1403 } 1391 }
1404 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1392 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1405 PaintChunk::Id id(container1, foregroundDrawingType); 1393 PaintChunk::Id id(container1, foregroundDrawingType);
1406 container1ForegroundProperties.effect = EffectPaintPropertyNode::create( 1394 container1ForegroundProperties.effect =
1407 EffectPaintPropertyNode::root(), TransformPaintPropertyNode::root(), 1395 createOpacityOnlyEffect(EffectPaintPropertyNode::root(), 0.5);
1408 ClipPaintPropertyNode::root(), CompositorFilterOperations(), 0.5);
1409 getPaintController().updateCurrentPaintChunkProperties( 1396 getPaintController().updateCurrentPaintChunkProperties(
1410 &id, container1ForegroundProperties); 1397 &id, container1ForegroundProperties);
1411 } 1398 }
1412 drawRect(context, container1, foregroundDrawingType, 1399 drawRect(context, container1, foregroundDrawingType,
1413 FloatRect(100, 100, 100, 100)); 1400 FloatRect(100, 100, 100, 100));
1414 } 1401 }
1415 { 1402 {
1416 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1403 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1417 PaintChunk::Id id(container2, backgroundDrawingType); 1404 PaintChunk::Id id(container2, backgroundDrawingType);
1418 container2BackgroundProperties.effect = EffectPaintPropertyNode::create( 1405 container2BackgroundProperties.effect =
1419 EffectPaintPropertyNode::root(), TransformPaintPropertyNode::root(), 1406 createOpacityOnlyEffect(EffectPaintPropertyNode::root(), 0.7);
1420 ClipPaintPropertyNode::root(), CompositorFilterOperations(), 0.7);
1421 getPaintController().updateCurrentPaintChunkProperties( 1407 getPaintController().updateCurrentPaintChunkProperties(
1422 &id, container2BackgroundProperties); 1408 &id, container2BackgroundProperties);
1423 } 1409 }
1424 SubsequenceRecorder r(context, container2); 1410 SubsequenceRecorder r(context, container2);
1425 drawRect(context, container2, backgroundDrawingType, 1411 drawRect(context, container2, backgroundDrawingType,
1426 FloatRect(100, 200, 100, 100)); 1412 FloatRect(100, 200, 100, 100));
1427 { 1413 {
1428 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1414 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1429 PaintChunk::Id id(content2, backgroundDrawingType); 1415 PaintChunk::Id id(content2, backgroundDrawingType);
1430 content2Properties.effect = EffectPaintPropertyNode::create( 1416 content2Properties.effect =
1431 EffectPaintPropertyNode::root(), TransformPaintPropertyNode::root(), 1417 createOpacityOnlyEffect(EffectPaintPropertyNode::root(), 0.8);
1432 ClipPaintPropertyNode::root(), CompositorFilterOperations(), 0.8);
1433 getPaintController().updateCurrentPaintChunkProperties( 1418 getPaintController().updateCurrentPaintChunkProperties(
1434 &id, content2Properties); 1419 &id, content2Properties);
1435 } 1420 }
1436 SubsequenceRecorder r(context, content2); 1421 SubsequenceRecorder r(context, content2);
1437 drawRect(context, content2, backgroundDrawingType, 1422 drawRect(context, content2, backgroundDrawingType,
1438 FloatRect(100, 200, 50, 200)); 1423 FloatRect(100, 200, 50, 200));
1439 } 1424 }
1440 } 1425 }
1441 getPaintController().commitNewDisplayItems(); 1426 getPaintController().commitNewDisplayItems();
1442 1427
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 DisplayItemClient::endShouldKeepAliveAllClients(); 1574 DisplayItemClient::endShouldKeepAliveAllClients();
1590 #endif 1575 #endif
1591 } 1576 }
1592 1577
1593 TEST_P(PaintControllerTest, SkipCache) { 1578 TEST_P(PaintControllerTest, SkipCache) {
1594 FakeDisplayItemClient multicol("multicol", LayoutRect(100, 100, 200, 200)); 1579 FakeDisplayItemClient multicol("multicol", LayoutRect(100, 100, 200, 200));
1595 FakeDisplayItemClient content("content", LayoutRect(100, 100, 100, 100)); 1580 FakeDisplayItemClient content("content", LayoutRect(100, 100, 100, 100));
1596 GraphicsContext context(getPaintController()); 1581 GraphicsContext context(getPaintController());
1597 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1582 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1598 getPaintController().updateCurrentPaintChunkProperties( 1583 getPaintController().updateCurrentPaintChunkProperties(
1599 &m_rootPaintChunkId, rootPaintChunkProperties()); 1584 &m_rootPaintChunkId, defaultPaintChunkProperties());
1600 } 1585 }
1601 1586
1602 FloatRect rect1(100, 100, 50, 50); 1587 FloatRect rect1(100, 100, 50, 50);
1603 FloatRect rect2(150, 100, 50, 50); 1588 FloatRect rect2(150, 100, 50, 50);
1604 FloatRect rect3(200, 100, 50, 50); 1589 FloatRect rect3(200, 100, 50, 50);
1605 1590
1606 drawRect(context, multicol, backgroundDrawingType, 1591 drawRect(context, multicol, backgroundDrawingType,
1607 FloatRect(100, 200, 100, 100)); 1592 FloatRect(100, 200, 100, 100));
1608 1593
1609 getPaintController().beginSkippingCache(); 1594 getPaintController().beginSkippingCache();
(...skipping 16 matching lines...) Expand all
1626 getPaintController().getDisplayItemList()[2]) 1611 getPaintController().getDisplayItemList()[2])
1627 .picture()); 1612 .picture());
1628 EXPECT_NE(picture1, picture2); 1613 EXPECT_NE(picture1, picture2);
1629 1614
1630 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1615 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1631 EXPECT_EQ(1u, getPaintController().paintChunks().size()); 1616 EXPECT_EQ(1u, getPaintController().paintChunks().size());
1632 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects, 1617 EXPECT_THAT(getPaintController().paintChunks()[0].rasterInvalidationRects,
1633 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect()))); 1618 UnorderedElementsAre(FloatRect(LayoutRect::infiniteIntRect())));
1634 1619
1635 getPaintController().updateCurrentPaintChunkProperties( 1620 getPaintController().updateCurrentPaintChunkProperties(
1636 &m_rootPaintChunkId, rootPaintChunkProperties()); 1621 &m_rootPaintChunkId, defaultPaintChunkProperties());
1637 } 1622 }
1638 1623
1639 // Draw again with nothing invalidated. 1624 // Draw again with nothing invalidated.
1640 EXPECT_TRUE(getPaintController().clientCacheIsValid(multicol)); 1625 EXPECT_TRUE(getPaintController().clientCacheIsValid(multicol));
1641 drawRect(context, multicol, backgroundDrawingType, 1626 drawRect(context, multicol, backgroundDrawingType,
1642 FloatRect(100, 200, 100, 100)); 1627 FloatRect(100, 200, 100, 100));
1643 1628
1644 getPaintController().beginSkippingCache(); 1629 getPaintController().beginSkippingCache();
1645 drawRect(context, content, foregroundDrawingType, rect1); 1630 drawRect(context, content, foregroundDrawingType, rect1);
1646 drawRect(context, content, foregroundDrawingType, rect2); 1631 drawRect(context, content, foregroundDrawingType, rect2);
(...skipping 21 matching lines...) Expand all
1668 1653
1669 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1654 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1670 EXPECT_EQ(1u, getPaintController().paintChunks().size()); 1655 EXPECT_EQ(1u, getPaintController().paintChunks().size());
1671 EXPECT_THAT( 1656 EXPECT_THAT(
1672 getPaintController().paintChunks()[0].rasterInvalidationRects, 1657 getPaintController().paintChunks()[0].rasterInvalidationRects,
1673 UnorderedElementsAre( 1658 UnorderedElementsAre(
1674 FloatRect(100, 100, 100, 100), // Old bounds of |content|. 1659 FloatRect(100, 100, 100, 100), // Old bounds of |content|.
1675 FloatRect(100, 100, 100, 100))); // New bounds of |content|. 1660 FloatRect(100, 100, 100, 100))); // New bounds of |content|.
1676 1661
1677 getPaintController().updateCurrentPaintChunkProperties( 1662 getPaintController().updateCurrentPaintChunkProperties(
1678 &m_rootPaintChunkId, rootPaintChunkProperties()); 1663 &m_rootPaintChunkId, defaultPaintChunkProperties());
1679 } 1664 }
1680 1665
1681 // Now the multicol becomes 3 columns and repaints. 1666 // Now the multicol becomes 3 columns and repaints.
1682 multicol.setDisplayItemsUncached(); 1667 multicol.setDisplayItemsUncached();
1683 drawRect(context, multicol, backgroundDrawingType, 1668 drawRect(context, multicol, backgroundDrawingType,
1684 FloatRect(100, 100, 100, 100)); 1669 FloatRect(100, 100, 100, 100));
1685 1670
1686 getPaintController().beginSkippingCache(); 1671 getPaintController().beginSkippingCache();
1687 drawRect(context, content, foregroundDrawingType, rect1); 1672 drawRect(context, content, foregroundDrawingType, rect1);
1688 drawRect(context, content, foregroundDrawingType, rect2); 1673 drawRect(context, content, foregroundDrawingType, rect2);
(...skipping 30 matching lines...) Expand all
1719 TEST_P(PaintControllerTest, PartialSkipCache) { 1704 TEST_P(PaintControllerTest, PartialSkipCache) {
1720 FakeDisplayItemClient content("content"); 1705 FakeDisplayItemClient content("content");
1721 GraphicsContext context(getPaintController()); 1706 GraphicsContext context(getPaintController());
1722 1707
1723 FloatRect rect1(100, 100, 50, 50); 1708 FloatRect rect1(100, 100, 50, 50);
1724 FloatRect rect2(150, 100, 50, 50); 1709 FloatRect rect2(150, 100, 50, 50);
1725 FloatRect rect3(200, 100, 50, 50); 1710 FloatRect rect3(200, 100, 50, 50);
1726 1711
1727 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1712 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1728 getPaintController().updateCurrentPaintChunkProperties( 1713 getPaintController().updateCurrentPaintChunkProperties(
1729 &m_rootPaintChunkId, rootPaintChunkProperties()); 1714 &m_rootPaintChunkId, defaultPaintChunkProperties());
1730 } 1715 }
1731 drawRect(context, content, backgroundDrawingType, rect1); 1716 drawRect(context, content, backgroundDrawingType, rect1);
1732 getPaintController().beginSkippingCache(); 1717 getPaintController().beginSkippingCache();
1733 drawRect(context, content, foregroundDrawingType, rect2); 1718 drawRect(context, content, foregroundDrawingType, rect2);
1734 getPaintController().endSkippingCache(); 1719 getPaintController().endSkippingCache();
1735 drawRect(context, content, foregroundDrawingType, rect3); 1720 drawRect(context, content, foregroundDrawingType, rect3);
1736 1721
1737 getPaintController().commitNewDisplayItems(); 1722 getPaintController().commitNewDisplayItems();
1738 1723
1739 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3, 1724 EXPECT_DISPLAY_LIST(getPaintController().getDisplayItemList(), 3,
(...skipping 13 matching lines...) Expand all
1753 getPaintController().getDisplayItemList()[2]) 1738 getPaintController().getDisplayItemList()[2])
1754 .picture()); 1739 .picture());
1755 EXPECT_NE(picture1, picture2); 1740 EXPECT_NE(picture1, picture2);
1756 1741
1757 // Content's cache is invalid because it has display items skipped cache. 1742 // Content's cache is invalid because it has display items skipped cache.
1758 EXPECT_FALSE(getPaintController().clientCacheIsValid(content)); 1743 EXPECT_FALSE(getPaintController().clientCacheIsValid(content));
1759 EXPECT_EQ(PaintInvalidationFull, content.getPaintInvalidationReason()); 1744 EXPECT_EQ(PaintInvalidationFull, content.getPaintInvalidationReason());
1760 1745
1761 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1746 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1762 getPaintController().updateCurrentPaintChunkProperties( 1747 getPaintController().updateCurrentPaintChunkProperties(
1763 &m_rootPaintChunkId, rootPaintChunkProperties()); 1748 &m_rootPaintChunkId, defaultPaintChunkProperties());
1764 } 1749 }
1765 // Draw again with nothing invalidated. 1750 // Draw again with nothing invalidated.
1766 drawRect(context, content, backgroundDrawingType, rect1); 1751 drawRect(context, content, backgroundDrawingType, rect1);
1767 getPaintController().beginSkippingCache(); 1752 getPaintController().beginSkippingCache();
1768 drawRect(context, content, foregroundDrawingType, rect2); 1753 drawRect(context, content, foregroundDrawingType, rect2);
1769 getPaintController().endSkippingCache(); 1754 getPaintController().endSkippingCache();
1770 drawRect(context, content, foregroundDrawingType, rect3); 1755 drawRect(context, content, foregroundDrawingType, rect3);
1771 1756
1772 EXPECT_EQ(0, numCachedNewItems()); 1757 EXPECT_EQ(0, numCachedNewItems());
1773 #ifndef NDEBUG 1758 #ifndef NDEBUG
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 TestDisplayItem(first, backgroundDrawingType), 1829 TestDisplayItem(first, backgroundDrawingType),
1845 TestDisplayItem(third, backgroundDrawingType)); 1830 TestDisplayItem(third, backgroundDrawingType));
1846 } 1831 }
1847 1832
1848 TEST_F(PaintControllerTestBase, SmallPaintControllerHasOnePaintChunk) { 1833 TEST_F(PaintControllerTestBase, SmallPaintControllerHasOnePaintChunk) {
1849 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); 1834 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true);
1850 FakeDisplayItemClient client("test client"); 1835 FakeDisplayItemClient client("test client");
1851 1836
1852 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 1837 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1853 getPaintController().updateCurrentPaintChunkProperties( 1838 getPaintController().updateCurrentPaintChunkProperties(
1854 nullptr, rootPaintChunkProperties()); 1839 nullptr, defaultPaintChunkProperties());
1855 } 1840 }
1856 GraphicsContext context(getPaintController()); 1841 GraphicsContext context(getPaintController());
1857 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100)); 1842 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100));
1858 1843
1859 getPaintController().commitNewDisplayItems(); 1844 getPaintController().commitNewDisplayItems();
1860 const auto& paintChunks = getPaintController().paintChunks(); 1845 const auto& paintChunks = getPaintController().paintChunks();
1861 ASSERT_EQ(1u, paintChunks.size()); 1846 ASSERT_EQ(1u, paintChunks.size());
1862 EXPECT_EQ(0u, paintChunks[0].beginIndex); 1847 EXPECT_EQ(0u, paintChunks[0].beginIndex);
1863 EXPECT_EQ(1u, paintChunks[0].endIndex); 1848 EXPECT_EQ(1u, paintChunks[0].endIndex);
1864 } 1849 }
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
2327 } 2312 }
2328 2313
2329 TEST_F(PaintControllerUnderInvalidationTest, 2314 TEST_F(PaintControllerUnderInvalidationTest,
2330 FoldCompositingDrawingInSubsequence) { 2315 FoldCompositingDrawingInSubsequence) {
2331 testFoldCompositingDrawingInSubsequence(); 2316 testFoldCompositingDrawingInSubsequence();
2332 } 2317 }
2333 2318
2334 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID) 2319 #endif // defined(GTEST_HAS_DEATH_TEST) && !OS(ANDROID)
2335 2320
2336 } // namespace blink 2321 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698