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

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

Issue 2540653003: Implement collection of out-of-flow descendants (Closed)
Patch Set: Removed unused members from block_layout Created 4 years 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_writing_mode.h" 9 #include "core/layout/ng/ng_writing_mode.h"
10 #include "platform/LayoutUnit.h" 10 #include "platform/LayoutUnit.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 struct NGLogicalOffset { 50 struct NGLogicalOffset {
51 NGLogicalOffset() {} 51 NGLogicalOffset() {}
52 NGLogicalOffset(LayoutUnit inline_offset, LayoutUnit block_offset) 52 NGLogicalOffset(LayoutUnit inline_offset, LayoutUnit block_offset)
53 : inline_offset(inline_offset), block_offset(block_offset) {} 53 : inline_offset(inline_offset), block_offset(block_offset) {}
54 54
55 LayoutUnit inline_offset; 55 LayoutUnit inline_offset;
56 LayoutUnit block_offset; 56 LayoutUnit block_offset;
57 57
58 // Converts a logical offset to a physical offset. See: 58 // Converts a logical offset to a physical offset. See:
59 // https://drafts.csswg.org/css-writing-modes-3/#logical-to-physical 59 // https://drafts.csswg.org/css-writing-modes-3/#logical-to-physical
60 // PhysicalOffset will be the physical top left point of the rectangle
61 // described by offset + inner_size. Setting inner_size to 0,0 will return
62 // the same point.
60 // @param outer_size the size of the rect (typically a fragment). 63 // @param outer_size the size of the rect (typically a fragment).
61 // @param inner_size the size of the inner rect (typically a child fragment). 64 // @param inner_size the size of the inner rect (typically a child fragment).
62 CORE_EXPORT NGPhysicalOffset 65 CORE_EXPORT NGPhysicalOffset
63 ConvertToPhysical(NGWritingMode, 66 ConvertToPhysical(NGWritingMode,
64 TextDirection, 67 TextDirection,
65 NGPhysicalSize outer_size, 68 NGPhysicalSize outer_size,
66 NGPhysicalSize inner_size) const; 69 NGPhysicalSize inner_size) const;
70
67 bool operator==(const NGLogicalOffset& other) const; 71 bool operator==(const NGLogicalOffset& other) const;
68 72
69 NGLogicalOffset operator+(const NGLogicalOffset& other) const; 73 NGLogicalOffset operator+(const NGLogicalOffset& other) const;
70 74
71 NGLogicalOffset& operator+=(const NGLogicalOffset& other); 75 NGLogicalOffset& operator+=(const NGLogicalOffset& other);
72 76
73 bool operator>(const NGLogicalOffset& other) const; 77 bool operator>(const NGLogicalOffset& other) const;
74 bool operator>=(const NGLogicalOffset& other) const; 78 bool operator>=(const NGLogicalOffset& other) const;
75 79
76 bool operator<(const NGLogicalOffset& other) const; 80 bool operator<(const NGLogicalOffset& other) const;
77 bool operator<=(const NGLogicalOffset& other) const; 81 bool operator<=(const NGLogicalOffset& other) const;
78 82
79 String ToString() const; 83 String ToString() const;
80 }; 84 };
81 85
82 CORE_EXPORT inline std::ostream& operator<<(std::ostream& os, 86 CORE_EXPORT inline std::ostream& operator<<(std::ostream& os,
83 const NGLogicalOffset& value) { 87 const NGLogicalOffset& value) {
84 return os << value.ToString(); 88 return os << value.ToString();
85 } 89 }
86 90
87 // NGPhysicalOffset is the position of a rect (typically a fragment) relative to 91 // NGPhysicalOffset is the position of a rect (typically a fragment) relative to
88 // its parent rect in the physical coordinate system. 92 // its parent rect in the physical coordinate system.
89 struct NGPhysicalOffset { 93 struct NGPhysicalOffset {
90 NGPhysicalOffset() {} 94 NGPhysicalOffset() {}
91 NGPhysicalOffset(LayoutUnit left, LayoutUnit top) : left(left), top(top) {} 95 NGPhysicalOffset(LayoutUnit left, LayoutUnit top) : left(left), top(top) {}
92 96
93 LayoutUnit left; 97 LayoutUnit left;
94 LayoutUnit top; 98 LayoutUnit top;
99
100 NGPhysicalOffset operator+(const NGPhysicalOffset& other) const {
ikilpatrick 2016/12/02 17:47:06 also define: NGPhysicalOffset& operator+=(const NG
atotic 2016/12/02 19:55:16 done. += is not used yet, our current policy see
ikilpatrick 2016/12/02 21:06:13 Thanks - this comes from: https://google.github.io
101 return NGPhysicalOffset{this->left + other.left, this->top + other.top};
102 }
95 }; 103 };
96 104
97 struct NGPhysicalSize { 105 struct NGPhysicalSize {
98 NGPhysicalSize() {} 106 NGPhysicalSize() {}
99 NGPhysicalSize(LayoutUnit width, LayoutUnit height) 107 NGPhysicalSize(LayoutUnit width, LayoutUnit height)
100 : width(width), height(height) {} 108 : width(width), height(height) {}
101 109
102 LayoutUnit width; 110 LayoutUnit width;
103 LayoutUnit height; 111 LayoutUnit height;
104 112
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 const NGMarginStrut& value) { 268 const NGMarginStrut& value) {
261 return stream << value.ToString(); 269 return stream << value.ToString();
262 } 270 }
263 271
264 // Struct to represent a simple edge that has start and end. 272 // Struct to represent a simple edge that has start and end.
265 struct NGEdge { 273 struct NGEdge {
266 LayoutUnit start; 274 LayoutUnit start;
267 LayoutUnit end; 275 LayoutUnit end;
268 }; 276 };
269 277
278 // Represents rectangle's physical corner.
ikilpatrick 2016/12/02 17:47:06 Maybe: This struct is used to represent the stati
atotic 2016/12/02 19:55:16 done
279 struct CORE_EXPORT NGCorner {
280 enum Type { kTopLeft, kTopRight, kBottomLeft, kBottomRight };
281
282 Type type; // Logical corner that corresponds to physical top left.
ikilpatrick 2016/12/02 17:47:06 remove this comment?
atotic 2016/12/02 19:55:16 Not done. I will not know what type is a year from
283 NGPhysicalOffset offset;
284
285 // Creates a corner with proper type wrt writing mode and direction.
286 static NGCorner Create(NGWritingMode, TextDirection, NGPhysicalOffset);
287 };
288
270 } // namespace blink 289 } // namespace blink
271 290
272 #endif // NGUnits_h 291 #endif // NGUnits_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698