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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp

Issue 2889783003: Only allow subsequence caching for SVG documents, not inline SVG. (Closed)
Patch Set: Merge branch 'master' into fixsvg Created 3 years, 7 months 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 unified diff | Download patch
OLDNEW
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 EXPECT_DISPLAY_LIST( 138 EXPECT_DISPLAY_LIST(
139 RootPaintController().GetDisplayItemList(), 5, 139 RootPaintController().GetDisplayItemList(), 5,
140 TestDisplayItem(GetLayoutView(), kDocumentBackgroundType), 140 TestDisplayItem(GetLayoutView(), kDocumentBackgroundType),
141 TestDisplayItem(container1, kBackgroundType), 141 TestDisplayItem(container1, kBackgroundType),
142 TestDisplayItem(content1, kBackgroundType), 142 TestDisplayItem(content1, kBackgroundType),
143 TestDisplayItem(container2, kBackgroundType), 143 TestDisplayItem(container2, kBackgroundType),
144 TestDisplayItem(content2, kBackgroundType)); 144 TestDisplayItem(content2, kBackgroundType));
145 } 145 }
146 } 146 }
147 147
148 TEST_P(PaintLayerPainterTest, CachedSubsequenceForSVGRoot) {
149 SetBodyInnerHTML(
150 "<svg id='svg' style='position: relative'>"
151 " <rect id='rect' x='10' y='10' width='100' height='100' rx='15' "
152 "ry='15'/>"
153 "</svg>"
154 "<div id='div' style='position: relative; width: 50x; height: "
155 "50px'></div>");
156 GetDocument().View()->UpdateAllLifecyclePhases();
157
158 LayoutObject& svg = *GetDocument().getElementById("svg")->GetLayoutObject();
159 LayoutObject& rect = *GetDocument().getElementById("rect")->GetLayoutObject();
160 LayoutObject& div = *GetDocument().getElementById("div")->GetLayoutObject();
161
162 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
163 // SPv2 slips the clip box (see BoxClipper).
164 EXPECT_DISPLAY_LIST(
165 RootPaintController().GetDisplayItemList(), 2,
166 TestDisplayItem(GetLayoutView(), kDocumentBackgroundType),
167 TestDisplayItem(rect, kForegroundType));
168 } else {
169 EXPECT_DISPLAY_LIST(
170 RootPaintController().GetDisplayItemList(), 6,
171 TestDisplayItem(GetLayoutView(), kDocumentBackgroundType),
172 TestDisplayItem(svg, DisplayItem::kClipLayerForeground),
173 TestDisplayItem(svg, DisplayItem::kBeginTransform),
174 TestDisplayItem(rect, kForegroundType),
175 TestDisplayItem(svg, DisplayItem::kEndTransform),
176 TestDisplayItem(svg, DisplayItem::ClipTypeToEndClipType(
177 DisplayItem::kClipLayerForeground)));
178 }
179
180 // Change the color of the div. This should not invalidate the subsequence
181 // for the SVG root.
182 ToHTMLElement(div.GetNode())
183 ->setAttribute(HTMLNames::styleAttr,
184 "position: relative; width: 50x; height: 50px; "
185 "background-color: green");
186 GetDocument().View()->UpdateAllLifecyclePhasesExceptPaint();
187 EXPECT_TRUE(PaintWithoutCommit());
188
189 // Reuse of SVG and document background. 2 fewer with SPv2 enabled because
190 // clip display items don't appear in SPv2 display lists.
191 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
192 EXPECT_EQ(2, NumCachedNewItems());
193 else
194 EXPECT_EQ(6, NumCachedNewItems());
195
196 Commit();
197
198 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
199 EXPECT_DISPLAY_LIST(
200 RootPaintController().GetDisplayItemList(), 3,
201 TestDisplayItem(GetLayoutView(), kDocumentBackgroundType),
202 TestDisplayItem(rect, kForegroundType),
203 TestDisplayItem(div, kBackgroundType));
204 } else {
205 EXPECT_DISPLAY_LIST(
206 RootPaintController().GetDisplayItemList(), 7,
207 TestDisplayItem(GetLayoutView(), kDocumentBackgroundType),
208 TestDisplayItem(svg, DisplayItem::kClipLayerForeground),
209 TestDisplayItem(svg, DisplayItem::kBeginTransform),
210 TestDisplayItem(rect, kForegroundType),
211 TestDisplayItem(svg, DisplayItem::kEndTransform),
212 TestDisplayItem(svg, DisplayItem::ClipTypeToEndClipType(
213 DisplayItem::kClipLayerForeground)),
214 TestDisplayItem(div, kBackgroundType),
215 TestDisplayItem(GetLayoutView(),
216 DisplayItem::ClipTypeToEndClipType(
217 DisplayItem::kClipFrameToVisibleContentRect)));
218 }
219 }
220
221 TEST_P(PaintLayerPainterTest, CachedSubsequenceOnInterestRectChange) { 148 TEST_P(PaintLayerPainterTest, CachedSubsequenceOnInterestRectChange) {
222 // TODO(wangxianzhu): SPv2 deals with interest rect differently, so disable 149 // TODO(wangxianzhu): SPv2 deals with interest rect differently, so disable
223 // this test for SPv2 temporarily. 150 // this test for SPv2 temporarily.
224 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 151 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
225 return; 152 return;
226 153
227 SetBodyInnerHTML( 154 SetBodyInnerHTML(
228 "<div id='container1' style='position: relative; z-index: 1; width: " 155 "<div id='container1' style='position: relative; z-index: 1; width: "
229 "200px; height: 200px; background-color: blue'>" 156 "200px; height: 200px; background-color: blue'>"
230 " <div id='content1' style='position: absolute; width: 100px; height: " 157 " <div id='content1' style='position: absolute; width: 100px; height: "
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 " height: 100px; " 846 " height: 100px; "
920 " opacity: 0; " 847 " opacity: 0; "
921 " will-change: opacity;" 848 " will-change: opacity;"
922 "}" 849 "}"
923 "</style> " 850 "</style> "
924 "<div id='target'></div>"); 851 "<div id='target'></div>");
925 ExpectPaintedOutputInvisible("target", false); 852 ExpectPaintedOutputInvisible("target", false);
926 } 853 }
927 854
928 } // namespace blink 855 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | third_party/WebKit/Source/core/paint/PaintLayerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698