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 GarbageCollected<NGConstraintSpaceBuilder> { |
15 public: | 15 public: |
16 NGConstraintSpaceBuilder(NGWritingMode writing_mode); | 16 NGConstraintSpaceBuilder(NGWritingMode writing_mode); |
17 | 17 |
18 NGConstraintSpaceBuilder& SetContainerSize(NGLogicalSize container_size); | 18 NGConstraintSpaceBuilder& SetAvailableSize(NGLogicalSize available_size); |
| 19 |
| 20 NGConstraintSpaceBuilder& SetPercentageResolutionSize( |
| 21 NGLogicalSize percentage_resolution_size); |
19 | 22 |
20 NGConstraintSpaceBuilder& SetIsFixedSizeInline(bool is_fixed_size_inline); | 23 NGConstraintSpaceBuilder& SetIsFixedSizeInline(bool is_fixed_size_inline); |
21 NGConstraintSpaceBuilder& SetIsFixedSizeBlock(bool is_fixed_size_block); | 24 NGConstraintSpaceBuilder& SetIsFixedSizeBlock(bool is_fixed_size_block); |
22 | 25 |
23 NGConstraintSpaceBuilder& SetIsInlineDirectionTriggersScrollbar( | 26 NGConstraintSpaceBuilder& SetIsInlineDirectionTriggersScrollbar( |
24 bool is_inline_direction_triggers_scrollbar); | 27 bool is_inline_direction_triggers_scrollbar); |
25 NGConstraintSpaceBuilder& SetIsBlockDirectionTriggersScrollbar( | 28 NGConstraintSpaceBuilder& SetIsBlockDirectionTriggersScrollbar( |
26 bool is_block_direction_triggers_scrollbar); | 29 bool is_block_direction_triggers_scrollbar); |
27 | 30 |
28 NGConstraintSpaceBuilder& SetFragmentationType(NGFragmentationType); | 31 NGConstraintSpaceBuilder& SetFragmentationType(NGFragmentationType); |
29 NGConstraintSpaceBuilder& SetIsNewFormattingContext(bool is_new_fc); | 32 NGConstraintSpaceBuilder& SetIsNewFormattingContext(bool is_new_fc); |
30 | 33 |
31 // Creates a new constraint space. This may be called multiple times, for | 34 // Creates a new constraint space. This may be called multiple times, for |
32 // example the constraint space will be different for a child which: | 35 // example the constraint space will be different for a child which: |
33 // - Establishes a new formatting context. | 36 // - Establishes a new formatting context. |
34 // - Is within a fragmentation container and needs its fragmentation offset | 37 // - Is within a fragmentation container and needs its fragmentation offset |
35 // updated. | 38 // updated. |
36 // - Has its size is determined by its parent layout (flex, abs-pos). | 39 // - Has its size is determined by its parent layout (flex, abs-pos). |
37 NGPhysicalConstraintSpace* ToConstraintSpace(); | 40 NGPhysicalConstraintSpace* ToConstraintSpace(); |
38 | 41 |
39 DEFINE_INLINE_TRACE() {} | 42 DEFINE_INLINE_TRACE() {} |
40 | 43 |
41 private: | 44 private: |
42 NGLogicalSize container_size_; | 45 NGLogicalSize available_size_; |
| 46 NGLogicalSize percentage_resolution_size_; |
43 | 47 |
44 // const bit fields. | 48 // const bit fields. |
45 const unsigned writing_mode_ : 2; | 49 const unsigned writing_mode_ : 2; |
46 | 50 |
47 // mutable bit fields. | 51 // mutable bit fields. |
48 unsigned is_fixed_size_inline_ : 1; | 52 unsigned is_fixed_size_inline_ : 1; |
49 unsigned is_fixed_size_block_ : 1; | 53 unsigned is_fixed_size_block_ : 1; |
50 unsigned is_inline_direction_triggers_scrollbar_ : 1; | 54 unsigned is_inline_direction_triggers_scrollbar_ : 1; |
51 unsigned is_block_direction_triggers_scrollbar_ : 1; | 55 unsigned is_block_direction_triggers_scrollbar_ : 1; |
52 unsigned fragmentation_type_ : 2; | 56 unsigned fragmentation_type_ : 2; |
53 unsigned is_new_fc_ : 1; | 57 unsigned is_new_fc_ : 1; |
54 }; | 58 }; |
55 | 59 |
56 } // namespace blink | 60 } // namespace blink |
57 | 61 |
58 #endif // NGConstraintSpaceBuilder | 62 #endif // NGConstraintSpaceBuilder |
OLD | NEW |