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/DisplayItemList.h" | 6 #include "platform/graphics/paint/DisplayItemList.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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300
)); | 126 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300
)); |
127 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 200, 20
0)); | 127 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 200, 20
0)); |
128 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300
)); | 128 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300
)); |
129 displayItemList().commitNewDisplayItems(); | 129 displayItemList().commitNewDisplayItems(); |
130 | 130 |
131 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 3, | 131 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 3, |
132 TestDisplayItem(first, backgroundDrawingType), | 132 TestDisplayItem(first, backgroundDrawingType), |
133 TestDisplayItem(second, backgroundDrawingType), | 133 TestDisplayItem(second, backgroundDrawingType), |
134 TestDisplayItem(first, foregroundDrawingType)); | 134 TestDisplayItem(first, foregroundDrawingType)); |
135 | 135 |
136 displayItemList().invalidate(second.displayItemClient()); | 136 displayItemList().invalidate(second); |
137 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300
)); | 137 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 300, 300
)); |
138 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300
)); | 138 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 300, 300
)); |
139 displayItemList().commitNewDisplayItems(); | 139 displayItemList().commitNewDisplayItems(); |
140 | 140 |
141 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 141 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
142 TestDisplayItem(first, backgroundDrawingType), | 142 TestDisplayItem(first, backgroundDrawingType), |
143 TestDisplayItem(first, foregroundDrawingType)); | 143 TestDisplayItem(first, foregroundDrawingType)); |
144 } | 144 } |
145 | 145 |
146 TEST_F(DisplayItemListTest, UpdateSwapOrder) | 146 TEST_F(DisplayItemListTest, UpdateSwapOrder) |
147 { | 147 { |
148 TestDisplayItemClient first("first"); | 148 TestDisplayItemClient first("first"); |
149 TestDisplayItemClient second("second"); | 149 TestDisplayItemClient second("second"); |
150 TestDisplayItemClient unaffected("unaffected"); | 150 TestDisplayItemClient unaffected("unaffected"); |
151 GraphicsContext context(&displayItemList()); | 151 GraphicsContext context(&displayItemList()); |
152 | 152 |
153 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100
)); | 153 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100
)); |
154 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200
)); | 154 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200
)); |
155 drawRect(context, unaffected, backgroundDrawingType, FloatRect(300, 300, 10,
10)); | 155 drawRect(context, unaffected, backgroundDrawingType, FloatRect(300, 300, 10,
10)); |
156 displayItemList().commitNewDisplayItems(); | 156 displayItemList().commitNewDisplayItems(); |
157 | 157 |
158 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 3, | 158 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 3, |
159 TestDisplayItem(first, backgroundDrawingType), | 159 TestDisplayItem(first, backgroundDrawingType), |
160 TestDisplayItem(second, backgroundDrawingType), | 160 TestDisplayItem(second, backgroundDrawingType), |
161 TestDisplayItem(unaffected, backgroundDrawingType)); | 161 TestDisplayItem(unaffected, backgroundDrawingType)); |
162 | 162 |
163 displayItemList().invalidate(second.displayItemClient()); | 163 displayItemList().invalidate(second); |
164 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200
)); | 164 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200
)); |
165 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100
)); | 165 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100
)); |
166 drawRect(context, unaffected, backgroundDrawingType, FloatRect(300, 300, 10,
10)); | 166 drawRect(context, unaffected, backgroundDrawingType, FloatRect(300, 300, 10,
10)); |
167 displayItemList().commitNewDisplayItems(); | 167 displayItemList().commitNewDisplayItems(); |
168 | 168 |
169 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 3, | 169 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 3, |
170 TestDisplayItem(second, backgroundDrawingType), | 170 TestDisplayItem(second, backgroundDrawingType), |
171 TestDisplayItem(first, backgroundDrawingType), | 171 TestDisplayItem(first, backgroundDrawingType), |
172 TestDisplayItem(unaffected, backgroundDrawingType)); | 172 TestDisplayItem(unaffected, backgroundDrawingType)); |
173 } | 173 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 displayItemList().commitNewDisplayItems(); | 214 displayItemList().commitNewDisplayItems(); |
215 | 215 |
216 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 6, | 216 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 6, |
217 TestDisplayItem(first, backgroundDrawingType), | 217 TestDisplayItem(first, backgroundDrawingType), |
218 TestDisplayItem(second, backgroundDrawingType), | 218 TestDisplayItem(second, backgroundDrawingType), |
219 TestDisplayItem(third, backgroundDrawingType), | 219 TestDisplayItem(third, backgroundDrawingType), |
220 TestDisplayItem(first, foregroundDrawingType), | 220 TestDisplayItem(first, foregroundDrawingType), |
221 TestDisplayItem(second, foregroundDrawingType), | 221 TestDisplayItem(second, foregroundDrawingType), |
222 TestDisplayItem(third, foregroundDrawingType)); | 222 TestDisplayItem(third, foregroundDrawingType)); |
223 | 223 |
224 displayItemList().invalidate(second.displayItemClient()); | 224 displayItemList().invalidate(second); |
225 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100
)); | 225 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 100, 100
)); |
226 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200
)); | 226 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 50, 200
)); |
227 drawRect(context, third, backgroundDrawingType, FloatRect(300, 100, 50, 50))
; | 227 drawRect(context, third, backgroundDrawingType, FloatRect(300, 100, 50, 50))
; |
228 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 100, 100
)); | 228 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 100, 100
)); |
229 drawRect(context, second, foregroundDrawingType, FloatRect(100, 100, 50, 200
)); | 229 drawRect(context, second, foregroundDrawingType, FloatRect(100, 100, 50, 200
)); |
230 drawRect(context, third, foregroundDrawingType, FloatRect(300, 100, 50, 50))
; | 230 drawRect(context, third, foregroundDrawingType, FloatRect(300, 100, 50, 50))
; |
231 displayItemList().commitNewDisplayItems(); | 231 displayItemList().commitNewDisplayItems(); |
232 | 232 |
233 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 6, | 233 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 6, |
234 TestDisplayItem(first, backgroundDrawingType), | 234 TestDisplayItem(first, backgroundDrawingType), |
(...skipping 11 matching lines...) Expand all Loading... |
246 GraphicsContext context(&displayItemList()); | 246 GraphicsContext context(&displayItemList()); |
247 | 247 |
248 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); | 248 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); |
249 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); | 249 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); |
250 displayItemList().commitNewDisplayItems(); | 250 displayItemList().commitNewDisplayItems(); |
251 | 251 |
252 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 252 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
253 TestDisplayItem(second, backgroundDrawingType), | 253 TestDisplayItem(second, backgroundDrawingType), |
254 TestDisplayItem(second, foregroundDrawingType)); | 254 TestDisplayItem(second, foregroundDrawingType)); |
255 | 255 |
256 displayItemList().invalidate(first.displayItemClient()); | 256 displayItemList().invalidate(first); |
257 displayItemList().invalidate(second.displayItemClient()); | 257 displayItemList().invalidate(second); |
258 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 258 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
259 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); | 259 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); |
260 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); | 260 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); |
261 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); | 261 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); |
262 displayItemList().commitNewDisplayItems(); | 262 displayItemList().commitNewDisplayItems(); |
263 | 263 |
264 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, | 264 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, |
265 TestDisplayItem(first, backgroundDrawingType), | 265 TestDisplayItem(first, backgroundDrawingType), |
266 TestDisplayItem(first, foregroundDrawingType), | 266 TestDisplayItem(first, foregroundDrawingType), |
267 TestDisplayItem(second, backgroundDrawingType), | 267 TestDisplayItem(second, backgroundDrawingType), |
268 TestDisplayItem(second, foregroundDrawingType)); | 268 TestDisplayItem(second, foregroundDrawingType)); |
269 | 269 |
270 displayItemList().invalidate(first.displayItemClient()); | 270 displayItemList().invalidate(first); |
271 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); | 271 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); |
272 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); | 272 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); |
273 displayItemList().commitNewDisplayItems(); | 273 displayItemList().commitNewDisplayItems(); |
274 | 274 |
275 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 275 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
276 TestDisplayItem(second, backgroundDrawingType), | 276 TestDisplayItem(second, backgroundDrawingType), |
277 TestDisplayItem(second, foregroundDrawingType)); | 277 TestDisplayItem(second, foregroundDrawingType)); |
278 } | 278 } |
279 | 279 |
280 TEST_F(DisplayItemListTest, UpdateAddLastOverlap) | 280 TEST_F(DisplayItemListTest, UpdateAddLastOverlap) |
281 { | 281 { |
282 TestDisplayItemClient first("first"); | 282 TestDisplayItemClient first("first"); |
283 TestDisplayItemClient second("second"); | 283 TestDisplayItemClient second("second"); |
284 GraphicsContext context(&displayItemList()); | 284 GraphicsContext context(&displayItemList()); |
285 | 285 |
286 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 286 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
287 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); | 287 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); |
288 displayItemList().commitNewDisplayItems(); | 288 displayItemList().commitNewDisplayItems(); |
289 | 289 |
290 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 290 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
291 TestDisplayItem(first, backgroundDrawingType), | 291 TestDisplayItem(first, backgroundDrawingType), |
292 TestDisplayItem(first, foregroundDrawingType)); | 292 TestDisplayItem(first, foregroundDrawingType)); |
293 | 293 |
294 displayItemList().invalidate(first.displayItemClient()); | 294 displayItemList().invalidate(first); |
295 displayItemList().invalidate(second.displayItemClient()); | 295 displayItemList().invalidate(second); |
296 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 296 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
297 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); | 297 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); |
298 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); | 298 drawRect(context, second, backgroundDrawingType, FloatRect(200, 200, 50, 50)
); |
299 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); | 299 drawRect(context, second, foregroundDrawingType, FloatRect(200, 200, 50, 50)
); |
300 displayItemList().commitNewDisplayItems(); | 300 displayItemList().commitNewDisplayItems(); |
301 | 301 |
302 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, | 302 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, |
303 TestDisplayItem(first, backgroundDrawingType), | 303 TestDisplayItem(first, backgroundDrawingType), |
304 TestDisplayItem(first, foregroundDrawingType), | 304 TestDisplayItem(first, foregroundDrawingType), |
305 TestDisplayItem(second, backgroundDrawingType), | 305 TestDisplayItem(second, backgroundDrawingType), |
306 TestDisplayItem(second, foregroundDrawingType)); | 306 TestDisplayItem(second, foregroundDrawingType)); |
307 | 307 |
308 displayItemList().invalidate(first.displayItemClient()); | 308 displayItemList().invalidate(first); |
309 displayItemList().invalidate(second.displayItemClient()); | 309 displayItemList().invalidate(second); |
310 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 310 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
311 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); | 311 drawRect(context, first, foregroundDrawingType, FloatRect(100, 100, 150, 150
)); |
312 displayItemList().commitNewDisplayItems(); | 312 displayItemList().commitNewDisplayItems(); |
313 | 313 |
314 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 314 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
315 TestDisplayItem(first, backgroundDrawingType), | 315 TestDisplayItem(first, backgroundDrawingType), |
316 TestDisplayItem(first, foregroundDrawingType)); | 316 TestDisplayItem(first, foregroundDrawingType)); |
317 } | 317 } |
318 | 318 |
319 TEST_F(DisplayItemListTest, UpdateClip) | 319 TEST_F(DisplayItemListTest, UpdateClip) |
320 { | 320 { |
321 TestDisplayItemClient first("first"); | 321 TestDisplayItemClient first("first"); |
322 TestDisplayItemClient second("second"); | 322 TestDisplayItemClient second("second"); |
323 GraphicsContext context(&displayItemList()); | 323 GraphicsContext context(&displayItemList()); |
324 | 324 |
325 { | 325 { |
326 ClipRecorder clipRecorder(context, first, clipType, LayoutRect(1, 1, 2,
2)); | 326 ClipRecorder clipRecorder(context, first, clipType, LayoutRect(1, 1, 2,
2)); |
327 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150,
150)); | 327 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150,
150)); |
328 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150
, 150)); | 328 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150
, 150)); |
329 } | 329 } |
330 displayItemList().commitNewDisplayItems(); | 330 displayItemList().commitNewDisplayItems(); |
331 | 331 |
332 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, | 332 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, |
333 TestDisplayItem(first, clipType), | 333 TestDisplayItem(first, clipType), |
334 TestDisplayItem(first, backgroundDrawingType), | 334 TestDisplayItem(first, backgroundDrawingType), |
335 TestDisplayItem(second, backgroundDrawingType), | 335 TestDisplayItem(second, backgroundDrawingType), |
336 TestDisplayItem(first, DisplayItem::clipTypeToEndClipType(clipType))); | 336 TestDisplayItem(first, DisplayItem::clipTypeToEndClipType(clipType))); |
337 | 337 |
338 displayItemList().invalidate(first.displayItemClient()); | 338 displayItemList().invalidate(first); |
339 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 339 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
340 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150, 15
0)); | 340 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150, 15
0)); |
341 displayItemList().commitNewDisplayItems(); | 341 displayItemList().commitNewDisplayItems(); |
342 | 342 |
343 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 343 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
344 TestDisplayItem(first, backgroundDrawingType), | 344 TestDisplayItem(first, backgroundDrawingType), |
345 TestDisplayItem(second, backgroundDrawingType)); | 345 TestDisplayItem(second, backgroundDrawingType)); |
346 | 346 |
347 displayItemList().invalidate(second.displayItemClient()); | 347 displayItemList().invalidate(second); |
348 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 348 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
349 { | 349 { |
350 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2,
2)); | 350 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2,
2)); |
351 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150
, 150)); | 351 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150
, 150)); |
352 } | 352 } |
353 displayItemList().commitNewDisplayItems(); | 353 displayItemList().commitNewDisplayItems(); |
354 | 354 |
355 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, | 355 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 4, |
356 TestDisplayItem(first, backgroundDrawingType), | 356 TestDisplayItem(first, backgroundDrawingType), |
357 TestDisplayItem(second, clipType), | 357 TestDisplayItem(second, clipType), |
(...skipping 12 matching lines...) Expand all Loading... |
370 displayItemList().commitNewDisplayItems(); | 370 displayItemList().commitNewDisplayItems(); |
371 | 371 |
372 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 372 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
373 TestDisplayItem(first, backgroundDrawingType), | 373 TestDisplayItem(first, backgroundDrawingType), |
374 TestDisplayItem(second, backgroundDrawingType)); | 374 TestDisplayItem(second, backgroundDrawingType)); |
375 EXPECT_TRUE(displayItemList().clientCacheIsValid(first.displayItemClient()))
; | 375 EXPECT_TRUE(displayItemList().clientCacheIsValid(first.displayItemClient()))
; |
376 EXPECT_TRUE(displayItemList().clientCacheIsValid(second.displayItemClient())
); | 376 EXPECT_TRUE(displayItemList().clientCacheIsValid(second.displayItemClient())
); |
377 const SkPicture* firstPicture = static_cast<const DrawingDisplayItem&>(displ
ayItemList().displayItems()[0]).picture(); | 377 const SkPicture* firstPicture = static_cast<const DrawingDisplayItem&>(displ
ayItemList().displayItems()[0]).picture(); |
378 const SkPicture* secondPicture = static_cast<const DrawingDisplayItem&>(disp
layItemList().displayItems()[1]).picture(); | 378 const SkPicture* secondPicture = static_cast<const DrawingDisplayItem&>(disp
layItemList().displayItems()[1]).picture(); |
379 | 379 |
380 displayItemList().invalidate(first.displayItemClient()); | 380 displayItemList().invalidate(first); |
381 EXPECT_FALSE(displayItemList().clientCacheIsValid(first.displayItemClient())
); | 381 EXPECT_FALSE(displayItemList().clientCacheIsValid(first.displayItemClient())
); |
382 EXPECT_TRUE(displayItemList().clientCacheIsValid(second.displayItemClient())
); | 382 EXPECT_TRUE(displayItemList().clientCacheIsValid(second.displayItemClient())
); |
383 | 383 |
384 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); | 384 drawRect(context, first, backgroundDrawingType, FloatRect(100, 100, 150, 150
)); |
385 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150, 15
0)); | 385 drawRect(context, second, backgroundDrawingType, FloatRect(100, 100, 150, 15
0)); |
386 displayItemList().commitNewDisplayItems(); | 386 displayItemList().commitNewDisplayItems(); |
387 | 387 |
388 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 388 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
389 TestDisplayItem(first, backgroundDrawingType), | 389 TestDisplayItem(first, backgroundDrawingType), |
390 TestDisplayItem(second, backgroundDrawingType)); | 390 TestDisplayItem(second, backgroundDrawingType)); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 TestDisplayItem(container1, backgroundDrawingType), | 422 TestDisplayItem(container1, backgroundDrawingType), |
423 TestDisplayItem(content1, backgroundDrawingType), | 423 TestDisplayItem(content1, backgroundDrawingType), |
424 TestDisplayItem(content1, foregroundDrawingType), | 424 TestDisplayItem(content1, foregroundDrawingType), |
425 TestDisplayItem(container1, foregroundDrawingType), | 425 TestDisplayItem(container1, foregroundDrawingType), |
426 TestDisplayItem(container2, backgroundDrawingType), | 426 TestDisplayItem(container2, backgroundDrawingType), |
427 TestDisplayItem(content2, backgroundDrawingType), | 427 TestDisplayItem(content2, backgroundDrawingType), |
428 TestDisplayItem(content2, foregroundDrawingType), | 428 TestDisplayItem(content2, foregroundDrawingType), |
429 TestDisplayItem(container2, foregroundDrawingType)); | 429 TestDisplayItem(container2, foregroundDrawingType)); |
430 | 430 |
431 // Simulate the situation when container1 e.g. gets a z-index that is now gr
eater than container2. | 431 // Simulate the situation when container1 e.g. gets a z-index that is now gr
eater than container2. |
432 displayItemList().invalidate(container1.displayItemClient()); | 432 displayItemList().invalidate(container1); |
433 drawRect(context, container2, backgroundDrawingType, FloatRect(100, 200, 100
, 100)); | 433 drawRect(context, container2, backgroundDrawingType, FloatRect(100, 200, 100
, 100)); |
434 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 200, 50, 2
00)); | 434 drawRect(context, content2, backgroundDrawingType, FloatRect(100, 200, 50, 2
00)); |
435 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 50, 2
00)); | 435 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 50, 2
00)); |
436 drawRect(context, container2, foregroundDrawingType, FloatRect(100, 200, 100
, 100)); | 436 drawRect(context, container2, foregroundDrawingType, FloatRect(100, 200, 100
, 100)); |
437 drawRect(context, container1, backgroundDrawingType, FloatRect(100, 100, 100
, 100)); | 437 drawRect(context, container1, backgroundDrawingType, FloatRect(100, 100, 100
, 100)); |
438 drawRect(context, content1, backgroundDrawingType, FloatRect(100, 100, 50, 2
00)); | 438 drawRect(context, content1, backgroundDrawingType, FloatRect(100, 100, 50, 2
00)); |
439 drawRect(context, content1, foregroundDrawingType, FloatRect(100, 100, 50, 2
00)); | 439 drawRect(context, content1, foregroundDrawingType, FloatRect(100, 100, 50, 2
00)); |
440 drawRect(context, container1, foregroundDrawingType, FloatRect(100, 100, 100
, 100)); | 440 drawRect(context, container1, foregroundDrawingType, FloatRect(100, 100, 100
, 100)); |
441 displayItemList().commitNewDisplayItems(); | 441 displayItemList().commitNewDisplayItems(); |
442 | 442 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 TestDisplayItem(container1, DisplayItem::EndSubsequence), | 555 TestDisplayItem(container1, DisplayItem::EndSubsequence), |
556 | 556 |
557 TestDisplayItem(container2, DisplayItem::BeginSubsequence), | 557 TestDisplayItem(container2, DisplayItem::BeginSubsequence), |
558 TestDisplayItem(container2, backgroundDrawingType), | 558 TestDisplayItem(container2, backgroundDrawingType), |
559 TestDisplayItem(content2, DisplayItem::BeginSubsequence), | 559 TestDisplayItem(content2, DisplayItem::BeginSubsequence), |
560 TestDisplayItem(content2, backgroundDrawingType), | 560 TestDisplayItem(content2, backgroundDrawingType), |
561 TestDisplayItem(content2, DisplayItem::EndSubsequence), | 561 TestDisplayItem(content2, DisplayItem::EndSubsequence), |
562 TestDisplayItem(container2, DisplayItem::EndSubsequence)); | 562 TestDisplayItem(container2, DisplayItem::EndSubsequence)); |
563 | 563 |
564 // Invalidate container1 but not content1. | 564 // Invalidate container1 but not content1. |
565 displayItemList().invalidate(container1.displayItemClient()); | 565 displayItemList().invalidate(container1); |
566 | 566 |
567 // Container2 itself now becomes empty (but still has the 'content2' child), | 567 // Container2 itself now becomes empty (but still has the 'content2' child), |
568 // and chooses not to output subsequence info. | 568 // and chooses not to output subsequence info. |
569 displayItemList().invalidate(container2.displayItemClient()); | 569 displayItemList().invalidate(container2); |
570 displayItemList().invalidate(content2.displayItemClient()); | 570 displayItemList().invalidate(content2); |
571 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, co
ntainer2)); | 571 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, co
ntainer2)); |
572 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, co
ntent2)); | 572 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context, co
ntent2)); |
573 // Content2 now outputs foreground only. | 573 // Content2 now outputs foreground only. |
574 { | 574 { |
575 SubsequenceRecorder r(context, content2); | 575 SubsequenceRecorder r(context, content2); |
576 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 5
0, 200)); | 576 drawRect(context, content2, foregroundDrawingType, FloatRect(100, 200, 5
0, 200)); |
577 } | 577 } |
578 // Repaint container1 with foreground only. | 578 // Repaint container1 with foreground only. |
579 { | 579 { |
580 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context
, container1)); | 580 EXPECT_FALSE(SubsequenceRecorder::useCachedSubsequenceIfPossible(context
, container1)); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 displayItemList().commitNewDisplayItems(); | 654 displayItemList().commitNewDisplayItems(); |
655 | 655 |
656 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 3, | 656 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 3, |
657 TestDisplayItem(multicol, backgroundDrawingType), | 657 TestDisplayItem(multicol, backgroundDrawingType), |
658 TestDisplayItem(content, foregroundDrawingType), | 658 TestDisplayItem(content, foregroundDrawingType), |
659 TestDisplayItem(content, foregroundDrawingType)); | 659 TestDisplayItem(content, foregroundDrawingType)); |
660 EXPECT_NE(picture1, static_cast<const DrawingDisplayItem&>(displayItemList()
.displayItems()[1]).picture()); | 660 EXPECT_NE(picture1, static_cast<const DrawingDisplayItem&>(displayItemList()
.displayItems()[1]).picture()); |
661 EXPECT_NE(picture2, static_cast<const DrawingDisplayItem&>(displayItemList()
.displayItems()[2]).picture()); | 661 EXPECT_NE(picture2, static_cast<const DrawingDisplayItem&>(displayItemList()
.displayItems()[2]).picture()); |
662 | 662 |
663 // Now the multicol becomes 3 columns and repaints. | 663 // Now the multicol becomes 3 columns and repaints. |
664 displayItemList().invalidate(multicol.displayItemClient()); | 664 displayItemList().invalidate(multicol); |
665 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 100, 100,
100)); | 665 drawRect(context, multicol, backgroundDrawingType, FloatRect(100, 100, 100,
100)); |
666 | 666 |
667 displayItemList().beginScope(); | 667 displayItemList().beginScope(); |
668 drawRect(context, content, foregroundDrawingType, rect1); | 668 drawRect(context, content, foregroundDrawingType, rect1); |
669 displayItemList().endScope(); | 669 displayItemList().endScope(); |
670 | 670 |
671 displayItemList().beginScope(); | 671 displayItemList().beginScope(); |
672 drawRect(context, content, foregroundDrawingType, rect2); | 672 drawRect(context, content, foregroundDrawingType, rect2); |
673 displayItemList().endScope(); | 673 displayItemList().endScope(); |
674 | 674 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 707 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
708 | 708 |
709 displayItemList().commitNewDisplayItems(); | 709 displayItemList().commitNewDisplayItems(); |
710 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 5, | 710 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 5, |
711 TestDisplayItem(first, backgroundDrawingType), | 711 TestDisplayItem(first, backgroundDrawingType), |
712 TestDisplayItem(second, DisplayItem::BeginClipPath), | 712 TestDisplayItem(second, DisplayItem::BeginClipPath), |
713 TestDisplayItem(second, backgroundDrawingType), | 713 TestDisplayItem(second, backgroundDrawingType), |
714 TestDisplayItem(second, DisplayItem::EndClipPath), | 714 TestDisplayItem(second, DisplayItem::EndClipPath), |
715 TestDisplayItem(third, backgroundDrawingType)); | 715 TestDisplayItem(third, backgroundDrawingType)); |
716 | 716 |
717 displayItemList().invalidate(second.displayItemClient()); | 717 displayItemList().invalidate(second); |
718 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 718 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
719 { | 719 { |
720 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2,
2)); | 720 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2,
2)); |
721 // Do not draw anything for second. | 721 // Do not draw anything for second. |
722 } | 722 } |
723 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 723 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
724 displayItemList().commitNewDisplayItems(); | 724 displayItemList().commitNewDisplayItems(); |
725 | 725 |
726 // Empty clips should have been optimized out. | 726 // Empty clips should have been optimized out. |
727 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 727 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
728 TestDisplayItem(first, backgroundDrawingType), | 728 TestDisplayItem(first, backgroundDrawingType), |
729 TestDisplayItem(third, backgroundDrawingType)); | 729 TestDisplayItem(third, backgroundDrawingType)); |
730 | 730 |
731 displayItemList().invalidate(second.displayItemClient()); | 731 displayItemList().invalidate(second); |
732 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 732 drawRect(context, first, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
733 { | 733 { |
734 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2,
2)); | 734 ClipRecorder clipRecorder(context, second, clipType, LayoutRect(1, 1, 2,
2)); |
735 { | 735 { |
736 ClipPathRecorder clipPathRecorder(context, second, Path()); | 736 ClipPathRecorder clipPathRecorder(context, second, Path()); |
737 // Do not draw anything for second. | 737 // Do not draw anything for second. |
738 } | 738 } |
739 } | 739 } |
740 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); | 740 drawRect(context, third, backgroundDrawingType, FloatRect(0, 0, 100, 100)); |
741 displayItemList().commitNewDisplayItems(); | 741 displayItemList().commitNewDisplayItems(); |
742 | 742 |
743 // Empty clips should have been optimized out. | 743 // Empty clips should have been optimized out. |
744 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, | 744 EXPECT_DISPLAY_LIST(displayItemList().displayItems(), 2, |
745 TestDisplayItem(first, backgroundDrawingType), | 745 TestDisplayItem(first, backgroundDrawingType), |
746 TestDisplayItem(third, backgroundDrawingType)); | 746 TestDisplayItem(third, backgroundDrawingType)); |
747 } | 747 } |
748 | 748 |
749 } // namespace blink | 749 } // namespace blink |
OLD | NEW |