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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp

Issue 2751383003: Add 'WithoutGeometryChange' variants of paint invalidation flag setters (Closed)
Patch Set: - Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/LayoutObject.h" 5 #include "core/layout/LayoutObject.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/layout/LayoutTestHelper.h" 8 #include "core/layout/LayoutTestHelper.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "platform/json/JSONValues.h" 10 #include "platform/json/JSONValues.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 175
176 skipInfo = LayoutObject::AncestorSkipInfo(container); 176 skipInfo = LayoutObject::AncestorSkipInfo(container);
177 EXPECT_EQ(container, floating->container(&skipInfo)); 177 EXPECT_EQ(container, floating->container(&skipInfo));
178 EXPECT_FALSE(skipInfo.ancestorSkipped()); 178 EXPECT_FALSE(skipInfo.ancestorSkipped());
179 } 179 }
180 180
181 TEST_F(LayoutObjectTest, MutableForPaintingClearPaintFlags) { 181 TEST_F(LayoutObjectTest, MutableForPaintingClearPaintFlags) {
182 LayoutObject* object = document().body()->layoutObject(); 182 LayoutObject* object = document().body()->layoutObject();
183 object->setShouldDoFullPaintInvalidation(); 183 object->setShouldDoFullPaintInvalidation();
184 EXPECT_TRUE(object->shouldDoFullPaintInvalidation()); 184 EXPECT_TRUE(object->shouldDoFullPaintInvalidation());
185 object->m_bitfields.setChildShouldCheckForPaintInvalidation(true); 185 EXPECT_TRUE(object->needsPaintOffsetAndVisualRectUpdate());
186 EXPECT_TRUE(object->m_bitfields.childShouldCheckForPaintInvalidation());
187 object->setMayNeedPaintInvalidation(); 186 object->setMayNeedPaintInvalidation();
188 EXPECT_TRUE(object->mayNeedPaintInvalidation()); 187 EXPECT_TRUE(object->mayNeedPaintInvalidation());
189 object->setMayNeedPaintInvalidationSubtree(); 188 object->setMayNeedPaintInvalidationSubtree();
190 EXPECT_TRUE(object->mayNeedPaintInvalidationSubtree()); 189 EXPECT_TRUE(object->mayNeedPaintInvalidationSubtree());
191 object->setMayNeedPaintInvalidationAnimatedBackgroundImage(); 190 object->setMayNeedPaintInvalidationAnimatedBackgroundImage();
192 EXPECT_TRUE(object->mayNeedPaintInvalidationAnimatedBackgroundImage()); 191 EXPECT_TRUE(object->mayNeedPaintInvalidationAnimatedBackgroundImage());
193 object->setShouldInvalidateSelection(); 192 object->setShouldInvalidateSelection();
194 EXPECT_TRUE(object->shouldInvalidateSelection()); 193 EXPECT_TRUE(object->shouldInvalidateSelection());
195 object->setBackgroundChangedSinceLastPaintInvalidation(); 194 object->setBackgroundChangedSinceLastPaintInvalidation();
196 EXPECT_TRUE(object->backgroundChangedSinceLastPaintInvalidation()); 195 EXPECT_TRUE(object->backgroundChangedSinceLastPaintInvalidation());
197 object->setNeedsPaintPropertyUpdate(); 196 object->setNeedsPaintPropertyUpdate();
198 EXPECT_TRUE(object->needsPaintPropertyUpdate()); 197 EXPECT_TRUE(object->needsPaintPropertyUpdate());
199 object->m_bitfields.setDescendantNeedsPaintPropertyUpdate(true); 198 object->m_bitfields.setDescendantNeedsPaintPropertyUpdate(true);
200 EXPECT_TRUE(object->descendantNeedsPaintPropertyUpdate()); 199 EXPECT_TRUE(object->descendantNeedsPaintPropertyUpdate());
201 200
202 ScopedSlimmingPaintV2ForTest enableSPv2(true); 201 ScopedSlimmingPaintV2ForTest enableSPv2(true);
203 document().lifecycle().advanceTo(DocumentLifecycle::InPrePaint); 202 document().lifecycle().advanceTo(DocumentLifecycle::InPrePaint);
204 object->getMutableForPainting().clearPaintFlags(); 203 object->getMutableForPainting().clearPaintFlags();
205 204
206 EXPECT_FALSE(object->shouldDoFullPaintInvalidation()); 205 EXPECT_FALSE(object->shouldDoFullPaintInvalidation());
207 EXPECT_FALSE(object->m_bitfields.childShouldCheckForPaintInvalidation());
208 EXPECT_FALSE(object->mayNeedPaintInvalidation()); 206 EXPECT_FALSE(object->mayNeedPaintInvalidation());
209 EXPECT_FALSE(object->mayNeedPaintInvalidationSubtree()); 207 EXPECT_FALSE(object->mayNeedPaintInvalidationSubtree());
210 EXPECT_FALSE(object->mayNeedPaintInvalidationAnimatedBackgroundImage()); 208 EXPECT_FALSE(object->mayNeedPaintInvalidationAnimatedBackgroundImage());
211 EXPECT_FALSE(object->shouldInvalidateSelection()); 209 EXPECT_FALSE(object->shouldInvalidateSelection());
212 EXPECT_FALSE(object->backgroundChangedSinceLastPaintInvalidation()); 210 EXPECT_FALSE(object->backgroundChangedSinceLastPaintInvalidation());
213 EXPECT_FALSE(object->needsPaintPropertyUpdate()); 211 EXPECT_FALSE(object->needsPaintPropertyUpdate());
214 EXPECT_FALSE(object->descendantNeedsPaintPropertyUpdate()); 212 EXPECT_FALSE(object->descendantNeedsPaintPropertyUpdate());
215 } 213 }
216 214
215 TEST_F(LayoutObjectTest, NeedsPaintOffsetAndVisualRectUpdate) {
216 LayoutObject* object = document().body()->layoutObject();
217 LayoutObject* parent = object->parent();
218
219 object->setShouldDoFullPaintInvalidation();
220 EXPECT_TRUE(object->shouldDoFullPaintInvalidation());
221 EXPECT_TRUE(object->needsPaintOffsetAndVisualRectUpdate());
222 EXPECT_TRUE(parent->mayNeedPaintInvalidation());
223 EXPECT_TRUE(parent->needsPaintOffsetAndVisualRectUpdate());
224 object->clearPaintInvalidationFlags();
225 EXPECT_FALSE(object->shouldDoFullPaintInvalidation());
226 EXPECT_FALSE(object->needsPaintOffsetAndVisualRectUpdate());
227 parent->clearPaintInvalidationFlags();
228 EXPECT_FALSE(parent->mayNeedPaintInvalidation());
229 EXPECT_FALSE(parent->needsPaintOffsetAndVisualRectUpdate());
230
231 object->setMayNeedPaintInvalidation();
232 EXPECT_TRUE(object->mayNeedPaintInvalidation());
233 EXPECT_TRUE(object->needsPaintOffsetAndVisualRectUpdate());
234 EXPECT_TRUE(parent->mayNeedPaintInvalidation());
235 EXPECT_TRUE(parent->needsPaintOffsetAndVisualRectUpdate());
236 object->clearPaintInvalidationFlags();
237 EXPECT_FALSE(object->mayNeedPaintInvalidation());
238 EXPECT_FALSE(object->needsPaintOffsetAndVisualRectUpdate());
239 parent->clearPaintInvalidationFlags();
240 EXPECT_FALSE(parent->mayNeedPaintInvalidation());
241 EXPECT_FALSE(parent->needsPaintOffsetAndVisualRectUpdate());
242
243 object->setShouldDoFullPaintInvalidationWithoutGeometryChange();
244 EXPECT_TRUE(object->shouldDoFullPaintInvalidation());
245 EXPECT_FALSE(object->needsPaintOffsetAndVisualRectUpdate());
246 EXPECT_TRUE(parent->mayNeedPaintInvalidation());
247 EXPECT_FALSE(parent->needsPaintOffsetAndVisualRectUpdate());
248 object->setMayNeedPaintInvalidation();
249 EXPECT_TRUE(object->needsPaintOffsetAndVisualRectUpdate());
250 EXPECT_TRUE(parent->needsPaintOffsetAndVisualRectUpdate());
251 object->clearPaintInvalidationFlags();
252 EXPECT_FALSE(object->mayNeedPaintInvalidation());
253 EXPECT_FALSE(object->needsPaintOffsetAndVisualRectUpdate());
254 parent->clearPaintInvalidationFlags();
255 EXPECT_FALSE(parent->mayNeedPaintInvalidation());
256 EXPECT_FALSE(parent->needsPaintOffsetAndVisualRectUpdate());
257
258 object->setMayNeedPaintInvalidationWithoutGeometryChange();
259 EXPECT_TRUE(object->mayNeedPaintInvalidation());
260 EXPECT_FALSE(object->needsPaintOffsetAndVisualRectUpdate());
261 EXPECT_TRUE(parent->mayNeedPaintInvalidation());
262 EXPECT_FALSE(parent->needsPaintOffsetAndVisualRectUpdate());
263 object->setMayNeedPaintInvalidation();
264 EXPECT_TRUE(object->needsPaintOffsetAndVisualRectUpdate());
265 EXPECT_TRUE(parent->needsPaintOffsetAndVisualRectUpdate());
266 object->clearPaintInvalidationFlags();
267 EXPECT_FALSE(object->mayNeedPaintInvalidation());
268 EXPECT_FALSE(object->needsPaintOffsetAndVisualRectUpdate());
269 parent->clearPaintInvalidationFlags();
270 EXPECT_FALSE(parent->mayNeedPaintInvalidation());
271 EXPECT_FALSE(parent->needsPaintOffsetAndVisualRectUpdate());
272 }
273
217 } // namespace blink 274 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698