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

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

Issue 2336353002: Collapse bottom margins of a last child and its parent if parent's height=auto (Closed)
Patch Set: add CORE_EXPORT 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc » ('j') | 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 1da0c530ef4f5112401a89a38d93b2fedd1c54b9..a1e794c2b079018f478a0194673f3f1f67a7b30b 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
@@ -112,7 +112,13 @@ LayoutUnit NGBlockLayoutAlgorithm::CollapseMargins(
// Calculate margin strut for the current child.
NGMarginStrut curr_margin_strut = children_margin_strut;
curr_margin_strut.AppendMarginBlockStart(margins.block_start);
- curr_margin_strut.AppendMarginBlockEnd(margins.block_end);
+ if (current_child_->Style()->logicalHeight().isAuto()) {
+ // bottom margin of a last in-flow child is only collapsed if
+ // the parent has 'auto' computed height
+ curr_margin_strut.AppendMarginBlockEnd(margins.block_end);
+ } else {
+ curr_margin_strut.SetMarginBlockEnd(margins.block_end);
+ }
// Set the margin strut for the resultant fragment if this is the first or
// last child fragment.
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698