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

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

Issue 2350603002: Ignore zero-height fragments during margin collapsing (Closed)
Patch Set: renamed children_fragment -> fragment, added spaces before parentheses 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_fragment_builder.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc
index cbb9244f0038f59b562f7622091b2d9d0c058a45..0b739cf97f4371b1d0f5b5c3418a759285757681 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc
@@ -11,8 +11,7 @@ NGFragmentBuilder::NGFragmentBuilder(
: type_(type),
writing_mode_(HorizontalTopBottom),
direction_(LeftToRight),
- is_margin_strut_block_start_updated_(false),
- is_margin_strut_block_end_updated_(false) {}
+ is_margin_strut_block_start_updated_(false) {}
NGFragmentBuilder& NGFragmentBuilder::SetWritingMode(
NGWritingMode writing_mode) {
@@ -54,22 +53,24 @@ NGFragmentBuilder& NGFragmentBuilder::AddChild(NGFragment* child,
return *this;
}
-NGFragmentBuilder& NGFragmentBuilder::SetMarginStrutBlockStart(
+NGFragmentBuilder& NGFragmentBuilder::UpdateMarginStrut(
const NGMarginStrut& from) {
+ if (!is_margin_strut_block_start_updated_)
+ SetMarginStrutBlockStart(from);
+ SetMarginStrutBlockEnd(from);
+ return *this;
+}
+
+void NGFragmentBuilder::SetMarginStrutBlockStart(const NGMarginStrut& from) {
DCHECK(!is_margin_strut_block_start_updated_);
margin_strut_.margin_block_start = from.margin_block_start;
margin_strut_.negative_margin_block_start = from.negative_margin_block_start;
is_margin_strut_block_start_updated_ = true;
- return *this;
}
-NGFragmentBuilder& NGFragmentBuilder::SetMarginStrutBlockEnd(
- const NGMarginStrut& from) {
- DCHECK(!is_margin_strut_block_end_updated_);
+void NGFragmentBuilder::SetMarginStrutBlockEnd(const NGMarginStrut& from) {
margin_strut_.margin_block_end = from.margin_block_end;
margin_strut_.negative_margin_block_end = from.negative_margin_block_end;
- is_margin_strut_block_end_updated_ = true;
- return *this;
}
NGPhysicalFragment* NGFragmentBuilder::ToFragment() {

Powered by Google App Engine
This is Rietveld 408576698