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_constraint_space.h" | 5 #include "core/layout/ng/ng_constraint_space.h" |
6 | 6 |
7 #include "core/layout/ng/ng_constraint_space.h" | 7 #include "core/layout/ng/ng_constraint_space.h" |
8 #include "core/layout/ng/ng_layout_opportunity_iterator.h" | 8 #include "core/layout/ng/ng_layout_opportunity_iterator.h" |
9 #include "core/layout/ng/ng_physical_constraint_space.h" | |
9 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
15 TEST(NGConstraintSpaceTest, WritingMode) { | 16 TEST(NGConstraintSpaceTest, WritingMode) { |
17 NGPhysicalConstraintSpace* phy_space = new NGPhysicalConstraintSpace( | |
18 NGPhysicalSize(LayoutUnit(200), LayoutUnit(100)), true, false, true, | |
Gleb Lanbin
2016/10/27 22:29:54
can you add comments for every bool here? and belo
ikilpatrick
2016/10/27 23:54:52
Done.
| |
19 false, FragmentNone, FragmentColumn, false); | |
20 | |
16 NGConstraintSpace* horz_space = | 21 NGConstraintSpace* horz_space = |
17 new NGConstraintSpace(HorizontalTopBottom, LeftToRight, | 22 new NGConstraintSpace(HorizontalTopBottom, LeftToRight, phy_space); |
18 NGLogicalSize(LayoutUnit(200), LayoutUnit(100))); | |
19 horz_space->SetOverflowTriggersScrollbar(true, false); | |
20 horz_space->SetFixedSize(true, false); | |
21 horz_space->SetFragmentationType(FragmentColumn); | |
22 | 23 |
23 NGConstraintSpace* vert_space = new NGConstraintSpace( | 24 NGConstraintSpace* vert_space = |
24 VerticalRightLeft, LeftToRight, horz_space->MutablePhysicalSpace()); | 25 new NGConstraintSpace(VerticalRightLeft, LeftToRight, phy_space); |
25 | 26 |
26 EXPECT_EQ(LayoutUnit(200), horz_space->ContainerSize().inline_size); | 27 EXPECT_EQ(LayoutUnit(200), horz_space->ContainerSize().inline_size); |
27 EXPECT_EQ(LayoutUnit(200), vert_space->ContainerSize().block_size); | 28 EXPECT_EQ(LayoutUnit(200), vert_space->ContainerSize().block_size); |
28 | 29 |
29 EXPECT_EQ(LayoutUnit(100), horz_space->ContainerSize().block_size); | 30 EXPECT_EQ(LayoutUnit(100), horz_space->ContainerSize().block_size); |
30 EXPECT_EQ(LayoutUnit(100), vert_space->ContainerSize().inline_size); | 31 EXPECT_EQ(LayoutUnit(100), vert_space->ContainerSize().inline_size); |
31 | 32 |
32 EXPECT_TRUE(horz_space->InlineTriggersScrollbar()); | 33 EXPECT_TRUE(horz_space->InlineTriggersScrollbar()); |
33 EXPECT_TRUE(vert_space->BlockTriggersScrollbar()); | 34 EXPECT_TRUE(vert_space->BlockTriggersScrollbar()); |
34 | 35 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 new NGConstraintSpace(HorizontalTopBottom, LeftToRight, physical_space); | 197 new NGConstraintSpace(HorizontalTopBottom, LeftToRight, physical_space); |
197 | 198 |
198 auto* iterator = space->LayoutOpportunities(); | 199 auto* iterator = space->LayoutOpportunities(); |
199 | 200 |
200 EXPECT_EQ("0,0 600x100", OpportunityToString(iterator->Next())); | 201 EXPECT_EQ("0,0 600x100", OpportunityToString(iterator->Next())); |
201 EXPECT_EQ("(empty)", OpportunityToString(iterator->Next())); | 202 EXPECT_EQ("(empty)", OpportunityToString(iterator->Next())); |
202 } | 203 } |
203 | 204 |
204 } // namespace | 205 } // namespace |
205 } // namespace blink | 206 } // namespace blink |
OLD | NEW |