| 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/paint/PaintLayerPainter.h" | 5 #include "core/paint/PaintLayerPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutBoxModelObject.h" | 7 #include "core/layout/LayoutBoxModelObject.h" |
| 8 #include "core/layout/compositing/CompositedLayerMapping.h" | 8 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 9 #include "core/paint/PaintControllerPaintTest.h" | 9 #include "core/paint/PaintControllerPaintTest.h" |
| 10 #include "platform/graphics/GraphicsContext.h" | 10 #include "platform/graphics/GraphicsContext.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 document().view()->updateAllLifecyclePhases(); | 216 document().view()->updateAllLifecyclePhases(); |
| 217 | 217 |
| 218 PaintLayer& htmlLayer = | 218 PaintLayer& htmlLayer = |
| 219 *toLayoutBoxModelObject(document().documentElement()->layoutObject()) | 219 *toLayoutBoxModelObject(document().documentElement()->layoutObject()) |
| 220 ->layer(); | 220 ->layer(); |
| 221 LayoutObject& svg = *document().getElementById("svg")->layoutObject(); | 221 LayoutObject& svg = *document().getElementById("svg")->layoutObject(); |
| 222 PaintLayer& svgLayer = *toLayoutBoxModelObject(svg).layer(); | 222 PaintLayer& svgLayer = *toLayoutBoxModelObject(svg).layer(); |
| 223 LayoutObject& rect = *document().getElementById("rect")->layoutObject(); | 223 LayoutObject& rect = *document().getElementById("rect")->layoutObject(); |
| 224 LayoutObject& div = *document().getElementById("div")->layoutObject(); | 224 LayoutObject& div = *document().getElementById("div")->layoutObject(); |
| 225 | 225 |
| 226 DisplayItem::Type clipBoxBegin = | |
| 227 DisplayItem::paintPhaseToClipBoxType(PaintPhaseForeground); | |
| 228 DisplayItem::Type clipBoxEnd = | |
| 229 DisplayItem::clipTypeToEndClipType(clipBoxBegin); | |
| 230 | |
| 231 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 226 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 232 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 227 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 233 // SPv2 slips the clip box (see BoxClipper). | 228 // SPv2 slips the clip box (see BoxClipper). |
| 234 EXPECT_DISPLAY_LIST( | 229 EXPECT_DISPLAY_LIST( |
| 235 rootPaintController().getDisplayItemList(), 10, | 230 rootPaintController().getDisplayItemList(), 10, |
| 236 TestDisplayItem(*layoutView().layer(), DisplayItem::kSubsequence), | 231 TestDisplayItem(*layoutView().layer(), DisplayItem::kSubsequence), |
| 237 TestDisplayItem(layoutView(), documentBackgroundType), | 232 TestDisplayItem(layoutView(), documentBackgroundType), |
| 238 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), | 233 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), |
| 239 TestDisplayItem(svgLayer, DisplayItem::kSubsequence), | 234 TestDisplayItem(svgLayer, DisplayItem::kSubsequence), |
| 240 TestDisplayItem(svg, DisplayItem::kBeginTransform), | 235 TestDisplayItem(svg, DisplayItem::kBeginTransform), |
| (...skipping 21 matching lines...) Expand all Loading... |
| 262 TestDisplayItem(layoutView(), | 257 TestDisplayItem(layoutView(), |
| 263 DisplayItem::clipTypeToEndClipType( | 258 DisplayItem::clipTypeToEndClipType( |
| 264 DisplayItem::kClipFrameToVisibleContentRect))); | 259 DisplayItem::kClipFrameToVisibleContentRect))); |
| 265 } | 260 } |
| 266 } else { | 261 } else { |
| 267 EXPECT_DISPLAY_LIST( | 262 EXPECT_DISPLAY_LIST( |
| 268 rootPaintController().getDisplayItemList(), 10, | 263 rootPaintController().getDisplayItemList(), 10, |
| 269 TestDisplayItem(layoutView(), documentBackgroundType), | 264 TestDisplayItem(layoutView(), documentBackgroundType), |
| 270 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), | 265 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), |
| 271 TestDisplayItem(svgLayer, DisplayItem::kSubsequence), | 266 TestDisplayItem(svgLayer, DisplayItem::kSubsequence), |
| 272 TestDisplayItem(svg, clipBoxBegin), | 267 TestDisplayItem(svg, DisplayItem::kClipLayerForeground), |
| 273 TestDisplayItem(svg, DisplayItem::kBeginTransform), | 268 TestDisplayItem(svg, DisplayItem::kBeginTransform), |
| 274 TestDisplayItem(rect, foregroundType), | 269 TestDisplayItem(rect, foregroundType), |
| 275 TestDisplayItem(svg, DisplayItem::kEndTransform), | 270 TestDisplayItem(svg, DisplayItem::kEndTransform), |
| 276 TestDisplayItem(svg, clipBoxEnd), | 271 TestDisplayItem(svg, DisplayItem::clipTypeToEndClipType( |
| 272 DisplayItem::kClipLayerForeground)), |
| 277 TestDisplayItem(svgLayer, DisplayItem::kEndSubsequence), | 273 TestDisplayItem(svgLayer, DisplayItem::kEndSubsequence), |
| 278 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence)); | 274 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence)); |
| 279 } | 275 } |
| 280 | 276 |
| 281 // Change the color of the div. This should not invalidate the subsequence | 277 // Change the color of the div. This should not invalidate the subsequence |
| 282 // for the SVG root. | 278 // for the SVG root. |
| 283 toHTMLElement(div.node()) | 279 toHTMLElement(div.node()) |
| 284 ->setAttribute(HTMLNames::styleAttr, | 280 ->setAttribute(HTMLNames::styleAttr, |
| 285 "position: relative; width: 50x; height: 50px; " | 281 "position: relative; width: 50x; height: 50px; " |
| 286 "background-color: green"); | 282 "background-color: green"); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 TestDisplayItem(layoutView(), | 326 TestDisplayItem(layoutView(), |
| 331 DisplayItem::clipTypeToEndClipType( | 327 DisplayItem::clipTypeToEndClipType( |
| 332 DisplayItem::kClipFrameToVisibleContentRect))); | 328 DisplayItem::kClipFrameToVisibleContentRect))); |
| 333 } | 329 } |
| 334 } else { | 330 } else { |
| 335 EXPECT_DISPLAY_LIST( | 331 EXPECT_DISPLAY_LIST( |
| 336 rootPaintController().getDisplayItemList(), 11, | 332 rootPaintController().getDisplayItemList(), 11, |
| 337 TestDisplayItem(layoutView(), documentBackgroundType), | 333 TestDisplayItem(layoutView(), documentBackgroundType), |
| 338 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), | 334 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), |
| 339 TestDisplayItem(svgLayer, DisplayItem::kSubsequence), | 335 TestDisplayItem(svgLayer, DisplayItem::kSubsequence), |
| 340 TestDisplayItem(svg, clipBoxBegin), | 336 TestDisplayItem(svg, DisplayItem::kClipLayerForeground), |
| 341 TestDisplayItem(svg, DisplayItem::kBeginTransform), | 337 TestDisplayItem(svg, DisplayItem::kBeginTransform), |
| 342 TestDisplayItem(rect, foregroundType), | 338 TestDisplayItem(rect, foregroundType), |
| 343 TestDisplayItem(svg, DisplayItem::kEndTransform), | 339 TestDisplayItem(svg, DisplayItem::kEndTransform), |
| 344 TestDisplayItem(svg, clipBoxEnd), | 340 TestDisplayItem(svg, DisplayItem::clipTypeToEndClipType( |
| 341 DisplayItem::kClipLayerForeground)), |
| 345 TestDisplayItem(svgLayer, DisplayItem::kEndSubsequence), | 342 TestDisplayItem(svgLayer, DisplayItem::kEndSubsequence), |
| 346 TestDisplayItem(div, backgroundType), | 343 TestDisplayItem(div, backgroundType), |
| 347 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence), | 344 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence), |
| 348 TestDisplayItem(layoutView(), | 345 TestDisplayItem(layoutView(), |
| 349 DisplayItem::clipTypeToEndClipType( | 346 DisplayItem::clipTypeToEndClipType( |
| 350 DisplayItem::kClipFrameToVisibleContentRect))); | 347 DisplayItem::kClipFrameToVisibleContentRect))); |
| 351 } | 348 } |
| 352 } | 349 } |
| 353 | 350 |
| 354 TEST_P(PaintLayerPainterTest, CachedSubsequenceOnInterestRectChange) { | 351 TEST_P(PaintLayerPainterTest, CachedSubsequenceOnInterestRectChange) { |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 "<div id='target' style='background: blue; opacity: 0.1'></div>"); | 1054 "<div id='target' style='background: blue; opacity: 0.1'></div>"); |
| 1058 PaintLayer* targetLayer = | 1055 PaintLayer* targetLayer = |
| 1059 toLayoutBox(getLayoutObjectByElementId("target"))->layer(); | 1056 toLayoutBox(getLayoutObjectByElementId("target"))->layer(); |
| 1060 PaintLayerPaintingInfo paintingInfo(nullptr, LayoutRect(), | 1057 PaintLayerPaintingInfo paintingInfo(nullptr, LayoutRect(), |
| 1061 GlobalPaintNormalPhase, LayoutSize()); | 1058 GlobalPaintNormalPhase, LayoutSize()); |
| 1062 EXPECT_FALSE( | 1059 EXPECT_FALSE( |
| 1063 PaintLayerPainter(*targetLayer).paintedOutputInvisible(paintingInfo)); | 1060 PaintLayerPainter(*targetLayer).paintedOutputInvisible(paintingInfo)); |
| 1064 } | 1061 } |
| 1065 | 1062 |
| 1066 } // namespace blink | 1063 } // namespace blink |
| OLD | NEW |