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_constraint_space.h" | 8 #include "core/layout/ng/ng_constraint_space.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 GarbageCollectedFinalized<NGConstraintSpaceBuilder> { | 14 : public GarbageCollectedFinalized<NGConstraintSpaceBuilder> { |
15 public: | 15 public: |
16 NGConstraintSpaceBuilder(const NGConstraintSpace* parent_space); | 16 NGConstraintSpaceBuilder(const NGConstraintSpace* parent_space); |
17 | 17 |
18 NGConstraintSpaceBuilder(NGWritingMode writing_mode); | 18 NGConstraintSpaceBuilder(NGWritingMode writing_mode); |
19 | 19 |
20 NGConstraintSpaceBuilder& SetAvailableSize(NGLogicalSize available_size); | 20 NGConstraintSpaceBuilder& SetAvailableSize(NGLogicalSize available_size); |
21 | 21 |
22 NGConstraintSpaceBuilder& SetPercentageResolutionSize( | 22 NGConstraintSpaceBuilder& SetPercentageResolutionSize( |
23 NGLogicalSize percentage_resolution_size); | 23 NGLogicalSize percentage_resolution_size); |
24 | 24 |
25 NGConstraintSpaceBuilder& SetTextDirection(TextDirection); | 25 NGConstraintSpaceBuilder& SetTextDirection(TextDirection); |
26 | 26 |
27 NGConstraintSpaceBuilder& SetIsFixedSizeInline(bool is_fixed_size_inline); | 27 NGConstraintSpaceBuilder& SetIsFixedSizeInline(bool is_fixed_size_inline); |
28 NGConstraintSpaceBuilder& SetIsFixedSizeBlock(bool is_fixed_size_block); | 28 NGConstraintSpaceBuilder& SetIsFixedSizeBlock(bool is_fixed_size_block); |
29 | 29 |
| 30 NGConstraintSpaceBuilder& SetIsShrinkToFit(bool shrink_to_fit); |
| 31 |
30 NGConstraintSpaceBuilder& SetIsInlineDirectionTriggersScrollbar( | 32 NGConstraintSpaceBuilder& SetIsInlineDirectionTriggersScrollbar( |
31 bool is_inline_direction_triggers_scrollbar); | 33 bool is_inline_direction_triggers_scrollbar); |
32 NGConstraintSpaceBuilder& SetIsBlockDirectionTriggersScrollbar( | 34 NGConstraintSpaceBuilder& SetIsBlockDirectionTriggersScrollbar( |
33 bool is_block_direction_triggers_scrollbar); | 35 bool is_block_direction_triggers_scrollbar); |
34 | 36 |
35 NGConstraintSpaceBuilder& SetFragmentationType(NGFragmentationType); | 37 NGConstraintSpaceBuilder& SetFragmentationType(NGFragmentationType); |
36 NGConstraintSpaceBuilder& SetIsNewFormattingContext(bool is_new_fc); | 38 NGConstraintSpaceBuilder& SetIsNewFormattingContext(bool is_new_fc); |
37 | 39 |
38 NGConstraintSpaceBuilder& SetWritingMode(NGWritingMode writing_mode); | 40 NGConstraintSpaceBuilder& SetWritingMode(NGWritingMode writing_mode); |
39 | 41 |
40 // Creates a new constraint space. This may be called multiple times, for | 42 // Creates a new constraint space. This may be called multiple times, for |
41 // example the constraint space will be different for a child which: | 43 // example the constraint space will be different for a child which: |
42 // - Establishes a new formatting context. | 44 // - Establishes a new formatting context. |
43 // - Is within a fragmentation container and needs its fragmentation offset | 45 // - Is within a fragmentation container and needs its fragmentation offset |
44 // updated. | 46 // updated. |
45 // - Has its size is determined by its parent layout (flex, abs-pos). | 47 // - Has its size is determined by its parent layout (flex, abs-pos). |
46 NGConstraintSpace* ToConstraintSpace(); | 48 NGConstraintSpace* ToConstraintSpace(); |
47 | 49 |
48 DEFINE_INLINE_TRACE() {} | 50 DEFINE_INLINE_TRACE() {} |
49 | 51 |
50 private: | 52 private: |
51 NGLogicalSize available_size_; | 53 NGLogicalSize available_size_; |
52 NGLogicalSize percentage_resolution_size_; | 54 NGLogicalSize percentage_resolution_size_; |
53 | 55 |
54 unsigned writing_mode_ : 2; | 56 unsigned writing_mode_ : 2; |
55 unsigned parent_writing_mode_ : 2; | 57 unsigned parent_writing_mode_ : 2; |
56 unsigned is_fixed_size_inline_ : 1; | 58 unsigned is_fixed_size_inline_ : 1; |
57 unsigned is_fixed_size_block_ : 1; | 59 unsigned is_fixed_size_block_ : 1; |
| 60 unsigned is_shrink_to_fit_ : 1; |
58 unsigned is_inline_direction_triggers_scrollbar_ : 1; | 61 unsigned is_inline_direction_triggers_scrollbar_ : 1; |
59 unsigned is_block_direction_triggers_scrollbar_ : 1; | 62 unsigned is_block_direction_triggers_scrollbar_ : 1; |
60 unsigned fragmentation_type_ : 2; | 63 unsigned fragmentation_type_ : 2; |
61 unsigned is_new_fc_ : 1; | 64 unsigned is_new_fc_ : 1; |
62 unsigned text_direction_ : 1; | 65 unsigned text_direction_ : 1; |
63 | 66 |
64 std::shared_ptr<NGExclusions> exclusions_; | 67 std::shared_ptr<NGExclusions> exclusions_; |
65 }; | 68 }; |
66 | 69 |
67 } // namespace blink | 70 } // namespace blink |
68 | 71 |
69 #endif // NGConstraintSpaceBuilder | 72 #endif // NGConstraintSpaceBuilder |
OLD | NEW |