| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NGConstraintSpaceBuilder_h | 5 #ifndef NGConstraintSpaceBuilder_h |
| 6 #define NGConstraintSpaceBuilder_h | 6 #define NGConstraintSpaceBuilder_h |
| 7 | 7 |
| 8 #include "core/layout/ng/ng_fragment.h" | 8 #include "core/layout/ng/ng_fragment.h" |
| 9 #include "core/layout/ng/ng_units.h" | 9 #include "core/layout/ng/ng_units.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class CORE_EXPORT NGConstraintSpaceBuilder final | 13 class CORE_EXPORT NGConstraintSpaceBuilder final |
| 14 : public GarbageCollected<NGConstraintSpaceBuilder> { | 14 : public GarbageCollectedFinalized<NGConstraintSpaceBuilder> { |
| 15 public: | 15 public: |
| 16 NGConstraintSpaceBuilder(const NGConstraintSpace* parent_space); |
| 17 |
| 16 NGConstraintSpaceBuilder(NGWritingMode writing_mode); | 18 NGConstraintSpaceBuilder(NGWritingMode writing_mode); |
| 17 | 19 |
| 18 NGConstraintSpaceBuilder& SetAvailableSize(NGLogicalSize available_size); | 20 NGConstraintSpaceBuilder& SetAvailableSize(NGLogicalSize available_size); |
| 19 | 21 |
| 20 NGConstraintSpaceBuilder& SetPercentageResolutionSize( | 22 NGConstraintSpaceBuilder& SetPercentageResolutionSize( |
| 21 NGLogicalSize percentage_resolution_size); | 23 NGLogicalSize percentage_resolution_size); |
| 22 | 24 |
| 25 NGConstraintSpaceBuilder& SetTextDirection(TextDirection); |
| 26 |
| 23 NGConstraintSpaceBuilder& SetIsFixedSizeInline(bool is_fixed_size_inline); | 27 NGConstraintSpaceBuilder& SetIsFixedSizeInline(bool is_fixed_size_inline); |
| 24 NGConstraintSpaceBuilder& SetIsFixedSizeBlock(bool is_fixed_size_block); | 28 NGConstraintSpaceBuilder& SetIsFixedSizeBlock(bool is_fixed_size_block); |
| 25 | 29 |
| 26 NGConstraintSpaceBuilder& SetIsInlineDirectionTriggersScrollbar( | 30 NGConstraintSpaceBuilder& SetIsInlineDirectionTriggersScrollbar( |
| 27 bool is_inline_direction_triggers_scrollbar); | 31 bool is_inline_direction_triggers_scrollbar); |
| 28 NGConstraintSpaceBuilder& SetIsBlockDirectionTriggersScrollbar( | 32 NGConstraintSpaceBuilder& SetIsBlockDirectionTriggersScrollbar( |
| 29 bool is_block_direction_triggers_scrollbar); | 33 bool is_block_direction_triggers_scrollbar); |
| 30 | 34 |
| 31 NGConstraintSpaceBuilder& SetFragmentationType(NGFragmentationType); | 35 NGConstraintSpaceBuilder& SetFragmentationType(NGFragmentationType); |
| 32 NGConstraintSpaceBuilder& SetIsNewFormattingContext(bool is_new_fc); | 36 NGConstraintSpaceBuilder& SetIsNewFormattingContext(bool is_new_fc); |
| 33 | 37 |
| 38 NGConstraintSpaceBuilder& SetWritingMode(NGWritingMode writing_mode); |
| 39 |
| 34 // Creates a new constraint space. This may be called multiple times, for | 40 // Creates a new constraint space. This may be called multiple times, for |
| 35 // example the constraint space will be different for a child which: | 41 // example the constraint space will be different for a child which: |
| 36 // - Establishes a new formatting context. | 42 // - Establishes a new formatting context. |
| 37 // - Is within a fragmentation container and needs its fragmentation offset | 43 // - Is within a fragmentation container and needs its fragmentation offset |
| 38 // updated. | 44 // updated. |
| 39 // - Has its size is determined by its parent layout (flex, abs-pos). | 45 // - Has its size is determined by its parent layout (flex, abs-pos). |
| 40 NGPhysicalConstraintSpace* ToConstraintSpace(); | 46 NGConstraintSpace* ToConstraintSpace(); |
| 41 | 47 |
| 42 DEFINE_INLINE_TRACE() {} | 48 DEFINE_INLINE_TRACE() {} |
| 43 | 49 |
| 44 private: | 50 private: |
| 45 NGLogicalSize available_size_; | 51 NGLogicalSize available_size_; |
| 46 NGLogicalSize percentage_resolution_size_; | 52 NGLogicalSize percentage_resolution_size_; |
| 47 | 53 |
| 48 // const bit fields. | 54 unsigned writing_mode_ : 2; |
| 49 const unsigned writing_mode_ : 2; | 55 unsigned parent_writing_mode_ : 2; |
| 50 | |
| 51 // mutable bit fields. | |
| 52 unsigned is_fixed_size_inline_ : 1; | 56 unsigned is_fixed_size_inline_ : 1; |
| 53 unsigned is_fixed_size_block_ : 1; | 57 unsigned is_fixed_size_block_ : 1; |
| 54 unsigned is_inline_direction_triggers_scrollbar_ : 1; | 58 unsigned is_inline_direction_triggers_scrollbar_ : 1; |
| 55 unsigned is_block_direction_triggers_scrollbar_ : 1; | 59 unsigned is_block_direction_triggers_scrollbar_ : 1; |
| 56 unsigned fragmentation_type_ : 2; | 60 unsigned fragmentation_type_ : 2; |
| 57 unsigned is_new_fc_ : 1; | 61 unsigned is_new_fc_ : 1; |
| 62 unsigned text_direction_ : 1; |
| 63 |
| 64 std::shared_ptr<NGExclusions> exclusions_; |
| 58 }; | 65 }; |
| 59 | 66 |
| 60 } // namespace blink | 67 } // namespace blink |
| 61 | 68 |
| 62 #endif // NGConstraintSpaceBuilder | 69 #endif // NGConstraintSpaceBuilder |
| OLD | NEW |