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

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

Issue 2831203002: Fix LayoutObject::SetSubtreeNeedsPaintPropertyUpdate() to set ancestor flags (Closed)
Patch Set: Created 3 years, 8 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/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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 object->SetMayNeedPaintInvalidationSubtree(); 191 object->SetMayNeedPaintInvalidationSubtree();
192 EXPECT_TRUE(object->MayNeedPaintInvalidationSubtree()); 192 EXPECT_TRUE(object->MayNeedPaintInvalidationSubtree());
193 object->SetMayNeedPaintInvalidationAnimatedBackgroundImage(); 193 object->SetMayNeedPaintInvalidationAnimatedBackgroundImage();
194 EXPECT_TRUE(object->MayNeedPaintInvalidationAnimatedBackgroundImage()); 194 EXPECT_TRUE(object->MayNeedPaintInvalidationAnimatedBackgroundImage());
195 object->SetShouldInvalidateSelection(); 195 object->SetShouldInvalidateSelection();
196 EXPECT_TRUE(object->ShouldInvalidateSelection()); 196 EXPECT_TRUE(object->ShouldInvalidateSelection());
197 object->SetBackgroundChangedSinceLastPaintInvalidation(); 197 object->SetBackgroundChangedSinceLastPaintInvalidation();
198 EXPECT_TRUE(object->BackgroundChangedSinceLastPaintInvalidation()); 198 EXPECT_TRUE(object->BackgroundChangedSinceLastPaintInvalidation());
199 object->SetNeedsPaintPropertyUpdate(); 199 object->SetNeedsPaintPropertyUpdate();
200 EXPECT_TRUE(object->NeedsPaintPropertyUpdate()); 200 EXPECT_TRUE(object->NeedsPaintPropertyUpdate());
201 EXPECT_TRUE(object->Parent()->DescendantNeedsPaintPropertyUpdate());
201 object->bitfields_.SetDescendantNeedsPaintPropertyUpdate(true); 202 object->bitfields_.SetDescendantNeedsPaintPropertyUpdate(true);
202 EXPECT_TRUE(object->DescendantNeedsPaintPropertyUpdate()); 203 EXPECT_TRUE(object->DescendantNeedsPaintPropertyUpdate());
203 204
204 ScopedSlimmingPaintV2ForTest enable_s_pv2(true); 205 ScopedSlimmingPaintInvalidationForTest enable_sp_invalidation(true);
205 GetDocument().Lifecycle().AdvanceTo(DocumentLifecycle::kInPrePaint); 206 GetDocument().Lifecycle().AdvanceTo(DocumentLifecycle::kInPrePaint);
206 object->GetMutableForPainting().ClearPaintFlags(); 207 object->GetMutableForPainting().ClearPaintFlags();
207 208
208 EXPECT_FALSE(object->ShouldDoFullPaintInvalidation()); 209 EXPECT_FALSE(object->ShouldDoFullPaintInvalidation());
209 EXPECT_FALSE(object->MayNeedPaintInvalidation()); 210 EXPECT_FALSE(object->MayNeedPaintInvalidation());
210 EXPECT_FALSE(object->MayNeedPaintInvalidationSubtree()); 211 EXPECT_FALSE(object->MayNeedPaintInvalidationSubtree());
211 EXPECT_FALSE(object->MayNeedPaintInvalidationAnimatedBackgroundImage()); 212 EXPECT_FALSE(object->MayNeedPaintInvalidationAnimatedBackgroundImage());
212 EXPECT_FALSE(object->ShouldInvalidateSelection()); 213 EXPECT_FALSE(object->ShouldInvalidateSelection());
213 EXPECT_FALSE(object->BackgroundChangedSinceLastPaintInvalidation()); 214 EXPECT_FALSE(object->BackgroundChangedSinceLastPaintInvalidation());
214 EXPECT_FALSE(object->NeedsPaintPropertyUpdate()); 215 EXPECT_FALSE(object->NeedsPaintPropertyUpdate());
215 EXPECT_FALSE(object->DescendantNeedsPaintPropertyUpdate()); 216 EXPECT_FALSE(object->DescendantNeedsPaintPropertyUpdate());
216 } 217 }
217 218
219 TEST_F(LayoutObjectTest, SubtreeNeedsPaintPropertyUpdate) {
220 LayoutObject* object = GetDocument().body()->GetLayoutObject();
221 object->SetSubtreeNeedsPaintPropertyUpdate();
222 EXPECT_TRUE(object->SubtreeNeedsPaintPropertyUpdate());
223 EXPECT_TRUE(object->NeedsPaintPropertyUpdate());
224 EXPECT_TRUE(object->Parent()->DescendantNeedsPaintPropertyUpdate());
225
226 ScopedSlimmingPaintInvalidationForTest enable_sp_invalidation(true);
227 GetDocument().Lifecycle().AdvanceTo(DocumentLifecycle::kInPrePaint);
228 object->GetMutableForPainting().ClearPaintFlags();
229
230 EXPECT_FALSE(object->SubtreeNeedsPaintPropertyUpdate());
231 EXPECT_FALSE(object->NeedsPaintPropertyUpdate());
232 }
233
218 TEST_F(LayoutObjectTest, NeedsPaintOffsetAndVisualRectUpdate) { 234 TEST_F(LayoutObjectTest, NeedsPaintOffsetAndVisualRectUpdate) {
219 LayoutObject* object = GetDocument().body()->GetLayoutObject(); 235 LayoutObject* object = GetDocument().body()->GetLayoutObject();
220 LayoutObject* parent = object->Parent(); 236 LayoutObject* parent = object->Parent();
221 237
222 object->SetShouldDoFullPaintInvalidation(); 238 object->SetShouldDoFullPaintInvalidation();
223 EXPECT_TRUE(object->ShouldDoFullPaintInvalidation()); 239 EXPECT_TRUE(object->ShouldDoFullPaintInvalidation());
224 EXPECT_TRUE(object->NeedsPaintOffsetAndVisualRectUpdate()); 240 EXPECT_TRUE(object->NeedsPaintOffsetAndVisualRectUpdate());
225 EXPECT_TRUE(parent->MayNeedPaintInvalidation()); 241 EXPECT_TRUE(parent->MayNeedPaintInvalidation());
226 EXPECT_TRUE(parent->NeedsPaintOffsetAndVisualRectUpdate()); 242 EXPECT_TRUE(parent->NeedsPaintOffsetAndVisualRectUpdate());
227 object->ClearPaintInvalidationFlags(); 243 object->ClearPaintInvalidationFlags();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 EXPECT_TRUE(parent->NeedsPaintOffsetAndVisualRectUpdate()); 284 EXPECT_TRUE(parent->NeedsPaintOffsetAndVisualRectUpdate());
269 object->ClearPaintInvalidationFlags(); 285 object->ClearPaintInvalidationFlags();
270 EXPECT_FALSE(object->MayNeedPaintInvalidation()); 286 EXPECT_FALSE(object->MayNeedPaintInvalidation());
271 EXPECT_FALSE(object->NeedsPaintOffsetAndVisualRectUpdate()); 287 EXPECT_FALSE(object->NeedsPaintOffsetAndVisualRectUpdate());
272 parent->ClearPaintInvalidationFlags(); 288 parent->ClearPaintInvalidationFlags();
273 EXPECT_FALSE(parent->MayNeedPaintInvalidation()); 289 EXPECT_FALSE(parent->MayNeedPaintInvalidation());
274 EXPECT_FALSE(parent->NeedsPaintOffsetAndVisualRectUpdate()); 290 EXPECT_FALSE(parent->NeedsPaintOffsetAndVisualRectUpdate());
275 } 291 }
276 292
277 } // namespace blink 293 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698