| 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_units.h" | 5 #include "core/layout/ng/ng_units.h" |
| 6 | 6 |
| 7 #include "core/layout/ng/ng_writing_mode.h" | 7 #include "core/layout/ng/ng_writing_mode.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 void NGMarginStrut::AppendMarginBlockEnd(const LayoutUnit& value) { | 73 void NGMarginStrut::AppendMarginBlockEnd(const LayoutUnit& value) { |
| 74 if (value < 0) { | 74 if (value < 0) { |
| 75 negative_margin_block_end = | 75 negative_margin_block_end = |
| 76 -std::max(value.abs(), negative_margin_block_end.abs()); | 76 -std::max(value.abs(), negative_margin_block_end.abs()); |
| 77 } else { | 77 } else { |
| 78 margin_block_end = std::max(value, margin_block_end); | 78 margin_block_end = std::max(value, margin_block_end); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 void NGMarginStrut::SetMarginBlockStart(const LayoutUnit& value) { |
| 83 if (value < 0) { |
| 84 negative_margin_block_start = value; |
| 85 } else { |
| 86 margin_block_start = value; |
| 87 } |
| 88 } |
| 89 |
| 82 void NGMarginStrut::SetMarginBlockEnd(const LayoutUnit& value) { | 90 void NGMarginStrut::SetMarginBlockEnd(const LayoutUnit& value) { |
| 83 if (value < 0) { | 91 if (value < 0) { |
| 84 negative_margin_block_end = value; | 92 negative_margin_block_end = value; |
| 85 } else { | 93 } else { |
| 86 margin_block_end = value; | 94 margin_block_end = value; |
| 87 } | 95 } |
| 88 } | 96 } |
| 89 | 97 |
| 90 String NGMarginStrut::ToString() const { | 98 String NGMarginStrut::ToString() const { |
| 91 return String::format( | 99 return String::format( |
| 92 "Start: (%d %d) End: (%d %d)", negative_margin_block_start.toInt(), | 100 "Start: (%d %d) End: (%d %d)", negative_margin_block_start.toInt(), |
| 93 margin_block_start.toInt(), negative_margin_block_end.toInt(), | 101 margin_block_start.toInt(), negative_margin_block_end.toInt(), |
| 94 margin_block_end.toInt()); | 102 margin_block_end.toInt()); |
| 95 } | 103 } |
| 96 | 104 |
| 97 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { | 105 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { |
| 98 return std::tie(other.margin_block_start, other.margin_block_end, | 106 return std::tie(other.margin_block_start, other.margin_block_end, |
| 99 other.negative_margin_block_start, | 107 other.negative_margin_block_start, |
| 100 other.negative_margin_block_end) == | 108 other.negative_margin_block_end) == |
| 101 std::tie(margin_block_start, margin_block_end, | 109 std::tie(margin_block_start, margin_block_end, |
| 102 negative_margin_block_start, negative_margin_block_end); | 110 negative_margin_block_start, negative_margin_block_end); |
| 103 } | 111 } |
| 104 | 112 |
| 105 } // namespace blink | 113 } // namespace blink |
| OLD | NEW |