Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(756)

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp

Issue 2498763002: Allow subsequence caching for SVG roots that have PaintLayers. (Closed)
Patch Set: none Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
index e5c6c16ddb6df27a8e63782d7ae4ca36d45c59b7..258637a394741ab3fd92de03f51dffd9c7259111 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
@@ -197,6 +197,152 @@ TEST_P(PaintLayerPainterTest, CachedSubsequence) {
}
}
+TEST_P(PaintLayerPainterTest, CachedSubsequenceForSVGRoot) {
+ setBodyInnerHTML(
+ "<svg id='svg' style='position: relative'>"
+ " <rect id='rect' x='10' y='10' width='100' height='100' rx='15' "
+ "ry='15'/>"
+ "</svg>"
+ "<div id='div' style='position: relative; width: 50x; height: "
+ "50px'></div>");
+ document().view()->updateAllLifecyclePhases();
+
+ PaintLayer& htmlLayer =
+ *toLayoutBoxModelObject(document().documentElement()->layoutObject())
+ ->layer();
+ LayoutObject& svg = *document().getElementById("svg")->layoutObject();
+ PaintLayer& svgLayer = *toLayoutBoxModelObject(svg).layer();
+ LayoutObject& rect = *document().getElementById("rect")->layoutObject();
+ LayoutObject& div = *document().getElementById("div")->layoutObject();
+
+ DisplayItem::Type clipBoxBegin =
+ DisplayItem::paintPhaseToClipBoxType(PaintPhaseForeground);
+ DisplayItem::Type clipBoxEnd =
+ DisplayItem::clipTypeToEndClipType(clipBoxBegin);
+
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
+ if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
+ // SPv2 slips the clip box (see BoxClipper).
+ EXPECT_DISPLAY_LIST(
+ rootPaintController().getDisplayItemList(), 10,
+ TestDisplayItem(*layoutView().layer(), DisplayItem::kSubsequence),
+ TestDisplayItem(layoutView(), documentBackgroundType),
+ TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
+ TestDisplayItem(svgLayer, DisplayItem::kSubsequence),
+ TestDisplayItem(svg, DisplayItem::kBeginTransform),
+ TestDisplayItem(rect, foregroundType),
+ TestDisplayItem(svg, DisplayItem::kEndTransform),
+ TestDisplayItem(svgLayer, DisplayItem::kEndSubsequence),
+ TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence),
+ TestDisplayItem(*layoutView().layer(), DisplayItem::kEndSubsequence));
+ } else {
+ // SPv2 slips the clip box (see BoxClipper).
+ EXPECT_DISPLAY_LIST(
+ rootPaintController().getDisplayItemList(), 12,
+ TestDisplayItem(layoutView(),
+ DisplayItem::kClipFrameToVisibleContentRect),
+ TestDisplayItem(*layoutView().layer(), DisplayItem::kSubsequence),
+ TestDisplayItem(layoutView(), documentBackgroundType),
+ TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
+ TestDisplayItem(svgLayer, DisplayItem::kSubsequence),
+ TestDisplayItem(svg, DisplayItem::kBeginTransform),
+ TestDisplayItem(rect, foregroundType),
+ TestDisplayItem(svg, DisplayItem::kEndTransform),
+ TestDisplayItem(svgLayer, DisplayItem::kEndSubsequence),
+ TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence),
+ TestDisplayItem(*layoutView().layer(), DisplayItem::kEndSubsequence),
+ TestDisplayItem(layoutView(),
+ DisplayItem::clipTypeToEndClipType(
+ DisplayItem::kClipFrameToVisibleContentRect)));
+ }
+ } else {
+ EXPECT_DISPLAY_LIST(
+ rootPaintController().getDisplayItemList(), 10,
+ TestDisplayItem(layoutView(), documentBackgroundType),
+ TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
+ TestDisplayItem(svgLayer, DisplayItem::kSubsequence),
+ TestDisplayItem(svg, clipBoxBegin),
+ TestDisplayItem(svg, DisplayItem::kBeginTransform),
+ TestDisplayItem(rect, foregroundType),
+ TestDisplayItem(svg, DisplayItem::kEndTransform),
+ TestDisplayItem(svg, clipBoxEnd),
+ TestDisplayItem(svgLayer, DisplayItem::kEndSubsequence),
+ TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
+ }
+
+ // Change the color of the div. This should not invalidate the subsequence
+ // for the SVG root.
+ toHTMLElement(div.node())
+ ->setAttribute(HTMLNames::styleAttr,
+ "position: relative; width: 50x; height: 50px; "
+ "background-color: green");
+ document().view()->updateAllLifecyclePhasesExceptPaint();
+ EXPECT_TRUE(paintWithoutCommit());
+
+ // Reuse of SVG and document background. 2 fewer with SPv2 enabled because
+ // clip display items don't appear in SPv2 display lists.
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
+ EXPECT_EQ(6, numCachedNewItems());
+ else
+ EXPECT_EQ(8, numCachedNewItems());
+
+ commit();
+
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
+ if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
+ EXPECT_DISPLAY_LIST(
+ rootPaintController().getDisplayItemList(), 11,
+ TestDisplayItem(*layoutView().layer(), DisplayItem::kSubsequence),
+ TestDisplayItem(layoutView(), documentBackgroundType),
+ TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
+ TestDisplayItem(svgLayer, DisplayItem::kSubsequence),
+ TestDisplayItem(svg, DisplayItem::kBeginTransform),
+ TestDisplayItem(rect, foregroundType),
+ TestDisplayItem(svg, DisplayItem::kEndTransform),
+ TestDisplayItem(svgLayer, DisplayItem::kEndSubsequence),
+ TestDisplayItem(div, backgroundType),
+ TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence),
+ TestDisplayItem(*layoutView().layer(), DisplayItem::kEndSubsequence));
+ } else {
+ EXPECT_DISPLAY_LIST(
+ rootPaintController().getDisplayItemList(), 13,
+ TestDisplayItem(layoutView(),
+ DisplayItem::kClipFrameToVisibleContentRect),
+ TestDisplayItem(*layoutView().layer(), DisplayItem::kSubsequence),
+ TestDisplayItem(layoutView(), documentBackgroundType),
+ TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
+ TestDisplayItem(svgLayer, DisplayItem::kSubsequence),
+ TestDisplayItem(svg, DisplayItem::kBeginTransform),
+ TestDisplayItem(rect, foregroundType),
+ TestDisplayItem(svg, DisplayItem::kEndTransform),
+ TestDisplayItem(svgLayer, DisplayItem::kEndSubsequence),
+ TestDisplayItem(div, backgroundType),
+ TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence),
+ TestDisplayItem(*layoutView().layer(), DisplayItem::kEndSubsequence),
+ TestDisplayItem(layoutView(),
+ DisplayItem::clipTypeToEndClipType(
+ DisplayItem::kClipFrameToVisibleContentRect)));
+ }
+ } else {
+ EXPECT_DISPLAY_LIST(
+ rootPaintController().getDisplayItemList(), 11,
+ TestDisplayItem(layoutView(), documentBackgroundType),
+ TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
+ TestDisplayItem(svgLayer, DisplayItem::kSubsequence),
+ TestDisplayItem(svg, clipBoxBegin),
+ TestDisplayItem(svg, DisplayItem::kBeginTransform),
+ TestDisplayItem(rect, foregroundType),
+ TestDisplayItem(svg, DisplayItem::kEndTransform),
+ TestDisplayItem(svg, clipBoxEnd),
+ TestDisplayItem(svgLayer, DisplayItem::kEndSubsequence),
+ TestDisplayItem(div, backgroundType),
+ TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence),
+ TestDisplayItem(layoutView(),
+ DisplayItem::clipTypeToEndClipType(
+ DisplayItem::kClipFrameToVisibleContentRect)));
+ }
+}
+
TEST_P(PaintLayerPainterTest, CachedSubsequenceOnInterestRectChange) {
// TODO(wangxianzhu): SPv2 deals with interest rect differently, so disable
// this test for SPv2 temporarily.
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698