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

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

Issue 2394263004: Reformat comments in core/layout up until LayoutMultiColumnFlowThread (Closed)
Patch Set: Rebase w/HEAD Created 4 years, 2 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 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/layout/LayoutBoxModelObject.h" 5 #include "core/layout/LayoutBoxModelObject.h"
6 6
7 #include "core/html/HTMLElement.h" 7 #include "core/html/HTMLElement.h"
8 #include "core/layout/ImageQualityController.h" 8 #include "core/layout/ImageQualityController.h"
9 #include "core/layout/LayoutTestHelper.h" 9 #include "core/layout/LayoutTestHelper.h"
10 #include "core/page/scrolling/StickyPositionScrollingConstraints.h" 10 #include "core/page/scrolling/StickyPositionScrollingConstraints.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 ASSERT_EQ(50.0, scrollableArea->scrollPosition().y()); 47 ASSERT_EQ(50.0, scrollableArea->scrollPosition().y());
48 LayoutBoxModelObject* sticky = 48 LayoutBoxModelObject* sticky =
49 toLayoutBoxModelObject(getLayoutObjectByElementId("sticky")); 49 toLayoutBoxModelObject(getLayoutObjectByElementId("sticky"));
50 sticky->updateStickyPositionConstraints(); 50 sticky->updateStickyPositionConstraints();
51 ASSERT_EQ(scroller->layer(), sticky->layer()->ancestorOverflowLayer()); 51 ASSERT_EQ(scroller->layer(), sticky->layer()->ancestorOverflowLayer());
52 52
53 const StickyPositionScrollingConstraints& constraints = 53 const StickyPositionScrollingConstraints& constraints =
54 scrollableArea->stickyConstraintsMap().get(sticky->layer()); 54 scrollableArea->stickyConstraintsMap().get(sticky->layer());
55 ASSERT_EQ(0.f, constraints.topOffset()); 55 ASSERT_EQ(0.f, constraints.topOffset());
56 56
57 // The coordinates of the constraint rects should all be with respect to the u nscrolled scroller. 57 // The coordinates of the constraint rects should all be with respect to the
58 // unscrolled scroller.
58 ASSERT_EQ(IntRect(15, 115, 170, 370), 59 ASSERT_EQ(IntRect(15, 115, 170, 370),
59 enclosingIntRect( 60 enclosingIntRect(
60 getScrollContainerRelativeContainingBlockRect(constraints))); 61 getScrollContainerRelativeContainingBlockRect(constraints)));
61 ASSERT_EQ( 62 ASSERT_EQ(
62 IntRect(15, 115, 100, 100), 63 IntRect(15, 115, 100, 100),
63 enclosingIntRect(getScrollContainerRelativeStickyBoxRect(constraints))); 64 enclosingIntRect(getScrollContainerRelativeStickyBoxRect(constraints)));
64 } 65 }
65 66
66 // Verifies that the sticky constraints are not affected by transforms 67 // Verifies that the sticky constraints are not affected by transforms
67 TEST_F(LayoutBoxModelObjectTest, StickyPositionTransforms) { 68 TEST_F(LayoutBoxModelObjectTest, StickyPositionTransforms) {
(...skipping 16 matching lines...) Expand all
84 ASSERT_EQ(50.0, scrollableArea->scrollPosition().y()); 85 ASSERT_EQ(50.0, scrollableArea->scrollPosition().y());
85 LayoutBoxModelObject* sticky = 86 LayoutBoxModelObject* sticky =
86 toLayoutBoxModelObject(getLayoutObjectByElementId("sticky")); 87 toLayoutBoxModelObject(getLayoutObjectByElementId("sticky"));
87 sticky->updateStickyPositionConstraints(); 88 sticky->updateStickyPositionConstraints();
88 ASSERT_EQ(scroller->layer(), sticky->layer()->ancestorOverflowLayer()); 89 ASSERT_EQ(scroller->layer(), sticky->layer()->ancestorOverflowLayer());
89 90
90 const StickyPositionScrollingConstraints& constraints = 91 const StickyPositionScrollingConstraints& constraints =
91 scrollableArea->stickyConstraintsMap().get(sticky->layer()); 92 scrollableArea->stickyConstraintsMap().get(sticky->layer());
92 ASSERT_EQ(0.f, constraints.topOffset()); 93 ASSERT_EQ(0.f, constraints.topOffset());
93 94
94 // The coordinates of the constraint rects should all be with respect to the u nscrolled scroller. 95 // The coordinates of the constraint rects should all be with respect to the
96 // unscrolled scroller.
95 ASSERT_EQ(IntRect(15, 115, 170, 370), 97 ASSERT_EQ(IntRect(15, 115, 170, 370),
96 enclosingIntRect( 98 enclosingIntRect(
97 getScrollContainerRelativeContainingBlockRect(constraints))); 99 getScrollContainerRelativeContainingBlockRect(constraints)));
98 ASSERT_EQ( 100 ASSERT_EQ(
99 IntRect(15, 115, 100, 100), 101 IntRect(15, 115, 100, 100),
100 enclosingIntRect(getScrollContainerRelativeStickyBoxRect(constraints))); 102 enclosingIntRect(getScrollContainerRelativeStickyBoxRect(constraints)));
101 } 103 }
102 104
103 // Verifies that the sticky constraints are correctly computed. 105 // Verifies that the sticky constraints are correctly computed.
104 TEST_F(LayoutBoxModelObjectTest, StickyPositionPercentageStyles) { 106 TEST_F(LayoutBoxModelObjectTest, StickyPositionPercentageStyles) {
(...skipping 23 matching lines...) Expand all
128 ASSERT_EQ(0.f, constraints.topOffset()); 130 ASSERT_EQ(0.f, constraints.topOffset());
129 131
130 ASSERT_EQ(IntRect(25, 145, 200, 330), 132 ASSERT_EQ(IntRect(25, 145, 200, 330),
131 enclosingIntRect( 133 enclosingIntRect(
132 getScrollContainerRelativeContainingBlockRect(constraints))); 134 getScrollContainerRelativeContainingBlockRect(constraints)));
133 ASSERT_EQ( 135 ASSERT_EQ(
134 IntRect(25, 145, 100, 100), 136 IntRect(25, 145, 100, 100),
135 enclosingIntRect(getScrollContainerRelativeStickyBoxRect(constraints))); 137 enclosingIntRect(getScrollContainerRelativeStickyBoxRect(constraints)));
136 } 138 }
137 139
138 // Verifies that the sticky constraints are correct when the sticky position con tainer is also 140 // Verifies that the sticky constraints are correct when the sticky position
139 // the ancestor scroller. 141 // container is also the ancestor scroller.
140 TEST_F(LayoutBoxModelObjectTest, StickyPositionContainerIsScroller) { 142 TEST_F(LayoutBoxModelObjectTest, StickyPositionContainerIsScroller) {
141 setBodyInnerHTML( 143 setBodyInnerHTML(
142 "<style>#sticky { position: sticky; top: 0; width: 100px; height: 100px; " 144 "<style>#sticky { position: sticky; top: 0; width: 100px; height: 100px; "
143 "}" 145 "}"
144 "#scroller { height: 100px; width: 400px; overflow: auto; position: " 146 "#scroller { height: 100px; width: 400px; overflow: auto; position: "
145 "relative; top: 200px; }" 147 "relative; top: 200px; }"
146 ".spacer { height: 1000px; }</style>" 148 ".spacer { height: 1000px; }</style>"
147 "<div id='scroller'><div id='sticky'></div><div " 149 "<div id='scroller'><div id='sticky'></div><div "
148 "class='spacer'></div></div>"); 150 "class='spacer'></div></div>");
149 LayoutBoxModelObject* scroller = 151 LayoutBoxModelObject* scroller =
(...skipping 10 matching lines...) Expand all
160 const StickyPositionScrollingConstraints& constraints = 162 const StickyPositionScrollingConstraints& constraints =
161 scrollableArea->stickyConstraintsMap().get(sticky->layer()); 163 scrollableArea->stickyConstraintsMap().get(sticky->layer());
162 ASSERT_EQ(IntRect(0, 0, 400, 1100), 164 ASSERT_EQ(IntRect(0, 0, 400, 1100),
163 enclosingIntRect( 165 enclosingIntRect(
164 getScrollContainerRelativeContainingBlockRect(constraints))); 166 getScrollContainerRelativeContainingBlockRect(constraints)));
165 ASSERT_EQ( 167 ASSERT_EQ(
166 IntRect(0, 0, 100, 100), 168 IntRect(0, 0, 100, 100),
167 enclosingIntRect(getScrollContainerRelativeStickyBoxRect(constraints))); 169 enclosingIntRect(getScrollContainerRelativeStickyBoxRect(constraints)));
168 } 170 }
169 171
170 // Verifies that the sticky constraints are correct when the sticky position obj ect has an 172 // Verifies that the sticky constraints are correct when the sticky position
171 // anonymous containing block. 173 // object has an anonymous containing block.
172 TEST_F(LayoutBoxModelObjectTest, StickyPositionAnonymousContainer) { 174 TEST_F(LayoutBoxModelObjectTest, StickyPositionAnonymousContainer) {
173 setBodyInnerHTML( 175 setBodyInnerHTML(
174 "<style>#sticky { display: inline-block; position: sticky; top: 0; " 176 "<style>#sticky { display: inline-block; position: sticky; top: 0; "
175 "width: 100px; height: 100px; }" 177 "width: 100px; height: 100px; }"
176 "#container { box-sizing: border-box; position: relative; top: 100px; " 178 "#container { box-sizing: border-box; position: relative; top: 100px; "
177 "height: 400px; width: 200px; padding: 10px; border: 5px solid black; }" 179 "height: 400px; width: 200px; padding: 10px; border: 5px solid black; }"
178 "#scroller { height: 100px; overflow: auto; position: relative; top: " 180 "#scroller { height: 100px; overflow: auto; position: relative; top: "
179 "200px; }" 181 "200px; }"
180 ".header { height: 50px; }" 182 ".header { height: 50px; }"
181 ".spacer { height: 1000px; }</style>" 183 ".spacer { height: 1000px; }</style>"
(...skipping 13 matching lines...) Expand all
195 const StickyPositionScrollingConstraints& constraints = 197 const StickyPositionScrollingConstraints& constraints =
196 scrollableArea->stickyConstraintsMap().get(sticky->layer()); 198 scrollableArea->stickyConstraintsMap().get(sticky->layer());
197 ASSERT_EQ(IntRect(15, 115, 170, 370), 199 ASSERT_EQ(IntRect(15, 115, 170, 370),
198 enclosingIntRect( 200 enclosingIntRect(
199 getScrollContainerRelativeContainingBlockRect(constraints))); 201 getScrollContainerRelativeContainingBlockRect(constraints)));
200 ASSERT_EQ( 202 ASSERT_EQ(
201 IntRect(15, 165, 100, 100), 203 IntRect(15, 165, 100, 100),
202 enclosingIntRect(getScrollContainerRelativeStickyBoxRect(constraints))); 204 enclosingIntRect(getScrollContainerRelativeStickyBoxRect(constraints)));
203 } 205 }
204 } // namespace blink 206 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698