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

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

Issue 2313873002: Initial implementation of Collapsing Margins computational logic for LayoutNG (Closed)
Patch Set: synced to the head 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 c329866ab446aac1f0d6a3528895a25a294147bb..cbb9244f0038f59b562f7622091b2d9d0c058a45 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
@@ -10,7 +10,9 @@ NGFragmentBuilder::NGFragmentBuilder(
NGPhysicalFragmentBase::NGFragmentType type)
: type_(type),
writing_mode_(HorizontalTopBottom),
- direction_(LeftToRight) {}
+ direction_(LeftToRight),
+ is_margin_strut_block_start_updated_(false),
+ is_margin_strut_block_end_updated_(false) {}
NGFragmentBuilder& NGFragmentBuilder::SetWritingMode(
NGWritingMode writing_mode) {
@@ -52,6 +54,24 @@ NGFragmentBuilder& NGFragmentBuilder::AddChild(NGFragment* child,
return *this;
}
+NGFragmentBuilder& 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_);
+ 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() {
// TODO(layout-ng): Support text fragments
DCHECK_EQ(type_, NGPhysicalFragmentBase::FragmentBox);
@@ -67,9 +87,9 @@ NGPhysicalFragment* NGFragmentBuilder::ToFragment() {
writing_mode_, direction_, physical_size, child->Size()));
children.append(child);
}
-
- return new NGPhysicalFragment(
- physical_size, overflow_.ConvertToPhysical(writing_mode_), children);
+ return new NGPhysicalFragment(physical_size,
+ overflow_.ConvertToPhysical(writing_mode_),
+ children, margin_strut_);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698