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

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

Issue 2706403008: [LayoutNG] Implement ComputeMinAndMaxContentSizes for inline (Closed)
Patch Set: cbiesinger review Created 3 years, 10 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_inline_node.h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_inline_node.h b/third_party/WebKit/Source/core/layout/ng/ng_inline_node.h
index 392ddc205e745ad79abd7bea837639ee94165e40..89a9e4d3a97625d9a18c98f5a7872c3692177a24 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_inline_node.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_inline_node.h
@@ -22,6 +22,7 @@ class ComputedStyle;
class LayoutBlockFlow;
class LayoutObject;
class LayoutUnit;
+struct MinAndMaxContentSizes;
class NGConstraintSpace;
class NGLayoutInlineItem;
class NGLayoutInlineItemRange;
@@ -29,7 +30,8 @@ class NGLayoutInlineItemsBuilder;
class NGLayoutResult;
class NGLineBuilder;
-// Represents an inline node to be laid out.
+// Represents an anonymous block box to be laid out, that contains consecutive
+// inline nodes and their descendants.
class CORE_EXPORT NGInlineNode : public NGLayoutInputNode {
public:
NGInlineNode(LayoutObject* start_inline, const ComputedStyle* block_style);
@@ -42,9 +44,13 @@ class CORE_EXPORT NGInlineNode : public NGLayoutInputNode {
NGInlineNode* NextSibling() override;
LayoutObject* GetLayoutObject() override;
- // Prepare inline and text content for layout. Must be called before
- // calling the Layout method.
- void PrepareLayout();
+ // Computes the value of min-content and max-content for this anonymous block
+ // box. min-content is the inline size when lines wrap at every break
+ // opportunity, and max-content is when lines do not wrap at all.
+ MinAndMaxContentSizes ComputeMinAndMaxContentSizes();
+
+ // Instruct to re-compute |PrepareLayout| on the next layout.
+ void InvalidatePrepareLayout();
const String& Text() const { return text_content_; }
String Text(unsigned start_offset, unsigned end_offset) const {
@@ -66,6 +72,12 @@ class CORE_EXPORT NGInlineNode : public NGLayoutInputNode {
protected:
NGInlineNode(); // This constructor is only for testing.
+
+ // Prepare inline and text content for layout. Must be called before
+ // calling the Layout method.
+ void PrepareLayout();
+ bool IsPrepareLayoutFinished() const { return !items_.isEmpty(); }
+
void CollectInlines(LayoutObject* start, LayoutObject* last);
void CollectInlines(LayoutObject* start,
LayoutObject* last,

Powered by Google App Engine
This is Rietveld 408576698