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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Computed infinite clip rects may not match LayoutRect::InfiniteIntRect() | 515 // Computed infinite clip rects may not match LayoutRect::InfiniteIntRect() |
516 // due to floating point errors. | 516 // due to floating point errors. |
517 static bool IsInfinite(const LayoutRect& rect) { | 517 static bool IsInfinite(const LayoutRect& rect) { |
518 return rect.X().Round() < -10000000 && rect.MaxX().Round() > 10000000 | 518 return rect.X().Round() < -10000000 && rect.MaxX().Round() > 10000000 && |
519 && rect.Y().Round() < -10000000 && rect.MaxY().Round() > 10000000; | 519 rect.Y().Round() < -10000000 && rect.MaxY().Round() > 10000000; |
520 } | 520 } |
521 | 521 |
522 TEST_P(PaintLayerClipperTest, IgnoreRootLayerClipWithCSSClip) { | 522 TEST_P(PaintLayerClipperTest, IgnoreRootLayerClipWithCSSClip) { |
523 SetBodyInnerHTML( | 523 SetBodyInnerHTML( |
524 "<style>" | 524 "<style>" |
525 " #root { " | 525 " #root { " |
526 " width: 400px; height: 400px;" | 526 " width: 400px; height: 400px;" |
527 " position: absolute; clip: rect(0, 50px, 100px, 0);" | 527 " position: absolute; clip: rect(0, 50px, 100px, 0);" |
528 " }" | 528 " }" |
529 " #target {" | 529 " #target {" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 ClipRect background_rect(infinite_rect); | 616 ClipRect background_rect(infinite_rect); |
617 ClipRect foreground_rect(infinite_rect); | 617 ClipRect foreground_rect(infinite_rect); |
618 target->Clipper(option).CalculateRects(context, infinite_rect, layer_bounds, | 618 target->Clipper(option).CalculateRects(context, infinite_rect, layer_bounds, |
619 background_rect, foreground_rect); | 619 background_rect, foreground_rect); |
620 | 620 |
621 EXPECT_TRUE(IsInfinite(background_rect.Rect())); | 621 EXPECT_TRUE(IsInfinite(background_rect.Rect())); |
622 EXPECT_TRUE(IsInfinite(foreground_rect.Rect())); | 622 EXPECT_TRUE(IsInfinite(foreground_rect.Rect())); |
623 } | 623 } |
624 | 624 |
625 } // namespace blink | 625 } // namespace blink |
OLD | NEW |