Index: third_party/WebKit/Source/core/layout/ng/geometry/ng_logical_rect.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/geometry/ng_logical_rect.cc b/third_party/WebKit/Source/core/layout/ng/geometry/ng_logical_rect.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7630e754ef44928a9aa0f9e4d9610b7568a7cf78 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/layout/ng/geometry/ng_logical_rect.cc |
@@ -0,0 +1,38 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "core/layout/ng/geometry/ng_logical_rect.h" |
+ |
+#include "wtf/text/WTFString.h" |
+ |
+namespace blink { |
+ |
+bool NGLogicalRect::IsEmpty() const { |
+ return size.IsEmpty(); |
+} |
+ |
+bool NGLogicalRect::IsContained(const NGLogicalRect& other) const { |
+ return !(InlineEndOffset() <= other.InlineStartOffset() || |
+ BlockEndOffset() <= other.BlockStartOffset() || |
+ InlineStartOffset() >= other.InlineEndOffset() || |
+ BlockStartOffset() >= other.BlockEndOffset()); |
+} |
+ |
+bool NGLogicalRect::operator==(const NGLogicalRect& other) const { |
+ return std::tie(other.offset, other.size) == std::tie(offset, size); |
+} |
+ |
+String NGLogicalRect::ToString() const { |
+ return String::format("%s,%s %sx%s", |
+ offset.inline_offset.toString().ascii().data(), |
+ offset.block_offset.toString().ascii().data(), |
+ size.inline_size.toString().ascii().data(), |
+ size.block_size.toString().ascii().data()); |
+} |
+ |
+std::ostream& operator<<(std::ostream& os, const NGLogicalRect& value) { |
+ return os << value.ToString(); |
+} |
+ |
+} // namespace blink |