Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/WebKit/Source/core/layout/VisualRectMappingTest.cpp

Issue 2642763009: Fix paint and rect mapping issues for stacked float under stacked inline (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 LayoutRect rect = targetVisualRect; 693 LayoutRect rect = targetVisualRect;
694 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); 694 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect));
695 EXPECT_EQ(LayoutRect(66, 55, 33, 44), rect); 695 EXPECT_EQ(LayoutRect(66, 55, 33, 44), rect);
696 EXPECT_EQ(rect, target->visualRect()); 696 EXPECT_EQ(rect, target->visualRect());
697 697
698 rect = targetVisualRect; 698 rect = targetVisualRect;
699 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(span, rect)); 699 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(span, rect));
700 EXPECT_EQ(LayoutRect(-200, -100, 33, 44), rect); 700 EXPECT_EQ(LayoutRect(-200, -100, 33, 44), rect);
701 } 701 }
702 702
703 TEST_F(VisualRectMappingTest, StackedFloatUnderStackedInline) {
704 setBodyInnerHTML(
705 "<div style='position: absolute; top: 55px; left: 66px'>"
706 " <span id='span' style='position: relative; top: 100px; left: 200px'>"
707 " <div id='target' style='float: left; position: relative; "
708 " top: 11px; left: 22px; width: 33px; height: 44px'>"
709 " </div>"
710 " </span>"
711 "</div>");
712
713 LayoutBoxModelObject* span =
714 toLayoutBoxModelObject(getLayoutObjectByElementId("span"));
715 LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target"));
716
717 LayoutRect targetVisualRect = target->localVisualRect();
718 EXPECT_EQ(LayoutRect(0, 0, 33, 44), targetVisualRect);
719
720 LayoutRect rect = targetVisualRect;
721 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect));
722 // Includes all offsets.
723 EXPECT_EQ(LayoutRect(288, 166, 33, 44), rect);
724 EXPECT_EQ(rect, target->visualRect());
725
726 rect = targetVisualRect;
727 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(span, rect));
728 // Includes offset of floating.
729 EXPECT_EQ(LayoutRect(22, 11, 33, 44), rect);
730 }
731
703 } // namespace blink 732 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698