Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(721)

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_constraint_space.h

Issue 2283233002: [LayoutNG] Construct ConstraintSpace form Physical (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 NGConstraintSpace_h 5 #ifndef NGConstraintSpace_h
6 #define NGConstraintSpace_h 6 #define NGConstraintSpace_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/ng_physical_constraint_space.h" 9 #include "core/layout/ng/ng_physical_constraint_space.h"
10 #include "core/layout/ng/ng_writing_mode.h" 10 #include "core/layout/ng/ng_writing_mode.h"
11 #include "platform/heap/Handle.h" 11 #include "platform/heap/Handle.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class LayoutBox; 15 class LayoutBox;
16 class NGDerivedConstraintSpace; 16 class NGDerivedConstraintSpace;
17 class NGFragment; 17 class NGFragment;
18 class NGLayoutOpportunityIterator; 18 class NGLayoutOpportunityIterator;
19 19
20 // The NGConstraintSpace represents a set of constraints and available space 20 // The NGConstraintSpace represents a set of constraints and available space
21 // which a layout algorithm may produce a NGFragment within. It is a view on 21 // which a layout algorithm may produce a NGFragment within. It is a view on
22 // top of a NGPhysicalConstraintSpace and provides accessor methods in the 22 // top of a NGPhysicalConstraintSpace and provides accessor methods in the
23 // logical coordinate system defined by the writing mode given. 23 // logical coordinate system defined by the writing mode given.
24 class CORE_EXPORT NGConstraintSpace 24 class CORE_EXPORT NGConstraintSpace
25 : public GarbageCollected<NGConstraintSpace> { 25 : public GarbageCollected<NGConstraintSpace> {
26 public: 26 public:
27 // Constructs a constraint space with a new backing NGPhysicalConstraintSpace. 27 // Constructs a constraint space with a new backing NGPhysicalConstraintSpace.
28 NGConstraintSpace(NGWritingMode writing_mode, NGLogicalSize container_size); 28 NGConstraintSpace(NGWritingMode writing_mode, NGLogicalSize container_size);
29 29
30 // Constructs a constraint space based on an existing backing
31 // NGPhysicalConstraintSpace.
32 NGConstraintSpace(NGWritingMode writing_mode, NGPhysicalConstraintSpace*);
33
30 // Constructs a constraint space with a different NGWritingMode. 34 // Constructs a constraint space with a different NGWritingMode.
31 NGConstraintSpace(NGWritingMode writing_mode, 35 NGConstraintSpace(NGWritingMode writing_mode,
32 const NGConstraintSpace* constraint_space) 36 const NGConstraintSpace* constraint_space)
33 : physical_space_(constraint_space->physical_space_), 37 : physical_space_(constraint_space->PhysicalSpace()),
34 writing_mode_(writing_mode) {} 38 writing_mode_(writing_mode) {}
35 39
40 // TODO: This should either be removed or also take an offset (if we merge
41 // this with NGDerivedConstraintSpace).
36 NGConstraintSpace(const NGConstraintSpace& other, 42 NGConstraintSpace(const NGConstraintSpace& other,
37 NGLogicalSize container_size); 43 NGLogicalSize container_size);
38 44
45 NGPhysicalConstraintSpace* PhysicalSpace() const { return physical_space_; }
cbiesinger 2016/08/29 16:37:42 Personally I'd name this PhysicalConstraintSpace b
46 NGWritingMode WritingMode() const {
47 return static_cast<NGWritingMode>(writing_mode_);
48 }
49
39 // Size of the container. Used for the following three cases: 50 // Size of the container. Used for the following three cases:
40 // 1) Percentage resolution. 51 // 1) Percentage resolution.
41 // 2) Resolving absolute positions of children. 52 // 2) Resolving absolute positions of children.
42 // 3) Defining the threashold that triggers the presence of a scrollbar. Only 53 // 3) Defining the threashold that triggers the presence of a scrollbar. Only
43 // applies if the corresponding scrollbarTrigger flag has been set for the 54 // applies if the corresponding scrollbarTrigger flag has been set for the
44 // direction. 55 // direction.
45 NGLogicalSize ContainerSize() const; 56 NGLogicalSize ContainerSize() const;
46 57
47 // Returns the effective size of the constraint space. Defaults to 58 // Returns the effective size of the constraint space. Defaults to
48 // ContainerSize() for the root constraint space but derived constraint spaces 59 // ContainerSize() for the root constraint space but derived constraint spaces
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 116
106 private: 117 private:
107 Persistent<NGConstraintSpace> constraint_space_; 118 Persistent<NGConstraintSpace> constraint_space_;
108 unsigned clear_; 119 unsigned clear_;
109 bool for_inline_or_bfc_; 120 bool for_inline_or_bfc_;
110 }; 121 };
111 122
112 } // namespace blink 123 } // namespace blink
113 124
114 #endif // NGConstraintSpace_h 125 #endif // NGConstraintSpace_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698