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

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

Issue 2868523002: [LayoutNG] Don't use the margin-strut in the OOF static-position if zero-height. (Closed)
Patch Set: rebase. Created 3 years, 7 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_block_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_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 017e0a754ddf3953e2b59a80b3990aeb712b8ee9..06f2e009c2feabf29a8231a9e0747c3aa343b618 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
@@ -221,10 +221,14 @@ RefPtr<NGLayoutResult> NGBlockLayoutAlgorithm::Layout() {
if (child->IsBlock()) {
EPosition position = child->Style().GetPosition();
if (position == EPosition::kAbsolute || position == EPosition::kFixed) {
- // TODO(ikilpatrick): curr_margin_strut_ shouldn't be included if there
- // is no content size yet? See floats-wrap-inside-inline-006.
NGLogicalOffset offset = {border_and_padding_.inline_start,
- content_size_ + curr_margin_strut_.Sum()};
+ content_size_};
+
+ // We only include the margin strut in the OOF static-position if we
+ // know we aren't going to be a zero-block-size fragment.
+ if (container_builder_.BfcOffset())
+ offset.block_offset += curr_margin_strut_.Sum();
+
container_builder_.AddOutOfFlowChildCandidate(ToNGBlockNode(child),
offset);
NGBlockChildIterator::Entry entry = child_iterator.NextChild();
@@ -389,7 +393,7 @@ void NGBlockLayoutAlgorithm::FinishChildLayout(
else if (IsLegacyBlock(*child))
child_bfc_offset = PositionLegacy(child_space);
else if (container_builder_.BfcOffset())
- child_bfc_offset = PositionWithParentBfc();
+ child_bfc_offset = PositionWithParentBfc(fragment);
NGLogicalOffset logical_offset = CalculateLogicalOffset(child_bfc_offset);
@@ -471,10 +475,19 @@ NGLogicalOffset NGBlockLayoutAlgorithm::PositionWithBfcOffset(
return fragment.BfcOffset().value();
}
-NGLogicalOffset NGBlockLayoutAlgorithm::PositionWithParentBfc() {
+NGLogicalOffset NGBlockLayoutAlgorithm::PositionWithParentBfc(
+ const NGBoxFragment& fragment) {
+ // The child must be an in-flow zero-block-size fragment, use its end margin
+ // strut for positioning.
+ DCHECK(!fragment.BfcOffset());
+ DCHECK_EQ(fragment.BlockSize(), LayoutUnit());
+
+ NGMarginStrut margin_strut = fragment.EndMarginStrut();
+ margin_strut.Append(curr_child_margins_.block_end);
+
curr_bfc_offset_ +=
{border_and_padding_.inline_start + curr_child_margins_.inline_start,
- curr_margin_strut_.Sum()};
+ margin_strut.Sum()};
return curr_bfc_offset_;
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698