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(parent->GetMutableForPainting() |
298 EXPECT_FALSE(child->PreviousPaintingClipRects()); | 298 .FirstFragment() |
299 EXPECT_TRUE(grandchild->PreviousPaintingClipRects()); | 299 ->PreviousPaintingClipRects()); |
| 300 EXPECT_FALSE(child->PaintProperties()); |
| 301 EXPECT_TRUE(grandchild->GetMutableForPainting() |
| 302 .FirstFragment() |
| 303 ->PreviousPaintingClipRects()); |
300 | 304 |
301 grandchild->ClearPreviousPaintingClipRects(); | 305 PrePaintTreeWalk::ClearPreviousPaintingClipRectsForTesting(*grandchild); |
302 GetDocument().View()->UpdateAllLifecyclePhases(); | 306 GetDocument().View()->UpdateAllLifecyclePhases(); |
303 // Still no rects, because the walk early-outed at the LayoutView. | 307 // Still no rects, because the walk early-outed at the LayoutView. |
304 EXPECT_FALSE(grandchild->PreviousPaintingClipRects()); | 308 EXPECT_FALSE(grandchild->GetMutableForPainting() |
| 309 .FirstFragment() |
| 310 ->PreviousPaintingClipRects()); |
305 | 311 |
306 grandchild->GetLayoutObject().SetNeedsPaintPropertyUpdate(); | 312 grandchild->SetNeedsPaintPropertyUpdate(); |
307 GetDocument().View()->UpdateAllLifecyclePhases(); | 313 GetDocument().View()->UpdateAllLifecyclePhases(); |
308 EXPECT_TRUE(grandchild->PreviousPaintingClipRects()); | 314 EXPECT_TRUE(grandchild->GetMutableForPainting() |
| 315 .FirstFragment() |
| 316 ->PreviousPaintingClipRects()); |
309 } | 317 } |
310 | 318 |
311 TEST_P(PrePaintTreeWalkTest, VisualRectClipForceSubtree) { | 319 TEST_P(PrePaintTreeWalkTest, VisualRectClipForceSubtree) { |
312 SetBodyInnerHTML( | 320 SetBodyInnerHTML( |
313 "<style>" | 321 "<style>" |
314 " #parent { height: 75px; position: relative; width: 100px; }" | 322 " #parent { height: 75px; position: relative; width: 100px; }" |
315 "</style>" | 323 "</style>" |
316 "<div id='parent' style='height: 100px;'>" | 324 "<div id='parent' style='height: 100px;'>" |
317 " <div id='child' style='overflow: hidden; width: 100%; height: 100%; " | 325 " <div id='child' style='overflow: hidden; width: 100%; height: 100%; " |
318 " position: relative'>" | 326 " position: relative'>" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 auto* target = GetDocument().getElementById("target"); | 360 auto* target = GetDocument().getElementById("target"); |
353 auto* target_object = ToLayoutBoxModelObject(target->GetLayoutObject()); | 361 auto* target_object = ToLayoutBoxModelObject(target->GetLayoutObject()); |
354 target->setAttribute(HTMLNames::styleAttr, "border-radius: 5px"); | 362 target->setAttribute(HTMLNames::styleAttr, "border-radius: 5px"); |
355 GetDocument().View()->UpdateAllLifecyclePhasesExceptPaint(); | 363 GetDocument().View()->UpdateAllLifecyclePhasesExceptPaint(); |
356 EXPECT_TRUE(target_object->Layer()->NeedsRepaint()); | 364 EXPECT_TRUE(target_object->Layer()->NeedsRepaint()); |
357 // And should not trigger any assert failure. | 365 // And should not trigger any assert failure. |
358 GetDocument().View()->UpdateAllLifecyclePhases(); | 366 GetDocument().View()->UpdateAllLifecyclePhases(); |
359 } | 367 } |
360 | 368 |
361 } // namespace blink | 369 } // namespace blink |
OLD | NEW |