OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/LayoutTestHelper.h" | 5 #include "core/layout/LayoutTestHelper.h" |
6 #include "core/layout/LayoutTreeAsText.h" | 6 #include "core/layout/LayoutTreeAsText.h" |
7 #include "core/layout/api/LayoutViewItem.h" | 7 #include "core/layout/api/LayoutViewItem.h" |
8 #include "core/paint/ObjectPaintProperties.h" | 8 #include "core/paint/ObjectPaintProperties.h" |
9 #include "core/paint/PaintLayer.h" | 9 #include "core/paint/PaintLayer.h" |
10 #include "core/paint/PaintPropertyTreePrinter.h" | 10 #include "core/paint/PaintPropertyTreePrinter.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 TEST_P(PrePaintTreeWalkTest, ClipRects) { | 283 TEST_P(PrePaintTreeWalkTest, ClipRects) { |
284 SetBodyInnerHTML( | 284 SetBodyInnerHTML( |
285 "<div id='parent' style='isolation: isolate'>" | 285 "<div id='parent' style='isolation: isolate'>" |
286 " <div id='child' style='position: relative'>" | 286 " <div id='child' style='position: relative'>" |
287 " <div id='grandchild' style='isolation: isolate'>" | 287 " <div id='grandchild' style='isolation: isolate'>" |
288 " <div style='position: relative'></div>" | 288 " <div style='position: relative'></div>" |
289 " </div>" | 289 " </div>" |
290 " </div>" | 290 " </div>" |
291 "</div>"); | 291 "</div>"); |
292 | 292 |
293 auto* parent = GetPaintLayerByElementId("parent"); | 293 auto* parent = GetLayoutObjectByElementId("parent"); |
294 auto* child = GetPaintLayerByElementId("child"); | 294 auto* child = GetLayoutObjectByElementId("child"); |
295 auto* grandchild = GetPaintLayerByElementId("grandchild"); | 295 auto* grandchild = GetLayoutObjectByElementId("grandchild"); |
296 | 296 |
297 EXPECT_TRUE(parent->PreviousPaintingClipRects()); | 297 EXPECT_TRUE( |
298 EXPECT_FALSE(child->PreviousPaintingClipRects()); | 298 parent->GetMutableForPainting().FirstFragment()->PreviousClipRects()); |
299 EXPECT_TRUE(grandchild->PreviousPaintingClipRects()); | 299 EXPECT_FALSE(child->PaintProperties()); |
| 300 EXPECT_TRUE( |
| 301 grandchild->GetMutableForPainting().FirstFragment()->PreviousClipRects()); |
300 | 302 |
301 grandchild->ClearPreviousPaintingClipRects(); | 303 PrePaintTreeWalk::ClearPreviousClipRectsForTesting(*grandchild); |
302 GetDocument().View()->UpdateAllLifecyclePhases(); | 304 GetDocument().View()->UpdateAllLifecyclePhases(); |
303 // Still no rects, because the walk early-outed at the LayoutView. | 305 // Still no rects, because the walk early-outed at the LayoutView. |
304 EXPECT_FALSE(grandchild->PreviousPaintingClipRects()); | 306 EXPECT_FALSE( |
| 307 grandchild->GetMutableForPainting().FirstFragment()->PreviousClipRects()); |
305 | 308 |
306 grandchild->GetLayoutObject().SetNeedsPaintPropertyUpdate(); | 309 grandchild->SetNeedsPaintPropertyUpdate(); |
307 GetDocument().View()->UpdateAllLifecyclePhases(); | 310 GetDocument().View()->UpdateAllLifecyclePhases(); |
308 EXPECT_TRUE(grandchild->PreviousPaintingClipRects()); | 311 EXPECT_TRUE( |
| 312 grandchild->GetMutableForPainting().FirstFragment()->PreviousClipRects()); |
309 } | 313 } |
310 | 314 |
311 TEST_P(PrePaintTreeWalkTest, VisualRectClipForceSubtree) { | 315 TEST_P(PrePaintTreeWalkTest, VisualRectClipForceSubtree) { |
312 SetBodyInnerHTML( | 316 SetBodyInnerHTML( |
313 "<style>" | 317 "<style>" |
314 " #parent { height: 75px; position: relative; width: 100px; }" | 318 " #parent { height: 75px; position: relative; width: 100px; }" |
315 "</style>" | 319 "</style>" |
316 "<div id='parent' style='height: 100px;'>" | 320 "<div id='parent' style='height: 100px;'>" |
317 " <div id='child' style='overflow: hidden; width: 100%; height: 100%; " | 321 " <div id='child' style='overflow: hidden; width: 100%; height: 100%; " |
318 " position: relative'>" | 322 " position: relative'>" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 auto* target = GetDocument().getElementById("target"); | 356 auto* target = GetDocument().getElementById("target"); |
353 auto* target_object = ToLayoutBoxModelObject(target->GetLayoutObject()); | 357 auto* target_object = ToLayoutBoxModelObject(target->GetLayoutObject()); |
354 target->setAttribute(HTMLNames::styleAttr, "border-radius: 5px"); | 358 target->setAttribute(HTMLNames::styleAttr, "border-radius: 5px"); |
355 GetDocument().View()->UpdateAllLifecyclePhasesExceptPaint(); | 359 GetDocument().View()->UpdateAllLifecyclePhasesExceptPaint(); |
356 EXPECT_TRUE(target_object->Layer()->NeedsRepaint()); | 360 EXPECT_TRUE(target_object->Layer()->NeedsRepaint()); |
357 // And should not trigger any assert failure. | 361 // And should not trigger any assert failure. |
358 GetDocument().View()->UpdateAllLifecyclePhases(); | 362 GetDocument().View()->UpdateAllLifecyclePhases(); |
359 } | 363 } |
360 | 364 |
361 } // namespace blink | 365 } // namespace blink |
OLD | NEW |