| 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 NGUnits_h | 5 #ifndef NGUnits_h |
| 6 #define NGUnits_h | 6 #define NGUnits_h |
| 7 | 7 |
| 8 #include "platform/LayoutUnit.h" | 8 #include "platform/LayoutUnit.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // This struct is used for storing margins, borders or padding of a box on all | 54 // This struct is used for storing margins, borders or padding of a box on all |
| 55 // four edges. | 55 // four edges. |
| 56 struct NGBoxStrut { | 56 struct NGBoxStrut { |
| 57 LayoutUnit inline_start; | 57 LayoutUnit inline_start; |
| 58 LayoutUnit inline_end; | 58 LayoutUnit inline_end; |
| 59 LayoutUnit block_start; | 59 LayoutUnit block_start; |
| 60 LayoutUnit block_end; | 60 LayoutUnit block_end; |
| 61 | 61 |
| 62 LayoutUnit InlineSum() const { return inline_start + inline_end; } | 62 LayoutUnit InlineSum() const { return inline_start + inline_end; } |
| 63 LayoutUnit BlockSum() const { return block_start + block_end; } | 63 LayoutUnit BlockSum() const { return block_start + block_end; } |
| 64 |
| 65 // The following two operators exist primarily to have an easy way to access |
| 66 // the sum of border and padding. |
| 67 NGBoxStrut& operator+=(const NGBoxStrut& other) { |
| 68 inline_start += other.inline_start; |
| 69 inline_end += other.inline_end; |
| 70 block_start += other.block_start; |
| 71 block_end += other.block_end; |
| 72 return *this; |
| 73 } |
| 74 |
| 75 NGBoxStrut operator+(const NGBoxStrut& other) { |
| 76 NGBoxStrut result(*this); |
| 77 result += other; |
| 78 return result; |
| 79 } |
| 64 }; | 80 }; |
| 65 | 81 |
| 66 } // namespace blink | 82 } // namespace blink |
| 67 | 83 |
| 68 #endif // NGUnits_h | 84 #endif // NGUnits_h |
| OLD | NEW |