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

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

Issue 2646853006: [LayoutNG] Pull out of flow candidate loop into out of flow layout part. (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_block_layout_algorithm.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
index 238c3b0dc9b0e67b3b35ff7d137341c747ca0ecb..edfb50291e69d9c74a02b49b696a32d4d8ffabc4 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
@@ -314,15 +314,10 @@ NGLayoutStatus NGBlockLayoutAlgorithm::Layout(
ComputeBlockSizeForFragment(ConstraintSpace(), Style(), content_size_);
builder_->SetBlockSize(block_size);
- // Out of flow setup.
- out_of_flow_layout_ = new NGOutOfFlowLayoutPart(&Style(), builder_->Size());
- builder_->GetAndClearOutOfFlowDescendantCandidates(
- &out_of_flow_candidates_, &out_of_flow_candidate_positions_);
- out_of_flow_candidate_positions_index_ = 0;
current_child_ = nullptr;
- while (!LayoutOutOfFlowChild())
- continue;
+ // Layout our absolute and fixed positioned children.
+ NGOutOfFlowLayoutPart(Style(), builder_).Run();
builder_->SetInlineOverflow(max_inline_size_).SetBlockOverflow(content_size_);
@@ -353,31 +348,6 @@ void NGBlockLayoutAlgorithm::FinishCurrentChildLayout(NGFragment* fragment) {
builder_->AddChild(fragment, fragment_offset);
}
-bool NGBlockLayoutAlgorithm::LayoutOutOfFlowChild() {
- if (out_of_flow_candidates_.isEmpty()) {
- out_of_flow_layout_ = nullptr;
- out_of_flow_candidate_positions_.clear();
- return true;
- }
- current_child_ = out_of_flow_candidates_.first();
- out_of_flow_candidates_.removeFirst();
- NGStaticPosition static_position = out_of_flow_candidate_positions_
- [out_of_flow_candidate_positions_index_++];
-
- if (IsContainingBlockForAbsoluteChild(Style(), *current_child_->Style())) {
- NGFragment* fragment;
- NGLogicalOffset offset;
- out_of_flow_layout_->Layout(*current_child_, static_position, &fragment,
- &offset);
- // TODO(atotic) Need to adjust size of overflow rect per spec.
- builder_->AddChild(fragment, offset);
- } else {
- builder_->AddOutOfFlowDescendant(current_child_, static_position);
- }
-
- return false;
-}
-
bool NGBlockLayoutAlgorithm::ProceedToNextUnfinishedSibling(
NGPhysicalFragment* child_fragment) {
DCHECK(current_child_);
@@ -679,8 +649,6 @@ DEFINE_TRACE(NGBlockLayoutAlgorithm) {
visitor->trace(space_builder_);
visitor->trace(space_for_current_child_);
visitor->trace(current_child_);
- visitor->trace(out_of_flow_layout_);
- visitor->trace(out_of_flow_candidates_);
visitor->trace(fragmentainer_mapper_);
}

Powered by Google App Engine
This is Rietveld 408576698