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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 block_offset, | 54 block_offset, |
55 container_size.height - inline_offset - inner_size.height); | 55 container_size.height - inline_offset - inner_size.height); |
56 else | 56 else |
57 return NGPhysicalOffset(block_offset, inline_offset); | 57 return NGPhysicalOffset(block_offset, inline_offset); |
58 default: | 58 default: |
59 ASSERT_NOT_REACHED(); | 59 ASSERT_NOT_REACHED(); |
60 return NGPhysicalOffset(); | 60 return NGPhysicalOffset(); |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
| 64 bool NGBoxStrut::IsEmpty() const { |
| 65 return *this == NGBoxStrut(); |
| 66 } |
| 67 |
| 68 bool NGBoxStrut::operator==(const NGBoxStrut& other) const { |
| 69 return std::tie(other.inline_start, other.inline_end, other.block_start, |
| 70 other.block_end) == |
| 71 std::tie(inline_start, inline_end, block_start, block_end); |
| 72 } |
| 73 |
64 void NGMarginStrut::AppendMarginBlockStart(const LayoutUnit& value) { | 74 void NGMarginStrut::AppendMarginBlockStart(const LayoutUnit& value) { |
65 if (value < 0) { | 75 if (value < 0) { |
66 negative_margin_block_start = | 76 negative_margin_block_start = |
67 -std::max(value.abs(), negative_margin_block_start.abs()); | 77 -std::max(value.abs(), negative_margin_block_start.abs()); |
68 } else { | 78 } else { |
69 margin_block_start = std::max(value, margin_block_start); | 79 margin_block_start = std::max(value, margin_block_start); |
70 } | 80 } |
71 } | 81 } |
72 | 82 |
73 void NGMarginStrut::AppendMarginBlockEnd(const LayoutUnit& value) { | 83 void NGMarginStrut::AppendMarginBlockEnd(const LayoutUnit& value) { |
(...skipping 30 matching lines...) Expand all Loading... |
104 | 114 |
105 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { | 115 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { |
106 return std::tie(other.margin_block_start, other.margin_block_end, | 116 return std::tie(other.margin_block_start, other.margin_block_end, |
107 other.negative_margin_block_start, | 117 other.negative_margin_block_start, |
108 other.negative_margin_block_end) == | 118 other.negative_margin_block_end) == |
109 std::tie(margin_block_start, margin_block_end, | 119 std::tie(margin_block_start, margin_block_end, |
110 negative_margin_block_start, negative_margin_block_end); | 120 negative_margin_block_start, negative_margin_block_end); |
111 } | 121 } |
112 | 122 |
113 } // namespace blink | 123 } // namespace blink |
OLD | NEW |