OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "core/layout/ng/geometry/ng_logical_rect.h" | |
6 | |
7 #include "wtf/text/WTFString.h" | |
8 | |
9 namespace blink { | |
10 | |
11 bool NGLogicalRect::IsEmpty() const { | |
12 return size.IsEmpty(); | |
13 } | |
14 | |
15 bool NGLogicalRect::IsContained(const NGLogicalRect& other) const { | |
16 return !(InlineEndOffset() <= other.InlineStartOffset() || | |
17 BlockEndOffset() <= other.BlockStartOffset() || | |
18 InlineStartOffset() >= other.InlineEndOffset() || | |
19 BlockStartOffset() >= other.BlockEndOffset()); | |
20 } | |
21 | |
22 bool NGLogicalRect::operator==(const NGLogicalRect& other) const { | |
23 return std::tie(other.offset, other.size) == std::tie(offset, size); | |
24 } | |
25 | |
26 String NGLogicalRect::ToString() const { | |
27 return String::format("%s,%s %sx%s", | |
28 offset.inline_offset.toString().ascii().data(), | |
29 offset.block_offset.toString().ascii().data(), | |
30 size.inline_size.toString().ascii().data(), | |
31 size.block_size.toString().ascii().data()); | |
32 } | |
33 | |
34 std::ostream& operator<<(std::ostream& os, const NGLogicalRect& value) { | |
35 return os << value.ToString(); | |
36 } | |
37 | |
38 } // namespace blink | |
OLD | NEW |