| 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 "core/layout/compositing/CompositedLayerMapping.h" | 5 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 6 #include "core/paint/PaintControllerPaintTest.h" | 6 #include "core/paint/PaintControllerPaintTest.h" |
| 7 #include "platform/graphics/GraphicsContext.h" | 7 #include "platform/graphics/GraphicsContext.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 TestDisplayItem(container1, backgroundType), | 46 TestDisplayItem(container1, backgroundType), |
| 47 TestDisplayItem(content1, backgroundType), | 47 TestDisplayItem(content1, backgroundType), |
| 48 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 48 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 49 TestDisplayItem(container2Layer, DisplayItem::Subsequence), | 49 TestDisplayItem(container2Layer, DisplayItem::Subsequence), |
| 50 TestDisplayItem(container2, backgroundType), | 50 TestDisplayItem(container2, backgroundType), |
| 51 TestDisplayItem(content2, backgroundType), | 51 TestDisplayItem(content2, backgroundType), |
| 52 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), | 52 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
| 53 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 53 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); |
| 54 | 54 |
| 55 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position
: absolute; width: 100px; height: 100px; background-color: green"); | 55 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position
: absolute; width: 100px; height: 100px; background-color: green"); |
| 56 updateLifecyclePhasesBeforePaint(); | 56 document().view()->updateAllLifecyclePhasesExceptPaint(); |
| 57 bool needsCommit = paintWithoutCommit(); | 57 bool needsCommit = paintWithoutCommit(); |
| 58 | 58 |
| 59 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 8, | 59 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 8, |
| 60 TestDisplayItem(layoutView(), cachedDocumentBackgroundType), | 60 TestDisplayItem(layoutView(), cachedDocumentBackgroundType), |
| 61 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 61 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), |
| 62 TestDisplayItem(container1Layer, DisplayItem::Subsequence), | 62 TestDisplayItem(container1Layer, DisplayItem::Subsequence), |
| 63 TestDisplayItem(container1, cachedBackgroundType), | 63 TestDisplayItem(container1, cachedBackgroundType), |
| 64 TestDisplayItem(content1, backgroundType), | 64 TestDisplayItem(content1, backgroundType), |
| 65 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 65 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 66 TestDisplayItem(container2Layer, DisplayItem::CachedSubsequence), | 66 TestDisplayItem(container2Layer, DisplayItem::CachedSubsequence), |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer(); | 103 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer(); |
| 104 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec
t(); | 104 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec
t(); |
| 105 LayoutObject& container2 = *document().getElementById("container2")->layoutO
bject(); | 105 LayoutObject& container2 = *document().getElementById("container2")->layoutO
bject(); |
| 106 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer(); | 106 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer(); |
| 107 LayoutObject& content2a = *document().getElementById("content2a")->layoutObj
ect(); | 107 LayoutObject& content2a = *document().getElementById("content2a")->layoutObj
ect(); |
| 108 LayoutObject& content2b = *document().getElementById("content2b")->layoutObj
ect(); | 108 LayoutObject& content2b = *document().getElementById("content2b")->layoutObj
ect(); |
| 109 LayoutObject& container3 = *document().getElementById("container3")->layoutO
bject(); | 109 LayoutObject& container3 = *document().getElementById("container3")->layoutO
bject(); |
| 110 PaintLayer& container3Layer = *toLayoutBoxModelObject(container3).layer(); | 110 PaintLayer& container3Layer = *toLayoutBoxModelObject(container3).layer(); |
| 111 LayoutObject& content3 = *document().getElementById("content3")->layoutObjec
t(); | 111 LayoutObject& content3 = *document().getElementById("content3")->layoutObjec
t(); |
| 112 | 112 |
| 113 updateLifecyclePhasesBeforePaint(); | 113 document().view()->updateAllLifecyclePhasesExceptPaint(); |
| 114 IntRect interestRect(0, 0, 400, 300); | 114 IntRect interestRect(0, 0, 400, 300); |
| 115 paint(&interestRect); | 115 paint(&interestRect); |
| 116 | 116 |
| 117 // Container1 is fully in the interest rect; | 117 // Container1 is fully in the interest rect; |
| 118 // Container2 is partly (including its stacking chidren) in the interest rec
t; | 118 // Container2 is partly (including its stacking chidren) in the interest rec
t; |
| 119 // Content2b is out of the interest rect and output nothing; | 119 // Content2b is out of the interest rect and output nothing; |
| 120 // Container3 is partly in the interest rect. | 120 // Container3 is partly in the interest rect. |
| 121 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 15, | 121 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 15, |
| 122 TestDisplayItem(layoutView(), documentBackgroundType), | 122 TestDisplayItem(layoutView(), documentBackgroundType), |
| 123 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 123 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), |
| 124 TestDisplayItem(container1Layer, DisplayItem::Subsequence), | 124 TestDisplayItem(container1Layer, DisplayItem::Subsequence), |
| 125 TestDisplayItem(container1, backgroundType), | 125 TestDisplayItem(container1, backgroundType), |
| 126 TestDisplayItem(content1, backgroundType), | 126 TestDisplayItem(content1, backgroundType), |
| 127 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 127 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 128 TestDisplayItem(container2Layer, DisplayItem::Subsequence), | 128 TestDisplayItem(container2Layer, DisplayItem::Subsequence), |
| 129 TestDisplayItem(container2, backgroundType), | 129 TestDisplayItem(container2, backgroundType), |
| 130 TestDisplayItem(content2a, backgroundType), | 130 TestDisplayItem(content2a, backgroundType), |
| 131 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), | 131 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
| 132 TestDisplayItem(container3Layer, DisplayItem::Subsequence), | 132 TestDisplayItem(container3Layer, DisplayItem::Subsequence), |
| 133 TestDisplayItem(container3, backgroundType), | 133 TestDisplayItem(container3, backgroundType), |
| 134 TestDisplayItem(content3, backgroundType), | 134 TestDisplayItem(content3, backgroundType), |
| 135 TestDisplayItem(container3Layer, DisplayItem::EndSubsequence), | 135 TestDisplayItem(container3Layer, DisplayItem::EndSubsequence), |
| 136 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 136 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); |
| 137 | 137 |
| 138 updateLifecyclePhasesBeforePaint(); | 138 document().view()->updateAllLifecyclePhasesExceptPaint(); |
| 139 IntRect newInterestRect(0, 100, 300, 1000); | 139 IntRect newInterestRect(0, 100, 300, 1000); |
| 140 bool needsCommit = paintWithoutCommit(&newInterestRect); | 140 bool needsCommit = paintWithoutCommit(&newInterestRect); |
| 141 | 141 |
| 142 // Container1 becomes partly in the interest rect, but uses cached subsequen
ce | 142 // Container1 becomes partly in the interest rect, but uses cached subsequen
ce |
| 143 // because it was fully painted before; | 143 // because it was fully painted before; |
| 144 // Container2's intersection with the interest rect changes; | 144 // Container2's intersection with the interest rect changes; |
| 145 // Content2b is out of the interest rect and outputs nothing; | 145 // Content2b is out of the interest rect and outputs nothing; |
| 146 // Container3 becomes out of the interest rect and outputs empty subsequence
pair.. | 146 // Container3 becomes out of the interest rect and outputs empty subsequence
pair.. |
| 147 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 11, | 147 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 11, |
| 148 TestDisplayItem(layoutView(), cachedDocumentBackgroundType), | 148 TestDisplayItem(layoutView(), cachedDocumentBackgroundType), |
| (...skipping 30 matching lines...) Expand all Loading... |
| 179 | 179 |
| 180 TEST_P(PaintLayerPainterTest, CachedSubsequenceOnStyleChangeWithInterestRectClip
ping) | 180 TEST_P(PaintLayerPainterTest, CachedSubsequenceOnStyleChangeWithInterestRectClip
ping) |
| 181 { | 181 { |
| 182 setBodyInnerHTML( | 182 setBodyInnerHTML( |
| 183 "<div id='container1' style='position: relative; z-index: 1; width: 200p
x; height: 200px; background-color: blue'>" | 183 "<div id='container1' style='position: relative; z-index: 1; width: 200p
x; height: 200px; background-color: blue'>" |
| 184 " <div id='content1' style='position: absolute; width: 100px; height: 1
00px; background-color: red'></div>" | 184 " <div id='content1' style='position: absolute; width: 100px; height: 1
00px; background-color: red'></div>" |
| 185 "</div>" | 185 "</div>" |
| 186 "<div id='container2' style='position: relative; z-index: 1; width: 200p
x; height: 200px; background-color: blue'>" | 186 "<div id='container2' style='position: relative; z-index: 1; width: 200p
x; height: 200px; background-color: blue'>" |
| 187 " <div id='content2' style='position: absolute; width: 100px; height: 1
00px; background-color: green'></div>" | 187 " <div id='content2' style='position: absolute; width: 100px; height: 1
00px; background-color: green'></div>" |
| 188 "</div>"); | 188 "</div>"); |
| 189 updateLifecyclePhasesBeforePaint(); | 189 document().view()->updateAllLifecyclePhasesExceptPaint(); |
| 190 IntRect interestRect(0, 0, 50, 300); // PaintResult of all subsequences will
be MayBeClippedByPaintDirtyRect. | 190 IntRect interestRect(0, 0, 50, 300); // PaintResult of all subsequences will
be MayBeClippedByPaintDirtyRect. |
| 191 paint(&interestRect); | 191 paint(&interestRect); |
| 192 | 192 |
| 193 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); | 193 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); |
| 194 LayoutObject& container1 = *document().getElementById("container1")->layoutO
bject(); | 194 LayoutObject& container1 = *document().getElementById("container1")->layoutO
bject(); |
| 195 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer(); | 195 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer(); |
| 196 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec
t(); | 196 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec
t(); |
| 197 LayoutObject& container2 = *document().getElementById("container2")->layoutO
bject(); | 197 LayoutObject& container2 = *document().getElementById("container2")->layoutO
bject(); |
| 198 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer(); | 198 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer(); |
| 199 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec
t(); | 199 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec
t(); |
| 200 | 200 |
| 201 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, | 201 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, |
| 202 TestDisplayItem(layoutView(), documentBackgroundType), | 202 TestDisplayItem(layoutView(), documentBackgroundType), |
| 203 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 203 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), |
| 204 TestDisplayItem(container1Layer, DisplayItem::Subsequence), | 204 TestDisplayItem(container1Layer, DisplayItem::Subsequence), |
| 205 TestDisplayItem(container1, backgroundType), | 205 TestDisplayItem(container1, backgroundType), |
| 206 TestDisplayItem(content1, backgroundType), | 206 TestDisplayItem(content1, backgroundType), |
| 207 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 207 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 208 TestDisplayItem(container2Layer, DisplayItem::Subsequence), | 208 TestDisplayItem(container2Layer, DisplayItem::Subsequence), |
| 209 TestDisplayItem(container2, backgroundType), | 209 TestDisplayItem(container2, backgroundType), |
| 210 TestDisplayItem(content2, backgroundType), | 210 TestDisplayItem(content2, backgroundType), |
| 211 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), | 211 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
| 212 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 212 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); |
| 213 | 213 |
| 214 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position
: absolute; width: 100px; height: 100px; background-color: green"); | 214 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position
: absolute; width: 100px; height: 100px; background-color: green"); |
| 215 updateLifecyclePhasesBeforePaint(); | 215 document().view()->updateAllLifecyclePhasesExceptPaint(); |
| 216 bool needsCommit = paintWithoutCommit(&interestRect); | 216 bool needsCommit = paintWithoutCommit(&interestRect); |
| 217 | 217 |
| 218 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 8, | 218 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 8, |
| 219 TestDisplayItem(layoutView(), cachedDocumentBackgroundType), | 219 TestDisplayItem(layoutView(), cachedDocumentBackgroundType), |
| 220 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 220 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), |
| 221 TestDisplayItem(container1Layer, DisplayItem::Subsequence), | 221 TestDisplayItem(container1Layer, DisplayItem::Subsequence), |
| 222 TestDisplayItem(container1, cachedBackgroundType), | 222 TestDisplayItem(container1, cachedBackgroundType), |
| 223 TestDisplayItem(content1, backgroundType), | 223 TestDisplayItem(content1, backgroundType), |
| 224 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 224 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 225 TestDisplayItem(container2Layer, DisplayItem::CachedSubsequence), | 225 TestDisplayItem(container2Layer, DisplayItem::CachedSubsequence), |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 // Outline on the self-painting-layer node itself doesn't affect PaintPhaseD
escendantOutlines. | 271 // Outline on the self-painting-layer node itself doesn't affect PaintPhaseD
escendantOutlines. |
| 272 toHTMLElement(selfPaintingLayerObject.node())->setAttribute(HTMLNames::style
Attr, "position: absolute; outline: 1px solid green"); | 272 toHTMLElement(selfPaintingLayerObject.node())->setAttribute(HTMLNames::style
Attr, "position: absolute; outline: 1px solid green"); |
| 273 document().view()->updateAllLifecyclePhases(); | 273 document().view()->updateAllLifecyclePhases(); |
| 274 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantOutlines()); | 274 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 275 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines()); | 275 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 276 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList
(), selfPaintingLayerObject, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelf
OutlineOnly))); | 276 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList
(), selfPaintingLayerObject, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelf
OutlineOnly))); |
| 277 | 277 |
| 278 // needsPaintPhaseDescendantOutlines should be set when any descendant on th
e same layer has outline. | 278 // needsPaintPhaseDescendantOutlines should be set when any descendant on th
e same layer has outline. |
| 279 toHTMLElement(outlineDiv.node())->setAttribute(HTMLNames::styleAttr, styleWi
thOutline); | 279 toHTMLElement(outlineDiv.node())->setAttribute(HTMLNames::styleAttr, styleWi
thOutline); |
| 280 updateLifecyclePhasesBeforePaint(); | 280 document().view()->updateAllLifecyclePhasesExceptPaint(); |
| 281 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseDescendantOutlines()); | 281 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 282 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines()); | 282 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 283 paint(); | 283 paint(); |
| 284 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList
(), outlineDiv, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOutlineOnly))
); | 284 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList
(), outlineDiv, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOutlineOnly))
); |
| 285 } | 285 } |
| 286 | 286 |
| 287 TEST_P(PaintLayerPainterTest, PaintPhaseFloat) | 287 TEST_P(PaintLayerPainterTest, PaintPhaseFloat) |
| 288 { | 288 { |
| 289 AtomicString styleWithoutFloat = "width: 50px; height: 50px; background-colo
r: green"; | 289 AtomicString styleWithoutFloat = "width: 50px; height: 50px; background-colo
r: green"; |
| 290 AtomicString styleWithFloat = "float: left; " + styleWithoutFloat; | 290 AtomicString styleWithFloat = "float: left; " + styleWithoutFloat; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 305 ASSERT_TRUE(selfPaintingLayer.isSelfPaintingLayer()); | 305 ASSERT_TRUE(selfPaintingLayer.isSelfPaintingLayer()); |
| 306 PaintLayer& nonSelfPaintingLayer = *toLayoutBoxModelObject(document().getEle
mentById("non-self-painting-layer")->layoutObject())->layer(); | 306 PaintLayer& nonSelfPaintingLayer = *toLayoutBoxModelObject(document().getEle
mentById("non-self-painting-layer")->layoutObject())->layer(); |
| 307 ASSERT_FALSE(nonSelfPaintingLayer.isSelfPaintingLayer()); | 307 ASSERT_FALSE(nonSelfPaintingLayer.isSelfPaintingLayer()); |
| 308 ASSERT_TRUE(&nonSelfPaintingLayer == floatDiv.enclosingLayer()); | 308 ASSERT_TRUE(&nonSelfPaintingLayer == floatDiv.enclosingLayer()); |
| 309 | 309 |
| 310 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseFloat()); | 310 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseFloat()); |
| 311 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat()); | 311 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat()); |
| 312 | 312 |
| 313 // needsPaintPhaseFloat should be set when any descendant on the same layer
has float. | 313 // needsPaintPhaseFloat should be set when any descendant on the same layer
has float. |
| 314 toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWith
Float); | 314 toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWith
Float); |
| 315 updateLifecyclePhasesBeforePaint(); | 315 document().view()->updateAllLifecyclePhasesExceptPaint(); |
| 316 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseFloat()); | 316 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseFloat()); |
| 317 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat()); | 317 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat()); |
| 318 paint(); | 318 paint(); |
| 319 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList
(), floatDiv, DisplayItem::BoxDecorationBackground)); | 319 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList
(), floatDiv, DisplayItem::BoxDecorationBackground)); |
| 320 } | 320 } |
| 321 | 321 |
| 322 TEST_P(PaintLayerPainterTest, PaintPhaseBlockBackground) | 322 TEST_P(PaintLayerPainterTest, PaintPhaseBlockBackground) |
| 323 { | 323 { |
| 324 AtomicString styleWithoutBackground = "width: 50px; height: 50px"; | 324 AtomicString styleWithoutBackground = "width: 50px; height: 50px"; |
| 325 AtomicString styleWithBackground = "background: blue; " + styleWithoutBackgr
ound; | 325 AtomicString styleWithBackground = "background: blue; " + styleWithoutBackgr
ound; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 347 | 347 |
| 348 // Background on the self-painting-layer node itself doesn't affect PaintPha
seDescendantBlockBackgrounds. | 348 // Background on the self-painting-layer node itself doesn't affect PaintPha
seDescendantBlockBackgrounds. |
| 349 toHTMLElement(selfPaintingLayerObject.node())->setAttribute(HTMLNames::style
Attr, "position: absolute; background: green"); | 349 toHTMLElement(selfPaintingLayerObject.node())->setAttribute(HTMLNames::style
Attr, "position: absolute; background: green"); |
| 350 document().view()->updateAllLifecyclePhases(); | 350 document().view()->updateAllLifecyclePhases(); |
| 351 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds()); | 351 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 352 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds(
)); | 352 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds(
)); |
| 353 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList
(), selfPaintingLayerObject, DisplayItem::BoxDecorationBackground)); | 353 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList
(), selfPaintingLayerObject, DisplayItem::BoxDecorationBackground)); |
| 354 | 354 |
| 355 // needsPaintPhaseDescendantBlockBackgrounds should be set when any descenda
nt on the same layer has Background. | 355 // needsPaintPhaseDescendantBlockBackgrounds should be set when any descenda
nt on the same layer has Background. |
| 356 toHTMLElement(backgroundDiv.node())->setAttribute(HTMLNames::styleAttr, styl
eWithBackground); | 356 toHTMLElement(backgroundDiv.node())->setAttribute(HTMLNames::styleAttr, styl
eWithBackground); |
| 357 updateLifecyclePhasesBeforePaint(); | 357 document().view()->updateAllLifecyclePhasesExceptPaint(); |
| 358 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds()); | 358 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 359 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds(
)); | 359 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds(
)); |
| 360 paint(); | 360 paint(); |
| 361 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList
(), backgroundDiv, DisplayItem::BoxDecorationBackground)); | 361 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList
(), backgroundDiv, DisplayItem::BoxDecorationBackground)); |
| 362 } | 362 } |
| 363 | 363 |
| 364 TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnLayerRemoval) | 364 TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnLayerRemoval) |
| 365 { | 365 { |
| 366 setBodyInnerHTML( | 366 setBodyInnerHTML( |
| 367 "<div id='layer' style='position: relative'>" | 367 "<div id='layer' style='position: relative'>" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 document().view()->updateAllLifecyclePhases(); | 414 document().view()->updateAllLifecyclePhases(); |
| 415 ASSERT_TRUE(layerDiv.hasLayer()); | 415 ASSERT_TRUE(layerDiv.hasLayer()); |
| 416 PaintLayer& layer = *layerDiv.layer(); | 416 PaintLayer& layer = *layerDiv.layer(); |
| 417 ASSERT_TRUE(layer.isSelfPaintingLayer()); | 417 ASSERT_TRUE(layer.isSelfPaintingLayer()); |
| 418 EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines()); | 418 EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines()); |
| 419 EXPECT_TRUE(layer.needsPaintPhaseFloat()); | 419 EXPECT_TRUE(layer.needsPaintPhaseFloat()); |
| 420 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); | 420 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 421 } | 421 } |
| 422 | 422 |
| 423 } // namespace blink | 423 } // namespace blink |
| OLD | NEW |