OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
4 * reserved. | 4 * reserved. |
5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 struct SameSizeAsComputedStyle : public RefCounted<SameSizeAsComputedStyle> { | 73 struct SameSizeAsComputedStyle : public RefCounted<SameSizeAsComputedStyle> { |
74 struct ComputedStyleBase { | 74 struct ComputedStyleBase { |
75 unsigned bitfields_[4]; | 75 unsigned bitfields_[4]; |
76 } base_; | 76 } base_; |
77 | 77 |
78 void* data_refs[7]; | 78 void* data_refs[7]; |
79 void* own_ptrs[1]; | 79 void* own_ptrs[1]; |
80 void* data_ref_svg_style; | 80 void* data_ref_svg_style; |
81 }; | 81 }; |
82 | 82 |
| 83 /* Length */ |
| 84 struct AlignmentSizeLength { |
| 85 char v; /* aligned to float */ |
| 86 Length data; |
| 87 }; |
| 88 static_assert(sizeof(AlignmentSizeLength) == sizeof(float) + sizeof(Length), |
| 89 "Alignment of Length is incorrect"); |
| 90 |
| 91 /* LengthBox */ |
| 92 struct AlignmentSizeLengthBox { |
| 93 char v; /* aligned to float */ |
| 94 LengthBox data; |
| 95 }; |
| 96 static_assert(sizeof(AlignmentSizeLengthBox) == |
| 97 sizeof(float) + sizeof(LengthBox), |
| 98 "Alignment of LengthBox is incorrect"); |
| 99 |
| 100 /* Color */ |
| 101 struct AlignmentSizeColor { |
| 102 char v; /* aligned to unsigned */ |
| 103 Color data; |
| 104 }; |
| 105 static_assert(sizeof(AlignmentSizeColor) == sizeof(unsigned) + sizeof(Color), |
| 106 "Alignment of Color is incorrect"); |
| 107 |
| 108 /* BorderValue */ |
| 109 struct AlignmentSizeBorderValue { |
| 110 char v; /* aligned to unsigned */ |
| 111 BorderValue data; |
| 112 }; |
| 113 static_assert(sizeof(AlignmentSizeBorderValue) == |
| 114 sizeof(unsigned) + sizeof(BorderValue), |
| 115 "Alignment of BorderValue is incorrect"); |
| 116 |
| 117 /* NinePieceImage */ |
| 118 struct AlignmentSizeNinePieceImage { |
| 119 char v; /* aligned to void* */ |
| 120 NinePieceImage data; |
| 121 }; |
| 122 static_assert(sizeof(AlignmentSizeNinePieceImage) == |
| 123 sizeof(void*) + sizeof(NinePieceImage), |
| 124 "Alignment of NinePieceImage is incorrect"); |
| 125 |
| 126 /* LengthSize */ |
| 127 struct AlignmentSizeLengthSize { |
| 128 char v; /* aligned to float */ |
| 129 LengthSize data; |
| 130 }; |
| 131 static_assert(sizeof(AlignmentSizeLengthSize) == |
| 132 sizeof(float) + sizeof(LengthSize), |
| 133 "Alignment of LengthSize is incorrect"); |
| 134 |
| 135 /* BorderData */ |
| 136 struct AlignmentSizeBorderData { |
| 137 char v; /* aligned to void* */ |
| 138 BorderData data; |
| 139 }; |
| 140 static_assert(sizeof(AlignmentSizeBorderData) == |
| 141 sizeof(void*) + sizeof(BorderData), |
| 142 "Alignment of BorderData is incorrect"); |
| 143 |
| 144 /* FillLayer */ |
| 145 struct AlignmentSizeFillLayer { |
| 146 char v; /* aligned to void* */ |
| 147 FillLayer data; |
| 148 }; |
| 149 static_assert(sizeof(AlignmentSizeFillLayer) == |
| 150 sizeof(void*) + sizeof(FillLayer), |
| 151 "Alignment of FillLayer is incorrect"); |
| 152 |
83 // If this assert fails, it means that size of ComputedStyle has changed. Please | 153 // If this assert fails, it means that size of ComputedStyle has changed. Please |
84 // check that you really *do* what to increase the size of ComputedStyle, then | 154 // check that you really *do* what to increase the size of ComputedStyle, then |
85 // update the SameSizeAsComputedStyle struct to match the updated storage of | 155 // update the SameSizeAsComputedStyle struct to match the updated storage of |
86 // ComputedStyle. | 156 // ComputedStyle. |
87 ASSERT_SIZE(ComputedStyle, SameSizeAsComputedStyle); | 157 ASSERT_SIZE(ComputedStyle, SameSizeAsComputedStyle); |
88 | 158 |
89 PassRefPtr<ComputedStyle> ComputedStyle::Create() { | 159 PassRefPtr<ComputedStyle> ComputedStyle::Create() { |
90 return AdoptRef(new ComputedStyle(InitialStyle())); | 160 return AdoptRef(new ComputedStyle(InitialStyle())); |
91 } | 161 } |
92 | 162 |
(...skipping 2403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2496 if (value < 0) | 2566 if (value < 0) |
2497 fvalue -= 0.5f; | 2567 fvalue -= 0.5f; |
2498 else | 2568 else |
2499 fvalue += 0.5f; | 2569 fvalue += 0.5f; |
2500 } | 2570 } |
2501 | 2571 |
2502 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); | 2572 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); |
2503 } | 2573 } |
2504 | 2574 |
2505 } // namespace blink | 2575 } // namespace blink |
OLD | NEW |