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_block_layout_algorithm.h" | 5 #include "core/layout/ng/ng_block_layout_algorithm.h" |
6 | 6 |
7 #include "core/layout/ng/ng_box.h" | 7 #include "core/layout/ng/ng_box.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_physical_fragment.h" | 9 #include "core/layout/ng/ng_physical_fragment.h" |
10 #include "core/layout/ng/ng_length_utils.h" | 10 #include "core/layout/ng/ng_length_utils.h" |
11 #include "core/layout/ng/ng_units.h" | 11 #include "core/layout/ng/ng_units.h" |
12 #include "core/style/ComputedStyle.h" | 12 #include "core/style/ComputedStyle.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 namespace { | 16 namespace { |
17 | 17 |
18 NGConstraintSpace* ConstructConstraintSpace(NGWritingMode writing_mode, | 18 NGConstraintSpace* ConstructConstraintSpace(NGWritingMode writing_mode, |
19 NGDirection direction, | 19 NGDirection direction, |
20 NGPhysicalSize size) { | 20 NGPhysicalSize size) { |
21 return new NGConstraintSpace(writing_mode, direction, | 21 return new NGConstraintSpace( |
22 new NGPhysicalConstraintSpace(size)); | 22 writing_mode, direction, |
23 new NGPhysicalConstraintSpace( | |
Gleb Lanbin
2016/10/31 16:33:56
may be it's time to introduce a builder for NGPhys
ikilpatrick
2016/10/31 17:00:03
Switched to builder here :)
| |
24 size, /* fixed_width */ false, /* fixed_height */ false, | |
25 /* width_direction_triggers_scrollbar */ false, | |
26 /* height_direction_triggers_scrollbar */ false, FragmentNone, | |
27 FragmentColumn, /* is_new_fc */ false)); | |
23 } | 28 } |
24 | 29 |
25 class NGBlockLayoutAlgorithmTest : public ::testing::Test { | 30 class NGBlockLayoutAlgorithmTest : public ::testing::Test { |
26 protected: | 31 protected: |
27 void SetUp() override { style_ = ComputedStyle::create(); } | 32 void SetUp() override { style_ = ComputedStyle::create(); } |
28 | 33 |
29 NGPhysicalFragment* RunBlockLayoutAlgorithm(NGConstraintSpace* space, | 34 NGPhysicalFragment* RunBlockLayoutAlgorithm(NGConstraintSpace* space, |
30 NGBox* first_child) { | 35 NGBox* first_child) { |
31 NGBlockLayoutAlgorithm algorithm(style_, first_child, space); | 36 NGBlockLayoutAlgorithm algorithm(style_, first_child, space); |
32 NGPhysicalFragment* frag; | 37 NGPhysicalFragment* frag; |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
659 EXPECT_EQ(0, child2->TopOffset()); | 664 EXPECT_EQ(0, child2->TopOffset()); |
660 EXPECT_EQ(kParentSize - kDiv2Size, child2->LeftOffset()); | 665 EXPECT_EQ(kParentSize - kDiv2Size, child2->LeftOffset()); |
661 | 666 |
662 // DIV3 | 667 // DIV3 |
663 const NGPhysicalFragmentBase* child3 = frag->Children()[2]; | 668 const NGPhysicalFragmentBase* child3 = frag->Children()[2]; |
664 EXPECT_EQ(kDiv2Size, child3->TopOffset()); | 669 EXPECT_EQ(kDiv2Size, child3->TopOffset()); |
665 EXPECT_EQ(kDiv3LeftMargin, child3->LeftOffset()); | 670 EXPECT_EQ(kDiv3LeftMargin, child3->LeftOffset()); |
666 } | 671 } |
667 } // namespace | 672 } // namespace |
668 } // namespace blink | 673 } // namespace blink |
OLD | NEW |