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

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

Issue 2286843002: Rename DisplayItem::Type enum constants to Chromium style. (Closed)
Patch Set: Rebasing... Created 4 years, 3 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/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 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" 10 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement() ->layoutObject())->layer(); 50 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement() ->layoutObject())->layer();
51 LayoutObject& container1 = *document().getElementById("container1")->layoutO bject(); 51 LayoutObject& container1 = *document().getElementById("container1")->layoutO bject();
52 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer(); 52 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer();
53 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec t(); 53 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec t();
54 LayoutObject& container2 = *document().getElementById("container2")->layoutO bject(); 54 LayoutObject& container2 = *document().getElementById("container2")->layoutO bject();
55 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer(); 55 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer();
56 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec t(); 56 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec t();
57 57
58 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, 58 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11,
59 TestDisplayItem(layoutView(), documentBackgroundType), 59 TestDisplayItem(layoutView(), documentBackgroundType),
60 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), 60 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
61 TestDisplayItem(container1Layer, DisplayItem::Subsequence), 61 TestDisplayItem(container1Layer, DisplayItem::kSubsequence),
62 TestDisplayItem(container1, backgroundType), 62 TestDisplayItem(container1, backgroundType),
63 TestDisplayItem(content1, backgroundType), 63 TestDisplayItem(content1, backgroundType),
64 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), 64 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence),
65 TestDisplayItem(container2Layer, DisplayItem::Subsequence), 65 TestDisplayItem(container2Layer, DisplayItem::kSubsequence),
66 TestDisplayItem(container2, backgroundType), 66 TestDisplayItem(container2, backgroundType),
67 TestDisplayItem(content2, backgroundType), 67 TestDisplayItem(content2, backgroundType),
68 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), 68 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence),
69 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); 69 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
70 70
71 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position : absolute; width: 100px; height: 100px; background-color: green"); 71 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position : absolute; width: 100px; height: 100px; background-color: green");
72 document().view()->updateAllLifecyclePhasesExceptPaint(); 72 document().view()->updateAllLifecyclePhasesExceptPaint();
73 EXPECT_TRUE(paintWithoutCommit()); 73 EXPECT_TRUE(paintWithoutCommit());
74 74
75 EXPECT_EQ(6, numCachedNewItems()); 75 EXPECT_EQ(6, numCachedNewItems());
76 76
77 commit(); 77 commit();
78 78
79 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, 79 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11,
80 TestDisplayItem(layoutView(), documentBackgroundType), 80 TestDisplayItem(layoutView(), documentBackgroundType),
81 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), 81 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
82 TestDisplayItem(container1Layer, DisplayItem::Subsequence), 82 TestDisplayItem(container1Layer, DisplayItem::kSubsequence),
83 TestDisplayItem(container1, backgroundType), 83 TestDisplayItem(container1, backgroundType),
84 TestDisplayItem(content1, backgroundType), 84 TestDisplayItem(content1, backgroundType),
85 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), 85 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence),
86 TestDisplayItem(container2Layer, DisplayItem::Subsequence), 86 TestDisplayItem(container2Layer, DisplayItem::kSubsequence),
87 TestDisplayItem(container2, backgroundType), 87 TestDisplayItem(container2, backgroundType),
88 TestDisplayItem(content2, backgroundType), 88 TestDisplayItem(content2, backgroundType),
89 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), 89 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence),
90 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); 90 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
91 } 91 }
92 92
93 TEST_P(PaintLayerPainterTest, CachedSubsequenceOnInterestRectChange) 93 TEST_P(PaintLayerPainterTest, CachedSubsequenceOnInterestRectChange)
94 { 94 {
95 // TODO(wangxianzhu): SPv2 deals with interest rect differently, so disable this test for SPv2 temporarily. 95 // TODO(wangxianzhu): SPv2 deals with interest rect differently, so disable this test for SPv2 temporarily.
96 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 96 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
97 return; 97 return;
98 98
99 setBodyInnerHTML( 99 setBodyInnerHTML(
100 "<div id='container1' style='position: relative; z-index: 1; width: 200p x; height: 200px; background-color: blue'>" 100 "<div id='container1' style='position: relative; z-index: 1; width: 200p x; height: 200px; background-color: blue'>"
(...skipping 23 matching lines...) Expand all
124 document().view()->updateAllLifecyclePhasesExceptPaint(); 124 document().view()->updateAllLifecyclePhasesExceptPaint();
125 IntRect interestRect(0, 0, 400, 300); 125 IntRect interestRect(0, 0, 400, 300);
126 paint(&interestRect); 126 paint(&interestRect);
127 127
128 // Container1 is fully in the interest rect; 128 // Container1 is fully in the interest rect;
129 // Container2 is partly (including its stacking chidren) in the interest rec t; 129 // Container2 is partly (including its stacking chidren) in the interest rec t;
130 // Content2b is out of the interest rect and output nothing; 130 // Content2b is out of the interest rect and output nothing;
131 // Container3 is partly in the interest rect. 131 // Container3 is partly in the interest rect.
132 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 15, 132 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 15,
133 TestDisplayItem(layoutView(), documentBackgroundType), 133 TestDisplayItem(layoutView(), documentBackgroundType),
134 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), 134 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
135 TestDisplayItem(container1Layer, DisplayItem::Subsequence), 135 TestDisplayItem(container1Layer, DisplayItem::kSubsequence),
136 TestDisplayItem(container1, backgroundType), 136 TestDisplayItem(container1, backgroundType),
137 TestDisplayItem(content1, backgroundType), 137 TestDisplayItem(content1, backgroundType),
138 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), 138 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence),
139 TestDisplayItem(container2Layer, DisplayItem::Subsequence), 139 TestDisplayItem(container2Layer, DisplayItem::kSubsequence),
140 TestDisplayItem(container2, backgroundType), 140 TestDisplayItem(container2, backgroundType),
141 TestDisplayItem(content2a, backgroundType), 141 TestDisplayItem(content2a, backgroundType),
142 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), 142 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence),
143 TestDisplayItem(container3Layer, DisplayItem::Subsequence), 143 TestDisplayItem(container3Layer, DisplayItem::kSubsequence),
144 TestDisplayItem(container3, backgroundType), 144 TestDisplayItem(container3, backgroundType),
145 TestDisplayItem(content3, backgroundType), 145 TestDisplayItem(content3, backgroundType),
146 TestDisplayItem(container3Layer, DisplayItem::EndSubsequence), 146 TestDisplayItem(container3Layer, DisplayItem::kEndSubsequence),
147 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); 147 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
148 148
149 document().view()->updateAllLifecyclePhasesExceptPaint(); 149 document().view()->updateAllLifecyclePhasesExceptPaint();
150 IntRect newInterestRect(0, 100, 300, 1000); 150 IntRect newInterestRect(0, 100, 300, 1000);
151 EXPECT_TRUE(paintWithoutCommit(&newInterestRect)); 151 EXPECT_TRUE(paintWithoutCommit(&newInterestRect));
152 152
153 // Container1 becomes partly in the interest rect, but uses cached subsequen ce 153 // Container1 becomes partly in the interest rect, but uses cached subsequen ce
154 // because it was fully painted before; 154 // because it was fully painted before;
155 // Container2's intersection with the interest rect changes; 155 // Container2's intersection with the interest rect changes;
156 // Content2b is out of the interest rect and outputs nothing; 156 // Content2b is out of the interest rect and outputs nothing;
157 // Container3 becomes out of the interest rect and outputs empty subsequence pair. 157 // Container3 becomes out of the interest rect and outputs empty subsequence pair.
158 EXPECT_EQ(7, numCachedNewItems()); 158 EXPECT_EQ(7, numCachedNewItems());
159 159
160 commit(); 160 commit();
161 161
162 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 14, 162 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 14,
163 TestDisplayItem(layoutView(), documentBackgroundType), 163 TestDisplayItem(layoutView(), documentBackgroundType),
164 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), 164 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
165 TestDisplayItem(container1Layer, DisplayItem::Subsequence), 165 TestDisplayItem(container1Layer, DisplayItem::kSubsequence),
166 TestDisplayItem(container1, backgroundType), 166 TestDisplayItem(container1, backgroundType),
167 TestDisplayItem(content1, backgroundType), 167 TestDisplayItem(content1, backgroundType),
168 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), 168 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence),
169 TestDisplayItem(container2Layer, DisplayItem::Subsequence), 169 TestDisplayItem(container2Layer, DisplayItem::kSubsequence),
170 TestDisplayItem(container2, backgroundType), 170 TestDisplayItem(container2, backgroundType),
171 TestDisplayItem(content2a, backgroundType), 171 TestDisplayItem(content2a, backgroundType),
172 TestDisplayItem(content2b, backgroundType), 172 TestDisplayItem(content2b, backgroundType),
173 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), 173 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence),
174 TestDisplayItem(container3Layer, DisplayItem::Subsequence), 174 TestDisplayItem(container3Layer, DisplayItem::kSubsequence),
175 TestDisplayItem(container3Layer, DisplayItem::EndSubsequence), 175 TestDisplayItem(container3Layer, DisplayItem::kEndSubsequence),
176 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); 176 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
177 } 177 }
178 178
179 TEST_P(PaintLayerPainterTest, CachedSubsequenceOnStyleChangeWithInterestRectClip ping) 179 TEST_P(PaintLayerPainterTest, CachedSubsequenceOnStyleChangeWithInterestRectClip ping)
180 { 180 {
181 setBodyInnerHTML( 181 setBodyInnerHTML(
182 "<div id='container1' style='position: relative; z-index: 1; width: 200p x; height: 200px; background-color: blue'>" 182 "<div id='container1' style='position: relative; z-index: 1; width: 200p x; height: 200px; background-color: blue'>"
183 " <div id='content1' style='position: absolute; width: 100px; height: 1 00px; background-color: red'></div>" 183 " <div id='content1' style='position: absolute; width: 100px; height: 1 00px; background-color: red'></div>"
184 "</div>" 184 "</div>"
185 "<div id='container2' style='position: relative; z-index: 1; width: 200p x; height: 200px; background-color: blue'>" 185 "<div id='container2' style='position: relative; z-index: 1; width: 200p x; height: 200px; background-color: blue'>"
186 " <div id='content2' style='position: absolute; width: 100px; height: 1 00px; background-color: green'></div>" 186 " <div id='content2' style='position: absolute; width: 100px; height: 1 00px; background-color: green'></div>"
187 "</div>"); 187 "</div>");
188 document().view()->updateAllLifecyclePhasesExceptPaint(); 188 document().view()->updateAllLifecyclePhasesExceptPaint();
189 IntRect interestRect(0, 0, 50, 300); // PaintResult of all subsequences will be MayBeClippedByPaintDirtyRect. 189 IntRect interestRect(0, 0, 50, 300); // PaintResult of all subsequences will be MayBeClippedByPaintDirtyRect.
190 paint(&interestRect); 190 paint(&interestRect);
191 191
192 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement() ->layoutObject())->layer(); 192 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement() ->layoutObject())->layer();
193 LayoutObject& container1 = *document().getElementById("container1")->layoutO bject(); 193 LayoutObject& container1 = *document().getElementById("container1")->layoutO bject();
194 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer(); 194 PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer();
195 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec t(); 195 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec t();
196 LayoutObject& container2 = *document().getElementById("container2")->layoutO bject(); 196 LayoutObject& container2 = *document().getElementById("container2")->layoutO bject();
197 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer(); 197 PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer();
198 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec t(); 198 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec t();
199 199
200 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, 200 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11,
201 TestDisplayItem(layoutView(), documentBackgroundType), 201 TestDisplayItem(layoutView(), documentBackgroundType),
202 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), 202 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
203 TestDisplayItem(container1Layer, DisplayItem::Subsequence), 203 TestDisplayItem(container1Layer, DisplayItem::kSubsequence),
204 TestDisplayItem(container1, backgroundType), 204 TestDisplayItem(container1, backgroundType),
205 TestDisplayItem(content1, backgroundType), 205 TestDisplayItem(content1, backgroundType),
206 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), 206 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence),
207 TestDisplayItem(container2Layer, DisplayItem::Subsequence), 207 TestDisplayItem(container2Layer, DisplayItem::kSubsequence),
208 TestDisplayItem(container2, backgroundType), 208 TestDisplayItem(container2, backgroundType),
209 TestDisplayItem(content2, backgroundType), 209 TestDisplayItem(content2, backgroundType),
210 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), 210 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence),
211 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); 211 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
212 212
213 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position : absolute; width: 100px; height: 100px; background-color: green"); 213 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position : absolute; width: 100px; height: 100px; background-color: green");
214 document().view()->updateAllLifecyclePhasesExceptPaint(); 214 document().view()->updateAllLifecyclePhasesExceptPaint();
215 EXPECT_TRUE(paintWithoutCommit(&interestRect)); 215 EXPECT_TRUE(paintWithoutCommit(&interestRect));
216 216
217 EXPECT_EQ(6, numCachedNewItems()); 217 EXPECT_EQ(6, numCachedNewItems());
218 218
219 commit(); 219 commit();
220 220
221 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11, 221 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 11,
222 TestDisplayItem(layoutView(), documentBackgroundType), 222 TestDisplayItem(layoutView(), documentBackgroundType),
223 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), 223 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
224 TestDisplayItem(container1Layer, DisplayItem::Subsequence), 224 TestDisplayItem(container1Layer, DisplayItem::kSubsequence),
225 TestDisplayItem(container1, backgroundType), 225 TestDisplayItem(container1, backgroundType),
226 TestDisplayItem(content1, backgroundType), 226 TestDisplayItem(content1, backgroundType),
227 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), 227 TestDisplayItem(container1Layer, DisplayItem::kEndSubsequence),
228 TestDisplayItem(container2Layer, DisplayItem::Subsequence), 228 TestDisplayItem(container2Layer, DisplayItem::kSubsequence),
229 TestDisplayItem(container2, backgroundType), 229 TestDisplayItem(container2, backgroundType),
230 TestDisplayItem(content2, backgroundType), 230 TestDisplayItem(content2, backgroundType),
231 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), 231 TestDisplayItem(container2Layer, DisplayItem::kEndSubsequence),
232 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); 232 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
233 } 233 }
234 234
235 TEST_P(PaintLayerPainterTest, PaintPhaseOutline) 235 TEST_P(PaintLayerPainterTest, PaintPhaseOutline)
236 { 236 {
237 AtomicString styleWithoutOutline = "width: 50px; height: 50px; background-co lor: green"; 237 AtomicString styleWithoutOutline = "width: 50px; height: 50px; background-co lor: green";
238 AtomicString styleWithOutline = "outline: 1px solid blue; " + styleWithoutOu tline; 238 AtomicString styleWithOutline = "outline: 1px solid blue; " + styleWithoutOu tline;
239 setBodyInnerHTML( 239 setBodyInnerHTML(
240 "<div id='self-painting-layer' style='position: absolute'>" 240 "<div id='self-painting-layer' style='position: absolute'>"
241 " <div id='non-self-painting-layer' style='overflow: hidden'>" 241 " <div id='non-self-painting-layer' style='overflow: hidden'>"
242 " <div>" 242 " <div>"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 299
300 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseFloat()); 300 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseFloat());
301 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat()); 301 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat());
302 302
303 // needsPaintPhaseFloat should be set when any descendant on the same layer has float. 303 // needsPaintPhaseFloat should be set when any descendant on the same layer has float.
304 toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWith Float); 304 toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWith Float);
305 document().view()->updateAllLifecyclePhasesExceptPaint(); 305 document().view()->updateAllLifecyclePhasesExceptPaint();
306 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseFloat()); 306 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseFloat());
307 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat()); 307 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat());
308 paint(); 308 paint();
309 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList (), floatDiv, DisplayItem::BoxDecorationBackground)); 309 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList (), floatDiv, DisplayItem::kBoxDecorationBackground));
310 } 310 }
311 311
312 TEST_P(PaintLayerPainterTest, PaintPhaseFloatUnderInlineLayer) 312 TEST_P(PaintLayerPainterTest, PaintPhaseFloatUnderInlineLayer)
313 { 313 {
314 setBodyInnerHTML( 314 setBodyInnerHTML(
315 "<div id='self-painting-layer' style='position: absolute'>" 315 "<div id='self-painting-layer' style='position: absolute'>"
316 " <div id='non-self-painting-layer' style='overflow: hidden'>" 316 " <div id='non-self-painting-layer' style='overflow: hidden'>"
317 " <span id='span' style='position: relative'>" 317 " <span id='span' style='position: relative'>"
318 " <div id='float' style='width: 10px; height: 10px; background-colo r: blue; float: left'></div>" 318 " <div id='float' style='width: 10px; height: 10px; background-colo r: blue; float: left'></div>"
319 " </span>" 319 " </span>"
320 " </div>" 320 " </div>"
321 "</div>"); 321 "</div>");
322 document().view()->updateAllLifecyclePhases(); 322 document().view()->updateAllLifecyclePhases();
323 323
324 LayoutObject& floatDiv = *document().getElementById("float")->layoutObject() ; 324 LayoutObject& floatDiv = *document().getElementById("float")->layoutObject() ;
325 LayoutInline& span = *toLayoutInline(document().getElementById("span")->layo utObject()); 325 LayoutInline& span = *toLayoutInline(document().getElementById("span")->layo utObject());
326 PaintLayer& spanLayer = *span.layer(); 326 PaintLayer& spanLayer = *span.layer();
327 ASSERT_TRUE(&spanLayer == floatDiv.enclosingLayer()); 327 ASSERT_TRUE(&spanLayer == floatDiv.enclosingLayer());
328 ASSERT_FALSE(spanLayer.needsPaintPhaseFloat()); 328 ASSERT_FALSE(spanLayer.needsPaintPhaseFloat());
329 LayoutBlock& selfPaintingLayerObject = *toLayoutBlock(document().getElementB yId("self-painting-layer")->layoutObject()); 329 LayoutBlock& selfPaintingLayerObject = *toLayoutBlock(document().getElementB yId("self-painting-layer")->layoutObject());
330 PaintLayer& selfPaintingLayer = *selfPaintingLayerObject.layer(); 330 PaintLayer& selfPaintingLayer = *selfPaintingLayerObject.layer();
331 ASSERT_TRUE(selfPaintingLayer.isSelfPaintingLayer()); 331 ASSERT_TRUE(selfPaintingLayer.isSelfPaintingLayer());
332 PaintLayer& nonSelfPaintingLayer = *toLayoutBoxModelObject(document().getEle mentById("non-self-painting-layer")->layoutObject())->layer(); 332 PaintLayer& nonSelfPaintingLayer = *toLayoutBoxModelObject(document().getEle mentById("non-self-painting-layer")->layoutObject())->layer();
333 ASSERT_FALSE(nonSelfPaintingLayer.isSelfPaintingLayer()); 333 ASSERT_FALSE(nonSelfPaintingLayer.isSelfPaintingLayer());
334 334
335 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseFloat()); 335 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseFloat());
336 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat()); 336 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat());
337 EXPECT_FALSE(spanLayer.needsPaintPhaseFloat()); 337 EXPECT_FALSE(spanLayer.needsPaintPhaseFloat());
338 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList (), floatDiv, DisplayItem::BoxDecorationBackground)); 338 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList (), floatDiv, DisplayItem::kBoxDecorationBackground));
339 } 339 }
340 340
341 TEST_P(PaintLayerPainterTest, PaintPhaseBlockBackground) 341 TEST_P(PaintLayerPainterTest, PaintPhaseBlockBackground)
342 { 342 {
343 AtomicString styleWithoutBackground = "width: 50px; height: 50px"; 343 AtomicString styleWithoutBackground = "width: 50px; height: 50px";
344 AtomicString styleWithBackground = "background: blue; " + styleWithoutBackgr ound; 344 AtomicString styleWithBackground = "background: blue; " + styleWithoutBackgr ound;
345 setBodyInnerHTML( 345 setBodyInnerHTML(
346 "<div id='self-painting-layer' style='position: absolute'>" 346 "<div id='self-painting-layer' style='position: absolute'>"
347 " <div id='non-self-painting-layer' style='overflow: hidden'>" 347 " <div id='non-self-painting-layer' style='overflow: hidden'>"
348 " <div>" 348 " <div>"
(...skipping 13 matching lines...) Expand all
362 ASSERT_TRUE(&nonSelfPaintingLayer == backgroundDiv.enclosingLayer()); 362 ASSERT_TRUE(&nonSelfPaintingLayer == backgroundDiv.enclosingLayer());
363 363
364 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds()); 364 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds());
365 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds( )); 365 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds( ));
366 366
367 // Background on the self-painting-layer node itself doesn't affect PaintPha seDescendantBlockBackgrounds. 367 // Background on the self-painting-layer node itself doesn't affect PaintPha seDescendantBlockBackgrounds.
368 toHTMLElement(selfPaintingLayerObject.node())->setAttribute(HTMLNames::style Attr, "position: absolute; background: green"); 368 toHTMLElement(selfPaintingLayerObject.node())->setAttribute(HTMLNames::style Attr, "position: absolute; background: green");
369 document().view()->updateAllLifecyclePhases(); 369 document().view()->updateAllLifecyclePhases();
370 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds()); 370 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds());
371 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds( )); 371 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds( ));
372 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList (), selfPaintingLayerObject, DisplayItem::BoxDecorationBackground)); 372 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList (), selfPaintingLayerObject, DisplayItem::kBoxDecorationBackground));
373 373
374 // needsPaintPhaseDescendantBlockBackgrounds should be set when any descenda nt on the same layer has Background. 374 // needsPaintPhaseDescendantBlockBackgrounds should be set when any descenda nt on the same layer has Background.
375 toHTMLElement(backgroundDiv.node())->setAttribute(HTMLNames::styleAttr, styl eWithBackground); 375 toHTMLElement(backgroundDiv.node())->setAttribute(HTMLNames::styleAttr, styl eWithBackground);
376 document().view()->updateAllLifecyclePhasesExceptPaint(); 376 document().view()->updateAllLifecyclePhasesExceptPaint();
377 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds()); 377 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds());
378 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds( )); 378 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantBlockBackgrounds( ));
379 paint(); 379 paint();
380 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList (), backgroundDiv, DisplayItem::BoxDecorationBackground)); 380 EXPECT_TRUE(displayItemListContains(rootPaintController().getDisplayItemList (), backgroundDiv, DisplayItem::kBoxDecorationBackground));
381 } 381 }
382 382
383 TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnLayerRemoval) 383 TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnLayerRemoval)
384 { 384 {
385 setBodyInnerHTML( 385 setBodyInnerHTML(
386 "<div id='layer' style='position: relative'>" 386 "<div id='layer' style='position: relative'>"
387 " <div style='height: 100px'>" 387 " <div style='height: 100px'>"
388 " <div style='height: 20px; outline: 1px solid red; background-color: green'>outline and background</div>" 388 " <div style='height: 20px; outline: 1px solid red; background-color: green'>outline and background</div>"
389 " <div style='float: left'>float</div>" 389 " <div style='float: left'>float</div>"
390 " </div>" 390 " </div>"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 PaintLayer& layer = *table.layer(); 528 PaintLayer& layer = *table.layer();
529 EXPECT_TRUE(layer.isSelfPaintingLayer()); 529 EXPECT_TRUE(layer.isSelfPaintingLayer());
530 EXPECT_FALSE(layer.needsPaintPhaseDescendantBlockBackgrounds()); 530 EXPECT_FALSE(layer.needsPaintPhaseDescendantBlockBackgrounds());
531 531
532 toHTMLElement(table.node())->setAttribute(HTMLNames::styleAttr, "position: r elative; border-collapse: collapse"); 532 toHTMLElement(table.node())->setAttribute(HTMLNames::styleAttr, "position: r elative; border-collapse: collapse");
533 document().view()->updateAllLifecyclePhases(); 533 document().view()->updateAllLifecyclePhases();
534 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); 534 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds());
535 } 535 }
536 536
537 } // namespace blink 537 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp ('k') | third_party/WebKit/Source/core/paint/PaintPhase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698