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

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

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.h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h
index 998a2aa8fe1e10f6d3164c892b70c839608de132..f9078a310c223a415f89e7aba05a9a5bf40e410b 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.h
@@ -26,11 +26,12 @@ class CORE_EXPORT NGFragmentBuilder final
NGFragmentBuilder& AddChild(NGFragment*, NGLogicalOffset);
- // Sets MarginStrut for the resultant fragment.
- // These 2 methods below should be only called once as we update the
- // fragment's MarginStrut block start/end from first/last children MarginStrut
- NGFragmentBuilder& SetMarginStrutBlockStart(const NGMarginStrut& from);
- NGFragmentBuilder& SetMarginStrutBlockEnd(const NGMarginStrut& from);
+ // Updates block-{start|end} of the currently constructed fragment.
+ //
+ // This method is supposed to be called on every child but it only updates
+ // the block-start once (on the first non-zero height child fragment) and
+ // keeps updating block-end (on every non-zero height child).
+ NGFragmentBuilder& UpdateMarginStrut(const NGMarginStrut& from);
// Offsets are not supposed to be set during fragment construction, so we
// do not provide a setter here.
@@ -41,6 +42,9 @@ class CORE_EXPORT NGFragmentBuilder final
DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(children_); }
private:
+ void SetMarginStrutBlockStart(const NGMarginStrut& from);
+ void SetMarginStrutBlockEnd(const NGMarginStrut& from);
+
NGPhysicalFragmentBase::NGFragmentType type_;
NGWritingMode writing_mode_;
NGDirection direction_;
@@ -53,10 +57,8 @@ class CORE_EXPORT NGFragmentBuilder final
HeapVector<Member<NGPhysicalFragmentBase>> children_;
Vector<NGLogicalOffset> offsets_;
- // Whether MarginStrut block start/end was updated.
- // It's used for DCHECK safety check.
+ // Whether MarginStrut block start is updated.
bool is_margin_strut_block_start_updated_ : 1;
- bool is_margin_strut_block_end_updated_ : 1;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698