Index: third_party/WebKit/Source/core/layout/ng/ng_linebox_fragment_builder.h |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_linebox_fragment_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_linebox_fragment_builder.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..eeea8c6088a5e6ce9da1a5791b8401c19372006a |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_linebox_fragment_builder.h |
@@ -0,0 +1,57 @@ |
+// Copyright 2017 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 NGLineboxFragmentBuilder_h |
+#define NGLineboxFragmentBuilder_h |
+ |
+#include "core/layout/ng/geometry/ng_logical_offset.h" |
+#include "core/layout/ng/ng_line_height_metrics.h" |
+#include "wtf/Allocator.h" |
+ |
+namespace blink { |
+ |
+class NGInlineNode; |
+class NGPhysicalFragment; |
+class NGPhysicalLineboxFragment; |
+ |
+class CORE_EXPORT NGLineboxFragmentBuilder final { |
+ STACK_ALLOCATED(); |
+ |
+ public: |
+ NGLineboxFragmentBuilder(NGInlineNode*); |
+ |
+ NGLineboxFragmentBuilder& SetDirection(TextDirection); |
+ |
+ NGLineboxFragmentBuilder& SetInlineSize(LayoutUnit); |
+ |
+ NGLineboxFragmentBuilder& AddChild(RefPtr<NGPhysicalFragment>, |
+ const NGLogicalOffset&); |
+ void MoveChildrenInBlockDirection(LayoutUnit); |
+ |
+ const Vector<RefPtr<NGPhysicalFragment>>& Children() const { |
+ return children_; |
+ } |
+ |
+ void UniteMetrics(const NGLineHeightMetrics&); |
+ const NGLineHeightMetrics& Metrics() const { return metrics_; } |
+ |
+ // Creates the fragment. Can only be called once. |
+ RefPtr<NGPhysicalLineboxFragment> ToLineboxFragment(); |
+ |
+ private: |
+ TextDirection direction_; |
+ |
+ Persistent<NGInlineNode> node_; |
+ |
+ LayoutUnit inline_size_; |
+ |
+ Vector<RefPtr<NGPhysicalFragment>> children_; |
+ Vector<NGLogicalOffset> offsets_; |
+ |
+ NGLineHeightMetrics metrics_; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // NGLineboxFragmentBuilder |