| 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_constraint_space_builder.h" | 8 #include "core/layout/ng/ng_constraint_space_builder.h" |
| 9 #include "core/layout/ng/ng_fragment.h" | 9 #include "core/layout/ng/ng_fragment.h" |
| 10 #include "core/style/ComputedStyle.h" | 10 #include "core/style/ComputedStyle.h" |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 if (style.marginStart().isAuto() && style.marginEnd().isAuto()) { | 401 if (style.marginStart().isAuto() && style.marginEnd().isAuto()) { |
| 402 margins->inline_start = available_space / 2; | 402 margins->inline_start = available_space / 2; |
| 403 margins->inline_end = available_space - margins->inline_start; | 403 margins->inline_end = available_space - margins->inline_start; |
| 404 } else if (style.marginStart().isAuto()) { | 404 } else if (style.marginStart().isAuto()) { |
| 405 margins->inline_start = available_space; | 405 margins->inline_start = available_space; |
| 406 } else if (style.marginEnd().isAuto()) { | 406 } else if (style.marginEnd().isAuto()) { |
| 407 margins->inline_end = available_space; | 407 margins->inline_end = available_space; |
| 408 } | 408 } |
| 409 } | 409 } |
| 410 | 410 |
| 411 LayoutUnit ConstrainByMinMax(LayoutUnit length, |
| 412 Optional<LayoutUnit> min, |
| 413 Optional<LayoutUnit> max) { |
| 414 if (max && length > max.value()) |
| 415 length = max.value(); |
| 416 if (min && length < min.value()) |
| 417 length = min.value(); |
| 418 return length; |
| 419 } |
| 420 |
| 411 } // namespace blink | 421 } // namespace blink |
| OLD | NEW |