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

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: CR fixes 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bc368492738f3f6dc8f5001601477a489afe56f9 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_;
+ 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 =
+ CreateConstraintSpaceForChild(*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_);
+NGConstraintSpace* NGInlineLayoutAlgorithm::CreateConstraintSpaceForChild(
+ const NGInlineNode& 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698