| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 6 |
| 7 #include "core/layout/compositing/CompositedLayerMapping.h" | 7 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 8 #include "core/paint/PaintControllerPaintTest.h" | 8 #include "core/paint/PaintControllerPaintTest.h" |
| 9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 TestDisplayItem(container1Layer, endSubsequenceType), | 71 TestDisplayItem(container1Layer, endSubsequenceType), |
| 72 TestDisplayItem(container2, backgroundType), | 72 TestDisplayItem(container2, backgroundType), |
| 73 TestDisplayItem(container2Layer, subsequenceType), | 73 TestDisplayItem(container2Layer, subsequenceType), |
| 74 TestDisplayItem(content2, backgroundType), | 74 TestDisplayItem(content2, backgroundType), |
| 75 TestDisplayItem(container2Layer, endSubsequenceType), | 75 TestDisplayItem(container2Layer, endSubsequenceType), |
| 76 TestDisplayItem(htmlLayer, endSubsequenceType), | 76 TestDisplayItem(htmlLayer, endSubsequenceType), |
| 77 TestDisplayItem(rootLayer, endSubsequenceType)); | 77 TestDisplayItem(rootLayer, endSubsequenceType)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position
: absolute; width: 100px; height: 100px; background-color: green"); | 80 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position
: absolute; width: 100px; height: 100px; background-color: green"); |
| 81 document().view()->updateAllLifecyclePhases(); | 81 updateLifecyclePhasesBeforePaint(); |
| 82 paint(); |
| 83 |
| 84 if (rootLayerScrolls) { |
| 85 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 9, |
| 86 TestDisplayItem(layoutView(), cachedBackgroundType), |
| 87 TestDisplayItem(rootLayer, subsequenceType), |
| 88 TestDisplayItem(container1, cachedBackgroundType), |
| 89 TestDisplayItem(container1Layer, subsequenceType), |
| 90 TestDisplayItem(content1, backgroundType), |
| 91 TestDisplayItem(container1Layer, endSubsequenceType), |
| 92 TestDisplayItem(container2, cachedBackgroundType), |
| 93 TestDisplayItem(container2Layer, cachedSubsequenceType), |
| 94 TestDisplayItem(rootLayer, endSubsequenceType)); |
| 95 } else { |
| 96 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 11, |
| 97 TestDisplayItem(layoutView(), cachedBackgroundType), |
| 98 TestDisplayItem(rootLayer, subsequenceType), |
| 99 TestDisplayItem(htmlLayer, subsequenceType), |
| 100 TestDisplayItem(container1, cachedBackgroundType), |
| 101 TestDisplayItem(container1Layer, subsequenceType), |
| 102 TestDisplayItem(content1, backgroundType), |
| 103 TestDisplayItem(container1Layer, endSubsequenceType), |
| 104 TestDisplayItem(container2, cachedBackgroundType), |
| 105 TestDisplayItem(container2Layer, cachedSubsequenceType), |
| 106 TestDisplayItem(htmlLayer, endSubsequenceType), |
| 107 TestDisplayItem(rootLayer, endSubsequenceType)); |
| 108 } |
| 109 |
| 110 commit(); |
| 82 | 111 |
| 83 if (rootLayerScrolls) { | 112 if (rootLayerScrolls) { |
| 84 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 11, | 113 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 11, |
| 85 TestDisplayItem(layoutView(), backgroundType), | 114 TestDisplayItem(layoutView(), backgroundType), |
| 86 TestDisplayItem(rootLayer, subsequenceType), | 115 TestDisplayItem(rootLayer, subsequenceType), |
| 87 TestDisplayItem(container1, backgroundType), | 116 TestDisplayItem(container1, backgroundType), |
| 88 TestDisplayItem(container1Layer, subsequenceType), | 117 TestDisplayItem(container1Layer, subsequenceType), |
| 89 TestDisplayItem(content1, backgroundType), | 118 TestDisplayItem(content1, backgroundType), |
| 90 TestDisplayItem(container1Layer, endSubsequenceType), | 119 TestDisplayItem(container1Layer, endSubsequenceType), |
| 91 TestDisplayItem(container2, backgroundType), | 120 TestDisplayItem(container2, backgroundType), |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 159 |
| 131 bool rootLayerScrolls = document().frame()->settings()->rootLayerScrolls(); | 160 bool rootLayerScrolls = document().frame()->settings()->rootLayerScrolls(); |
| 132 PaintLayer& rootLayer = *layoutView().layer(); | 161 PaintLayer& rootLayer = *layoutView().layer(); |
| 133 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); | 162 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); |
| 134 LayoutObject& container1 = *document().getElementById("container1")->layoutO
bject(); | 163 LayoutObject& container1 = *document().getElementById("container1")->layoutO
bject(); |
| 135 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer(); | 164 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer(); |
| 136 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec
t(); | 165 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec
t(); |
| 137 LayoutObject& container2 = *document().getElementById("container2")->layoutO
bject(); | 166 LayoutObject& container2 = *document().getElementById("container2")->layoutO
bject(); |
| 138 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer(); | 167 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer(); |
| 139 LayoutObject& content2a = *document().getElementById("content2a")->layoutObj
ect(); | 168 LayoutObject& content2a = *document().getElementById("content2a")->layoutObj
ect(); |
| 169 LayoutObject& content2b = *document().getElementById("content2b")->layoutObj
ect(); |
| 140 LayoutObject& container3 = *document().getElementById("container3")->layoutO
bject(); | 170 LayoutObject& container3 = *document().getElementById("container3")->layoutO
bject(); |
| 141 PaintLayer& container3Layer = *toLayoutBoxModelObject(container3).layer(); | 171 PaintLayer& container3Layer = *toLayoutBoxModelObject(container3).layer(); |
| 142 LayoutObject& content3 = *document().getElementById("content3")->layoutObjec
t(); | 172 LayoutObject& content3 = *document().getElementById("content3")->layoutObjec
t(); |
| 143 | 173 |
| 144 LayoutRect interestRect(0, 0, 400, 300); | 174 updateLifecyclePhasesBeforePaint(); |
| 145 document().view()->updateAllLifecyclePhases(&interestRect); | 175 IntRect interestRect(0, 0, 400, 300); |
| 176 paint(&interestRect); |
| 177 commit(); |
| 146 | 178 |
| 147 // Container1 is fully in the interest rect; | 179 // Container1 is fully in the interest rect; |
| 148 // Container2 is partly (including its stacking chidren) in the interest rec
t; | 180 // Container2 is partly (including its stacking chidren) in the interest rec
t; |
| 149 // Content2b is out of the interest rect and output nothing; | 181 // Content2b is out of the interest rect and output nothing; |
| 150 // Container3 is partly in the interest rect. | 182 // Container3 is partly in the interest rect. |
| 151 if (rootLayerScrolls) { | 183 if (rootLayerScrolls) { |
| 152 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 15, | 184 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 15, |
| 153 TestDisplayItem(layoutView(), backgroundType), | 185 TestDisplayItem(layoutView(), backgroundType), |
| 154 TestDisplayItem(rootLayer, subsequenceType), | 186 TestDisplayItem(rootLayer, subsequenceType), |
| 155 TestDisplayItem(container1, backgroundType), | 187 TestDisplayItem(container1, backgroundType), |
| (...skipping 23 matching lines...) Expand all Loading... |
| 179 TestDisplayItem(content2a, backgroundType), | 211 TestDisplayItem(content2a, backgroundType), |
| 180 TestDisplayItem(container2Layer, endSubsequenceType), | 212 TestDisplayItem(container2Layer, endSubsequenceType), |
| 181 TestDisplayItem(container3, backgroundType), | 213 TestDisplayItem(container3, backgroundType), |
| 182 TestDisplayItem(container3Layer, subsequenceType), | 214 TestDisplayItem(container3Layer, subsequenceType), |
| 183 TestDisplayItem(content3, backgroundType), | 215 TestDisplayItem(content3, backgroundType), |
| 184 TestDisplayItem(container3Layer, endSubsequenceType), | 216 TestDisplayItem(container3Layer, endSubsequenceType), |
| 185 TestDisplayItem(htmlLayer, endSubsequenceType), | 217 TestDisplayItem(htmlLayer, endSubsequenceType), |
| 186 TestDisplayItem(rootLayer, endSubsequenceType)); | 218 TestDisplayItem(rootLayer, endSubsequenceType)); |
| 187 } | 219 } |
| 188 | 220 |
| 189 LayoutRect newInterestRect(0, 100, 300, 300); | 221 updateLifecyclePhasesBeforePaint(); |
| 190 document().view()->updateAllLifecyclePhases(&newInterestRect); | 222 IntRect newInterestRect(0, 100, 300, 1000); |
| 223 paint(&newInterestRect); |
| 191 | 224 |
| 192 // Container1 becomes partly in the interest rect, but uses cached subsequen
ce | 225 // Container1 becomes partly in the interest rect, but uses cached subsequen
ce |
| 193 // because it was fully painted before; | 226 // because it was fully painted before; |
| 194 // Container2's intersection with the interest rect changes; | 227 // Container2's intersection with the interest rect changes; |
| 195 // Content2b is out of the interest rect and outputs nothing; | 228 // Content2b is out of the interest rect and outputs nothing; |
| 196 // Container3 becomes out of the interest rect and outputs nothing. | 229 // Container3 becomes out of the interest rect and outputs nothing. |
| 230 |
| 197 if (rootLayerScrolls) { | 231 if (rootLayerScrolls) { |
| 198 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 11, | 232 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 10, |
| 233 TestDisplayItem(layoutView(), cachedBackgroundType), |
| 234 TestDisplayItem(rootLayer, subsequenceType), |
| 235 TestDisplayItem(container1, cachedBackgroundType), |
| 236 TestDisplayItem(container1Layer, cachedSubsequenceType), |
| 237 TestDisplayItem(container2, cachedBackgroundType), |
| 238 TestDisplayItem(container2Layer, subsequenceType), |
| 239 TestDisplayItem(content2a, cachedBackgroundType), |
| 240 TestDisplayItem(content2b, backgroundType), |
| 241 TestDisplayItem(container2Layer, endSubsequenceType), |
| 242 TestDisplayItem(rootLayer, endSubsequenceType)); |
| 243 } else { |
| 244 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 12, |
| 245 TestDisplayItem(layoutView(), cachedBackgroundType), |
| 246 TestDisplayItem(rootLayer, subsequenceType), |
| 247 TestDisplayItem(htmlLayer, subsequenceType), |
| 248 TestDisplayItem(container1, cachedBackgroundType), |
| 249 TestDisplayItem(container1Layer, cachedSubsequenceType), |
| 250 TestDisplayItem(container2, cachedBackgroundType), |
| 251 TestDisplayItem(container2Layer, subsequenceType), |
| 252 TestDisplayItem(content2a, cachedBackgroundType), |
| 253 TestDisplayItem(content2b, backgroundType), |
| 254 TestDisplayItem(container2Layer, endSubsequenceType), |
| 255 TestDisplayItem(htmlLayer, endSubsequenceType), |
| 256 TestDisplayItem(rootLayer, endSubsequenceType)); |
| 257 } |
| 258 |
| 259 commit(); |
| 260 |
| 261 if (rootLayerScrolls) { |
| 262 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 12, |
| 199 TestDisplayItem(layoutView(), backgroundType), | 263 TestDisplayItem(layoutView(), backgroundType), |
| 200 TestDisplayItem(rootLayer, subsequenceType), | 264 TestDisplayItem(rootLayer, subsequenceType), |
| 201 TestDisplayItem(container1, backgroundType), | 265 TestDisplayItem(container1, backgroundType), |
| 202 TestDisplayItem(container1Layer, subsequenceType), | 266 TestDisplayItem(container1Layer, subsequenceType), |
| 203 TestDisplayItem(content1, backgroundType), | 267 TestDisplayItem(content1, backgroundType), |
| 204 TestDisplayItem(container1Layer, endSubsequenceType), | 268 TestDisplayItem(container1Layer, endSubsequenceType), |
| 205 TestDisplayItem(container2, backgroundType), | 269 TestDisplayItem(container2, backgroundType), |
| 206 TestDisplayItem(container2Layer, subsequenceType), | 270 TestDisplayItem(container2Layer, subsequenceType), |
| 207 TestDisplayItem(content2a, backgroundType), | 271 TestDisplayItem(content2a, backgroundType), |
| 272 TestDisplayItem(content2b, backgroundType), |
| 208 TestDisplayItem(container2Layer, endSubsequenceType), | 273 TestDisplayItem(container2Layer, endSubsequenceType), |
| 209 TestDisplayItem(rootLayer, endSubsequenceType)); | 274 TestDisplayItem(rootLayer, endSubsequenceType)); |
| 210 } else { | 275 } else { |
| 211 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 13, | 276 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 14, |
| 212 TestDisplayItem(layoutView(), backgroundType), | 277 TestDisplayItem(layoutView(), backgroundType), |
| 213 TestDisplayItem(rootLayer, subsequenceType), | 278 TestDisplayItem(rootLayer, subsequenceType), |
| 214 TestDisplayItem(htmlLayer, subsequenceType), | 279 TestDisplayItem(htmlLayer, subsequenceType), |
| 215 TestDisplayItem(container1, backgroundType), | 280 TestDisplayItem(container1, backgroundType), |
| 216 TestDisplayItem(container1Layer, subsequenceType), | 281 TestDisplayItem(container1Layer, subsequenceType), |
| 217 TestDisplayItem(content1, backgroundType), | 282 TestDisplayItem(content1, backgroundType), |
| 218 TestDisplayItem(container1Layer, endSubsequenceType), | 283 TestDisplayItem(container1Layer, endSubsequenceType), |
| 219 TestDisplayItem(container2, backgroundType), | 284 TestDisplayItem(container2, backgroundType), |
| 220 TestDisplayItem(container2Layer, subsequenceType), | 285 TestDisplayItem(container2Layer, subsequenceType), |
| 221 TestDisplayItem(content2a, backgroundType), | 286 TestDisplayItem(content2a, backgroundType), |
| 287 TestDisplayItem(content2b, backgroundType), |
| 222 TestDisplayItem(container2Layer, endSubsequenceType), | 288 TestDisplayItem(container2Layer, endSubsequenceType), |
| 223 TestDisplayItem(htmlLayer, endSubsequenceType), | 289 TestDisplayItem(htmlLayer, endSubsequenceType), |
| 224 TestDisplayItem(rootLayer, endSubsequenceType)); | 290 TestDisplayItem(rootLayer, endSubsequenceType)); |
| 225 } | 291 } |
| 226 } | 292 } |
| 227 | 293 |
| 228 TEST_F(PaintLayerPainterTestForSlimmingPaintV2, CachedSubsequence) | |
| 229 { | |
| 230 setBodyInnerHTML( | |
| 231 "<div id='container1' style='position: relative; z-index: 1; width: 200p
x; height: 200px; background-color: blue'>" | |
| 232 " <div id='content1' style='position: absolute; width: 100px; height: 1
00px; background-color: red'></div>" | |
| 233 "</div>" | |
| 234 "<div id='container2' style='position: relative; z-index: 1; width: 200p
x; height: 200px; background-color: blue'>" | |
| 235 " <div id='content2' style='position: absolute; width: 100px; height: 1
00px; background-color: green'></div>" | |
| 236 "</div>"); | |
| 237 document().view()->updateAllLifecyclePhases(); | |
| 238 | |
| 239 PaintLayer& rootLayer = *layoutView().layer(); | |
| 240 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); | |
| 241 LayoutObject& container1 = *document().getElementById("container1")->layoutO
bject(); | |
| 242 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer(); | |
| 243 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec
t(); | |
| 244 LayoutObject& container2 = *document().getElementById("container2")->layoutO
bject(); | |
| 245 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer(); | |
| 246 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec
t(); | |
| 247 | |
| 248 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 13, | |
| 249 TestDisplayItem(layoutView(), backgroundType), | |
| 250 TestDisplayItem(rootLayer, subsequenceType), | |
| 251 TestDisplayItem(htmlLayer, subsequenceType), | |
| 252 TestDisplayItem(container1, backgroundType), | |
| 253 TestDisplayItem(container1Layer, subsequenceType), | |
| 254 TestDisplayItem(content1, backgroundType), | |
| 255 TestDisplayItem(container1Layer, endSubsequenceType), | |
| 256 TestDisplayItem(container2, backgroundType), | |
| 257 TestDisplayItem(container2Layer, subsequenceType), | |
| 258 TestDisplayItem(content2, backgroundType), | |
| 259 TestDisplayItem(container2Layer, endSubsequenceType), | |
| 260 TestDisplayItem(htmlLayer, endSubsequenceType), | |
| 261 TestDisplayItem(rootLayer, endSubsequenceType)); | |
| 262 | |
| 263 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position
: absolute; width: 100px; height: 100px; background-color: green"); | |
| 264 updateLifecyclePhasesToPaintClean(); | |
| 265 | |
| 266 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 11, | |
| 267 TestDisplayItem(layoutView(), cachedBackgroundType), | |
| 268 TestDisplayItem(rootLayer, subsequenceType), | |
| 269 TestDisplayItem(htmlLayer, subsequenceType), | |
| 270 TestDisplayItem(container1, cachedBackgroundType), | |
| 271 TestDisplayItem(container1Layer, subsequenceType), | |
| 272 TestDisplayItem(content1, backgroundType), | |
| 273 TestDisplayItem(container1Layer, endSubsequenceType), | |
| 274 TestDisplayItem(container2, cachedBackgroundType), | |
| 275 TestDisplayItem(container2Layer, cachedSubsequenceType), | |
| 276 TestDisplayItem(htmlLayer, endSubsequenceType), | |
| 277 TestDisplayItem(rootLayer, endSubsequenceType)); | |
| 278 | |
| 279 compositeForSlimmingPaintV2(); | |
| 280 | |
| 281 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 13, | |
| 282 TestDisplayItem(layoutView(), backgroundType), | |
| 283 TestDisplayItem(rootLayer, subsequenceType), | |
| 284 TestDisplayItem(htmlLayer, subsequenceType), | |
| 285 TestDisplayItem(container1, backgroundType), | |
| 286 TestDisplayItem(container1Layer, subsequenceType), | |
| 287 TestDisplayItem(content1, backgroundType), | |
| 288 TestDisplayItem(container1Layer, endSubsequenceType), | |
| 289 TestDisplayItem(container2, backgroundType), | |
| 290 TestDisplayItem(container2Layer, subsequenceType), | |
| 291 TestDisplayItem(content2, backgroundType), | |
| 292 TestDisplayItem(container2Layer, endSubsequenceType), | |
| 293 TestDisplayItem(htmlLayer, endSubsequenceType), | |
| 294 TestDisplayItem(rootLayer, endSubsequenceType)); | |
| 295 | |
| 296 // Repeated painting should just generate a CachedDisplayItemList item. | |
| 297 updateLifecyclePhasesToPaintClean(); | |
| 298 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 1, | |
| 299 TestDisplayItem(*rootLayer.compositedLayerMapping(), DisplayItem::Cached
DisplayItemList)); | |
| 300 | |
| 301 compositeForSlimmingPaintV2(); | |
| 302 | |
| 303 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 13, | |
| 304 TestDisplayItem(layoutView(), backgroundType), | |
| 305 TestDisplayItem(rootLayer, subsequenceType), | |
| 306 TestDisplayItem(htmlLayer, subsequenceType), | |
| 307 TestDisplayItem(container1, backgroundType), | |
| 308 TestDisplayItem(container1Layer, subsequenceType), | |
| 309 TestDisplayItem(content1, backgroundType), | |
| 310 TestDisplayItem(container1Layer, endSubsequenceType), | |
| 311 TestDisplayItem(container2, backgroundType), | |
| 312 TestDisplayItem(container2Layer, subsequenceType), | |
| 313 TestDisplayItem(content2, backgroundType), | |
| 314 TestDisplayItem(container2Layer, endSubsequenceType), | |
| 315 TestDisplayItem(htmlLayer, endSubsequenceType), | |
| 316 TestDisplayItem(rootLayer, endSubsequenceType)); | |
| 317 } | |
| 318 | |
| 319 TEST_F(PaintLayerPainterTestForSlimmingPaintV2, CachedSubsequenceOnInterestRectC
hange) | |
| 320 { | |
| 321 setBodyInnerHTML( | |
| 322 "<div id='container1' style='position: relative; z-index: 1; width: 200p
x; height: 200px; background-color: blue'>" | |
| 323 " <div id='content1' style='position: absolute; width: 100px; height: 1
00px; background-color: green'></div>" | |
| 324 "</div>" | |
| 325 "<div id='container2' style='position: relative; z-index: 1; width: 200p
x; height: 200px; background-color: blue'>" | |
| 326 " <div id='content2a' style='position: absolute; width: 100px; height:
100px; background-color: green'></div>" | |
| 327 " <div id='content2b' style='position: absolute; top: 200px; width: 100
px; height: 100px; background-color: green'></div>" | |
| 328 "</div>" | |
| 329 "<div id='container3' style='position: absolute; z-index: 2; left: 300px
; top: 0; width: 200px; height: 200px; background-color: blue'>" | |
| 330 " <div id='content3' style='position: absolute; width: 200px; height: 2
00px; background-color: green'></div>" | |
| 331 "</div>"); | |
| 332 rootPaintController().invalidateAll(); | |
| 333 | |
| 334 PaintLayer& rootLayer = *layoutView().layer(); | |
| 335 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); | |
| 336 LayoutObject& container1 = *document().getElementById("container1")->layoutO
bject(); | |
| 337 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer(); | |
| 338 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec
t(); | |
| 339 LayoutObject& container2 = *document().getElementById("container2")->layoutO
bject(); | |
| 340 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer(); | |
| 341 LayoutObject& content2a = *document().getElementById("content2a")->layoutObj
ect(); | |
| 342 LayoutObject& container3 = *document().getElementById("container3")->layoutO
bject(); | |
| 343 PaintLayer& container3Layer = *toLayoutBoxModelObject(container3).layer(); | |
| 344 LayoutObject& content3 = *document().getElementById("content3")->layoutObjec
t(); | |
| 345 | |
| 346 LayoutRect interestRect(0, 0, 400, 300); | |
| 347 document().view()->updateAllLifecyclePhases(&interestRect); | |
| 348 | |
| 349 // Container1 is fully in the interest rect; | |
| 350 // Container2 is partly (including its stacking chidren) in the interest rec
t; | |
| 351 // Content2b is out of the interest rect and output nothing; | |
| 352 // Container3 is partly in the interest rect. | |
| 353 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 17, | |
| 354 TestDisplayItem(layoutView(), backgroundType), | |
| 355 TestDisplayItem(rootLayer, subsequenceType), | |
| 356 TestDisplayItem(htmlLayer, subsequenceType), | |
| 357 TestDisplayItem(container1, backgroundType), | |
| 358 TestDisplayItem(container1Layer, subsequenceType), | |
| 359 TestDisplayItem(content1, backgroundType), | |
| 360 TestDisplayItem(container1Layer, endSubsequenceType), | |
| 361 TestDisplayItem(container2, backgroundType), | |
| 362 TestDisplayItem(container2Layer, subsequenceType), | |
| 363 TestDisplayItem(content2a, backgroundType), | |
| 364 TestDisplayItem(container2Layer, endSubsequenceType), | |
| 365 TestDisplayItem(container3, backgroundType), | |
| 366 TestDisplayItem(container3Layer, subsequenceType), | |
| 367 TestDisplayItem(content3, backgroundType), | |
| 368 TestDisplayItem(container3Layer, endSubsequenceType), | |
| 369 TestDisplayItem(htmlLayer, endSubsequenceType), | |
| 370 TestDisplayItem(rootLayer, endSubsequenceType)); | |
| 371 | |
| 372 // Container1 becomes partly in the interest rect, but uses cached subsequen
ce | |
| 373 // because it was fully painted before; | |
| 374 // Container2's intersection with the interest rect changes; | |
| 375 // Content2b is out of the interest rect and outputs nothing; | |
| 376 // Container3 becomes out of the interest rect and outputs nothing. | |
| 377 LayoutRect newInterestRect(0, 100, 300, 300); | |
| 378 updateLifecyclePhasesToPaintClean(&newInterestRect); | |
| 379 | |
| 380 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 11, | |
| 381 TestDisplayItem(layoutView(), cachedBackgroundType), | |
| 382 TestDisplayItem(rootLayer, subsequenceType), | |
| 383 TestDisplayItem(htmlLayer, subsequenceType), | |
| 384 TestDisplayItem(container1, cachedBackgroundType), | |
| 385 TestDisplayItem(container1Layer, cachedSubsequenceType), | |
| 386 TestDisplayItem(container2, cachedBackgroundType), | |
| 387 TestDisplayItem(container2Layer, subsequenceType), | |
| 388 TestDisplayItem(content2a, cachedBackgroundType), | |
| 389 TestDisplayItem(container2Layer, endSubsequenceType), | |
| 390 TestDisplayItem(htmlLayer, endSubsequenceType), | |
| 391 TestDisplayItem(rootLayer, endSubsequenceType)); | |
| 392 | |
| 393 compositeForSlimmingPaintV2(); | |
| 394 | |
| 395 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 13, | |
| 396 TestDisplayItem(layoutView(), backgroundType), | |
| 397 TestDisplayItem(rootLayer, subsequenceType), | |
| 398 TestDisplayItem(htmlLayer, subsequenceType), | |
| 399 TestDisplayItem(container1, backgroundType), | |
| 400 TestDisplayItem(container1Layer, subsequenceType), | |
| 401 TestDisplayItem(content1, backgroundType), | |
| 402 TestDisplayItem(container1Layer, endSubsequenceType), | |
| 403 TestDisplayItem(container2, backgroundType), | |
| 404 TestDisplayItem(container2Layer, subsequenceType), | |
| 405 TestDisplayItem(content2a, backgroundType), | |
| 406 TestDisplayItem(container2Layer, endSubsequenceType), | |
| 407 TestDisplayItem(htmlLayer, endSubsequenceType), | |
| 408 TestDisplayItem(rootLayer, endSubsequenceType)); | |
| 409 } | |
| 410 | |
| 411 } // namespace blink | 294 } // namespace blink |
| OLD | NEW |