Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Unified Diff: third_party/WebKit/Source/core/layout/ng/geometry/ng_logical_rect.cc

Issue 2721613003: [LayoutNG] Move remaining ng_units structs to their own files (Closed)
Patch Set: Don't export NGBoxStrut for now Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698