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

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

Issue 2551793002: [LayoutNG] NGInlineLayoutAlgorithm and NGTextLayoutAlgorithm (Closed)
Patch Set: Resolved merge conflicts Created 4 years 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_layout_algorithm.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.cc
index f72caecb8cf527f60a4c59fa3722d0250fc3147e..291c18eebcdd5cbce5eec3fdd5b7ac3a4cdf0089 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.cc
@@ -6,6 +6,8 @@
#include "core/layout/ng/ng_break_token.h"
#include "core/layout/ng/ng_constraint_space.h"
+#include "core/layout/ng/ng_fragment.h"
+#include "core/layout/ng/ng_fragment_builder.h"
#include "core/layout/ng/ng_inline_node.h"
namespace blink {
@@ -25,8 +27,23 @@ NGLayoutStatus NGTextLayoutAlgorithm::Layout(
NGPhysicalFragmentBase*,
NGPhysicalFragmentBase** fragment_out,
NGLayoutAlgorithm**) {
- // TODO(layout-dev): implement.
- *fragment_out = nullptr;
+ // TODO(kojii): What kind of fragment tree do we want for line boxes/root line
+ // boxes? Just text, box, or new type of fragment?
+ NGFragmentBuilder root_line_box_builder(NGPhysicalFragmentBase::kFragmentBox);
+ root_line_box_builder.SetWritingMode(constraint_space_->WritingMode());
+ root_line_box_builder.SetDirection(constraint_space_->Direction());
+ unsigned start = 0;
+ do {
+ NGFragmentBuilder line_box_builder(NGPhysicalFragmentBase::kFragmentBox);
+ start =
+ inline_box_->CreateLine(start, constraint_space_, &line_box_builder);
+ root_line_box_builder.AddChild(
+ new NGFragment(constraint_space_->WritingMode(),
+ constraint_space_->Direction(),
+ line_box_builder.ToFragment()),
+ NGLogicalOffset());
+ } while (start);
+ *fragment_out = root_line_box_builder.ToFragment();
return kNewFragment;
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_inline_node.cc ('k') | third_party/WebKit/Source/web/tests/NGInlineLayoutTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698