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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc

Issue 2635143002: Changed EBoxSizing to an enum class and renamed its members (Closed)
Patch Set: Aded k prefix 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 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/ng/ng_length_utils.h" 5 #include "core/layout/ng/ng_length_utils.h"
6 6
7 #include "core/layout/ng/ng_box_fragment.h" 7 #include "core/layout/ng/ng_box_fragment.h"
8 #include "core/layout/ng/ng_constraint_space.h" 8 #include "core/layout/ng/ng_constraint_space.h"
9 #include "core/layout/ng/ng_constraint_space_builder.h" 9 #include "core/layout/ng/ng_constraint_space_builder.h"
10 #include "core/layout/ng/ng_fragment_builder.h" 10 #include "core/layout/ng/ng_fragment_builder.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 style_->setMinWidth(Length(80, Fixed)); 162 style_->setMinWidth(Length(80, Fixed));
163 EXPECT_EQ(expected, ComputeMinAndMaxContentContribution(*style_, sizes)); 163 EXPECT_EQ(expected, ComputeMinAndMaxContentContribution(*style_, sizes));
164 164
165 expected = MinAndMaxContentSizes{LayoutUnit(150), LayoutUnit(150)}; 165 expected = MinAndMaxContentSizes{LayoutUnit(150), LayoutUnit(150)};
166 style_ = ComputedStyle::create(); 166 style_ = ComputedStyle::create();
167 style_->setLogicalWidth(Length(100, Fixed)); 167 style_->setLogicalWidth(Length(100, Fixed));
168 style_->setPaddingLeft(Length(50, Fixed)); 168 style_->setPaddingLeft(Length(50, Fixed));
169 EXPECT_EQ(expected, ComputeMinAndMaxContentContribution(*style_, sizes)); 169 EXPECT_EQ(expected, ComputeMinAndMaxContentContribution(*style_, sizes));
170 170
171 expected = MinAndMaxContentSizes{LayoutUnit(100), LayoutUnit(100)}; 171 expected = MinAndMaxContentSizes{LayoutUnit(100), LayoutUnit(100)};
172 style_->setBoxSizing(BoxSizingBorderBox); 172 style_->setBoxSizing(EBoxSizing::kBorderBox);
173 EXPECT_EQ(expected, ComputeMinAndMaxContentContribution(*style_, sizes)); 173 EXPECT_EQ(expected, ComputeMinAndMaxContentContribution(*style_, sizes));
174 174
175 // Content size should never be below zero, even with box-sizing: border-box 175 // Content size should never be below zero, even with box-sizing: border-box
176 // and a large padding... 176 // and a large padding...
177 expected = MinAndMaxContentSizes{LayoutUnit(400), LayoutUnit(400)}; 177 expected = MinAndMaxContentSizes{LayoutUnit(400), LayoutUnit(400)};
178 style_->setPaddingLeft(Length(400, Fixed)); 178 style_->setPaddingLeft(Length(400, Fixed));
179 EXPECT_EQ(expected, ComputeMinAndMaxContentContribution(*style_, sizes)); 179 EXPECT_EQ(expected, ComputeMinAndMaxContentContribution(*style_, sizes));
180 180
181 expected.min_content = expected.max_content = 181 expected.min_content = expected.max_content =
182 sizes.min_content + LayoutUnit(400); 182 sizes.min_content + LayoutUnit(400);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 EXPECT_EQ(LayoutUnit(160), ComputeInlineSizeForFragment()); 228 EXPECT_EQ(LayoutUnit(160), ComputeInlineSizeForFragment());
229 229
230 style_ = ComputedStyle::create(); 230 style_ = ComputedStyle::create();
231 style_->setMarginRight(Length(20, Fixed)); 231 style_->setMarginRight(Length(20, Fixed));
232 EXPECT_EQ(LayoutUnit(180), ComputeInlineSizeForFragment()); 232 EXPECT_EQ(LayoutUnit(180), ComputeInlineSizeForFragment());
233 233
234 style_->setLogicalWidth(Length(100, Fixed)); 234 style_->setLogicalWidth(Length(100, Fixed));
235 style_->setPaddingLeft(Length(50, Fixed)); 235 style_->setPaddingLeft(Length(50, Fixed));
236 EXPECT_EQ(LayoutUnit(150), ComputeInlineSizeForFragment()); 236 EXPECT_EQ(LayoutUnit(150), ComputeInlineSizeForFragment());
237 237
238 style_->setBoxSizing(BoxSizingBorderBox); 238 style_->setBoxSizing(EBoxSizing::kBorderBox);
239 EXPECT_EQ(LayoutUnit(100), ComputeInlineSizeForFragment()); 239 EXPECT_EQ(LayoutUnit(100), ComputeInlineSizeForFragment());
240 240
241 // Content size should never be below zero, even with box-sizing: border-box 241 // Content size should never be below zero, even with box-sizing: border-box
242 // and a large padding... 242 // and a large padding...
243 style_->setPaddingLeft(Length(400, Fixed)); 243 style_->setPaddingLeft(Length(400, Fixed));
244 EXPECT_EQ(LayoutUnit(400), ComputeInlineSizeForFragment()); 244 EXPECT_EQ(LayoutUnit(400), ComputeInlineSizeForFragment());
245 245
246 // ...and the same goes for fill-available with a large padding. 246 // ...and the same goes for fill-available with a large padding.
247 style_->setLogicalWidth(Length(FillAvailable)); 247 style_->setLogicalWidth(Length(FillAvailable));
248 EXPECT_EQ(LayoutUnit(400), ComputeInlineSizeForFragment()); 248 EXPECT_EQ(LayoutUnit(400), ComputeInlineSizeForFragment());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 299
300 style_ = ComputedStyle::create(); 300 style_ = ComputedStyle::create();
301 style_->setMarginTop(Length(20, Fixed)); 301 style_->setMarginTop(Length(20, Fixed));
302 style_->setLogicalHeight(Length(FillAvailable)); 302 style_->setLogicalHeight(Length(FillAvailable));
303 EXPECT_EQ(LayoutUnit(280), ComputeBlockSizeForFragment()); 303 EXPECT_EQ(LayoutUnit(280), ComputeBlockSizeForFragment());
304 304
305 style_->setLogicalHeight(Length(100, Fixed)); 305 style_->setLogicalHeight(Length(100, Fixed));
306 style_->setPaddingBottom(Length(50, Fixed)); 306 style_->setPaddingBottom(Length(50, Fixed));
307 EXPECT_EQ(LayoutUnit(150), ComputeBlockSizeForFragment()); 307 EXPECT_EQ(LayoutUnit(150), ComputeBlockSizeForFragment());
308 308
309 style_->setBoxSizing(BoxSizingBorderBox); 309 style_->setBoxSizing(EBoxSizing::kBorderBox);
310 EXPECT_EQ(LayoutUnit(100), ComputeBlockSizeForFragment()); 310 EXPECT_EQ(LayoutUnit(100), ComputeBlockSizeForFragment());
311 311
312 // Content size should never be below zero, even with box-sizing: border-box 312 // Content size should never be below zero, even with box-sizing: border-box
313 // and a large padding... 313 // and a large padding...
314 style_->setPaddingBottom(Length(400, Fixed)); 314 style_->setPaddingBottom(Length(400, Fixed));
315 EXPECT_EQ(LayoutUnit(400), ComputeBlockSizeForFragment()); 315 EXPECT_EQ(LayoutUnit(400), ComputeBlockSizeForFragment());
316 316
317 // ...and the same goes for fill-available with a large padding. 317 // ...and the same goes for fill-available with a large padding.
318 style_->setLogicalHeight(Length(FillAvailable)); 318 style_->setLogicalHeight(Length(FillAvailable));
319 EXPECT_EQ(LayoutUnit(400), ComputeBlockSizeForFragment()); 319 EXPECT_EQ(LayoutUnit(400), ComputeBlockSizeForFragment());
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 EXPECT_EQ(125, GetUsedColumnWidth(4, 100, 10, 530)); 493 EXPECT_EQ(125, GetUsedColumnWidth(4, 100, 10, 530));
494 EXPECT_EQ(4, GetUsedColumnCount(4, 100, 10, 530)); 494 EXPECT_EQ(4, GetUsedColumnCount(4, 100, 10, 530));
495 EXPECT_EQ(100, GetUsedColumnWidth(6, 100, 10, 540)); 495 EXPECT_EQ(100, GetUsedColumnWidth(6, 100, 10, 540));
496 EXPECT_EQ(5, GetUsedColumnCount(6, 100, 10, 540)); 496 EXPECT_EQ(5, GetUsedColumnCount(6, 100, 10, 540));
497 EXPECT_EQ(100, GetUsedColumnWidth(0, 100, 10, 540)); 497 EXPECT_EQ(100, GetUsedColumnWidth(0, 100, 10, 540));
498 EXPECT_EQ(5, GetUsedColumnCount(0, 100, 10, 540)); 498 EXPECT_EQ(5, GetUsedColumnCount(0, 100, 10, 540));
499 } 499 }
500 500
501 } // namespace 501 } // namespace
502 } // namespace blink 502 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698