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

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

Issue 2636353002: [LayoutNG] Remove the state machine from ng_out_of_flow_layout_part. (Closed)
Patch Set: fix compile 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 ef259608b6a7629e153cdb1c81ab18ab62122dbc..62a8508a2f8cf5a7ae2ab301b58c9f7fd68765b6 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
@@ -374,30 +374,33 @@ void NGBlockLayoutAlgorithm::FinishCurrentChildLayout(NGFragment* fragment) {
}
bool NGBlockLayoutAlgorithm::LayoutOutOfFlowChild() {
- if (!current_child_) {
- 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 position = out_of_flow_candidate_positions_
- [out_of_flow_candidate_positions_index_++];
-
- if (!out_of_flow_layout_->StartLayout(current_child_, position)) {
- builder_->AddOutOfFlowDescendant(current_child_, position);
- current_child_ = nullptr;
- return false;
- }
+ if (out_of_flow_candidates_.isEmpty()) {
+ out_of_flow_layout_ = nullptr;
+ out_of_flow_candidate_positions_.clear();
+ return true;
}
- NGFragment* fragment;
- NGLogicalOffset offset;
- if (out_of_flow_layout_->Layout(&fragment, &offset) == kNewFragment) {
+ 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_++];
+
+ EPosition position = current_child_->Style()->position();
+ bool contains_fixed = Style().canContainFixedPositionObjects();
+ bool contains_absolute =
+ Style().canContainAbsolutePositionObjects() || contains_fixed;
+
+ if ((contains_absolute && position == AbsolutePosition) ||
+ (contains_fixed && position == FixedPosition)) {
+ 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.
atotic 2017/01/18 18:48:49 I think the code to decide whether NGBlockNode can
ikilpatrick 2017/01/18 19:32:13 Right, I've pulled it into a static method inside
builder_->AddChild(fragment, offset);
- current_child_ = nullptr;
+ } else {
+ builder_->AddOutOfFlowDescendant(current_child_, static_position);
}
+
return false;
}

Powered by Google App Engine
This is Rietveld 408576698