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 namespace blink { | 7 namespace blink { |
8 | 8 |
9 LayoutUnit MinAndMaxContentSizes::ShrinkToFit(LayoutUnit available_size) const { | 9 LayoutUnit MinAndMaxContentSizes::ShrinkToFit(LayoutUnit available_size) const { |
10 DCHECK_GE(max_content, min_content); | 10 DCHECK_GE(max_content, min_content); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 NGPhysicalOffset NGPhysicalOffset::operator+( | 140 NGPhysicalOffset NGPhysicalOffset::operator+( |
141 const NGPhysicalOffset& other) const { | 141 const NGPhysicalOffset& other) const { |
142 return NGPhysicalOffset{this->left + other.left, this->top + other.top}; | 142 return NGPhysicalOffset{this->left + other.left, this->top + other.top}; |
143 } | 143 } |
144 | 144 |
145 NGPhysicalOffset& NGPhysicalOffset::operator+=(const NGPhysicalOffset& other) { | 145 NGPhysicalOffset& NGPhysicalOffset::operator+=(const NGPhysicalOffset& other) { |
146 *this = *this + other; | 146 *this = *this + other; |
147 return *this; | 147 return *this; |
148 } | 148 } |
149 | 149 |
| 150 NGPhysicalOffset NGPhysicalOffset::operator-( |
| 151 const NGPhysicalOffset& other) const { |
| 152 return NGPhysicalOffset{this->left - other.left, this->top - other.top}; |
| 153 } |
| 154 |
| 155 NGPhysicalOffset& NGPhysicalOffset::operator-=(const NGPhysicalOffset& other) { |
| 156 *this = *this - other; |
| 157 return *this; |
| 158 } |
| 159 |
150 bool NGBoxStrut::IsEmpty() const { | 160 bool NGBoxStrut::IsEmpty() const { |
151 return *this == NGBoxStrut(); | 161 return *this == NGBoxStrut(); |
152 } | 162 } |
153 | 163 |
154 bool NGBoxStrut::operator==(const NGBoxStrut& other) const { | 164 bool NGBoxStrut::operator==(const NGBoxStrut& other) const { |
155 return std::tie(other.inline_start, other.inline_end, other.block_start, | 165 return std::tie(other.inline_start, other.inline_end, other.block_start, |
156 other.block_end) == | 166 other.block_end) == |
157 std::tie(inline_start, inline_end, block_start, block_end); | 167 std::tie(inline_start, inline_end, block_start, block_end); |
158 } | 168 } |
159 | 169 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 break; | 295 break; |
286 case kSidewaysLeftRight: | 296 case kSidewaysLeftRight: |
287 position.type = | 297 position.type = |
288 (direction == TextDirection::Ltr) ? kBottomLeft : kTopLeft; | 298 (direction == TextDirection::Ltr) ? kBottomLeft : kTopLeft; |
289 break; | 299 break; |
290 } | 300 } |
291 return position; | 301 return position; |
292 } | 302 } |
293 | 303 |
294 } // namespace blink | 304 } // namespace blink |
OLD | NEW |