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::SetMarginBlockEnd(const LayoutUnit& value) { |
| 83 if (value < 0) { |
| 84 negative_margin_block_end = value; |
| 85 } else { |
| 86 margin_block_end = value; |
| 87 } |
| 88 } |
| 89 |
82 String NGMarginStrut::ToString() const { | 90 String NGMarginStrut::ToString() const { |
83 return String::format( | 91 return String::format( |
84 "Start: (%d %d) End: (%d %d)", negative_margin_block_start.toInt(), | 92 "Start: (%d %d) End: (%d %d)", negative_margin_block_start.toInt(), |
85 margin_block_start.toInt(), negative_margin_block_end.toInt(), | 93 margin_block_start.toInt(), negative_margin_block_end.toInt(), |
86 margin_block_end.toInt()); | 94 margin_block_end.toInt()); |
87 } | 95 } |
88 | 96 |
| 97 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { |
| 98 return std::tie(other.margin_block_start, other.margin_block_end, |
| 99 other.negative_margin_block_start, |
| 100 other.negative_margin_block_end) == |
| 101 std::tie(margin_block_start, margin_block_end, |
| 102 negative_margin_block_start, negative_margin_block_end); |
| 103 } |
| 104 |
89 } // namespace blink | 105 } // namespace blink |
OLD | NEW |