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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h

Issue 2270983002: [layoutng] Add an NGFragmentBuilder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove SwapChildren Created 4 years, 4 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/ng_fragment_builder.h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h
new file mode 100644
index 0000000000000000000000000000000000000000..a6984492230f86c27f1b85a8eab51ef18ce1fead
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h
@@ -0,0 +1,47 @@
+// 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.
+
+#ifndef NGFragmentBuilder_h
+#define NGFragmentBuilder_h
+
+#include "core/layout/ng/ng_fragment.h"
+#include "core/layout/ng/ng_units.h"
+
+namespace blink {
+
+class CORE_EXPORT NGFragmentBuilder final {
+ public:
+ NGFragmentBuilder(NGFragmentBase::NGFragmentType);
+
+ NGFragmentBuilder& SetWritingMode(NGWritingMode);
+ NGFragmentBuilder& SetDirection(NGDirection);
+
+ NGFragmentBuilder& SetInlineSize(LayoutUnit);
+ NGFragmentBuilder& SetBlockSize(LayoutUnit);
+
+ NGFragmentBuilder& SetInlineOverflow(LayoutUnit);
+ NGFragmentBuilder& SetBlockOverflow(LayoutUnit);
+
+ NGFragmentBuilder& AddChild(const NGFragment*);
+
+ // Offsets are not supposed to be set during fragment construction, so we
+ // do not provide a setter here.
+
+ // Creates the fragment. Can only be called once.
+ NGFragment* ToFragment();
+
+ private:
+ NGFragmentBase::NGFragmentType type_;
+ NGWritingMode writing_mode_;
+ NGDirection direction_;
+
+ NGLogicalSize size_;
+ NGLogicalSize overflow_;
+
+ PersistentHeapVector<Member<const NGFragmentBase>> children_;
+};
+
+} // namespace blink
+
+#endif // NGFragmentBuilder

Powered by Google App Engine
This is Rietveld 408576698