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

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

Issue 2457013004: Use NGLogicalRect instead of NGExclusion for exclusions. (Closed)
Patch Set: renamed IsWithing to IsContained Created 4 years, 1 month 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
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 NGUnits_h 5 #ifndef NGUnits_h
6 #define NGUnits_h 6 #define NGUnits_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/ng_direction.h" 9 #include "core/layout/ng/ng_direction.h"
10 #include "core/layout/ng/ng_writing_mode.h" 10 #include "core/layout/ng/ng_writing_mode.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 struct NGPhysicalLocation { 85 struct NGPhysicalLocation {
86 LayoutUnit left; 86 LayoutUnit left;
87 LayoutUnit top; 87 LayoutUnit top;
88 }; 88 };
89 89
90 struct NGPhysicalRect { 90 struct NGPhysicalRect {
91 NGPhysicalOffset offset; 91 NGPhysicalOffset offset;
92 NGPhysicalSize size; 92 NGPhysicalSize size;
93 }; 93 };
94 94
95 // TODO(glebl): move to a separate file in layout/ng/units.
95 struct CORE_EXPORT NGLogicalRect { 96 struct CORE_EXPORT NGLogicalRect {
96 NGLogicalRect() {} 97 NGLogicalRect() {}
97 NGLogicalRect(LayoutUnit inline_offset, 98 NGLogicalRect(LayoutUnit inline_offset,
98 LayoutUnit block_offset, 99 LayoutUnit block_offset,
99 LayoutUnit inline_size, 100 LayoutUnit inline_size,
100 LayoutUnit block_size) 101 LayoutUnit block_size)
101 : offset(inline_offset, block_offset), size(inline_size, block_size) {} 102 : offset(inline_offset, block_offset), size(inline_size, block_size) {}
102 103
103 bool IsEmpty() const; 104 bool IsEmpty() const;
105
106 // Whether this rectangle is contained by the provided rectangle.
107 bool IsContained(const NGLogicalRect& other) const;
108
104 String ToString() const; 109 String ToString() const;
105 bool operator==(const NGLogicalRect& other) const; 110 bool operator==(const NGLogicalRect& other) const;
106 111
112 // Getters
113 LayoutUnit InlineStartOffset() const { return offset.inline_offset; }
114
115 LayoutUnit InlineEndOffset() const {
116 return offset.inline_offset + size.inline_size;
117 }
118
119 LayoutUnit BlockStartOffset() const { return offset.block_offset; }
120
121 LayoutUnit BlockEndOffset() const {
122 return offset.block_offset + size.block_size;
123 }
124
125 LayoutUnit BlockSize() const { return size.block_size; }
126
127 LayoutUnit InlineSize() const { return size.inline_size; }
128
107 NGLogicalOffset offset; 129 NGLogicalOffset offset;
108 NGLogicalSize size; 130 NGLogicalSize size;
109 }; 131 };
110 132
111 inline std::ostream& operator<<(std::ostream& stream, 133 inline std::ostream& operator<<(std::ostream& stream,
112 const NGLogicalRect& value) { 134 const NGLogicalRect& value) {
113 return stream << value.ToString(); 135 return stream << value.ToString();
114 } 136 }
115 137
116 struct NGPixelSnappedPhysicalRect { 138 struct NGPixelSnappedPhysicalRect {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 213
192 // Struct to represent a simple edge that has start and end. 214 // Struct to represent a simple edge that has start and end.
193 struct NGEdge { 215 struct NGEdge {
194 LayoutUnit start; 216 LayoutUnit start;
195 LayoutUnit end; 217 LayoutUnit end;
196 }; 218 };
197 219
198 } // namespace blink 220 } // namespace blink
199 221
200 #endif // NGUnits_h 222 #endif // NGUnits_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698