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

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

Issue 2764753007: [LayoutNG] Add NGLineBoxFragment (Closed)
Patch Set: Rebase again as other CLs landed faster Created 3 years, 9 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_line_box_fragment_builder.h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_line_box_fragment_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_line_box_fragment_builder.h
new file mode 100644
index 0000000000000000000000000000000000000000..7606b544b16df332715d947ccdad2fb2e3c05f96
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/ng/ng_line_box_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

Powered by Google App Engine
This is Rietveld 408576698