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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 LayoutRect layerBounds(infiniteRect); | 475 LayoutRect layerBounds(infiniteRect); |
476 ClipRect backgroundRect(infiniteRect); | 476 ClipRect backgroundRect(infiniteRect); |
477 ClipRect foregroundRect(infiniteRect); | 477 ClipRect foregroundRect(infiniteRect); |
478 target->clipper(option).calculateRects(context, infiniteRect, layerBounds, | 478 target->clipper(option).calculateRects(context, infiniteRect, layerBounds, |
479 backgroundRect, foregroundRect); | 479 backgroundRect, foregroundRect); |
480 | 480 |
481 EXPECT_EQ(LayoutRect(0, 0, 50, 100), backgroundRect.rect()); | 481 EXPECT_EQ(LayoutRect(0, 0, 50, 100), backgroundRect.rect()); |
482 EXPECT_EQ(LayoutRect(0, 0, 50, 100), foregroundRect.rect()); | 482 EXPECT_EQ(LayoutRect(0, 0, 50, 100), foregroundRect.rect()); |
483 } | 483 } |
484 | 484 |
| 485 TEST_P(PaintLayerClipperTest, Filter) { |
| 486 setBodyInnerHTML( |
| 487 "<style>" |
| 488 " * { margin: 0 }" |
| 489 " #target { " |
| 490 " filter: drop-shadow(0 3px 4px #333); overflow: hidden;" |
| 491 " width: 100px; height: 200px;" |
| 492 " }" |
| 493 "</style>" |
| 494 "<div id='target'></div>"); |
| 495 |
| 496 PaintLayer* target = |
| 497 toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer(); |
| 498 ClipRectsContext context(target, UncachedClipRects); |
| 499 PaintLayer::GeometryMapperOption option = PaintLayer::DoNotUseGeometryMapper; |
| 500 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
| 501 option = PaintLayer::UseGeometryMapper; |
| 502 LayoutRect infiniteRect(LayoutRect::infiniteIntRect()); |
| 503 LayoutRect layerBounds(infiniteRect); |
| 504 ClipRect backgroundRect(infiniteRect); |
| 505 ClipRect foregroundRect(infiniteRect); |
| 506 target->clipper(option).calculateRects(context, infiniteRect, layerBounds, |
| 507 backgroundRect, foregroundRect); |
| 508 |
| 509 EXPECT_EQ(LayoutRect(-12, -9, 124, 224), backgroundRect.rect()); |
| 510 EXPECT_EQ(LayoutRect(0, 0, 100, 200), foregroundRect.rect()); |
| 511 } |
| 512 |
485 } // namespace blink | 513 } // namespace blink |
OLD | NEW |