| OLD | NEW |
| 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 NGBoxStrut_h | 5 #ifndef NGBoxStrut_h |
| 6 #define NGBoxStrut_h | 6 #define NGBoxStrut_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/ng/geometry/ng_logical_offset.h" |
| 9 #include "core/layout/ng/ng_writing_mode.h" | 10 #include "core/layout/ng/ng_writing_mode.h" |
| 10 #include "platform/LayoutUnit.h" | 11 #include "platform/LayoutUnit.h" |
| 11 #include "platform/text/TextDirection.h" | 12 #include "platform/text/TextDirection.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 // This struct is used for storing margins, borders or padding of a box on all | 16 // This struct is used for storing margins, borders or padding of a box on all |
| 16 // four edges. | 17 // four edges. |
| 17 struct CORE_EXPORT NGBoxStrut { | 18 struct CORE_EXPORT NGBoxStrut { |
| 18 NGBoxStrut() {} | 19 NGBoxStrut() {} |
| 19 NGBoxStrut(LayoutUnit inline_start, | 20 NGBoxStrut(LayoutUnit inline_start, |
| 20 LayoutUnit inline_end, | 21 LayoutUnit inline_end, |
| 21 LayoutUnit block_start, | 22 LayoutUnit block_start, |
| 22 LayoutUnit block_end) | 23 LayoutUnit block_end) |
| 23 : inline_start(inline_start), | 24 : inline_start(inline_start), |
| 24 inline_end(inline_end), | 25 inline_end(inline_end), |
| 25 block_start(block_start), | 26 block_start(block_start), |
| 26 block_end(block_end) {} | 27 block_end(block_end) {} |
| 27 | 28 |
| 28 LayoutUnit InlineSum() const { return inline_start + inline_end; } | 29 LayoutUnit InlineSum() const { return inline_start + inline_end; } |
| 29 LayoutUnit BlockSum() const { return block_start + block_end; } | 30 LayoutUnit BlockSum() const { return block_start + block_end; } |
| 30 | 31 |
| 32 NGLogicalOffset InlineBlockStartOffset() { |
| 33 return {inline_start, block_start}; |
| 34 } |
| 35 |
| 31 bool IsEmpty() const; | 36 bool IsEmpty() const; |
| 32 | 37 |
| 33 // The following two operators exist primarily to have an easy way to access | 38 // The following two operators exist primarily to have an easy way to access |
| 34 // the sum of border and padding. | 39 // the sum of border and padding. |
| 35 NGBoxStrut& operator+=(const NGBoxStrut& other) { | 40 NGBoxStrut& operator+=(const NGBoxStrut& other) { |
| 36 inline_start += other.inline_start; | 41 inline_start += other.inline_start; |
| 37 inline_end += other.inline_end; | 42 inline_end += other.inline_end; |
| 38 block_start += other.block_start; | 43 block_start += other.block_start; |
| 39 block_end += other.block_end; | 44 block_end += other.block_end; |
| 40 return *this; | 45 return *this; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 65 LayoutUnit left; | 70 LayoutUnit left; |
| 66 LayoutUnit right; | 71 LayoutUnit right; |
| 67 LayoutUnit top; | 72 LayoutUnit top; |
| 68 LayoutUnit bottom; | 73 LayoutUnit bottom; |
| 69 NGBoxStrut ConvertToLogical(NGWritingMode, TextDirection) const; | 74 NGBoxStrut ConvertToLogical(NGWritingMode, TextDirection) const; |
| 70 }; | 75 }; |
| 71 | 76 |
| 72 } // namespace blink | 77 } // namespace blink |
| 73 | 78 |
| 74 #endif // NGBoxStrut_h | 79 #endif // NGBoxStrut_h |
| OLD | NEW |