| Index: third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h
|
| diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h
|
| index 7124e1a2959180fabac75cea8d7fabaa93838c69..56e0daaf5d6b06d0dc8e5d731f8d300865690a9b 100644
|
| --- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h
|
| +++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h
|
| @@ -7,7 +7,7 @@
|
|
|
| #include "core/CoreExport.h"
|
| #include "core/layout/ng/ng_macros.h"
|
| -#include "core/layout/ng/ng_physical_constraint_space.h"
|
| +#include "core/layout/ng/ng_units.h"
|
| #include "core/layout/ng/ng_writing_mode.h"
|
| #include "platform/heap/Handle.h"
|
| #include "wtf/text/WTFString.h"
|
| @@ -20,39 +20,32 @@ class LayoutBox;
|
| class NGFragment;
|
| class NGLayoutOpportunityIterator;
|
|
|
| +// TODO(glebl@): unused, delete.
|
| +enum NGExclusionType {
|
| + kNGClearNone = 0,
|
| + kNGClearFloatLeft = 1,
|
| + kNGClearFloatRight = 2,
|
| + kNGClearFragment = 4
|
| +};
|
| +
|
| +enum NGFragmentationType {
|
| + kFragmentNone,
|
| + kFragmentPage,
|
| + kFragmentColumn,
|
| + kFragmentRegion
|
| +};
|
| +
|
| // The NGConstraintSpace represents a set of constraints and available space
|
| -// which a layout algorithm may produce a NGFragment within. It is a view on
|
| -// top of a NGPhysicalConstraintSpace and provides accessor methods in the
|
| -// logical coordinate system defined by the writing mode given.
|
| +// which a layout algorithm may produce a NGFragment within.
|
| class CORE_EXPORT NGConstraintSpace final
|
| - : public GarbageCollected<NGConstraintSpace> {
|
| + : public GarbageCollectedFinalized<NGConstraintSpace> {
|
| public:
|
| - // Constructs a constraint space based on an existing backing
|
| - // NGPhysicalConstraintSpace. Sets this constraint space's size to the
|
| - // physical constraint space's available size, converted to logical
|
| - // coordinates.
|
| - NGConstraintSpace(NGWritingMode, TextDirection, NGPhysicalConstraintSpace*);
|
| -
|
| // This should live on NGBlockNode or another layout bridge and probably take
|
| - // a root
|
| - // NGConstraintSpace or a NGPhysicalConstraintSpace.
|
| + // a root NGConstraintSpace.
|
| static NGConstraintSpace* CreateFromLayoutObject(const LayoutBox&);
|
|
|
| - // Mutable Getters.
|
| - // TODO(layout-dev): remove const constraint from MutablePhysicalSpace method
|
| - NGPhysicalConstraintSpace* MutablePhysicalSpace() const {
|
| - return physical_space_;
|
| - }
|
| -
|
| - // Read-only Getters.
|
| - const NGPhysicalConstraintSpace* PhysicalSpace() const {
|
| - return physical_space_;
|
| - }
|
| -
|
| - const Vector<std::unique_ptr<const NGExclusion>>& Exclusions() const {
|
| - WRITING_MODE_IGNORED(
|
| - "Exclusions are stored directly in physical constraint space.");
|
| - return PhysicalSpace()->Exclusions();
|
| + const std::shared_ptr<NGExclusions>& Exclusions() const {
|
| + return exclusions_;
|
| }
|
|
|
| TextDirection Direction() const {
|
| @@ -63,40 +56,46 @@ class CORE_EXPORT NGConstraintSpace final
|
| return static_cast<NGWritingMode>(writing_mode_);
|
| }
|
|
|
| - // Adds the exclusion in the physical constraint space.
|
| - void AddExclusion(const NGExclusion& exclusion) const;
|
| - const NGExclusion* LastLeftFloatExclusion() const;
|
| - const NGExclusion* LastRightFloatExclusion() const;
|
| + void AddExclusion(const NGExclusion& exclusion);
|
|
|
| // The size to use for percentage resolution.
|
| // See: https://drafts.csswg.org/css-sizing/#percentage-sizing
|
| - NGLogicalSize PercentageResolutionSize() const;
|
| + NGLogicalSize PercentageResolutionSize() const {
|
| + return percentage_resolution_size_;
|
| + }
|
|
|
| // The available space size.
|
| // See: https://drafts.csswg.org/css-sizing/#available
|
| - NGLogicalSize AvailableSize() const;
|
| + NGLogicalSize AvailableSize() const { return available_size_; }
|
|
|
| // Offset relative to the root constraint space.
|
| NGLogicalOffset Offset() const { return offset_; }
|
| + // TODO(layout-ng): Set offset via NGConstraintSpacebuilder.
|
| void SetOffset(const NGLogicalOffset& offset) { offset_ = offset; }
|
|
|
| // Whether the current constraint space is for the newly established
|
| // Formatting Context.
|
| - bool IsNewFormattingContext() const;
|
| + bool IsNewFormattingContext() const { return is_new_fc_; }
|
|
|
| // Whether exceeding the AvailableSize() 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;
|
| - bool BlockTriggersScrollbar() const;
|
| + bool IsInlineDirectionTriggersScrollbar() const {
|
| + return is_inline_direction_triggers_scrollbar_;
|
| + }
|
| +
|
| + bool IsBlockDirectionTriggersScrollbar() const {
|
| + return is_block_direction_triggers_scrollbar_;
|
| + }
|
|
|
| // Some layout modes “stretch” their children to a fixed size (e.g. flex,
|
| // grid). These flags represented whether a layout needs to produce a
|
| // fragment that satisfies a fixed constraint in the inline and block
|
| // direction respectively.
|
| - bool FixedInlineSize() const;
|
| - bool FixedBlockSize() const;
|
| + bool IsFixedSizeInline() const { return is_fixed_size_inline_; }
|
| +
|
| + bool IsFixedSizeBlock() const { return is_fixed_size_block_; }
|
|
|
| // If specified a layout should produce a Fragment which fragments at the
|
| // blockSize if possible.
|
| @@ -111,17 +110,46 @@ class CORE_EXPORT NGConstraintSpace final
|
| unsigned clear = kNGClearNone,
|
| bool for_inline_or_bfc = false);
|
|
|
| - DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(physical_space_); }
|
| + DEFINE_INLINE_VIRTUAL_TRACE() {}
|
|
|
| NGConstraintSpace* ChildSpace(const ComputedStyle* style) const;
|
| -
|
| String ToString() const;
|
|
|
| private:
|
| - Member<NGPhysicalConstraintSpace> physical_space_;
|
| + friend class NGConstraintSpaceBuilder;
|
| + // Default constructor.
|
| + NGConstraintSpace(NGWritingMode,
|
| + TextDirection,
|
| + NGLogicalSize available_size,
|
| + NGLogicalSize percentage_resolution_size,
|
| + bool is_fixed_size_inline,
|
| + bool is_fixed_size_block,
|
| + bool is_inline_direction_triggers_scrollbar,
|
| + bool is_block_direction_triggers_scrollbar,
|
| + NGFragmentationType block_direction_fragmentation_type,
|
| + bool is_new_fc,
|
| + const std::shared_ptr<NGExclusions>& exclusions_);
|
| +
|
| + NGLogicalSize available_size_;
|
| + NGLogicalSize percentage_resolution_size_;
|
| +
|
| + unsigned is_fixed_size_inline_ : 1;
|
| + unsigned is_fixed_size_block_ : 1;
|
| +
|
| + unsigned is_inline_direction_triggers_scrollbar_ : 1;
|
| + unsigned is_block_direction_triggers_scrollbar_ : 1;
|
| +
|
| + unsigned block_direction_fragmentation_type_ : 2;
|
| +
|
| + // Whether the current constraint space is for the newly established
|
| + // formatting Context
|
| + unsigned is_new_fc_ : 1;
|
| +
|
| NGLogicalOffset offset_;
|
| unsigned writing_mode_ : 3;
|
| unsigned direction_ : 1;
|
| +
|
| + const std::shared_ptr<NGExclusions> exclusions_;
|
| };
|
|
|
| inline std::ostream& operator<<(std::ostream& stream,
|
|
|