| 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/LayoutBlock.h" | 5 #include "core/layout/LayoutBlock.h" |
| 6 #include "core/layout/LayoutInline.h" | 6 #include "core/layout/LayoutInline.h" |
| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 TestDisplayItem(content1, backgroundType), | 49 TestDisplayItem(content1, backgroundType), |
| 50 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 50 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 51 TestDisplayItem(container2Layer, DisplayItem::Subsequence), | 51 TestDisplayItem(container2Layer, DisplayItem::Subsequence), |
| 52 TestDisplayItem(container2, backgroundType), | 52 TestDisplayItem(container2, backgroundType), |
| 53 TestDisplayItem(content2, backgroundType), | 53 TestDisplayItem(content2, backgroundType), |
| 54 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), | 54 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
| 55 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 55 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); |
| 56 | 56 |
| 57 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position
: absolute; width: 100px; height: 100px; background-color: green"); | 57 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position
: absolute; width: 100px; height: 100px; background-color: green"); |
| 58 document().view()->updateAllLifecyclePhasesExceptPaint(); | 58 document().view()->updateAllLifecyclePhasesExceptPaint(); |
| 59 bool needsCommit = paintWithoutCommit(); | 59 EXPECT_TRUE(paintWithoutCommit()); |
| 60 | 60 |
| 61 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 8, | 61 EXPECT_EQ(6, numCachedNewItems()); |
| 62 TestDisplayItem(layoutView(), cachedDocumentBackgroundType), | |
| 63 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | |
| 64 TestDisplayItem(container1Layer, DisplayItem::Subsequence), | |
| 65 TestDisplayItem(container1, cachedBackgroundType), | |
| 66 TestDisplayItem(content1, backgroundType), | |
| 67 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | |
| 68 TestDisplayItem(container2Layer, DisplayItem::CachedSubsequence), | |
| 69 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | |
| 70 | 62 |
| 71 if (needsCommit) | 63 commit(); |
| 72 commit(); | |
| 73 | 64 |
| 74 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, | 65 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, |
| 75 TestDisplayItem(layoutView(), documentBackgroundType), | 66 TestDisplayItem(layoutView(), documentBackgroundType), |
| 76 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 67 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), |
| 77 TestDisplayItem(container1Layer, DisplayItem::Subsequence), | 68 TestDisplayItem(container1Layer, DisplayItem::Subsequence), |
| 78 TestDisplayItem(container1, backgroundType), | 69 TestDisplayItem(container1, backgroundType), |
| 79 TestDisplayItem(content1, backgroundType), | 70 TestDisplayItem(content1, backgroundType), |
| 80 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 71 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 81 TestDisplayItem(container2Layer, DisplayItem::Subsequence), | 72 TestDisplayItem(container2Layer, DisplayItem::Subsequence), |
| 82 TestDisplayItem(container2, backgroundType), | 73 TestDisplayItem(container2, backgroundType), |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 TestDisplayItem(content2a, backgroundType), | 123 TestDisplayItem(content2a, backgroundType), |
| 133 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), | 124 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
| 134 TestDisplayItem(container3Layer, DisplayItem::Subsequence), | 125 TestDisplayItem(container3Layer, DisplayItem::Subsequence), |
| 135 TestDisplayItem(container3, backgroundType), | 126 TestDisplayItem(container3, backgroundType), |
| 136 TestDisplayItem(content3, backgroundType), | 127 TestDisplayItem(content3, backgroundType), |
| 137 TestDisplayItem(container3Layer, DisplayItem::EndSubsequence), | 128 TestDisplayItem(container3Layer, DisplayItem::EndSubsequence), |
| 138 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 129 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); |
| 139 | 130 |
| 140 document().view()->updateAllLifecyclePhasesExceptPaint(); | 131 document().view()->updateAllLifecyclePhasesExceptPaint(); |
| 141 IntRect newInterestRect(0, 100, 300, 1000); | 132 IntRect newInterestRect(0, 100, 300, 1000); |
| 142 bool needsCommit = paintWithoutCommit(&newInterestRect); | 133 EXPECT_TRUE(paintWithoutCommit(&newInterestRect)); |
| 143 | 134 |
| 144 // Container1 becomes partly in the interest rect, but uses cached subsequen
ce | 135 // Container1 becomes partly in the interest rect, but uses cached subsequen
ce |
| 145 // because it was fully painted before; | 136 // because it was fully painted before; |
| 146 // Container2's intersection with the interest rect changes; | 137 // Container2's intersection with the interest rect changes; |
| 147 // Content2b is out of the interest rect and outputs nothing; | 138 // Content2b is out of the interest rect and outputs nothing; |
| 148 // Container3 becomes out of the interest rect and outputs empty subsequence
pair.. | 139 // Container3 becomes out of the interest rect and outputs empty subsequence
pair.. |
| 149 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 11, | 140 EXPECT_EQ(7, numCachedNewItems()); |
| 150 TestDisplayItem(layoutView(), cachedDocumentBackgroundType), | |
| 151 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | |
| 152 TestDisplayItem(container1Layer, DisplayItem::CachedSubsequence), | |
| 153 TestDisplayItem(container2Layer, DisplayItem::Subsequence), | |
| 154 TestDisplayItem(container2, cachedBackgroundType), | |
| 155 TestDisplayItem(content2a, cachedBackgroundType), | |
| 156 TestDisplayItem(content2b, backgroundType), | |
| 157 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), | |
| 158 TestDisplayItem(container3Layer, DisplayItem::Subsequence), | |
| 159 TestDisplayItem(container3Layer, DisplayItem::EndSubsequence), | |
| 160 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | |
| 161 | 141 |
| 162 if (needsCommit) | 142 commit(); |
| 163 commit(); | |
| 164 | 143 |
| 165 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 14, | 144 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 14, |
| 166 TestDisplayItem(layoutView(), documentBackgroundType), | 145 TestDisplayItem(layoutView(), documentBackgroundType), |
| 167 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 146 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), |
| 168 TestDisplayItem(container1Layer, DisplayItem::Subsequence), | 147 TestDisplayItem(container1Layer, DisplayItem::Subsequence), |
| 169 TestDisplayItem(container1, backgroundType), | 148 TestDisplayItem(container1, backgroundType), |
| 170 TestDisplayItem(content1, backgroundType), | 149 TestDisplayItem(content1, backgroundType), |
| 171 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 150 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 172 TestDisplayItem(container2Layer, DisplayItem::Subsequence), | 151 TestDisplayItem(container2Layer, DisplayItem::Subsequence), |
| 173 TestDisplayItem(container2, backgroundType), | 152 TestDisplayItem(container2, backgroundType), |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 TestDisplayItem(content1, backgroundType), | 187 TestDisplayItem(content1, backgroundType), |
| 209 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 188 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 210 TestDisplayItem(container2Layer, DisplayItem::Subsequence), | 189 TestDisplayItem(container2Layer, DisplayItem::Subsequence), |
| 211 TestDisplayItem(container2, backgroundType), | 190 TestDisplayItem(container2, backgroundType), |
| 212 TestDisplayItem(content2, backgroundType), | 191 TestDisplayItem(content2, backgroundType), |
| 213 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), | 192 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
| 214 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 193 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); |
| 215 | 194 |
| 216 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position
: absolute; width: 100px; height: 100px; background-color: green"); | 195 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position
: absolute; width: 100px; height: 100px; background-color: green"); |
| 217 document().view()->updateAllLifecyclePhasesExceptPaint(); | 196 document().view()->updateAllLifecyclePhasesExceptPaint(); |
| 218 bool needsCommit = paintWithoutCommit(&interestRect); | 197 EXPECT_TRUE(paintWithoutCommit(&interestRect)); |
| 219 | 198 |
| 220 EXPECT_DISPLAY_LIST(rootPaintController().newDisplayItemList(), 8, | 199 EXPECT_EQ(6, numCachedNewItems()); |
| 221 TestDisplayItem(layoutView(), cachedDocumentBackgroundType), | |
| 222 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | |
| 223 TestDisplayItem(container1Layer, DisplayItem::Subsequence), | |
| 224 TestDisplayItem(container1, cachedBackgroundType), | |
| 225 TestDisplayItem(content1, backgroundType), | |
| 226 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | |
| 227 TestDisplayItem(container2Layer, DisplayItem::CachedSubsequence), | |
| 228 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | |
| 229 | 200 |
| 230 if (needsCommit) | 201 commit(); |
| 231 commit(); | |
| 232 | 202 |
| 233 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, | 203 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, |
| 234 TestDisplayItem(layoutView(), documentBackgroundType), | 204 TestDisplayItem(layoutView(), documentBackgroundType), |
| 235 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 205 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), |
| 236 TestDisplayItem(container1Layer, DisplayItem::Subsequence), | 206 TestDisplayItem(container1Layer, DisplayItem::Subsequence), |
| 237 TestDisplayItem(container1, backgroundType), | 207 TestDisplayItem(container1, backgroundType), |
| 238 TestDisplayItem(content1, backgroundType), | 208 TestDisplayItem(content1, backgroundType), |
| 239 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 209 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 240 TestDisplayItem(container2Layer, DisplayItem::Subsequence), | 210 TestDisplayItem(container2Layer, DisplayItem::Subsequence), |
| 241 TestDisplayItem(container2, backgroundType), | 211 TestDisplayItem(container2, backgroundType), |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 PaintLayer& layer = *table.layer(); | 502 PaintLayer& layer = *table.layer(); |
| 533 EXPECT_TRUE(layer.isSelfPaintingLayer()); | 503 EXPECT_TRUE(layer.isSelfPaintingLayer()); |
| 534 EXPECT_FALSE(layer.needsPaintPhaseDescendantBlockBackgrounds()); | 504 EXPECT_FALSE(layer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 535 | 505 |
| 536 toHTMLElement(table.node())->setAttribute(HTMLNames::styleAttr, "position: r
elative; border-collapse: collapse"); | 506 toHTMLElement(table.node())->setAttribute(HTMLNames::styleAttr, "position: r
elative; border-collapse: collapse"); |
| 537 document().view()->updateAllLifecyclePhases(); | 507 document().view()->updateAllLifecyclePhases(); |
| 538 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); | 508 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 539 } | 509 } |
| 540 | 510 |
| 541 } // namespace blink | 511 } // namespace blink |
| OLD | NEW |