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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), | 85 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), |
86 TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground)), | 86 TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground)), |
87 TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground))); | 87 TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground))); |
88 } | 88 } |
89 | 89 |
90 TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, FullDocumentPaintingWithCaret
) | 90 TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, FullDocumentPaintingWithCaret
) |
91 { | 91 { |
92 setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>
XYZ</div>"); | 92 setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>
XYZ</div>"); |
93 document().page()->focusController().setActive(true); | 93 document().page()->focusController().setActive(true); |
94 document().page()->focusController().setFocused(true); | 94 document().page()->focusController().setFocused(true); |
| 95 DeprecatedPaintLayer& rootLayer = *layoutView().layer(); |
95 DeprecatedPaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documen
tElement()->layoutObject())->layer(); | 96 DeprecatedPaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documen
tElement()->layoutObject())->layer(); |
96 Element& div = *toElement(document().body()->firstChild()); | 97 Element& div = *toElement(document().body()->firstChild()); |
97 LayoutObject& divLayoutObject = *document().body()->firstChild()->layoutObje
ct(); | 98 LayoutObject& divLayoutObject = *document().body()->firstChild()->layoutObje
ct(); |
98 InlineTextBox& textInlineBox = *toLayoutText(div.firstChild()->layoutObject(
))->firstTextBox(); | 99 InlineTextBox& textInlineBox = *toLayoutText(div.firstChild()->layoutObject(
))->firstTextBox(); |
99 | 100 |
100 document().view()->updateAllLifecyclePhases(); | 101 document().view()->updateAllLifecyclePhases(); |
101 | 102 |
102 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 4, | 103 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 6, |
| 104 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), |
103 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), | 105 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), |
104 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), | 106 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), |
105 TestDisplayItem(textInlineBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground)), | 107 TestDisplayItem(textInlineBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground)), |
106 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 108 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), |
| 109 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
107 | 110 |
108 div.focus(); | 111 div.focus(); |
109 document().view()->updateAllLifecyclePhases(); | 112 document().view()->updateAllLifecyclePhases(); |
110 | 113 |
111 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 5, | 114 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 7, |
| 115 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), |
112 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), | 116 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), |
113 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), | 117 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), |
114 TestDisplayItem(textInlineBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground)), | 118 TestDisplayItem(textInlineBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground)), |
115 TestDisplayItem(divLayoutObject, DisplayItem::Caret), // New! | 119 TestDisplayItem(divLayoutObject, DisplayItem::Caret), // New! |
116 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 120 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), |
| 121 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
117 } | 122 } |
118 | 123 |
119 TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, InlineRelayout) | 124 TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, InlineRelayout) |
120 { | 125 { |
121 setBodyInnerHTML("<div id='div' style='width:100px; height: 200px'>AAAAAAAAA
A BBBBBBBBBB</div>"); | 126 setBodyInnerHTML("<div id='div' style='width:100px; height: 200px'>AAAAAAAAA
A BBBBBBBBBB</div>"); |
| 127 DeprecatedPaintLayer& rootLayer = *layoutView().layer(); |
122 DeprecatedPaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documen
tElement()->layoutObject())->layer(); | 128 DeprecatedPaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documen
tElement()->layoutObject())->layer(); |
123 Element& div = *toElement(document().body()->firstChild()); | 129 Element& div = *toElement(document().body()->firstChild()); |
124 LayoutBlock& divBlock = *toLayoutBlock(document().body()->firstChild()->layo
utObject()); | 130 LayoutBlock& divBlock = *toLayoutBlock(document().body()->firstChild()->layo
utObject()); |
125 LayoutText& text = *toLayoutText(divBlock.firstChild()); | 131 LayoutText& text = *toLayoutText(divBlock.firstChild()); |
126 InlineTextBox& firstTextBox = *text.firstTextBox(); | 132 InlineTextBox& firstTextBox = *text.firstTextBox(); |
127 | 133 |
128 document().view()->updateAllLifecyclePhases(); | 134 document().view()->updateAllLifecyclePhases(); |
129 | 135 |
130 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 4, | 136 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 6, |
| 137 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), |
131 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), | 138 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), |
132 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), | 139 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), |
133 TestDisplayItem(firstTextBox, DisplayItem::paintPhaseToDrawingType(Paint
PhaseForeground)), | 140 TestDisplayItem(firstTextBox, DisplayItem::paintPhaseToDrawingType(Paint
PhaseForeground)), |
134 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 141 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), |
| 142 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
135 | 143 |
136 div.setAttribute(HTMLNames::styleAttr, "width: 10px; height: 200px"); | 144 div.setAttribute(HTMLNames::styleAttr, "width: 10px; height: 200px"); |
137 document().view()->updateAllLifecyclePhases(); | 145 document().view()->updateAllLifecyclePhases(); |
138 | 146 |
139 LayoutText& newText = *toLayoutText(divBlock.firstChild()); | 147 LayoutText& newText = *toLayoutText(divBlock.firstChild()); |
140 InlineTextBox& newFirstTextBox = *newText.firstTextBox(); | 148 InlineTextBox& newFirstTextBox = *newText.firstTextBox(); |
141 InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox(); | 149 InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox(); |
142 | 150 |
143 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 5, | 151 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 7, |
| 152 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), |
144 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), | 153 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), |
145 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), | 154 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), |
146 TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground)), | 155 TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground)), |
147 TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground)), | 156 TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground)), |
148 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 157 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), |
| 158 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
149 } | 159 } |
150 | 160 |
151 TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, CachedSubsequence) | 161 TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, CachedSubsequence) |
152 { | 162 { |
153 setBodyInnerHTML( | 163 setBodyInnerHTML( |
154 "<div id='container1' style='position: relative; width: 200px; height: 2
00px; background-color: blue'>" | 164 "<div id='container1' style='position: relative; width: 200px; height: 2
00px; background-color: blue'>" |
155 " <div id='content1' style='width: 100px; height: 100px; background-col
or: red'></div>" | 165 " <div id='content1' style='width: 100px; height: 100px; background-col
or: red'></div>" |
156 "</div>" | 166 "</div>" |
157 "<div id='container2' style='position: relative; width: 200px; height: 2
00px; background-color: blue'>" | 167 "<div id='container2' style='position: relative; width: 200px; height: 2
00px; background-color: blue'>" |
158 " <div id='content2' style='width: 100px; height: 100px; background-col
or: green'></div>" | 168 " <div id='content2' style='width: 100px; height: 100px; background-col
or: green'></div>" |
159 "</div>"); | 169 "</div>"); |
160 document().view()->updateAllLifecyclePhases(); | 170 document().view()->updateAllLifecyclePhases(); |
161 | 171 |
| 172 DeprecatedPaintLayer& rootLayer = *layoutView().layer(); |
162 DeprecatedPaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documen
tElement()->layoutObject())->layer(); | 173 DeprecatedPaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documen
tElement()->layoutObject())->layer(); |
163 LayoutObject& container1 = *document().getElementById("container1")->layoutO
bject(); | 174 LayoutObject& container1 = *document().getElementById("container1")->layoutO
bject(); |
164 DeprecatedPaintLayer& container1Layer = *toLayoutBoxModelObject(container1).
layer(); | 175 DeprecatedPaintLayer& container1Layer = *toLayoutBoxModelObject(container1).
layer(); |
165 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec
t(); | 176 LayoutObject& content1 = *document().getElementById("content1")->layoutObjec
t(); |
166 LayoutObject& container2 = *document().getElementById("container2")->layoutO
bject(); | 177 LayoutObject& container2 = *document().getElementById("container2")->layoutO
bject(); |
167 DeprecatedPaintLayer& container2Layer = *toLayoutBoxModelObject(container2).
layer(); | 178 DeprecatedPaintLayer& container2Layer = *toLayoutBoxModelObject(container2).
layer(); |
168 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec
t(); | 179 LayoutObject& content2 = *document().getElementById("content2")->layoutObjec
t(); |
169 | 180 |
170 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 11, | 181 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 13, |
| 182 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), |
171 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), | 183 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), |
172 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), | 184 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), |
173 TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence), | 185 TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence), |
174 TestDisplayItem(container1, DisplayItem::BoxDecorationBackground), | 186 TestDisplayItem(container1, DisplayItem::BoxDecorationBackground), |
175 TestDisplayItem(content1, DisplayItem::BoxDecorationBackground), | 187 TestDisplayItem(content1, DisplayItem::BoxDecorationBackground), |
176 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 188 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
177 TestDisplayItem(container2Layer, DisplayItem::BeginSubsequence), | 189 TestDisplayItem(container2Layer, DisplayItem::BeginSubsequence), |
178 TestDisplayItem(container2, DisplayItem::BoxDecorationBackground), | 190 TestDisplayItem(container2, DisplayItem::BoxDecorationBackground), |
179 TestDisplayItem(content2, DisplayItem::BoxDecorationBackground), | 191 TestDisplayItem(content2, DisplayItem::BoxDecorationBackground), |
180 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), | 192 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
181 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 193 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), |
| 194 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
182 | 195 |
183 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "width: 1
00px; height: 100px; background-color: green"); | 196 toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "width: 1
00px; height: 100px; background-color: green"); |
184 updateLifecyclePhasesToPaintForSlimmingPaintV2Clean(); | 197 updateLifecyclePhasesToPaintForSlimmingPaintV2Clean(LayoutRect::infiniteRect
()); |
185 | 198 |
186 EXPECT_DISPLAY_LIST_WITH_CACHED_RED_FILL_IN_DEBUG(rootDisplayItemList().newD
isplayItems(), 8, | 199 EXPECT_DISPLAY_LIST_WITH_CACHED_RED_FILL_IN_DEBUG(rootDisplayItemList().newD
isplayItems(), 10, |
| 200 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), |
187 TestDisplayItem(layoutView(), DisplayItem::drawingTypeToCachedDrawingTyp
e(DisplayItem::BoxDecorationBackground)), | 201 TestDisplayItem(layoutView(), DisplayItem::drawingTypeToCachedDrawingTyp
e(DisplayItem::BoxDecorationBackground)), |
188 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), | 202 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), |
189 TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence), | 203 TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence), |
190 TestDisplayItem(container1, DisplayItem::drawingTypeToCachedDrawingType(
DisplayItem::BoxDecorationBackground)), | 204 TestDisplayItem(container1, DisplayItem::drawingTypeToCachedDrawingType(
DisplayItem::BoxDecorationBackground)), |
191 TestDisplayItem(content1, DisplayItem::BoxDecorationBackground), | 205 TestDisplayItem(content1, DisplayItem::BoxDecorationBackground), |
192 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 206 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
193 TestDisplayItem(container2Layer, DisplayItem::CachedSubsequence), | 207 TestDisplayItem(container2Layer, DisplayItem::CachedSubsequence), |
194 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 208 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), |
| 209 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
195 | 210 |
196 compositeForSlimmingPaintV2(); | 211 compositeForSlimmingPaintV2(); |
197 | 212 |
198 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 11, | 213 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 13, |
| 214 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), |
199 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), | 215 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), |
200 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), | 216 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), |
201 TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence), | 217 TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence), |
| 218 TestDisplayItem(container1, DisplayItem::BoxDecorationBackground), |
| 219 TestDisplayItem(content1, DisplayItem::BoxDecorationBackground), |
| 220 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 221 TestDisplayItem(container2Layer, DisplayItem::BeginSubsequence), |
| 222 TestDisplayItem(container2, DisplayItem::BoxDecorationBackground), |
| 223 TestDisplayItem(content2, DisplayItem::BoxDecorationBackground), |
| 224 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
| 225 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), |
| 226 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
| 227 |
| 228 // Repeated painting should just generate the root cached subsequence. |
| 229 updateLifecyclePhasesToPaintForSlimmingPaintV2Clean(); |
| 230 EXPECT_DISPLAY_LIST_WITH_CACHED_RED_FILL_IN_DEBUG(rootDisplayItemList().newD
isplayItems(), 1, |
| 231 TestDisplayItem(rootLayer, DisplayItem::CachedSubsequence)); |
| 232 |
| 233 compositeForSlimmingPaintV2(); |
| 234 |
| 235 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 13, |
| 236 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), |
| 237 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), |
| 238 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), |
| 239 TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence), |
202 TestDisplayItem(container1, DisplayItem::BoxDecorationBackground), | 240 TestDisplayItem(container1, DisplayItem::BoxDecorationBackground), |
203 TestDisplayItem(content1, DisplayItem::BoxDecorationBackground), | 241 TestDisplayItem(content1, DisplayItem::BoxDecorationBackground), |
204 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 242 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
205 TestDisplayItem(container2Layer, DisplayItem::BeginSubsequence), | 243 TestDisplayItem(container2Layer, DisplayItem::BeginSubsequence), |
206 TestDisplayItem(container2, DisplayItem::BoxDecorationBackground), | 244 TestDisplayItem(container2, DisplayItem::BoxDecorationBackground), |
207 TestDisplayItem(content2, DisplayItem::BoxDecorationBackground), | 245 TestDisplayItem(content2, DisplayItem::BoxDecorationBackground), |
208 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), | 246 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
209 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 247 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), |
| 248 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
| 249 } |
| 250 |
| 251 TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, CachedSubsequenceOnInterestRe
ctChange) |
| 252 { |
| 253 setBodyInnerHTML( |
| 254 "<div id='container1' style='position: relative; width: 200px; height: 2
00px; background-color: blue'></div>" |
| 255 "<div id='container2' style='position: absolute; z-index: 1; width: 200p
x; height: 200px; background-color: blue'>" |
| 256 " <div id='content2' style='position: relative; top: 200px; width: 100p
x; height: 100px; background-color: green'></div>" |
| 257 "</div>" |
| 258 "<div id='container3' style='position: absolute; z-index: 2; left: 300px
; top: 0; width: 200px; height: 200px; background-color: blue'></div>"); |
| 259 rootDisplayItemList().invalidateAll(); |
| 260 |
| 261 DeprecatedPaintLayer& rootLayer = *layoutView().layer(); |
| 262 DeprecatedPaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documen
tElement()->layoutObject())->layer(); |
| 263 LayoutObject& container1 = *document().getElementById("container1")->layoutO
bject(); |
| 264 DeprecatedPaintLayer& container1Layer = *toLayoutBoxModelObject(container1).
layer(); |
| 265 LayoutObject& container2 = *document().getElementById("container2")->layoutO
bject(); |
| 266 DeprecatedPaintLayer& container2Layer = *toLayoutBoxModelObject(container2).
layer(); |
| 267 LayoutObject& container3 = *document().getElementById("container3")->layoutO
bject(); |
| 268 DeprecatedPaintLayer& container3Layer = *toLayoutBoxModelObject(container3).
layer(); |
| 269 |
| 270 document().view()->updateAllLifecyclePhases(LayoutRect(0, 0, 400, 300)); |
| 271 |
| 272 // Container1 is fully in the interest rect; |
| 273 // Container2 is partly (including its stacking chidren) in the interest rec
t; |
| 274 // Content2 is out of the interest rect and output nothing; |
| 275 // Container3 is fully in the interest rect. |
| 276 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 14, |
| 277 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), |
| 278 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), |
| 279 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), |
| 280 TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence), |
| 281 TestDisplayItem(container1, DisplayItem::BoxDecorationBackground), |
| 282 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 283 TestDisplayItem(container2Layer, DisplayItem::BeginSubsequence), |
| 284 TestDisplayItem(container2, DisplayItem::BoxDecorationBackground), |
| 285 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
| 286 TestDisplayItem(container3Layer, DisplayItem::BeginSubsequence), |
| 287 TestDisplayItem(container3, DisplayItem::BoxDecorationBackground), |
| 288 TestDisplayItem(container3Layer, DisplayItem::EndSubsequence), |
| 289 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), |
| 290 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
| 291 |
| 292 // Container1 becomes partly in the interest rect, but uses cached subsequen
ce |
| 293 // because it was fully painted before; |
| 294 // Container2's intersection with the interest rect changes; |
| 295 // Content2 is out of the interest rect and outputs nothing; |
| 296 // Container3 becomes out of the interest rect and outputs nothing. |
| 297 updateLifecyclePhasesToPaintForSlimmingPaintV2Clean(LayoutRect(0, 100, 300,
300)); |
| 298 |
| 299 EXPECT_DISPLAY_LIST_WITH_CACHED_RED_FILL_IN_DEBUG(rootDisplayItemList().newD
isplayItems(), 9, |
| 300 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), |
| 301 TestDisplayItem(layoutView(), DisplayItem::drawingTypeToCachedDrawingTyp
e(DisplayItem::BoxDecorationBackground)), |
| 302 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), |
| 303 TestDisplayItem(container1Layer, DisplayItem::CachedSubsequence), |
| 304 TestDisplayItem(container2Layer, DisplayItem::BeginSubsequence), |
| 305 TestDisplayItem(container2, DisplayItem::drawingTypeToCachedDrawingType(
DisplayItem::BoxDecorationBackground)), |
| 306 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
| 307 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), |
| 308 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
| 309 |
| 310 compositeForSlimmingPaintV2(); |
| 311 |
| 312 EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItem
s(), 11, |
| 313 TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence), |
| 314 TestDisplayItem(layoutView(), DisplayItem::BoxDecorationBackground), |
| 315 TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence), |
| 316 TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence), |
| 317 TestDisplayItem(container1, DisplayItem::BoxDecorationBackground), |
| 318 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
| 319 TestDisplayItem(container2Layer, DisplayItem::BeginSubsequence), |
| 320 TestDisplayItem(container2, DisplayItem::BoxDecorationBackground), |
| 321 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
| 322 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence), |
| 323 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
210 } | 324 } |
211 | 325 |
212 } // namespace blink | 326 } // namespace blink |
OLD | NEW |