Index: third_party/WebKit/Source/core/layout/ng/NGConstraintSpace.h |
diff --git a/third_party/WebKit/Source/core/layout/ng/NGConstraintSpace.h b/third_party/WebKit/Source/core/layout/ng/NGConstraintSpace.h |
index 88a401e774f157ffb15262cfd5608216d2fa87b8..e6d8536b8c4346459bf4a653ad70744a480eb4ae 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/NGConstraintSpace.h |
+++ b/third_party/WebKit/Source/core/layout/ng/NGConstraintSpace.h |
@@ -46,24 +46,44 @@ public: |
class CORE_EXPORT NGConstraintSpace { |
public: |
- NGConstraintSpace(LayoutUnit inlineSize, LayoutUnit blockSize); |
+ NGConstraintSpace(LayoutUnit inlineContainerSize, |
+ LayoutUnit blockContainerSize); |
~NGConstraintSpace() { } |
void addExclusion(const NGExclusion, unsigned options = 0); |
- void setOverflowSize(LayoutUnit inlineSize, LayoutUnit blockSize); |
+ void setOverflowTriggersScrollbar(bool inlineTriggers, |
+ bool blockTriggers); |
void setFixedSize(bool inlineFixed, bool blockFixed); |
- void setFragmentationType(NGFragmentationType blockFragmentationType); |
- |
- // Available space in each direction, -1 indicates infinite space. |
- LayoutUnit inlineSize() const { return m_inlineSize; } |
- LayoutUnit blockSize() const { return m_blockSize; } |
+ void setFragmentationType(NGFragmentationType); |
+ |
+ // Size of the container in each direction. Used for the following |
+ // three cases: |
+ // 1) Percentage resolution. |
+ // 2) Resolving absolute positions of children. |
+ // 3) Defining the threashold that triggers the presence of a |
+ // scrollbar. Only applies if the corresponding scrollbarTrigger |
+ // flag has been set for the direction. |
+ LayoutUnit inlineContainerSize() const |
+ { |
+ return m_inlineContainerSize; |
+ } |
+ LayoutUnit blockContainerSize() const |
+ { |
+ return m_blockContainerSize; |
+ } |
- // The size threashold in the inline and block directions respectively that |
- // triggers the presence of a scrollbar. If exceeded the current layout |
- // should be aborted and invoked again with a constraint space modified to |
- // reserve space for a scrollbar. -1 indicates no limit. |
- LayoutUnit inlineOverflowSize() const { return m_inlineOverflowSize; } |
- LayoutUnit blockOverflowSize() const { return m_blockOverflowSize; } |
+ // Whether exceeding the containerSize triggers the presence of a |
+ // scrollbar for the indicated direction. |
+ // If exceeded the current layout should be aborted and invoked again |
+ // with a constraint space modified to reserve space for a scrollbar. |
+ bool inlineTriggersScrollbar() const |
+ { |
+ return m_inlineTriggersScrollbar; |
+ } |
+ bool blockTriggersScrollbar() const |
+ { |
+ return m_blockTriggersScrollbar; |
+ } |
// Some layout modes “stretch” their children to a fixed size (e.g. flex, |
// grid). These flags represented whether a layout needs to produce a |
@@ -91,13 +111,13 @@ public: |
void subtract(const NGFragment); |
private: |
- LayoutUnit m_inlineSize; |
- LayoutUnit m_blockSize; |
- LayoutUnit m_inlineOverflowSize; |
- LayoutUnit m_blockOverflowSize; |
+ LayoutUnit m_inlineContainerSize; |
+ LayoutUnit m_blockContainerSize; |
unsigned m_fixedInlineSize : 1; |
unsigned m_fixedBlockSize : 1; |
+ unsigned m_inlineTriggersScrollbar : 1; |
+ unsigned m_blockTriggersScrollbar : 1; |
unsigned m_blockFragmentationType : 2; |
DoublyLinkedList<const NGExclusion> m_exclusions; |
@@ -128,20 +148,16 @@ public: |
LayoutUnit inlineOffset() const; |
LayoutUnit blockOffset() const; |
- |
- // When creating a derived NGConstraintSpace for the next inline level |
- // layout opportunity, inlineSize and blockSize of the NGConstraintSpace |
- // may be different from its parent. These properties hold the inline and |
- // block size of the original NGConstraintSpaces, allowing percentage |
- // resolution to work correctly. |
- LayoutUnit inlineSizeForPercentageResolution() const; |
- LayoutUnit blockSizeForPercentageResolution() const; |
+ LayoutUnit inlineSize() const; |
+ LayoutUnit blockSize() const; |
private: |
NGDerivedConstraintSpace(); |
LayoutUnit m_inlineOffset; |
LayoutUnit m_blockOffset; |
+ LayoutUnit m_inlineSize; |
+ LayoutUnit m_blockSize; |
NGConstraintSpace* m_original; |
}; |