OLD | NEW |
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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 style_->setBorderTopWidth(1); | 357 style_->setBorderTopWidth(1); |
358 style_->setBorderRightWidth(2); | 358 style_->setBorderRightWidth(2); |
359 style_->setBorderBottomWidth(3); | 359 style_->setBorderBottomWidth(3); |
360 style_->setBorderLeftWidth(4); | 360 style_->setBorderLeftWidth(4); |
361 style_->setBorderTopStyle(BorderStyleSolid); | 361 style_->setBorderTopStyle(BorderStyleSolid); |
362 style_->setBorderRightStyle(BorderStyleSolid); | 362 style_->setBorderRightStyle(BorderStyleSolid); |
363 style_->setBorderBottomStyle(BorderStyleSolid); | 363 style_->setBorderBottomStyle(BorderStyleSolid); |
364 style_->setBorderLeftStyle(BorderStyleSolid); | 364 style_->setBorderLeftStyle(BorderStyleSolid); |
365 style_->setWritingMode(WritingMode::kVerticalLr); | 365 style_->setWritingMode(WritingMode::kVerticalLr); |
366 | 366 |
367 NGBoxStrut borders = ComputeBorders(*style_); | 367 NGConstraintSpace* constraint_space(ConstructConstraintSpace(200, 300)); |
| 368 |
| 369 NGBoxStrut borders = ComputeBorders(*constraint_space, *style_); |
368 | 370 |
369 EXPECT_EQ(LayoutUnit(4), borders.block_start); | 371 EXPECT_EQ(LayoutUnit(4), borders.block_start); |
370 EXPECT_EQ(LayoutUnit(3), borders.inline_end); | 372 EXPECT_EQ(LayoutUnit(3), borders.inline_end); |
371 EXPECT_EQ(LayoutUnit(2), borders.block_end); | 373 EXPECT_EQ(LayoutUnit(2), borders.block_end); |
372 EXPECT_EQ(LayoutUnit(1), borders.inline_start); | 374 EXPECT_EQ(LayoutUnit(1), borders.inline_start); |
373 } | 375 } |
374 | 376 |
375 TEST_F(NGLengthUtilsTest, testPadding) { | 377 TEST_F(NGLengthUtilsTest, testPadding) { |
376 style_->setPaddingTop(Length(10, Percent)); | 378 style_->setPaddingTop(Length(10, Percent)); |
377 style_->setPaddingRight(Length(52, Fixed)); | 379 style_->setPaddingRight(Length(52, Fixed)); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 EXPECT_EQ(125, GetUsedColumnWidth(4, 100, 10, 530)); | 490 EXPECT_EQ(125, GetUsedColumnWidth(4, 100, 10, 530)); |
489 EXPECT_EQ(4, GetUsedColumnCount(4, 100, 10, 530)); | 491 EXPECT_EQ(4, GetUsedColumnCount(4, 100, 10, 530)); |
490 EXPECT_EQ(100, GetUsedColumnWidth(6, 100, 10, 540)); | 492 EXPECT_EQ(100, GetUsedColumnWidth(6, 100, 10, 540)); |
491 EXPECT_EQ(5, GetUsedColumnCount(6, 100, 10, 540)); | 493 EXPECT_EQ(5, GetUsedColumnCount(6, 100, 10, 540)); |
492 EXPECT_EQ(100, GetUsedColumnWidth(0, 100, 10, 540)); | 494 EXPECT_EQ(100, GetUsedColumnWidth(0, 100, 10, 540)); |
493 EXPECT_EQ(5, GetUsedColumnCount(0, 100, 10, 540)); | 495 EXPECT_EQ(5, GetUsedColumnCount(0, 100, 10, 540)); |
494 } | 496 } |
495 | 497 |
496 } // namespace | 498 } // namespace |
497 } // namespace blink | 499 } // namespace blink |
OLD | NEW |