| 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_constraint_space.h" | 7 #include "core/layout/ng/ng_constraint_space.h" |
| 8 #include "core/layout/ng/ng_margin_strut.h" | |
| 9 #include "core/style/ComputedStyle.h" | 8 #include "core/style/ComputedStyle.h" |
| 10 #include "platform/CalculationValue.h" | 9 #include "platform/CalculationValue.h" |
| 11 #include "platform/LayoutUnit.h" | 10 #include "platform/LayoutUnit.h" |
| 12 #include "platform/Length.h" | 11 #include "platform/Length.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "wtf/RefPtr.h" | 13 #include "wtf/RefPtr.h" |
| 15 | 14 |
| 16 namespace blink { | 15 namespace blink { |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 174 } |
| 176 | 175 |
| 177 TEST_F(NGLengthUtilsTest, testMargins) { | 176 TEST_F(NGLengthUtilsTest, testMargins) { |
| 178 style_->setMarginTop(Length(10, Percent)); | 177 style_->setMarginTop(Length(10, Percent)); |
| 179 style_->setMarginRight(Length(52, Fixed)); | 178 style_->setMarginRight(Length(52, Fixed)); |
| 180 style_->setMarginBottom(Length(Auto)); | 179 style_->setMarginBottom(Length(Auto)); |
| 181 style_->setMarginLeft(Length(11, Percent)); | 180 style_->setMarginLeft(Length(11, Percent)); |
| 182 | 181 |
| 183 NGConstraintSpace constraintSpace(constructConstraintSpace(200, 300)); | 182 NGConstraintSpace constraintSpace(constructConstraintSpace(200, 300)); |
| 184 | 183 |
| 185 NGBoxMargins margins = computeMargins(constraintSpace, *style_); | 184 NGBoxStrut margins = computeMargins(constraintSpace, *style_); |
| 186 | 185 |
| 187 EXPECT_EQ(LayoutUnit(20), margins.block_start); | 186 EXPECT_EQ(LayoutUnit(20), margins.block_start); |
| 188 EXPECT_EQ(LayoutUnit(52), margins.inline_end); | 187 EXPECT_EQ(LayoutUnit(52), margins.inline_end); |
| 189 EXPECT_EQ(LayoutUnit(), margins.block_end); | 188 EXPECT_EQ(LayoutUnit(), margins.block_end); |
| 190 EXPECT_EQ(LayoutUnit(22), margins.inline_start); | 189 EXPECT_EQ(LayoutUnit(22), margins.inline_start); |
| 191 } | 190 } |
| 192 | 191 |
| 193 } // namespace | 192 } // namespace |
| 194 } // namespace blink | 193 } // namespace blink |
| OLD | NEW |