| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 #include "platform/graphics/paint/PaintController.h" | 6 #include "platform/graphics/paint/PaintController.h" |
| 7 | 7 |
| 8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
| 9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
| 10 #include "platform/graphics/paint/CachedDisplayItem.h" | 10 #include "platform/graphics/paint/CachedDisplayItem.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300
)); | 127 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300
)); |
| 128 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 200, 20
0)); | 128 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 200, 20
0)); |
| 129 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300
)); | 129 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300
)); |
| 130 paintController().commitNewDisplayItems(); | 130 paintController().commitNewDisplayItems(); |
| 131 | 131 |
| 132 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3, | 132 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3, |
| 133 TestDisplayItem(first, backgroundDrawingType), | 133 TestDisplayItem(first, backgroundDrawingType), |
| 134 TestDisplayItem(second, backgroundDrawingType), | 134 TestDisplayItem(second, backgroundDrawingType), |
| 135 TestDisplayItem(first, foregroundDrawingType)); | 135 TestDisplayItem(first, foregroundDrawingType)); |
| 136 | 136 |
| 137 paintController().invalidate(second, PaintInvalidationFull, IntRect(), IntRe
ct()); | 137 paintController().invalidate(second, PaintInvalidationFull, Vector<IntRect>(
)); |
| 138 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300
)); | 138 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300
)); |
| 139 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300
)); | 139 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300
)); |
| 140 paintController().commitNewDisplayItems(); | 140 paintController().commitNewDisplayItems(); |
| 141 | 141 |
| 142 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, | 142 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, |
| 143 TestDisplayItem(first, backgroundDrawingType), | 143 TestDisplayItem(first, backgroundDrawingType), |
| 144 TestDisplayItem(first, foregroundDrawingType)); | 144 TestDisplayItem(first, foregroundDrawingType)); |
| 145 } | 145 } |
| 146 | 146 |
| 147 TEST_F(PaintControllerTest, UpdateSwapOrder) | 147 TEST_F(PaintControllerTest, UpdateSwapOrder) |
| 148 { | 148 { |
| 149 TestDisplayItemClient first("first"); | 149 TestDisplayItemClient first("first"); |
| 150 TestDisplayItemClient second("second"); | 150 TestDisplayItemClient second("second"); |
| 151 TestDisplayItemClient unaffected("unaffected"); | 151 TestDisplayItemClient unaffected("unaffected"); |
| 152 GraphicsContext context(paintController()); | 152 GraphicsContext context(paintController()); |
| 153 | 153 |
| 154 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100
)); | 154 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100
)); |
| 155 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200
)); | 155 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200
)); |
| 156 drawRect(context, unaffected, backgroundDrawingType, FloatRect(300, 300, 10,
10)); | 156 drawRect(context, unaffected, backgroundDrawingType, FloatRect(300, 300, 10,
10)); |
| 157 paintController().commitNewDisplayItems(); | 157 paintController().commitNewDisplayItems(); |
| 158 | 158 |
| 159 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3, | 159 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3, |
| 160 TestDisplayItem(first, backgroundDrawingType), | 160 TestDisplayItem(first, backgroundDrawingType), |
| 161 TestDisplayItem(second, backgroundDrawingType), | 161 TestDisplayItem(second, backgroundDrawingType), |
| 162 TestDisplayItem(unaffected, backgroundDrawingType)); | 162 TestDisplayItem(unaffected, backgroundDrawingType)); |
| 163 | 163 |
| 164 paintController().invalidate(second, PaintInvalidationFull, IntRect(), IntRe
ct()); | 164 paintController().invalidate(second, PaintInvalidationFull, Vector<IntRect>(
)); |
| 165 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200
)); | 165 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200
)); |
| 166 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100
)); | 166 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100
)); |
| 167 drawRect(context, unaffected, backgroundDrawingType, FloatRect(300, 300, 10,
10)); | 167 drawRect(context, unaffected, backgroundDrawingType, FloatRect(300, 300, 10,
10)); |
| 168 paintController().commitNewDisplayItems(); | 168 paintController().commitNewDisplayItems(); |
| 169 | 169 |
| 170 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3, | 170 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3, |
| 171 TestDisplayItem(second, backgroundDrawingType), | 171 TestDisplayItem(second, backgroundDrawingType), |
| 172 TestDisplayItem(first, backgroundDrawingType), | 172 TestDisplayItem(first, backgroundDrawingType), |
| 173 TestDisplayItem(unaffected, backgroundDrawingType)); | 173 TestDisplayItem(unaffected, backgroundDrawingType)); |
| 174 } | 174 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 paintController().commitNewDisplayItems(); | 215 paintController().commitNewDisplayItems(); |
| 216 | 216 |
| 217 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 6, | 217 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 6, |
| 218 TestDisplayItem(first, backgroundDrawingType), | 218 TestDisplayItem(first, backgroundDrawingType), |
| 219 TestDisplayItem(second, backgroundDrawingType), | 219 TestDisplayItem(second, backgroundDrawingType), |
| 220 TestDisplayItem(third, backgroundDrawingType), | 220 TestDisplayItem(third, backgroundDrawingType), |
| 221 TestDisplayItem(first, foregroundDrawingType), | 221 TestDisplayItem(first, foregroundDrawingType), |
| 222 TestDisplayItem(second, foregroundDrawingType), | 222 TestDisplayItem(second, foregroundDrawingType), |
| 223 TestDisplayItem(third, foregroundDrawingType)); | 223 TestDisplayItem(third, foregroundDrawingType)); |
| 224 | 224 |
| 225 paintController().invalidate(second, PaintInvalidationFull, IntRect(), IntRe
ct()); | 225 paintController().invalidate(second, PaintInvalidationFull, Vector<IntRect>(
)); |
| 226 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100
)); | 226 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100
)); |
| 227 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200
)); | 227 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200
)); |
| 228 drawRect(context, third, backgroundDrawingType, FloatRect(300, 100, 50, 50))
; | 228 drawRect(context, third, backgroundDrawingType, FloatRect(300, 100, 50, 50))
; |
| 229 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 100, 100
)); | 229 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 100, 100
)); |
| 230 drawRect(context, second, foregroundDrawingType, FloatRect(100, 100, 50, 200
)); | 230 drawRect(context, second, foregroundDrawingType, FloatRect(100, 100, 50, 200
)); |
| 231 drawRect(context, third, foregroundDrawingType, FloatRect(300, 100, 50, 50))
; | 231 drawRect(context, third, foregroundDrawingType, FloatRect(300, 100, 50, 50))
; |
| 232 paintController().commitNewDisplayItems(); | 232 paintController().commitNewDisplayItems(); |
| 233 | 233 |
| 234 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 6, | 234 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 6, |
| 235 TestDisplayItem(first, backgroundDrawingType), | 235 TestDisplayItem(first, backgroundDrawingType), |
| (...skipping 11 matching lines...) Expand all Loading... |
| 247 GraphicsContext context(paintController()); | 247 GraphicsContext context(paintController()); |
| 248 | 248 |
| 249 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); | 249 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); |
| 250 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); | 250 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); |
| 251 paintController().commitNewDisplayItems(); | 251 paintController().commitNewDisplayItems(); |
| 252 | 252 |
| 253 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, | 253 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, |
| 254 TestDisplayItem(second, backgroundDrawingType), | 254 TestDisplayItem(second, backgroundDrawingType), |
| 255 TestDisplayItem(second, foregroundDrawingType)); | 255 TestDisplayItem(second, foregroundDrawingType)); |
| 256 | 256 |
| 257 paintController().invalidate(first, PaintInvalidationFull, IntRect(), IntRec
t()); | 257 paintController().invalidate(first, PaintInvalidationFull, Vector<IntRect>()
); |
| 258 paintController().invalidate(second, PaintInvalidationFull, IntRect(), IntRe
ct()); | 258 paintController().invalidate(second, PaintInvalidationFull, Vector<IntRect>(
)); |
| 259 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 259 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
| 260 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); | 260 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); |
| 261 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); | 261 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); |
| 262 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); | 262 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); |
| 263 paintController().commitNewDisplayItems(); | 263 paintController().commitNewDisplayItems(); |
| 264 | 264 |
| 265 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4, | 265 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4, |
| 266 TestDisplayItem(first, backgroundDrawingType), | 266 TestDisplayItem(first, backgroundDrawingType), |
| 267 TestDisplayItem(first, foregroundDrawingType), | 267 TestDisplayItem(first, foregroundDrawingType), |
| 268 TestDisplayItem(second, backgroundDrawingType), | 268 TestDisplayItem(second, backgroundDrawingType), |
| 269 TestDisplayItem(second, foregroundDrawingType)); | 269 TestDisplayItem(second, foregroundDrawingType)); |
| 270 | 270 |
| 271 paintController().invalidate(first, PaintInvalidationFull, IntRect(), IntRec
t()); | 271 paintController().invalidate(first, PaintInvalidationFull, Vector<IntRect>()
); |
| 272 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); | 272 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); |
| 273 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); | 273 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); |
| 274 paintController().commitNewDisplayItems(); | 274 paintController().commitNewDisplayItems(); |
| 275 | 275 |
| 276 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, | 276 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, |
| 277 TestDisplayItem(second, backgroundDrawingType), | 277 TestDisplayItem(second, backgroundDrawingType), |
| 278 TestDisplayItem(second, foregroundDrawingType)); | 278 TestDisplayItem(second, foregroundDrawingType)); |
| 279 } | 279 } |
| 280 | 280 |
| 281 TEST_F(PaintControllerTest, UpdateAddLastOverlap) | 281 TEST_F(PaintControllerTest, UpdateAddLastOverlap) |
| 282 { | 282 { |
| 283 TestDisplayItemClient first("first"); | 283 TestDisplayItemClient first("first"); |
| 284 TestDisplayItemClient second("second"); | 284 TestDisplayItemClient second("second"); |
| 285 GraphicsContext context(paintController()); | 285 GraphicsContext context(paintController()); |
| 286 | 286 |
| 287 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 287 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
| 288 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); | 288 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); |
| 289 paintController().commitNewDisplayItems(); | 289 paintController().commitNewDisplayItems(); |
| 290 | 290 |
| 291 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, | 291 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, |
| 292 TestDisplayItem(first, backgroundDrawingType), | 292 TestDisplayItem(first, backgroundDrawingType), |
| 293 TestDisplayItem(first, foregroundDrawingType)); | 293 TestDisplayItem(first, foregroundDrawingType)); |
| 294 | 294 |
| 295 paintController().invalidate(first, PaintInvalidationFull, IntRect(), IntRec
t()); | 295 paintController().invalidate(first, PaintInvalidationFull, Vector<IntRect>()
); |
| 296 paintController().invalidate(second, PaintInvalidationFull, IntRect(), IntRe
ct()); | 296 paintController().invalidate(second, PaintInvalidationFull, Vector<IntRect>(
)); |
| 297 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 297 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
| 298 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); | 298 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); |
| 299 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); | 299 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); |
| 300 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); | 300 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); |
| 301 paintController().commitNewDisplayItems(); | 301 paintController().commitNewDisplayItems(); |
| 302 | 302 |
| 303 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4, | 303 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4, |
| 304 TestDisplayItem(first, backgroundDrawingType), | 304 TestDisplayItem(first, backgroundDrawingType), |
| 305 TestDisplayItem(first, foregroundDrawingType), | 305 TestDisplayItem(first, foregroundDrawingType), |
| 306 TestDisplayItem(second, backgroundDrawingType), | 306 TestDisplayItem(second, backgroundDrawingType), |
| 307 TestDisplayItem(second, foregroundDrawingType)); | 307 TestDisplayItem(second, foregroundDrawingType)); |
| 308 | 308 |
| 309 paintController().invalidate(first, PaintInvalidationFull, IntRect(), IntRec
t()); | 309 paintController().invalidate(first, PaintInvalidationFull, Vector<IntRect>()
); |
| 310 paintController().invalidate(second, PaintInvalidationFull, IntRect(), IntRe
ct()); | 310 paintController().invalidate(second, PaintInvalidationFull, Vector<IntRect>(
)); |
| 311 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 311 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
| 312 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); | 312 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); |
| 313 paintController().commitNewDisplayItems(); | 313 paintController().commitNewDisplayItems(); |
| 314 | 314 |
| 315 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, | 315 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, |
| 316 TestDisplayItem(first, backgroundDrawingType), | 316 TestDisplayItem(first, backgroundDrawingType), |
| 317 TestDisplayItem(first, foregroundDrawingType)); | 317 TestDisplayItem(first, foregroundDrawingType)); |
| 318 } | 318 } |
| 319 | 319 |
| 320 TEST_F(PaintControllerTest, UpdateClip) | 320 TEST_F(PaintControllerTest, UpdateClip) |
| 321 { | 321 { |
| 322 TestDisplayItemClient first("first"); | 322 TestDisplayItemClient first("first"); |
| 323 TestDisplayItemClient second("second"); | 323 TestDisplayItemClient second("second"); |
| 324 GraphicsContext context(paintController()); | 324 GraphicsContext context(paintController()); |
| 325 | 325 |
| 326 { | 326 { |
| 327 ClipRecorder clipRecorder(context, first, clipType, LayoutRect(1, 1, 2,
2)); | 327 ClipRecorder clipRecorder(context, first, clipType, LayoutRect(1, 1, 2,
2)); |
| 328 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150,
150)); | 328 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150,
150)); |
| 329 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150
, 150)); | 329 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150
, 150)); |
| 330 } | 330 } |
| 331 paintController().commitNewDisplayItems(); | 331 paintController().commitNewDisplayItems(); |
| 332 | 332 |
| 333 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4, | 333 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4, |
| 334 TestDisplayItem(first, clipType), | 334 TestDisplayItem(first, clipType), |
| 335 TestDisplayItem(first, backgroundDrawingType), | 335 TestDisplayItem(first, backgroundDrawingType), |
| 336 TestDisplayItem(second, backgroundDrawingType), | 336 TestDisplayItem(second, backgroundDrawingType), |
| 337 TestDisplayItem(first, DisplayItem::clipTypeToEndClipType(clipType))); | 337 TestDisplayItem(first, DisplayItem::clipTypeToEndClipType(clipType))); |
| 338 | 338 |
| 339 paintController().invalidate(first, PaintInvalidationFull, IntRect(), IntRec
t()); | 339 paintController().invalidate(first, PaintInvalidationFull, Vector<IntRect>()
); |
| 340 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 340 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
| 341 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150, 15
0)); | 341 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150, 15
0)); |
| 342 paintController().commitNewDisplayItems(); | 342 paintController().commitNewDisplayItems(); |
| 343 | 343 |
| 344 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, | 344 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, |
| 345 TestDisplayItem(first, backgroundDrawingType), | 345 TestDisplayItem(first, backgroundDrawingType), |
| 346 TestDisplayItem(second, backgroundDrawingType)); | 346 TestDisplayItem(second, backgroundDrawingType)); |
| 347 | 347 |
| 348 paintController().invalidate(second, PaintInvalidationFull, IntRect(), IntRe
ct()); | 348 paintController().invalidate(second, PaintInvalidationFull, Vector<IntRect>(
)); |
| 349 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 349 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
| 350 { | 350 { |
| 351 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2,
2)); | 351 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2,
2)); |
| 352 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150
, 150)); | 352 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150
, 150)); |
| 353 } | 353 } |
| 354 paintController().commitNewDisplayItems(); | 354 paintController().commitNewDisplayItems(); |
| 355 | 355 |
| 356 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4, | 356 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 4, |
| 357 TestDisplayItem(first, backgroundDrawingType), | 357 TestDisplayItem(first, backgroundDrawingType), |
| 358 TestDisplayItem(second, clipType), | 358 TestDisplayItem(second, clipType), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 371 paintController().commitNewDisplayItems(); | 371 paintController().commitNewDisplayItems(); |
| 372 | 372 |
| 373 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, | 373 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, |
| 374 TestDisplayItem(first, backgroundDrawingType), | 374 TestDisplayItem(first, backgroundDrawingType), |
| 375 TestDisplayItem(second, backgroundDrawingType)); | 375 TestDisplayItem(second, backgroundDrawingType)); |
| 376 EXPECT_TRUE(paintController().clientCacheIsValid(first.displayItemClient()))
; | 376 EXPECT_TRUE(paintController().clientCacheIsValid(first.displayItemClient()))
; |
| 377 EXPECT_TRUE(paintController().clientCacheIsValid(second.displayItemClient())
); | 377 EXPECT_TRUE(paintController().clientCacheIsValid(second.displayItemClient())
); |
| 378 const SkPicture* firstPicture = static_cast<const DrawingDisplayItem&>(paint
Controller().displayItemList()[0]).picture(); | 378 const SkPicture* firstPicture = static_cast<const DrawingDisplayItem&>(paint
Controller().displayItemList()[0]).picture(); |
| 379 const SkPicture* secondPicture = static_cast<const DrawingDisplayItem&>(pain
tController().displayItemList()[1]).picture(); | 379 const SkPicture* secondPicture = static_cast<const DrawingDisplayItem&>(pain
tController().displayItemList()[1]).picture(); |
| 380 | 380 |
| 381 paintController().invalidate(first, PaintInvalidationFull, IntRect(), IntRec
t()); | 381 paintController().invalidate(first, PaintInvalidationFull, Vector<IntRect>()
); |
| 382 EXPECT_FALSE(paintController().clientCacheIsValid(first.displayItemClient())
); | 382 EXPECT_FALSE(paintController().clientCacheIsValid(first.displayItemClient())
); |
| 383 EXPECT_TRUE(paintController().clientCacheIsValid(second.displayItemClient())
); | 383 EXPECT_TRUE(paintController().clientCacheIsValid(second.displayItemClient())
); |
| 384 | 384 |
| 385 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 385 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
| 386 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150, 15
0)); | 386 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150, 15
0)); |
| 387 paintController().commitNewDisplayItems(); | 387 paintController().commitNewDisplayItems(); |
| 388 | 388 |
| 389 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, | 389 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, |
| 390 TestDisplayItem(first, backgroundDrawingType), | 390 TestDisplayItem(first, backgroundDrawingType), |
| 391 TestDisplayItem(second, backgroundDrawingType)); | 391 TestDisplayItem(second, backgroundDrawingType)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 TestDisplayItem(container1, backgroundDrawingType), | 423 TestDisplayItem(container1, backgroundDrawingType), |
| 424 TestDisplayItem(content1, backgroundDrawingType), | 424 TestDisplayItem(content1, backgroundDrawingType), |
| 425 TestDisplayItem(content1, foregroundDrawingType), | 425 TestDisplayItem(content1, foregroundDrawingType), |
| 426 TestDisplayItem(container1, foregroundDrawingType), | 426 TestDisplayItem(container1, foregroundDrawingType), |
| 427 TestDisplayItem(container2, backgroundDrawingType), | 427 TestDisplayItem(container2, backgroundDrawingType), |
| 428 TestDisplayItem(content2, backgroundDrawingType), | 428 TestDisplayItem(content2, backgroundDrawingType), |
| 429 TestDisplayItem(content2, foregroundDrawingType), | 429 TestDisplayItem(content2, foregroundDrawingType), |
| 430 TestDisplayItem(container2, foregroundDrawingType)); | 430 TestDisplayItem(container2, foregroundDrawingType)); |
| 431 | 431 |
| 432 // Simulate the situation when container1 e.g. gets a z-index that is now gr
eater than container2. | 432 // Simulate the situation when container1 e.g. gets a z-index that is now gr
eater than container2. |
| 433 paintController().invalidate(container1, PaintInvalidationFull, IntRect(), I
ntRect()); | 433 paintController().invalidate(container1, PaintInvalidationFull, Vector<IntRe
ct>()); |
| 434 drawRect(context, container2, backgroundDrawingType, FloatRect(100, 200, 100
, 100)); | 434 drawRect(context, container2, backgroundDrawingType, FloatRect(100, 200, 100
, 100)); |
| 435 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 200, 50, 2
00)); | 435 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 200, 50, 2
00)); |
| 436 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 50, 2
00)); | 436 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 50, 2
00)); |
| 437 drawRect(context, container2, foregroundDrawingType, FloatRect(100, 200, 100
, 100)); | 437 drawRect(context, container2, foregroundDrawingType, FloatRect(100, 200, 100
, 100)); |
| 438 drawRect(context, container1, backgroundDrawingType, FloatRect(100, 100, 100
, 100)); | 438 drawRect(context, container1, backgroundDrawingType, FloatRect(100, 100, 100
, 100)); |
| 439 drawRect(context, content1, backgroundDrawingType, FloatRect(100, 100, 50, 2
00)); | 439 drawRect(context, content1, backgroundDrawingType, FloatRect(100, 100, 50, 2
00)); |
| 440 drawRect(context, content1, foregroundDrawingType, FloatRect(100, 100, 50, 2
00)); | 440 drawRect(context, content1, foregroundDrawingType, FloatRect(100, 100, 50, 2
00)); |
| 441 drawRect(context, container1, foregroundDrawingType, FloatRect(100, 100, 100
, 100)); | 441 drawRect(context, container1, foregroundDrawingType, FloatRect(100, 100, 100
, 100)); |
| 442 paintController().commitNewDisplayItems(); | 442 paintController().commitNewDisplayItems(); |
| 443 | 443 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 TestDisplayItem(container1, endSubsequenceType), | 585 TestDisplayItem(container1, endSubsequenceType), |
| 586 | 586 |
| 587 TestDisplayItem(container2, subsequenceType), | 587 TestDisplayItem(container2, subsequenceType), |
| 588 TestDisplayItem(container2, backgroundDrawingType), | 588 TestDisplayItem(container2, backgroundDrawingType), |
| 589 TestDisplayItem(content2, subsequenceType), | 589 TestDisplayItem(content2, subsequenceType), |
| 590 TestDisplayItem(content2, backgroundDrawingType), | 590 TestDisplayItem(content2, backgroundDrawingType), |
| 591 TestDisplayItem(content2, endSubsequenceType), | 591 TestDisplayItem(content2, endSubsequenceType), |
| 592 TestDisplayItem(container2, endSubsequenceType)); | 592 TestDisplayItem(container2, endSubsequenceType)); |
| 593 | 593 |
| 594 // Invalidate container1 but not content1. | 594 // Invalidate container1 but not content1. |
| 595 paintController().invalidate(container1, PaintInvalidationFull, IntRect(), I
ntRect()); | 595 paintController().invalidate(container1, PaintInvalidationFull, Vector<IntRe
ct>()); |
| 596 | 596 |
| 597 // Container2 itself now becomes empty (but still has the 'content2' child), | 597 // Container2 itself now becomes empty (but still has the 'content2' child), |
| 598 // and chooses not to output subsequence info. | 598 // and chooses not to output subsequence info. |
| 599 | 599 |
| 600 paintController().invalidate(container2, PaintInvalidationFull, IntRect(), I
ntRect()); | 600 paintController().invalidate(container2, PaintInvalidationFull, Vector<IntRe
ct>()); |
| 601 paintController().invalidate(content2, PaintInvalidationFull, IntRect(), Int
Rect()); | 601 paintController().invalidate(content2, PaintInvalidationFull, Vector<IntRect
>()); |
| 602 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, co
ntainer2, subsequenceType)); | 602 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, co
ntainer2, subsequenceType)); |
| 603 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, co
ntent2, subsequenceType)); | 603 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, co
ntent2, subsequenceType)); |
| 604 // Content2 now outputs foreground only. | 604 // Content2 now outputs foreground only. |
| 605 { | 605 { |
| 606 SubsequenceRecorder r(context, content2, subsequenceType); | 606 SubsequenceRecorder r(context, content2, subsequenceType); |
| 607 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 5
0, 200)); | 607 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 5
0, 200)); |
| 608 } | 608 } |
| 609 // Repaint container1 with foreground only. | 609 // Repaint container1 with foreground only. |
| 610 { | 610 { |
| 611 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context
, container1, subsequenceType)); | 611 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context
, container1, subsequenceType)); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 paintController().commitNewDisplayItems(); | 687 paintController().commitNewDisplayItems(); |
| 688 | 688 |
| 689 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3, | 689 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 3, |
| 690 TestDisplayItem(multicol, backgroundDrawingType), | 690 TestDisplayItem(multicol, backgroundDrawingType), |
| 691 TestDisplayItem(content, foregroundDrawingType), | 691 TestDisplayItem(content, foregroundDrawingType), |
| 692 TestDisplayItem(content, foregroundDrawingType)); | 692 TestDisplayItem(content, foregroundDrawingType)); |
| 693 EXPECT_NE(picture1, static_cast<const DrawingDisplayItem&>(paintController()
.displayItemList()[1]).picture()); | 693 EXPECT_NE(picture1, static_cast<const DrawingDisplayItem&>(paintController()
.displayItemList()[1]).picture()); |
| 694 EXPECT_NE(picture2, static_cast<const DrawingDisplayItem&>(paintController()
.displayItemList()[2]).picture()); | 694 EXPECT_NE(picture2, static_cast<const DrawingDisplayItem&>(paintController()
.displayItemList()[2]).picture()); |
| 695 | 695 |
| 696 // Now the multicol becomes 3 columns and repaints. | 696 // Now the multicol becomes 3 columns and repaints. |
| 697 paintController().invalidate(multicol, PaintInvalidationFull, IntRect(), Int
Rect()); | 697 paintController().invalidate(multicol, PaintInvalidationFull, Vector<IntRect
>()); |
| 698 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 100, 100,
100)); | 698 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 100, 100,
100)); |
| 699 | 699 |
| 700 paintController().beginScope(); | 700 paintController().beginScope(); |
| 701 drawRect(context, content, foregroundDrawingType, rect1); | 701 drawRect(context, content, foregroundDrawingType, rect1); |
| 702 paintController().endScope(); | 702 paintController().endScope(); |
| 703 | 703 |
| 704 paintController().beginScope(); | 704 paintController().beginScope(); |
| 705 drawRect(context, content, foregroundDrawingType, rect2); | 705 drawRect(context, content, foregroundDrawingType, rect2); |
| 706 paintController().endScope(); | 706 paintController().endScope(); |
| 707 | 707 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 736 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 736 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 737 | 737 |
| 738 paintController().commitNewDisplayItems(); | 738 paintController().commitNewDisplayItems(); |
| 739 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 5, | 739 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 5, |
| 740 TestDisplayItem(first, backgroundDrawingType), | 740 TestDisplayItem(first, backgroundDrawingType), |
| 741 TestDisplayItem(second, DisplayItem::BeginClipPath), | 741 TestDisplayItem(second, DisplayItem::BeginClipPath), |
| 742 TestDisplayItem(second, backgroundDrawingType), | 742 TestDisplayItem(second, backgroundDrawingType), |
| 743 TestDisplayItem(second, DisplayItem::EndClipPath), | 743 TestDisplayItem(second, DisplayItem::EndClipPath), |
| 744 TestDisplayItem(third, backgroundDrawingType)); | 744 TestDisplayItem(third, backgroundDrawingType)); |
| 745 | 745 |
| 746 paintController().invalidate(second, PaintInvalidationFull, IntRect(), IntRe
ct()); | 746 paintController().invalidate(second, PaintInvalidationFull, Vector<IntRect>(
)); |
| 747 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 747 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 748 { | 748 { |
| 749 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2,
2)); | 749 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2,
2)); |
| 750 // Do not draw anything for second. | 750 // Do not draw anything for second. |
| 751 } | 751 } |
| 752 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 752 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 753 paintController().commitNewDisplayItems(); | 753 paintController().commitNewDisplayItems(); |
| 754 | 754 |
| 755 // Empty clips should have been optimized out. | 755 // Empty clips should have been optimized out. |
| 756 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, | 756 EXPECT_DISPLAY_LIST(paintController().displayItemList(), 2, |
| 757 TestDisplayItem(first, backgroundDrawingType), | 757 TestDisplayItem(first, backgroundDrawingType), |
| 758 TestDisplayItem(third, backgroundDrawingType)); | 758 TestDisplayItem(third, backgroundDrawingType)); |
| 759 | 759 |
| 760 paintController().invalidate(second, PaintInvalidationFull, IntRect(), IntRe
ct()); | 760 paintController().invalidate(second, PaintInvalidationFull, Vector<IntRect>(
)); |
| 761 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 761 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 762 { | 762 { |
| 763 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2,
2)); | 763 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2,
2)); |
| 764 { | 764 { |
| 765 ClipPathRecorder clipPathRecorder(context, second, Path()); | 765 ClipPathRecorder clipPathRecorder(context, second, Path()); |
| 766 // Do not draw anything for second. | 766 // Do not draw anything for second. |
| 767 } | 767 } |
| 768 } | 768 } |
| 769 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 769 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 770 paintController().commitNewDisplayItems(); | 770 paintController().commitNewDisplayItems(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 784 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 784 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
| 785 | 785 |
| 786 paintController().commitNewDisplayItems(); | 786 paintController().commitNewDisplayItems(); |
| 787 const auto& paintChunks = paintController().paintChunks(); | 787 const auto& paintChunks = paintController().paintChunks(); |
| 788 ASSERT_EQ(1u, paintChunks.size()); | 788 ASSERT_EQ(1u, paintChunks.size()); |
| 789 EXPECT_EQ(0u, paintChunks[0].beginIndex); | 789 EXPECT_EQ(0u, paintChunks[0].beginIndex); |
| 790 EXPECT_EQ(1u, paintChunks[0].endIndex); | 790 EXPECT_EQ(1u, paintChunks[0].endIndex); |
| 791 } | 791 } |
| 792 | 792 |
| 793 } // namespace blink | 793 } // namespace blink |
| OLD | NEW |