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

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

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.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_text_fragment_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_text_fragment_builder.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7d9f1f7ac282eed7907ce7f87d6182c268f4698a
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/ng/ng_text_fragment_builder.cc
@@ -0,0 +1,48 @@
+// 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.
+
+#include "core/layout/ng/ng_text_fragment_builder.h"
+
+#include "core/layout/ng/ng_fragment.h"
+#include "core/layout/ng/ng_inline_node.h"
+#include "core/layout/ng/ng_physical_text_fragment.h"
+#include "platform/heap/Handle.h"
+
+namespace blink {
+
+NGTextFragmentBuilder::NGTextFragmentBuilder(NGInlineNode* node)
+ : direction_(TextDirection::kLtr), node_(node) {}
+
+NGTextFragmentBuilder& NGTextFragmentBuilder::SetDirection(
+ TextDirection direction) {
+ direction_ = direction;
+ return *this;
+}
+
+NGTextFragmentBuilder& NGTextFragmentBuilder::SetInlineSize(LayoutUnit size) {
+ size_.inline_size = size;
+ return *this;
+}
+
+NGTextFragmentBuilder& NGTextFragmentBuilder::SetBlockSize(LayoutUnit size) {
+ size_.block_size = size;
+ return *this;
+}
+
+void NGTextFragmentBuilder::UniteMetrics(const NGLineHeightMetrics& metrics) {
+ metrics_.Unite(metrics);
+}
+
+RefPtr<NGPhysicalTextFragment> NGTextFragmentBuilder::ToTextFragment(
+ unsigned index,
+ unsigned start_offset,
+ unsigned end_offset) {
+ NGWritingMode writing_mode(
+ FromPlatformWritingMode(node_->BlockStyle()->getWritingMode()));
+ return adoptRef(new NGPhysicalTextFragment(
+ node_->GetLayoutObject(), node_, index, start_offset, end_offset,
+ size_.ConvertToPhysical(writing_mode)));
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698