| 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 21 matching lines...) Expand all Loading... |
| 32 document().view()->updateAllLifecyclePhases(); | 32 document().view()->updateAllLifecyclePhases(); |
| 33 | 33 |
| 34 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); | 34 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); |
| 35 LayoutObject& container1 = *document().getElementById("container1")->layoutO
bject(); | 35 LayoutObject& container1 = *document().getElementById("container1")->layoutO
bject(); |
| 36 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer(); | 36 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer(); |
| 37 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec
t(); | 37 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec
t(); |
| 38 LayoutObject& container2 = *document().getElementById("container2")->layoutO
bject(); | 38 LayoutObject& container2 = *document().getElementById("container2")->layoutO
bject(); |
| 39 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer(); | 39 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer(); |
| 40 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec
t(); | 40 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec
t(); |
| 41 | 41 |
| 42 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 11, | 42 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, |
| 43 TestDisplayItem(layoutView(), documentBackgroundType), | 43 TestDisplayItem(layoutView(), documentBackgroundType), |
| 44 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 44 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), |
| 45 TestDisplayItem(container1Layer, DisplayItem::Subsequence), | 45 TestDisplayItem(container1Layer, DisplayItem::Subsequence), |
| 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 updateLifecyclePhasesBeforePaint(); |
| 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), |
| 67 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 67 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); |
| 68 | 68 |
| 69 if (needsCommit) | 69 if (needsCommit) |
| 70 commit(); | 70 commit(); |
| 71 | 71 |
| 72 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 11, | 72 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, |
| 73 TestDisplayItem(layoutView(), documentBackgroundType), | 73 TestDisplayItem(layoutView(), documentBackgroundType), |
| 74 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 74 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), |
| 75 TestDisplayItem(container1Layer, DisplayItem::Subsequence), | 75 TestDisplayItem(container1Layer, DisplayItem::Subsequence), |
| 76 TestDisplayItem(container1, backgroundType), | 76 TestDisplayItem(container1, backgroundType), |
| 77 TestDisplayItem(content1, backgroundType), | 77 TestDisplayItem(content1, backgroundType), |
| 78 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 78 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 79 TestDisplayItem(container2Layer, DisplayItem::Subsequence), | 79 TestDisplayItem(container2Layer, DisplayItem::Subsequence), |
| 80 TestDisplayItem(container2, backgroundType), | 80 TestDisplayItem(container2, backgroundType), |
| 81 TestDisplayItem(content2, backgroundType), | 81 TestDisplayItem(content2, backgroundType), |
| 82 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), | 82 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
| (...skipping 28 matching lines...) Expand all Loading... |
| 111 LayoutObject& content3 = *document().getElementById("content3")->layoutObjec
t(); | 111 LayoutObject& content3 = *document().getElementById("content3")->layoutObjec
t(); |
| 112 | 112 |
| 113 updateLifecyclePhasesBeforePaint(); | 113 updateLifecyclePhasesBeforePaint(); |
| 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().displayItemList(), 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), |
| (...skipping 21 matching lines...) Expand all Loading... |
| 153 TestDisplayItem(content2a, cachedBackgroundType), | 153 TestDisplayItem(content2a, cachedBackgroundType), |
| 154 TestDisplayItem(content2b, backgroundType), | 154 TestDisplayItem(content2b, backgroundType), |
| 155 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), | 155 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
| 156 TestDisplayItem(container3Layer, DisplayItem::Subsequence), | 156 TestDisplayItem(container3Layer, DisplayItem::Subsequence), |
| 157 TestDisplayItem(container3Layer, DisplayItem::EndSubsequence), | 157 TestDisplayItem(container3Layer, DisplayItem::EndSubsequence), |
| 158 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 158 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); |
| 159 | 159 |
| 160 if (needsCommit) | 160 if (needsCommit) |
| 161 commit(); | 161 commit(); |
| 162 | 162 |
| 163 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 14, | 163 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 14, |
| 164 TestDisplayItem(layoutView(), documentBackgroundType), | 164 TestDisplayItem(layoutView(), documentBackgroundType), |
| 165 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 165 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), |
| 166 TestDisplayItem(container1Layer, DisplayItem::Subsequence), | 166 TestDisplayItem(container1Layer, DisplayItem::Subsequence), |
| 167 TestDisplayItem(container1, backgroundType), | 167 TestDisplayItem(container1, backgroundType), |
| 168 TestDisplayItem(content1, backgroundType), | 168 TestDisplayItem(content1, backgroundType), |
| 169 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 169 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 170 TestDisplayItem(container2Layer, DisplayItem::Subsequence), | 170 TestDisplayItem(container2Layer, DisplayItem::Subsequence), |
| 171 TestDisplayItem(container2, backgroundType), | 171 TestDisplayItem(container2, backgroundType), |
| 172 TestDisplayItem(content2a, backgroundType), | 172 TestDisplayItem(content2a, backgroundType), |
| 173 TestDisplayItem(content2b, backgroundType), | 173 TestDisplayItem(content2b, backgroundType), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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().displayItemList(), 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 updateLifecyclePhasesBeforePaint(); |
| 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), |
| 226 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 226 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); |
| 227 | 227 |
| 228 if (needsCommit) | 228 if (needsCommit) |
| 229 commit(); | 229 commit(); |
| 230 | 230 |
| 231 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 11, | 231 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, |
| 232 TestDisplayItem(layoutView(), documentBackgroundType), | 232 TestDisplayItem(layoutView(), documentBackgroundType), |
| 233 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 233 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), |
| 234 TestDisplayItem(container1Layer, DisplayItem::Subsequence), | 234 TestDisplayItem(container1Layer, DisplayItem::Subsequence), |
| 235 TestDisplayItem(container1, backgroundType), | 235 TestDisplayItem(container1, backgroundType), |
| 236 TestDisplayItem(content1, backgroundType), | 236 TestDisplayItem(content1, backgroundType), |
| 237 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 237 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 238 TestDisplayItem(container2Layer, DisplayItem::Subsequence), | 238 TestDisplayItem(container2Layer, DisplayItem::Subsequence), |
| 239 TestDisplayItem(container2, backgroundType), | 239 TestDisplayItem(container2, backgroundType), |
| 240 TestDisplayItem(content2, backgroundType), | 240 TestDisplayItem(content2, backgroundType), |
| 241 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), | 241 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 266 ASSERT_TRUE(&nonSelfPaintingLayer == outlineDiv.enclosingLayer()); | 266 ASSERT_TRUE(&nonSelfPaintingLayer == outlineDiv.enclosingLayer()); |
| 267 | 267 |
| 268 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantOutlines()); | 268 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 269 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines()); | 269 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 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().displayItemList(),
selfPaintingLayerObject, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOut
lineOnly))); | 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 updateLifecyclePhasesBeforePaint(); |
| 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().displayItemList(),
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; |
| 291 setBodyInnerHTML( | 291 setBodyInnerHTML( |
| 292 "<div id='self-painting-layer' style='position: absolute'>" | 292 "<div id='self-painting-layer' style='position: absolute'>" |
| 293 " <div id='non-self-painting-layer' style='overflow: hidden'>" | 293 " <div id='non-self-painting-layer' style='overflow: hidden'>" |
| 294 " <div>" | 294 " <div>" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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 updateLifecyclePhasesBeforePaint(); |
| 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().displayItemList(),
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; |
| 326 setBodyInnerHTML( | 326 setBodyInnerHTML( |
| 327 "<div id='self-painting-layer' style='position: absolute'>" | 327 "<div id='self-painting-layer' style='position: absolute'>" |
| 328 " <div id='non-self-painting-layer' style='overflow: hidden'>" | 328 " <div id='non-self-painting-layer' style='overflow: hidden'>" |
| 329 " <div>" | 329 " <div>" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 343 ASSERT_TRUE(&nonSelfPaintingLayer == backgroundDiv.enclosingLayer()); | 343 ASSERT_TRUE(&nonSelfPaintingLayer == backgroundDiv.enclosingLayer()); |
| 344 | 344 |
| 345 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds()); | 345 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 346 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds(
)); | 346 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds(
)); |
| 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().displayItemList(),
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 updateLifecyclePhasesBeforePaint(); |
| 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().displayItemList(),
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='opacity: 0.5'>" | 367 "<div id='layer' style='opacity: 0.5'>" |
| 368 " <div style='height: 100px'>" | 368 " <div style='height: 100px'>" |
| 369 " <div style='height: 20px; outline: 1px solid red; background-color:
green'>outline and background</div>" | 369 " <div style='height: 20px; outline: 1px solid red; background-color:
green'>outline and background</div>" |
| 370 " <div style='float: left'>float</div>" | 370 " <div style='float: left'>float</div>" |
| 371 " </div>" | 371 " </div>" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 386 toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "opacity:
1"); | 386 toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "opacity:
1"); |
| 387 document().view()->updateAllLifecyclePhases(); | 387 document().view()->updateAllLifecyclePhases(); |
| 388 | 388 |
| 389 EXPECT_FALSE(layerDiv.hasLayer()); | 389 EXPECT_FALSE(layerDiv.hasLayer()); |
| 390 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantOutlines()); | 390 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantOutlines()); |
| 391 EXPECT_TRUE(htmlLayer.needsPaintPhaseFloat()); | 391 EXPECT_TRUE(htmlLayer.needsPaintPhaseFloat()); |
| 392 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds()); | 392 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 393 } | 393 } |
| 394 | 394 |
| 395 } // namespace blink | 395 } // namespace blink |
| OLD | NEW |