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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_text_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_text_fragment_builder.h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_text_fragment_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_text_fragment_builder.h
new file mode 100644
index 0000000000000000000000000000000000000000..6f7eddc539948f3e09478ba9871d911f1266106f
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/ng/ng_text_fragment_builder.h
@@ -0,0 +1,49 @@
+// 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 NGTextFragmentBuilder_h
+#define NGTextFragmentBuilder_h
+
+#include "core/layout/ng/geometry/ng_logical_size.h"
+#include "core/layout/ng/ng_line_height_metrics.h"
+#include "platform/text/TextDirection.h"
+#include "wtf/Allocator.h"
+
+namespace blink {
+
+class NGInlineNode;
+class NGPhysicalTextFragment;
+
+class CORE_EXPORT NGTextFragmentBuilder final {
+ STACK_ALLOCATED();
+
+ public:
+ NGTextFragmentBuilder(NGInlineNode*);
+
+ NGTextFragmentBuilder& SetDirection(TextDirection);
+
+ NGTextFragmentBuilder& SetInlineSize(LayoutUnit);
+ NGTextFragmentBuilder& SetBlockSize(LayoutUnit);
+
+ void UniteMetrics(const NGLineHeightMetrics&);
+ const NGLineHeightMetrics& Metrics() const { return metrics_; }
+
+ // Creates the fragment. Can only be called once.
+ RefPtr<NGPhysicalTextFragment> ToTextFragment(unsigned index,
+ unsigned start_offset,
+ unsigned end_offset);
+
+ private:
+ TextDirection direction_;
+
+ Persistent<NGInlineNode> node_;
+
+ NGLogicalSize size_;
+
+ NGLineHeightMetrics metrics_;
+};
+
+} // namespace blink
+
+#endif // NGTextFragmentBuilder

Powered by Google App Engine
This is Rietveld 408576698