OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/DisplayItemListPaintTest.h" | 6 #include "core/paint/DisplayItemListPaintTest.h" |
7 | 7 |
8 #include "core/layout/LayoutText.h" | 8 #include "core/layout/LayoutText.h" |
9 #include "core/layout/line/InlineTextBox.h" | 9 #include "core/layout/line/InlineTextBox.h" |
10 #include "core/page/FocusController.h" | 10 #include "core/page/FocusController.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 7, | 149 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 7, |
150 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), | 150 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), |
151 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), | 151 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), |
152 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), | 152 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), |
153 TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(Pa intPhaseForeground)), | 153 TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(Pa intPhaseForeground)), |
154 TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(Pain tPhaseForeground)), | 154 TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(Pain tPhaseForeground)), |
155 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), | 155 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), |
156 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); | 156 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
157 } | 157 } |
158 | 158 |
159 TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, OverflowClipHierarchy) | |
Xianzhu
2015/09/15 23:40:13
Can this be moved into DeprecatedPaintLayerPainter
trchen
2015/09/17 01:56:04
Acknowledged.
| |
160 { | |
161 setBodyInnerHTML( | |
162 "<div id='scroller1' style='overflow: hidden; width: 100px; height: 100p x;'>" | |
163 " <div id='scroller2' style='overflow: hidden; width: 200px; height: 20 0px;'>" | |
164 " normal flow" | |
165 " <div id='positioned' style='position:relative; width: 300px; height : 300px; border: 1px dotted black;'></div>" | |
166 " </div>" | |
167 "</div>"); | |
168 | |
169 LayoutView& layoutView = *document().layoutView(); | |
170 DeprecatedPaintLayer& rootLayer = *layoutView.layer(); | |
171 LayoutObject& html = *document().documentElement()->layoutObject(); | |
172 DeprecatedPaintLayer& htmlLayer = *static_cast<LayoutBoxModelObject&>(html). layer(); | |
173 LayoutObject& scroller1 = *document().getElementById("scroller1")->layoutObj ect(); | |
174 DeprecatedPaintLayer& scroller1Layer = *static_cast<LayoutBoxModelObject&>(s croller1).layer(); | |
175 LayoutObject& scroller2 = *document().getElementById("scroller2")->layoutObj ect(); | |
176 DeprecatedPaintLayer& scroller2Layer = *static_cast<LayoutBoxModelObject&>(s croller2).layer(); | |
177 InlineTextBox& normalFlow = *static_cast<LayoutText*>(scroller2.slowFirstChi ld()->slowFirstChild())->firstTextBox(); | |
178 LayoutObject& positioned = *document().getElementById("positioned")->layoutO bject(); | |
179 DeprecatedPaintLayer& positionedLayer = *static_cast<LayoutBoxModelObject&>( positioned).layer(); | |
180 | |
181 static_cast<LayoutBox&>(scroller1).scrollToOffset(DoubleSize(12, 34)); | |
182 static_cast<LayoutBox&>(scroller2).scrollToOffset(DoubleSize(56, 78)); | |
183 document().view()->updateAllLifecyclePhases(); | |
184 | |
185 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 33, | |
186 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), | |
187 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), | |
188 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), | |
189 | |
190 TestDisplayItem(scroller1, DisplayItem::paintPhaseToClipBoxType(Pain tPhaseForeground)), | |
191 TestDisplayItem(scroller1, DisplayItem::paintPhaseToScrollType(P aintPhaseForeground)), | |
192 TestDisplayItem(scroller2, DisplayItem::paintPhaseToClipBoxT ype(PaintPhaseForeground)), | |
193 TestDisplayItem(scroller2, DisplayItem::paintPhaseToScro llType(PaintPhaseForeground)), | |
194 TestDisplayItem(normalFlow, DisplayItem::paintPhaseT oDrawingType(PaintPhaseForeground)), | |
195 TestDisplayItem(scroller2, DisplayItem::scrollTypeToEndS crollType(DisplayItem::paintPhaseToScrollType(PaintPhaseForeground))), | |
196 TestDisplayItem(scroller2, DisplayItem::clipTypeToEndClipTyp e(DisplayItem::paintPhaseToClipBoxType(PaintPhaseForeground))), | |
197 TestDisplayItem(scroller1, DisplayItem::scrollTypeToEndScrollTyp e(DisplayItem::paintPhaseToScrollType(PaintPhaseForeground))), | |
198 TestDisplayItem(scroller1, DisplayItem::clipTypeToEndClipType(Displa yItem::paintPhaseToClipBoxType(PaintPhaseForeground))), | |
199 | |
200 TestDisplayItem(scroller1Layer, DisplayItem::BeginSubsequence), | |
201 TestDisplayItem(scroller1, DisplayItem::ClipDescendantStackingCo ntext), | |
202 TestDisplayItem(scroller1, DisplayItem::paintPhaseToScrollTy pe(PaintPhaseBlockBackground)), | |
203 TestDisplayItem(scroller2Layer, DisplayItem::BeginSubseq uence), | |
204 TestDisplayItem(scroller2Layer, DisplayItem::EndSubseque nce), | |
205 TestDisplayItem(scroller1, DisplayItem::scrollTypeToEndScrol lType(DisplayItem::paintPhaseToScrollType(PaintPhaseBlockBackground))), | |
206 TestDisplayItem(scroller1, DisplayItem::clipTypeToEndClipType(Di splayItem::ClipDescendantStackingContext)), | |
207 TestDisplayItem(scroller1Layer, DisplayItem::EndSubsequence), | |
208 | |
209 TestDisplayItem(scroller1, DisplayItem::ClipDescendantStackingContex t), | |
210 TestDisplayItem(scroller1, DisplayItem::paintPhaseToScrollType(P aintPhaseBlockBackground)), | |
211 TestDisplayItem(scroller2, DisplayItem::ClipDescendantStacki ngContext), | |
212 TestDisplayItem(scroller2, DisplayItem::paintPhaseToScro llType(PaintPhaseBlockBackground)), | |
213 TestDisplayItem(positionedLayer, DisplayItem::BeginS ubsequence), | |
214 TestDisplayItem(positioned, DisplayItem::BoxDeco rationBackground), | |
215 TestDisplayItem(positionedLayer, DisplayItem::EndSub sequence), | |
216 TestDisplayItem(scroller2, DisplayItem::scrollTypeToEndS crollType(DisplayItem::paintPhaseToScrollType(PaintPhaseBlockBackground))), | |
217 TestDisplayItem(scroller2, DisplayItem::clipTypeToEndClipTyp e(DisplayItem::ClipDescendantStackingContext)), | |
218 TestDisplayItem(scroller1, DisplayItem::scrollTypeToEndScrollTyp e(DisplayItem::paintPhaseToScrollType(PaintPhaseBlockBackground))), | |
219 TestDisplayItem(scroller1, DisplayItem::clipTypeToEndClipType(Displa yItem::ClipDescendantStackingContext)), | |
220 | |
221 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), | |
222 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); | |
223 } | |
224 | |
225 TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, OverflowClipHierarchyPhaseInt erleave) | |
226 { | |
227 setBodyInnerHTML( | |
228 "<div id='scroller1' style='overflow: hidden; width: 100px; height: 100p x;'>" | |
229 " <div id='scroller2' style='overflow: hidden; width: 200px; height: 20 0px;'>" | |
230 " <div id='multi-phase' style='width: 300px; height: 300px; backgroun d: green; outline: 1px dotted black;'></div>" | |
231 " </div>" | |
232 "</div>" | |
233 "<div id='interleave' style='float: right; width: 300px; height: 300px; background-color: blue;'></div>"); | |
234 | |
235 LayoutView& layoutView = *document().layoutView(); | |
236 DeprecatedPaintLayer& rootLayer = *layoutView.layer(); | |
237 LayoutObject& html = *document().documentElement()->layoutObject(); | |
238 DeprecatedPaintLayer& htmlLayer = *static_cast<LayoutBoxModelObject&>(html). layer(); | |
239 LayoutObject& scroller1 = *document().getElementById("scroller1")->layoutObj ect(); | |
240 LayoutObject& scroller2 = *document().getElementById("scroller2")->layoutObj ect(); | |
241 LayoutObject& multiPhase = *document().getElementById("multi-phase")->layout Object(); | |
242 LayoutObject& interleave = *document().getElementById("interleave")->layoutO bject(); | |
243 | |
244 static_cast<LayoutBox&>(scroller1).scrollToOffset(DoubleSize(12, 34)); | |
245 static_cast<LayoutBox&>(scroller2).scrollToOffset(DoubleSize(56, 78)); | |
246 document().view()->updateAllLifecyclePhases(); | |
247 | |
248 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 24, | |
249 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), | |
250 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), | |
251 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), | |
252 | |
253 TestDisplayItem(scroller1, DisplayItem::paintPhaseToClipBoxType(Pain tPhaseChildBlockBackgrounds)), | |
254 TestDisplayItem(scroller1, DisplayItem::paintPhaseToScrollType(P aintPhaseChildBlockBackgrounds)), | |
255 TestDisplayItem(scroller2, DisplayItem::paintPhaseToClipBoxT ype(PaintPhaseChildBlockBackgrounds)), | |
256 TestDisplayItem(scroller2, DisplayItem::paintPhaseToScro llType(PaintPhaseChildBlockBackgrounds)), | |
257 TestDisplayItem(multiPhase, DisplayItem::BoxDecorati onBackground), | |
258 TestDisplayItem(scroller2, DisplayItem::scrollTypeToEndS crollType(DisplayItem::paintPhaseToScrollType(PaintPhaseChildBlockBackgrounds))) , | |
259 TestDisplayItem(scroller2, DisplayItem::clipTypeToEndClipTyp e(DisplayItem::paintPhaseToClipBoxType(PaintPhaseChildBlockBackgrounds))), | |
260 TestDisplayItem(scroller1, DisplayItem::scrollTypeToEndScrollTyp e(DisplayItem::paintPhaseToScrollType(PaintPhaseChildBlockBackgrounds))), | |
261 TestDisplayItem(scroller1, DisplayItem::clipTypeToEndClipType(Displa yItem::paintPhaseToClipBoxType(PaintPhaseChildBlockBackgrounds))), | |
262 | |
263 TestDisplayItem(interleave, DisplayItem::BoxDecorationBackground), | |
264 | |
265 TestDisplayItem(scroller1, DisplayItem::paintPhaseToClipBoxType(Pain tPhaseChildOutlines)), | |
266 TestDisplayItem(scroller1, DisplayItem::paintPhaseToScrollType(P aintPhaseChildOutlines)), | |
267 TestDisplayItem(scroller2, DisplayItem::paintPhaseToClipBoxT ype(PaintPhaseChildOutlines)), | |
268 TestDisplayItem(scroller2, DisplayItem::paintPhaseToScro llType(PaintPhaseChildOutlines)), | |
269 TestDisplayItem(multiPhase, DisplayItem::paintPhaseT oDrawingType(PaintPhaseSelfOutline)), | |
270 TestDisplayItem(scroller2, DisplayItem::scrollTypeToEndS crollType(DisplayItem::paintPhaseToScrollType(PaintPhaseChildOutlines))), | |
271 TestDisplayItem(scroller2, DisplayItem::clipTypeToEndClipTyp e(DisplayItem::paintPhaseToClipBoxType(PaintPhaseChildOutlines))), | |
272 TestDisplayItem(scroller1, DisplayItem::scrollTypeToEndScrollTyp e(DisplayItem::paintPhaseToScrollType(PaintPhaseChildOutlines))), | |
273 TestDisplayItem(scroller1, DisplayItem::clipTypeToEndClipType(Displa yItem::paintPhaseToClipBoxType(PaintPhaseChildOutlines))), | |
274 | |
275 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), | |
276 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); | |
277 } | |
278 | |
159 } // namespace blink | 279 } // namespace blink |
OLD | NEW |