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 writing_mode_ = writing_mode; | |
ikilpatrick
2016/11/29 00:10:27
.nit? move to cc file? up to you.
Gleb Lanbin
2016/12/01 20:41:53
Done.
| |
40 return *this; | |
41 } | |
42 | |
34 // Creates a new constraint space. This may be called multiple times, for | 43 // Creates a new constraint space. This may be called multiple times, for |
35 // example the constraint space will be different for a child which: | 44 // example the constraint space will be different for a child which: |
36 // - Establishes a new formatting context. | 45 // - Establishes a new formatting context. |
37 // - Is within a fragmentation container and needs its fragmentation offset | 46 // - Is within a fragmentation container and needs its fragmentation offset |
38 // updated. | 47 // updated. |
39 // - Has its size is determined by its parent layout (flex, abs-pos). | 48 // - Has its size is determined by its parent layout (flex, abs-pos). |
40 NGPhysicalConstraintSpace* ToConstraintSpace(); | 49 NGConstraintSpace* ToConstraintSpace(); |
41 | 50 |
42 DEFINE_INLINE_TRACE() {} | 51 DEFINE_INLINE_TRACE() {} |
43 | 52 |
44 private: | 53 private: |
45 NGLogicalSize available_size_; | 54 NGLogicalSize available_size_; |
46 NGLogicalSize percentage_resolution_size_; | 55 NGLogicalSize percentage_resolution_size_; |
47 | 56 |
48 // const bit fields. | 57 unsigned writing_mode_ : 2; |
49 const unsigned writing_mode_ : 2; | 58 unsigned parent_writing_mode_ : 2; |
50 | |
51 // mutable bit fields. | |
52 unsigned is_fixed_size_inline_ : 1; | 59 unsigned is_fixed_size_inline_ : 1; |
53 unsigned is_fixed_size_block_ : 1; | 60 unsigned is_fixed_size_block_ : 1; |
54 unsigned is_inline_direction_triggers_scrollbar_ : 1; | 61 unsigned is_inline_direction_triggers_scrollbar_ : 1; |
55 unsigned is_block_direction_triggers_scrollbar_ : 1; | 62 unsigned is_block_direction_triggers_scrollbar_ : 1; |
56 unsigned fragmentation_type_ : 2; | 63 unsigned fragmentation_type_ : 2; |
57 unsigned is_new_fc_ : 1; | 64 unsigned is_new_fc_ : 1; |
65 unsigned text_direction_ : 1; | |
66 | |
67 std::shared_ptr<NGExclusions> exclusions_; | |
58 }; | 68 }; |
59 | 69 |
60 } // namespace blink | 70 } // namespace blink |
61 | 71 |
62 #endif // NGConstraintSpaceBuilder | 72 #endif // NGConstraintSpaceBuilder |
OLD | NEW |