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

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

Issue 2365083002: Make NGFragment to own NGPhysicalFragment (Closed)
Patch Set: Created 4 years, 3 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 2c9789afc08cec3ded1ab824f738533f80f753cb..5b30972274d1f539ea16d6e44949bb7962b4b5f4 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
@@ -36,21 +36,21 @@ NGBlockLayoutAlgorithm::NGBlockLayoutAlgorithm(
DCHECK(style_);
}
-bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace* constraint_space,
+bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace& constraint_space,
NGPhysicalFragment** out) {
switch (state_) {
case kStateInit: {
border_and_padding_ =
- computeBorders(*style_) + computePadding(*constraint_space, *style_);
+ computeBorders(*style_) + computePadding(constraint_space, *style_);
LayoutUnit inline_size =
- computeInlineSizeForFragment(*constraint_space, *style_);
+ computeInlineSizeForFragment(constraint_space, *style_);
LayoutUnit adjusted_inline_size =
inline_size - border_and_padding_.InlineSum();
// TODO(layout-ng): For quirks mode, should we pass blockSize instead of
// -1?
LayoutUnit block_size = computeBlockSizeForFragment(
- *constraint_space, *style_, NGSizeIndefinite);
+ constraint_space, *style_, NGSizeIndefinite);
LayoutUnit adjusted_block_size(block_size);
// Our calculated block-axis size may be indefinite at this point.
// If so, just leave the size as NGSizeIndefinite instead of subtracting
@@ -59,13 +59,13 @@ bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace* constraint_space,
adjusted_block_size -= border_and_padding_.BlockSum();
constraint_space_for_children_ = new NGConstraintSpace(
FromPlatformWritingMode(style_->getWritingMode()),
- FromPlatformDirection(style_->direction()), *constraint_space,
+ FromPlatformDirection(style_->direction()), constraint_space,
NGLogicalSize(adjusted_inline_size, adjusted_block_size));
content_size_ = border_and_padding_.block_start;
builder_ = new NGFragmentBuilder(NGPhysicalFragmentBase::FragmentBox);
- builder_->SetDirection(constraint_space->Direction());
- builder_->SetWritingMode(constraint_space->WritingMode());
+ builder_->SetDirection(constraint_space.Direction());
+ builder_->SetWritingMode(constraint_space.WritingMode());
builder_->SetInlineSize(inline_size).SetBlockSize(block_size);
current_child_ = first_child_;
state_ = kStateChildLayout;
@@ -73,16 +73,16 @@ bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace* constraint_space,
}
case kStateChildLayout: {
if (current_child_) {
- NGFragment* fragment;
- if (!current_child_->Layout(constraint_space_for_children_, &fragment))
+ if (!current_child_->Layout(constraint_space_for_children_.get()))
cbiesinger 2016/09/26 17:17:55 Why did you remove the out param?
return false;
+ NGFragment* fragment = current_child_->Fragment();
NGBoxStrut child_margins = computeMargins(
*constraint_space_for_children_, *current_child_->Style(),
constraint_space_for_children_->WritingMode(),
constraint_space_for_children_->Direction());
LayoutUnit margin_block_start =
- CollapseMargins(*constraint_space, child_margins, *fragment);
+ CollapseMargins(constraint_space, child_margins, *fragment);
// TODO(layout-ng): Support auto margins
builder_->AddChild(fragment,
@@ -105,8 +105,8 @@ bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace* constraint_space,
case kStateFinalize: {
content_size_ += border_and_padding_.block_end;
// Recompute the block-axis size now that we know our content size.
- LayoutUnit block_size = computeBlockSizeForFragment(
- *constraint_space, *style_, content_size_);
+ LayoutUnit block_size =
+ computeBlockSizeForFragment(constraint_space, *style_, content_size_);
builder_->SetBlockSize(block_size)
.SetInlineOverflow(max_inline_size_)

Powered by Google App Engine
This is Rietveld 408576698