| 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 10 matching lines...) Expand all Loading... |
| 21 NGLogicalSize NGPhysicalSize::ConvertToLogical(NGWritingMode mode) const { | 21 NGLogicalSize NGPhysicalSize::ConvertToLogical(NGWritingMode mode) const { |
| 22 return mode == HorizontalTopBottom ? NGLogicalSize(width, height) | 22 return mode == HorizontalTopBottom ? NGLogicalSize(width, height) |
| 23 : NGLogicalSize(height, width); | 23 : NGLogicalSize(height, width); |
| 24 } | 24 } |
| 25 | 25 |
| 26 bool NGLogicalRect::IsEmpty() const { | 26 bool NGLogicalRect::IsEmpty() const { |
| 27 // TODO(layout-dev): equality check shouldn't allocate an object each time. | 27 // TODO(layout-dev): equality check shouldn't allocate an object each time. |
| 28 return *this == NGLogicalRect(); | 28 return *this == NGLogicalRect(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool NGLogicalRect::IsContained(const NGLogicalRect& other) const { | |
| 32 return !(InlineEndOffset() <= other.InlineStartOffset() || | |
| 33 BlockEndOffset() <= other.BlockStartOffset() || | |
| 34 InlineStartOffset() >= other.InlineEndOffset() || | |
| 35 BlockStartOffset() >= other.BlockEndOffset()); | |
| 36 } | |
| 37 | |
| 38 bool NGLogicalRect::operator==(const NGLogicalRect& other) const { | 31 bool NGLogicalRect::operator==(const NGLogicalRect& other) const { |
| 39 return std::tie(other.offset, other.size) == std::tie(offset, size); | 32 return std::tie(other.offset, other.size) == std::tie(offset, size); |
| 40 } | 33 } |
| 41 | 34 |
| 42 String NGLogicalRect::ToString() const { | 35 String NGLogicalRect::ToString() const { |
| 43 return String::format("%s,%s %sx%s", | 36 return String::format("%s,%s %sx%s", |
| 44 offset.inline_offset.toString().ascii().data(), | 37 offset.inline_offset.toString().ascii().data(), |
| 45 offset.block_offset.toString().ascii().data(), | 38 offset.block_offset.toString().ascii().data(), |
| 46 size.inline_size.toString().ascii().data(), | 39 size.inline_size.toString().ascii().data(), |
| 47 size.block_size.toString().ascii().data()); | 40 size.block_size.toString().ascii().data()); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 161 |
| 169 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { | 162 bool NGMarginStrut::operator==(const NGMarginStrut& other) const { |
| 170 return std::tie(other.margin_block_start, other.margin_block_end, | 163 return std::tie(other.margin_block_start, other.margin_block_end, |
| 171 other.negative_margin_block_start, | 164 other.negative_margin_block_start, |
| 172 other.negative_margin_block_end) == | 165 other.negative_margin_block_end) == |
| 173 std::tie(margin_block_start, margin_block_end, | 166 std::tie(margin_block_start, margin_block_end, |
| 174 negative_margin_block_start, negative_margin_block_end); | 167 negative_margin_block_start, negative_margin_block_end); |
| 175 } | 168 } |
| 176 | 169 |
| 177 } // namespace blink | 170 } // namespace blink |
| OLD | NEW |