| 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 "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 TEST(NGConstraintSpaceTest, WritingMode) { | 15 TEST(NGConstraintSpaceTest, WritingMode) { |
| 16 NGConstraintSpace* horz_space = | 16 NGConstraintSpace* horz_space = |
| 17 new NGConstraintSpace(HorizontalTopBottom, LeftToRight, | 17 new NGConstraintSpace(HorizontalTopBottom, LeftToRight, |
| 18 NGLogicalSize(LayoutUnit(200), LayoutUnit(100))); | 18 NGLogicalSize(LayoutUnit(200), LayoutUnit(100))); |
| 19 horz_space->SetOverflowTriggersScrollbar(true, false); | 19 horz_space->SetOverflowTriggersScrollbar(true, false); |
| 20 horz_space->SetFixedSize(true, false); | 20 horz_space->SetFixedSize(true, false); |
| 21 horz_space->SetFragmentationType(FragmentColumn); | 21 horz_space->SetFragmentationType(FragmentColumn); |
| 22 | 22 |
| 23 NGConstraintSpace* vert_space = | 23 NGConstraintSpace* vert_space = new NGConstraintSpace( |
| 24 new NGConstraintSpace(VerticalRightLeft, LeftToRight, horz_space); | 24 VerticalRightLeft, LeftToRight, horz_space->MutablePhysicalSpace()); |
| 25 | 25 |
| 26 EXPECT_EQ(LayoutUnit(200), horz_space->ContainerSize().inline_size); | 26 EXPECT_EQ(LayoutUnit(200), horz_space->ContainerSize().inline_size); |
| 27 EXPECT_EQ(LayoutUnit(200), vert_space->ContainerSize().block_size); | 27 EXPECT_EQ(LayoutUnit(200), vert_space->ContainerSize().block_size); |
| 28 | 28 |
| 29 EXPECT_EQ(LayoutUnit(100), horz_space->ContainerSize().block_size); | 29 EXPECT_EQ(LayoutUnit(100), horz_space->ContainerSize().block_size); |
| 30 EXPECT_EQ(LayoutUnit(100), vert_space->ContainerSize().inline_size); | 30 EXPECT_EQ(LayoutUnit(100), vert_space->ContainerSize().inline_size); |
| 31 | 31 |
| 32 EXPECT_TRUE(horz_space->InlineTriggersScrollbar()); | 32 EXPECT_TRUE(horz_space->InlineTriggersScrollbar()); |
| 33 EXPECT_TRUE(vert_space->BlockTriggersScrollbar()); | 33 EXPECT_TRUE(vert_space->BlockTriggersScrollbar()); |
| 34 | 34 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 201 |
| 202 bool for_inline_or_bfc = true; | 202 bool for_inline_or_bfc = true; |
| 203 auto* iterator = space->LayoutOpportunities(NGClearNone, for_inline_or_bfc); | 203 auto* iterator = space->LayoutOpportunities(NGClearNone, for_inline_or_bfc); |
| 204 | 204 |
| 205 EXPECT_EQ("0,0 600x100", OpportunityToString(iterator->Next())); | 205 EXPECT_EQ("0,0 600x100", OpportunityToString(iterator->Next())); |
| 206 EXPECT_EQ("(null)", OpportunityToString(iterator->Next())); | 206 EXPECT_EQ("(null)", OpportunityToString(iterator->Next())); |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // namespace | 209 } // namespace |
| 210 } // namespace blink | 210 } // namespace blink |
| OLD | NEW |