OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/LayoutView.h" | 6 #include "core/layout/LayoutView.h" |
7 #include "core/layout/PaintInvalidationState.h" | 7 #include "core/layout/PaintInvalidationState.h" |
8 #include "core/paint/PaintLayer.h" | 8 #include "core/paint/PaintLayer.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target")); | 667 LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target")); |
668 | 668 |
669 LayoutRect targetLocalVisualRect = target->localVisualRect(); | 669 LayoutRect targetLocalVisualRect = target->localVisualRect(); |
670 EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetLocalVisualRect); | 670 EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetLocalVisualRect); |
671 LayoutRect rect = targetLocalVisualRect; | 671 LayoutRect rect = targetLocalVisualRect; |
672 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); | 672 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
673 EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); | 673 EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); |
674 EXPECT_EQ(rect, target->visualRect()); | 674 EXPECT_EQ(rect, target->visualRect()); |
675 } | 675 } |
676 | 676 |
| 677 TEST_F(VisualRectMappingTest, FloatUnderInline) { |
| 678 setBodyInnerHTML( |
| 679 "<div style='position: absolute; top: 55px; left: 66px'>" |
| 680 " <span id='span' style='position: relative; top: 100px; left: 200px'>" |
| 681 " <div id='target' style='float: left; width: 33px; height: 44px'>" |
| 682 " </div>" |
| 683 " </span>" |
| 684 "</div>"); |
| 685 |
| 686 LayoutBoxModelObject* span = |
| 687 toLayoutBoxModelObject(getLayoutObjectByElementId("span")); |
| 688 LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target")); |
| 689 |
| 690 LayoutRect targetVisualRect = target->localVisualRect(); |
| 691 EXPECT_EQ(LayoutRect(0, 0, 33, 44), targetVisualRect); |
| 692 |
| 693 LayoutRect rect = targetVisualRect; |
| 694 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
| 695 EXPECT_EQ(LayoutRect(66, 55, 33, 44), rect); |
| 696 EXPECT_EQ(rect, target->visualRect()); |
| 697 |
| 698 rect = targetVisualRect; |
| 699 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(span, rect)); |
| 700 EXPECT_EQ(LayoutRect(-200, -100, 33, 44), rect); |
| 701 } |
| 702 |
677 } // namespace blink | 703 } // namespace blink |
OLD | NEW |