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/paint/PaintLayerClipper.h" | 5 #include "core/paint/PaintLayerClipper.h" |
6 | 6 |
7 #include "core/layout/LayoutBoxModelObject.h" | 7 #include "core/layout/LayoutBoxModelObject.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 "core/paint/PaintLayer.h" | 10 #include "core/paint/PaintLayer.h" |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 LayoutRect layer_bounds(infinite_rect); | 505 LayoutRect layer_bounds(infinite_rect); |
506 ClipRect background_rect(infinite_rect); | 506 ClipRect background_rect(infinite_rect); |
507 ClipRect foreground_rect(infinite_rect); | 507 ClipRect foreground_rect(infinite_rect); |
508 target->Clipper(option).CalculateRects(context, infinite_rect, layer_bounds, | 508 target->Clipper(option).CalculateRects(context, infinite_rect, layer_bounds, |
509 background_rect, foreground_rect); | 509 background_rect, foreground_rect); |
510 | 510 |
511 EXPECT_EQ(LayoutRect(-12, -9, 124, 224), background_rect.Rect()); | 511 EXPECT_EQ(LayoutRect(-12, -9, 124, 224), background_rect.Rect()); |
512 EXPECT_EQ(LayoutRect(0, 0, 100, 200), foreground_rect.Rect()); | 512 EXPECT_EQ(LayoutRect(0, 0, 100, 200), foreground_rect.Rect()); |
513 } | 513 } |
514 | 514 |
| 515 TEST_P(PaintLayerClipperTest, CalculateBackgroundClipRectRoot) { |
| 516 SetBodyInnerHTML( |
| 517 "<style>" |
| 518 " * { margin: 0 }" |
| 519 " #target { " |
| 520 " position: relative; " |
| 521 " overflow: hidden;" |
| 522 " width: 100px; height: 200px;" |
| 523 " }" |
| 524 "</style>" |
| 525 "<div id='target'></div>"); |
| 526 |
| 527 PaintLayer* target = |
| 528 ToLayoutBoxModelObject(GetLayoutObjectByElementId("target"))->Layer(); |
| 529 ClipRectsContext context(target, kUncachedClipRects); |
| 530 PaintLayer::GeometryMapperOption option = PaintLayer::kDoNotUseGeometryMapper; |
| 531 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
| 532 option = PaintLayer::kUseGeometryMapper; |
| 533 ClipRect output; |
| 534 |
| 535 target->Clipper(option).CalculateBackgroundClipRect(context, output); |
| 536 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { |
| 537 EXPECT_EQ(LayoutRect(FloatRect(LayoutRect::InfiniteIntRect())), |
| 538 output.Rect()); |
| 539 } else { |
| 540 EXPECT_EQ(LayoutRect(LayoutRect::InfiniteIntRect()), output.Rect()); |
| 541 } |
| 542 } |
| 543 |
515 } // namespace blink | 544 } // namespace blink |
OLD | NEW |