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

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

Issue 2851983002: [LayoutNG] Change anonymous LayoutBlockFlow to LayoutNGBlockFlow (Closed)
Patch Set: fix test expectations. Created 3 years, 8 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/inline/ng_inline_layout_algorithm.cc ('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_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 90b65553e5296b14e7d307b114912f9a4bebf9a4..cf98fe68011761ebe2c205bbe9797f43844210b5 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
@@ -347,8 +347,11 @@ NGLogicalOffset NGBlockLayoutAlgorithm::PrepareChildLayout(
bool is_legacy_block =
child->IsBlock() && !ToNGBlockNode(child)->CanUseNewLayout();
- // Should collapse margins if inline or legacy block
- if (child->IsInline() || is_legacy_block) {
+ // TODO(crbug.com/716930): We should also collapse margins below once we
+ // remove LayoutInline splitting.
+
+ // Should collapse margins if our child is a legacy block.
+ if (is_legacy_block) {
curr_bfc_offset_.block_offset += curr_margin_strut_.Sum();
MaybeUpdateFragmentBfcOffset(ConstraintSpace(), curr_bfc_offset_,
&container_builder_);
@@ -563,6 +566,12 @@ RefPtr<NGConstraintSpace> NGBlockLayoutAlgorithm::CreateConstraintSpaceForChild(
space_builder_.SetIsNewFormattingContext(is_new_bfc)
.SetBfcOffset(child_bfc_offset);
+ // Float's margins are not included in child's space because:
+ // 1) Floats do not participate in margins collapsing.
+ // 2) Floats margins are used separately to calculate floating exclusions.
+ space_builder_.SetMarginStrut(child->IsFloating() ? NGMarginStrut()
+ : curr_margin_strut_);
+
if (child->IsInline()) {
// TODO(kojii): Setup space_builder_ appropriately for inline child.
space_builder_.SetClearanceOffset(ConstraintSpace().ClearanceOffset());
@@ -576,12 +585,6 @@ RefPtr<NGConstraintSpace> NGBlockLayoutAlgorithm::CreateConstraintSpaceForChild(
.SetIsShrinkToFit(ShouldShrinkToFit(Style(), child_style))
.SetTextDirection(child_style.Direction());
- // Float's margins are not included in child's space because:
- // 1) Floats do not participate in margins collapsing.
- // 2) Floats margins are used separately to calculate floating exclusions.
- space_builder_.SetMarginStrut(child->IsFloating() ? NGMarginStrut()
- : curr_margin_strut_);
-
LayoutUnit space_available;
if (constraint_space_->HasBlockFragmentation()) {
space_available = ConstraintSpace().FragmentainerSpaceAvailable();
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/inline/ng_inline_layout_algorithm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698