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

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

Issue 2655783006: Top down version of algorithm to position margins and floats in LayoutNG (Closed)
Patch Set: git rebase-update Created 3 years, 11 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 901cf7ba3472f051c5e9a24c81f81ae289d01359..6d197b30002762381af29808d83097aba00b5036 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
@@ -38,6 +38,10 @@ class CORE_EXPORT NGFragmentBuilder final
NGFragmentBuilder& AddFloatingObject(NGFloatingObject*,
const NGLogicalOffset&);
+ NGFragmentBuilder& SetBfcOffset(const NGLogicalOffset& offset);
+
+ NGFragmentBuilder& AddUnpositionedFloat(NGFloatingObject* floating_object);
+
// Builder has non-trivial out-of-flow descendant methods.
// These methods are building blocks for implementation of
// out-of-flow descendants by layout algorithms.
@@ -71,19 +75,16 @@ class CORE_EXPORT NGFragmentBuilder final
NGFragmentBuilder& AddOutOfFlowDescendant(NGBlockNode*,
const NGStaticPosition&);
- NGFragmentBuilder& AddUnpositionedFloat(NGFloatingObject* floating_object);
-
void SetBreakToken(NGBreakToken* token) {
DCHECK(!break_token_);
break_token_ = token;
}
bool HasBreakToken() const { return break_token_; }
- // Sets MarginStrut for the resultant fragment.
- NGFragmentBuilder& SetMarginStrutBlockStart(
- const NGDeprecatedMarginStrut& from);
- NGFragmentBuilder& SetMarginStrutBlockEnd(
- const NGDeprecatedMarginStrut& from);
+ NGFragmentBuilder& SetEndMarginStrut(const NGMarginStrut& from) {
+ end_margin_strut_ = from;
+ return *this;
+ }
// Offsets are not supposed to be set during fragment construction, so we
// do not provide a setter here.
@@ -94,14 +95,22 @@ class CORE_EXPORT NGFragmentBuilder final
unsigned start_index,
unsigned end_index);
+ // Mutable list of floats that need to be positioned.
+ HeapVector<Member<NGFloatingObject>>& MutableUnpositionedFloats() {
+ return unpositioned_floats_;
+ }
+
// List of floats that need to be positioned.
- HeapVector<Member<NGFloatingObject>>& UnpositionedFloats() {
+ const HeapVector<Member<NGFloatingObject>>& UnpositionedFloats() const {
return unpositioned_floats_;
}
+ const WTF::Optional<NGLogicalOffset>& BfcOffset() const {
+ return bfc_offset_;
+ }
+
DECLARE_VIRTUAL_TRACE();
- private:
// Out-of-flow descendant placement information.
// The generated fragment must compute NGStaticPosition for all
// out-of-flow descendants.
@@ -129,8 +138,6 @@ class CORE_EXPORT NGFragmentBuilder final
NGLogicalSize size_;
NGLogicalSize overflow_;
- NGDeprecatedMarginStrut margin_strut_;
-
HeapVector<Member<NGPhysicalFragment>> children_;
Vector<NGLogicalOffset> offsets_;
@@ -148,6 +155,9 @@ class CORE_EXPORT NGFragmentBuilder final
HeapVector<Member<NGFloatingObject>> positioned_floats_;
Member<NGBreakToken> break_token_;
+
+ WTF::Optional<NGLogicalOffset> bfc_offset_;
+ NGMarginStrut end_margin_strut_;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698