| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 bool NGBoxStrut::IsEmpty() const { | 64 bool NGBoxStrut::IsEmpty() const { |
| 65 return *this == NGBoxStrut(); | 65 return *this == NGBoxStrut(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool NGBoxStrut::operator==(const NGBoxStrut& other) const { | 68 bool NGBoxStrut::operator==(const NGBoxStrut& other) const { |
| 69 return std::tie(other.inline_start, other.inline_end, other.block_start, | 69 return std::tie(other.inline_start, other.inline_end, other.block_start, |
| 70 other.block_end) == | 70 other.block_end) == |
| 71 std::tie(inline_start, inline_end, block_start, block_end); | 71 std::tie(inline_start, inline_end, block_start, block_end); |
| 72 } | 72 } |
| 73 | 73 |
| 74 LayoutUnit NGMarginStrut::BlockEndSum() const { |
| 75 return margin_block_end + negative_margin_block_end; |
| 76 } |
| 77 |
| 74 void NGMarginStrut::AppendMarginBlockStart(const LayoutUnit& value) { | 78 void NGMarginStrut::AppendMarginBlockStart(const LayoutUnit& value) { |
| 75 if (value < 0) { | 79 if (value < 0) { |
| 76 negative_margin_block_start = | 80 negative_margin_block_start = |
| 77 -std::max(value.abs(), negative_margin_block_start.abs()); | 81 -std::max(value.abs(), negative_margin_block_start.abs()); |
| 78 } else { | 82 } else { |
| 79 margin_block_start = std::max(value, margin_block_start); | 83 margin_block_start = std::max(value, margin_block_start); |
| 80 } | 84 } |
| 81 } | 85 } |
| 82 | 86 |
| 83 void NGMarginStrut::AppendMarginBlockEnd(const LayoutUnit& value) { | 87 void NGMarginStrut::AppendMarginBlockEnd(const LayoutUnit& value) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 105 } | 109 } |
| 106 } | 110 } |
| 107 | 111 |
| 108 String NGMarginStrut::ToString() const { | 112 String NGMarginStrut::ToString() const { |
| 109 return String::format("Start: (%d %d) End: (%d %d)", | 113 return String::format("Start: (%d %d) End: (%d %d)", |
| 110 margin_block_start.toInt(), margin_block_end.toInt(), | 114 margin_block_start.toInt(), margin_block_end.toInt(), |
| 111 negative_margin_block_start.toInt(), | 115 negative_margin_block_start.toInt(), |
| 112 negative_margin_block_end.toInt()); | 116 negative_margin_block_end.toInt()); |
| 113 } | 117 } |
| 114 | 118 |
| 119 bool NGMarginStrut::IsEmpty() const { |
| 120 return *this == NGMarginStrut(); |
| 121 } |
| 122 |
| 115 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { | 123 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { |
| 116 return std::tie(other.margin_block_start, other.margin_block_end, | 124 return std::tie(other.margin_block_start, other.margin_block_end, |
| 117 other.negative_margin_block_start, | 125 other.negative_margin_block_start, |
| 118 other.negative_margin_block_end) == | 126 other.negative_margin_block_end) == |
| 119 std::tie(margin_block_start, margin_block_end, | 127 std::tie(margin_block_start, margin_block_end, |
| 120 negative_margin_block_start, negative_margin_block_end); | 128 negative_margin_block_start, negative_margin_block_end); |
| 121 } | 129 } |
| 122 | 130 |
| 123 } // namespace blink | 131 } // namespace blink |
| OLD | NEW |