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

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

Issue 1540443003: Fix LayoutObject::mapToVisibleRectInContainerSpace() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 "config.h" 5 #include "config.h"
6 #include "core/layout/LayoutObject.h" 6 #include "core/layout/LayoutObject.h"
7 7
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 "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 LayoutObject* layoutObject = bodyLayoutObject->slowFirstChild()->slowFirstCh ild(); 100 LayoutObject* layoutObject = bodyLayoutObject->slowFirstChild()->slowFirstCh ild();
101 101
102 // Sanity check: Make sure we don't generate anonymous objects. 102 // Sanity check: Make sure we don't generate anonymous objects.
103 EXPECT_EQ(nullptr, bodyLayoutObject->slowFirstChild()->nextSibling()); 103 EXPECT_EQ(nullptr, bodyLayoutObject->slowFirstChild()->nextSibling());
104 EXPECT_EQ(nullptr, layoutObject->slowFirstChild()); 104 EXPECT_EQ(nullptr, layoutObject->slowFirstChild());
105 EXPECT_EQ(nullptr, layoutObject->nextSibling()); 105 EXPECT_EQ(nullptr, layoutObject->nextSibling());
106 106
107 EXPECT_EQ(layoutObject->containingBlock(), bodyLayoutObject); 107 EXPECT_EQ(layoutObject->containingBlock(), bodyLayoutObject);
108 } 108 }
109 109
110 TEST_F(LayoutObjectTest, MapToVisibleRectInContainerSpace)
111 {
112 setBodyInnerHTML(
113 "<div id='container' style='overflow: scroll; will-change: transform; wi dth: 50px; height: 50px'>"
114 " <span><img style='width: 20px; height: 100px'></span>"
115 " text text text text text text text"
116 "</div>");
117 LayoutBlock* container = toLayoutBlock(document().getElementById("container" )->layoutObject());
118 LayoutText* text = toLayoutText(container->lastChild());
119
120 container->setScrollTop(50);
121 LayoutRect rect(0, 60, 20, 20);
122 text->mapToVisibleRectInContainerSpace(container, rect, nullptr);
123 EXPECT_TRUE(rect == LayoutRect(0, 10, 20, 20));
124 }
125
110 } 126 }
111 127
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698