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

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

Issue 2568743005: Place the out of flow positioned blocks (Closed)
Patch Set: skip failing tests Created 3 years, 11 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
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // its parent rect in the physical coordinate system. 98 // its parent rect in the physical coordinate system.
99 struct NGPhysicalOffset { 99 struct NGPhysicalOffset {
100 NGPhysicalOffset() {} 100 NGPhysicalOffset() {}
101 NGPhysicalOffset(LayoutUnit left, LayoutUnit top) : left(left), top(top) {} 101 NGPhysicalOffset(LayoutUnit left, LayoutUnit top) : left(left), top(top) {}
102 102
103 LayoutUnit left; 103 LayoutUnit left;
104 LayoutUnit top; 104 LayoutUnit top;
105 105
106 NGPhysicalOffset operator+(const NGPhysicalOffset& other) const; 106 NGPhysicalOffset operator+(const NGPhysicalOffset& other) const;
107 NGPhysicalOffset& operator+=(const NGPhysicalOffset& other); 107 NGPhysicalOffset& operator+=(const NGPhysicalOffset& other);
108 NGPhysicalOffset operator-(const NGPhysicalOffset& other) const;
109 NGPhysicalOffset& operator-=(const NGPhysicalOffset& other);
108 }; 110 };
109 111
110 struct NGPhysicalSize { 112 struct NGPhysicalSize {
111 NGPhysicalSize() {} 113 NGPhysicalSize() {}
112 NGPhysicalSize(LayoutUnit width, LayoutUnit height) 114 NGPhysicalSize(LayoutUnit width, LayoutUnit height)
113 : width(width), height(height) {} 115 : width(width), height(height) {}
114 116
115 LayoutUnit width; 117 LayoutUnit width;
116 LayoutUnit height; 118 LayoutUnit height;
117 119
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 struct CORE_EXPORT NGStaticPosition { 305 struct CORE_EXPORT NGStaticPosition {
304 enum Type { kTopLeft, kTopRight, kBottomLeft, kBottomRight }; 306 enum Type { kTopLeft, kTopRight, kBottomLeft, kBottomRight };
305 307
306 Type type; // Logical corner that corresponds to physical top left. 308 Type type; // Logical corner that corresponds to physical top left.
307 NGPhysicalOffset offset; 309 NGPhysicalOffset offset;
308 310
309 // Creates a position with proper type wrt writing mode and direction. 311 // Creates a position with proper type wrt writing mode and direction.
310 static NGStaticPosition Create(NGWritingMode, 312 static NGStaticPosition Create(NGWritingMode,
311 TextDirection, 313 TextDirection,
312 NGPhysicalOffset); 314 NGPhysicalOffset);
313
314 // Left/Right/TopPosition functions map static position to 315 // Left/Right/TopPosition functions map static position to
315 // left/right/top edge wrt container space. 316 // left/right/top edge wrt container space.
316 // The function arguments are required to solve the equation: 317 // The function arguments are required to solve the equation:
317 // contaner_size = left + margin_left + width + margin_right + right 318 // contaner_size = left + margin_left + width + margin_right + right
318 LayoutUnit LeftPosition(LayoutUnit container_size, 319 LayoutUnit LeftPosition(LayoutUnit container_size,
319 LayoutUnit width, 320 LayoutUnit width,
320 LayoutUnit margin_left, 321 LayoutUnit margin_left,
321 LayoutUnit margin_right) const { 322 LayoutUnit margin_right) const {
322 return GenericPosition(HasLeft(), offset.left, container_size, width, 323 return GenericPosition(HasLeft(), offset.left, container_size, width,
323 margin_left, margin_right); 324 margin_left, margin_right);
(...skipping 27 matching lines...) Expand all
351 if (position_matches) 352 if (position_matches)
352 return position; 353 return position;
353 else 354 else
354 return container_size - position - length - margin_start - margin_end; 355 return container_size - position - length - margin_start - margin_end;
355 } 356 }
356 }; 357 };
357 358
358 } // namespace blink 359 } // namespace blink
359 360
360 #endif // NGUnits_h 361 #endif // NGUnits_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698