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

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

Issue 2835233004: Collapse margins before child that uses legacy layout. (Closed)
Patch Set: 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
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 e4f148ad47b744dc0ff123f04fbb55dd2f2b188d..0d4e4ab9d64f7098d9dbc2d06e7bdda32daff2e7 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
@@ -344,8 +344,12 @@ NGLogicalOffset NGBlockLayoutAlgorithm::PrepareChildLayout(
curr_margin_strut_.Append(curr_child_margins_.block_start);
}
- // Should collapse margins if inline.
- if (child->IsInline()) {
+ // TODO(glebl): Handle the case when a legacy block has border/padding.
ikilpatrick 2017/04/24 20:27:50 This should be fine right? As these should always
Gleb Lanbin 2017/04/24 21:15:33 yes, on a second thought, I think this TODO is not
+ bool is_legacy_block =
+ child->IsBlock() && !ToNGBlockNode(child)->CanUseNewLayout();
+
+ // Should collapse margins if inline or legacy block
+ if (child->IsInline() || is_legacy_block) {
curr_bfc_offset_.block_offset += curr_margin_strut_.Sum();
MaybeUpdateFragmentBfcOffset(ConstraintSpace(), curr_bfc_offset_,
&container_builder_);
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | third_party/WebKit/Source/core/layout/ng/ng_block_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698