OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NGPhysicalConstraintSpace_h | |
6 #define NGPhysicalConstraintSpace_h | |
7 | |
8 #include "core/CoreExport.h" | |
9 #include "core/layout/ng/ng_units.h" | |
10 #include "platform/heap/Handle.h" | |
11 #include "wtf/Vector.h" | |
12 #include "wtf/text/WTFString.h" | |
13 | |
14 namespace blink { | |
15 | |
16 // TODO(glebl@): unused, delete. | |
17 enum NGExclusionType { | |
18 kNGClearNone = 0, | |
19 kNGClearFloatLeft = 1, | |
20 kNGClearFloatRight = 2, | |
21 kNGClearFragment = 4 | |
22 }; | |
23 | |
24 enum NGFragmentationType { | |
25 kFragmentNone, | |
26 kFragmentPage, | |
27 kFragmentColumn, | |
28 kFragmentRegion | |
29 }; | |
30 | |
31 // The NGPhysicalConstraintSpace contains the underlying data for the | |
32 // NGConstraintSpace. It is not meant to be used directly as all members are in | |
33 // the physical coordinate space. Instead NGConstraintSpace should be used. | |
34 class CORE_EXPORT NGPhysicalConstraintSpace final | |
35 : public GarbageCollectedFinalized<NGPhysicalConstraintSpace> { | |
36 public: | |
37 NGPhysicalConstraintSpace( | |
38 NGPhysicalSize available_size, | |
39 NGPhysicalSize percentage_resolution_size, | |
40 bool fixed_width, | |
41 bool fixed_height, | |
42 bool width_direction_triggers_scrollbar, | |
43 bool height_direction_triggers_scrollbar, | |
44 NGFragmentationType width_direction_fragmentation_type, | |
45 NGFragmentationType height_direction_fragmentation_type, | |
46 bool is_new_fc); | |
47 | |
48 void AddExclusion(const NGExclusion&); | |
49 const Vector<std::unique_ptr<const NGExclusion>>& Exclusions( | |
50 unsigned options = 0) const; | |
51 | |
52 // Read only getters. | |
53 const NGExclusion* LastLeftFloatExclusion() const { | |
54 return last_left_float_exclusion_; | |
55 } | |
56 | |
57 const NGExclusion* LastRightFloatExclusion() const { | |
58 return last_right_float_exclusion_; | |
59 } | |
60 | |
61 DEFINE_INLINE_TRACE() {} | |
62 | |
63 private: | |
64 friend class NGConstraintSpace; | |
65 | |
66 NGPhysicalSize available_size_; | |
67 NGPhysicalSize percentage_resolution_size_; | |
68 | |
69 unsigned fixed_width_ : 1; | |
70 unsigned fixed_height_ : 1; | |
71 unsigned width_direction_triggers_scrollbar_ : 1; | |
72 unsigned height_direction_triggers_scrollbar_ : 1; | |
73 unsigned width_direction_fragmentation_type_ : 2; | |
74 unsigned height_direction_fragmentation_type_ : 2; | |
75 | |
76 // Whether the current constraint space is for the newly established | |
77 // formatting Context | |
78 unsigned is_new_fc_ : 1; | |
79 | |
80 // Last left/right float exclusions are used to enforce the top edge alignment | |
81 // rule for floats and for the support of CSS "clear" property. | |
82 const NGExclusion* last_left_float_exclusion_; // Owned by exclusions_. | |
83 const NGExclusion* last_right_float_exclusion_; // Owned by exclusions_. | |
84 | |
85 Vector<std::unique_ptr<const NGExclusion>> exclusions_; | |
86 }; | |
87 | |
88 } // namespace blink | |
89 | |
90 #endif // NGPhysicalConstraintSpace_h | |
OLD | NEW |