| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 // Rule 4: left is auto. | 238 // Rule 4: left is auto. |
| 239 SetHorizontalStyle(NGAuto, margin_left, width, margin_right, right); | 239 SetHorizontalStyle(NGAuto, margin_left, width, margin_right, right); |
| 240 EXPECT_EQ(AbsoluteNeedsChildInlineSize(*style_), false); | 240 EXPECT_EQ(AbsoluteNeedsChildInlineSize(*style_), false); |
| 241 estimated_inline.reset(); | 241 estimated_inline.reset(); |
| 242 p = ComputePartialAbsoluteWithChildInlineSize( | 242 p = ComputePartialAbsoluteWithChildInlineSize( |
| 243 *ltr_space_, *style_, static_position, estimated_inline); | 243 *ltr_space_, *style_, static_position, estimated_inline); |
| 244 EXPECT_EQ(left + margin_left, p.inset.left); | 244 EXPECT_EQ(left + margin_left, p.inset.left); |
| 245 | 245 |
| 246 // Rule 4: left is auto, EBoxSizing::kContentBox | 246 // Rule 4: left is auto, EBoxSizing::kContentBox |
| 247 style_->setBoxSizing(EBoxSizing::kContentBox); | 247 style_->setBoxSizing(EBoxSizing::kContentBox); |
| 248 SetHorizontalStyle(NGAuto, margin_left, width - border_left - border_right - | 248 SetHorizontalStyle( |
| 249 padding_left - padding_right, | 249 NGAuto, margin_left, |
| 250 margin_right, right); | 250 width - border_left - border_right - padding_left - padding_right, |
| 251 margin_right, right); |
| 251 EXPECT_EQ(AbsoluteNeedsChildInlineSize(*style_), false); | 252 EXPECT_EQ(AbsoluteNeedsChildInlineSize(*style_), false); |
| 252 estimated_inline.reset(); | 253 estimated_inline.reset(); |
| 253 p = ComputePartialAbsoluteWithChildInlineSize( | 254 p = ComputePartialAbsoluteWithChildInlineSize( |
| 254 *ltr_space_, *style_, static_position, estimated_inline); | 255 *ltr_space_, *style_, static_position, estimated_inline); |
| 255 EXPECT_EQ(left + margin_left, p.inset.left); | 256 EXPECT_EQ(left + margin_left, p.inset.left); |
| 256 style_->setBoxSizing(EBoxSizing::kBorderBox); | 257 style_->setBoxSizing(EBoxSizing::kBorderBox); |
| 257 | 258 |
| 258 // Rule 5: right is auto. | 259 // Rule 5: right is auto. |
| 259 SetHorizontalStyle(left, margin_left, width, margin_right, NGAuto); | 260 SetHorizontalStyle(left, margin_left, width, margin_right, NGAuto); |
| 260 EXPECT_EQ(AbsoluteNeedsChildInlineSize(*style_), false); | 261 EXPECT_EQ(AbsoluteNeedsChildInlineSize(*style_), false); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 // // Unspecified height becomes estimated, gets clamped to min. | 473 // // Unspecified height becomes estimated, gets clamped to min. |
| 473 SetVerticalStyle(NGAuto, NGAuto, NGAuto, NGAuto, NGAuto); | 474 SetVerticalStyle(NGAuto, NGAuto, NGAuto, NGAuto, NGAuto); |
| 474 auto_height = LayoutUnit(20); | 475 auto_height = LayoutUnit(20); |
| 475 ComputeFullAbsoluteWithChildBlockSize(*ltr_space_, *style_, static_position, | 476 ComputeFullAbsoluteWithChildBlockSize(*ltr_space_, *style_, static_position, |
| 476 auto_height, &p); | 477 auto_height, &p); |
| 477 EXPECT_EQ(min, p.size.width); | 478 EXPECT_EQ(min, p.size.width); |
| 478 } | 479 } |
| 479 | 480 |
| 480 } // namespace | 481 } // namespace |
| 481 } // namespace blink | 482 } // namespace blink |
| OLD | NEW |