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

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

Issue 2648253005: Cleanup: remove state variables from inline_algorithm (Closed)
Patch Set: Created 3 years, 11 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_inline_layout_algorithm.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.cc
index 9b16f265f80bd363d509472c18652c771369dc55..65fc14eefd82952a7569c456435bec2f9c56990d 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.cc
@@ -36,25 +36,25 @@ NGPhysicalFragment* NGInlineLayoutAlgorithm::Layout() {
builder_ = new NGFragmentBuilder(NGPhysicalFragment::kFragmentBox);
builder_->SetWritingMode(constraint_space_->WritingMode());
builder_->SetDirection(constraint_space_->Direction());
- current_child_ = first_child_;
-
ikilpatrick 2017/01/23 23:21:36 my newlines /o\!
atotic 2017/01/23 23:31:21 done. newline is back.
+ NGInlineNode* current_child = first_child_;
+ Member<NGLineBuilder> line_builder;
// TODO(kojii): Since line_builder_ is bound to NGLayoutInlineItem
- // in current_child_, changing the current_child_ needs more work.
- if (current_child_) {
- space_for_current_child_ = CreateConstraintSpaceForCurrentChild();
- line_builder_ = new NGLineBuilder(current_child_, space_for_current_child_);
- current_child_->LayoutInline(space_for_current_child_, line_builder_);
+ // in current_child, changing the current_child needs more work.
+ if (current_child) {
+ Member<NGConstraintSpace> space_for_current_child =
+ CreateConstraintSpaceForCurrentChild(*current_child);
+ line_builder = new NGLineBuilder(current_child, space_for_current_child);
+ current_child->LayoutInline(space_for_current_child, line_builder);
}
-
- line_builder_->CreateFragments(builder_);
+ line_builder->CreateFragments(builder_);
NGPhysicalFragment* fragment = builder_->ToBoxFragment();
- line_builder_->CopyFragmentDataToLayoutBlockFlow();
+ line_builder->CopyFragmentDataToLayoutBlockFlow();
return fragment;
}
NGConstraintSpace*
-NGInlineLayoutAlgorithm::CreateConstraintSpaceForCurrentChild() const {
- DCHECK(current_child_);
+NGInlineLayoutAlgorithm::CreateConstraintSpaceForCurrentChild(
+ const NGInlineNode& current_child) const {
// TODO(kojii): Implement child constraint space.
NGConstraintSpace* child_space =
NGConstraintSpaceBuilder(constraint_space_->WritingMode())
@@ -69,9 +69,6 @@ DEFINE_TRACE(NGInlineLayoutAlgorithm) {
visitor->trace(constraint_space_);
visitor->trace(break_token_);
visitor->trace(builder_);
- visitor->trace(space_for_current_child_);
- visitor->trace(current_child_);
- visitor->trace(line_builder_);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698