| 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_absolute_utils.h" | 5 #include "core/layout/ng/ng_absolute_utils.h" |
| 6 | 6 |
| 7 #include "core/layout/ng/ng_constraint_space_builder.h" | 7 #include "core/layout/ng/ng_constraint_space_builder.h" |
| 8 #include "core/layout/ng/ng_length_utils.h" | 8 #include "core/layout/ng/ng_length_utils.h" |
| 9 #include "core/style/ComputedStyle.h" | 9 #include "core/style/ComputedStyle.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 margin_bottom == NGAuto | 75 margin_bottom == NGAuto |
| 76 ? Length(LengthType::Auto) | 76 ? Length(LengthType::Auto) |
| 77 : Length(margin_bottom.toInt(), LengthType::Fixed)); | 77 : Length(margin_bottom.toInt(), LengthType::Fixed)); |
| 78 style_->setBottom(bottom == NGAuto | 78 style_->setBottom(bottom == NGAuto |
| 79 ? Length(LengthType::Auto) | 79 ? Length(LengthType::Auto) |
| 80 : Length(bottom.toInt(), LengthType::Fixed)); | 80 : Length(bottom.toInt(), LengthType::Fixed)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 RefPtr<ComputedStyle> style_; | 83 RefPtr<ComputedStyle> style_; |
| 84 NGLogicalSize container_size_; | 84 NGLogicalSize container_size_; |
| 85 Persistent<NGConstraintSpace> ltr_space_; | 85 RefPtr<NGConstraintSpace> ltr_space_; |
| 86 Persistent<NGConstraintSpace> rtl_space_; | 86 RefPtr<NGConstraintSpace> rtl_space_; |
| 87 Persistent<NGConstraintSpace> vertical_lr_space_; | 87 RefPtr<NGConstraintSpace> vertical_lr_space_; |
| 88 Persistent<NGConstraintSpace> vertical_rl_space_; | 88 RefPtr<NGConstraintSpace> vertical_rl_space_; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 TEST_F(NGAbsoluteUtilsTest, Horizontal) { | 91 TEST_F(NGAbsoluteUtilsTest, Horizontal) { |
| 92 // Test that the equation is computed correctly: | 92 // Test that the equation is computed correctly: |
| 93 // left + marginLeft + borderLeft + paddingLeft + | 93 // left + marginLeft + borderLeft + paddingLeft + |
| 94 // width + | 94 // width + |
| 95 // right + marginRight + borderRight + paddingRight = container width | 95 // right + marginRight + borderRight + paddingRight = container width |
| 96 | 96 |
| 97 // Common setup. | 97 // Common setup. |
| 98 LayoutUnit left(5); | 98 LayoutUnit left(5); |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 // // Unspecified height becomes estimated, gets clamped to min. | 472 // // Unspecified height becomes estimated, gets clamped to min. |
| 473 SetVerticalStyle(NGAuto, NGAuto, NGAuto, NGAuto, NGAuto); | 473 SetVerticalStyle(NGAuto, NGAuto, NGAuto, NGAuto, NGAuto); |
| 474 auto_height = LayoutUnit(20); | 474 auto_height = LayoutUnit(20); |
| 475 ComputeFullAbsoluteWithChildBlockSize(*ltr_space_, *style_, static_position, | 475 ComputeFullAbsoluteWithChildBlockSize(*ltr_space_, *style_, static_position, |
| 476 auto_height, &p); | 476 auto_height, &p); |
| 477 EXPECT_EQ(min, p.size.width); | 477 EXPECT_EQ(min, p.size.width); |
| 478 } | 478 } |
| 479 | 479 |
| 480 } // namespace | 480 } // namespace |
| 481 } // namespace blink | 481 } // namespace blink |
| OLD | NEW |