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

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

Issue 2462153002: [layoutng] Support computing min-content and max-content (Closed)
Patch Set: more review comments Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/layout/ng/ng_box.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/ng/ng_box.h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_box.h b/third_party/WebKit/Source/core/layout/ng/ng_box.h
index a402ad24c2b1cde35a50da3d5d4b05ffe32b9f1e..1292b2d9975d1acfc5cd902c20524591392eb718 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_box.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_box.h
@@ -13,10 +13,11 @@ namespace blink {
class ComputedStyle;
class LayoutBox;
class LayoutObject;
-class NGBlockLayoutAlgorithm;
class NGConstraintSpace;
class NGFragment;
+class NGLayoutAlgorithm;
class NGPhysicalFragment;
+struct MinAndMaxContentSizes;
// Represents a node to be laid out.
class CORE_EXPORT NGBox final : public GarbageCollectedFinalized<NGBox> {
@@ -32,6 +33,18 @@ class CORE_EXPORT NGBox final : public GarbageCollectedFinalized<NGBox> {
// TODO(layout-ng): Should we have a StartLayout function to avoid passing
// the same space for each Layout iteration?
bool Layout(const NGConstraintSpace*, NGFragment**);
+
+ // Computes the value of min-content and max-content for this box.
+ // The return value has the same meaning as for Layout.
+ // If the underlying layout algorithm returns NotImplemented from
+ // ComputeMinAndMaxContentSizes, this function will synthesize these sizes
+ // using Layout with special constraint spaces.
+ // It is not legal to interleave a pending Layout() with a pending
+ // ComputeOrSynthesizeMinAndMaxContentSizes (i.e. you have to call Layout
+ // often enough that it returns true before calling
+ // ComputeOrSynthesizeMinAndMaxContentSizes)
+ bool ComputeMinAndMaxContentSizes(MinAndMaxContentSizes*);
+
const ComputedStyle* Style() const;
NGBox* NextSibling();
@@ -41,12 +54,7 @@ class CORE_EXPORT NGBox final : public GarbageCollectedFinalized<NGBox> {
void SetNextSibling(NGBox*);
void SetFirstChild(NGBox*);
- DEFINE_INLINE_VIRTUAL_TRACE() {
- visitor->trace(algorithm_);
- visitor->trace(fragment_);
- visitor->trace(next_sibling_);
- visitor->trace(first_child_);
- }
+ DECLARE_VIRTUAL_TRACE();
private:
// This is necessary for interop between old and new trees -- after our parent
@@ -70,7 +78,8 @@ class CORE_EXPORT NGBox final : public GarbageCollectedFinalized<NGBox> {
RefPtr<ComputedStyle> style_;
Member<NGBox> next_sibling_;
Member<NGBox> first_child_;
- Member<NGBlockLayoutAlgorithm> algorithm_;
+ Member<NGLayoutAlgorithm> layout_algorithm_;
+ Member<NGLayoutAlgorithm> minmax_algorithm_;
Member<NGPhysicalFragment> fragment_;
};
« no previous file with comments | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/layout/ng/ng_box.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698