OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) | 4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. |
6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 10 matching lines...) Expand all Loading... |
21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 #include "config.h" | 25 #include "config.h" |
26 #include "platform/Length.h" | 26 #include "platform/Length.h" |
27 | 27 |
28 #include "platform/CalculationValue.h" | 28 #include "platform/CalculationValue.h" |
29 #include "platform/animation/AnimationUtilities.h" | 29 #include "platform/animation/AnimationUtilities.h" |
30 #include "wtf/ASCIICType.h" | 30 #include "wtf/ASCIICType.h" |
| 31 #include "wtf/SizeAssertions.h" |
31 #include "wtf/text/StringBuffer.h" | 32 #include "wtf/text/StringBuffer.h" |
32 #include "wtf/text/WTFString.h" | 33 #include "wtf/text/WTFString.h" |
33 | 34 |
34 using namespace WTF; | 35 using namespace WTF; |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 | 38 |
| 39 ASSERT_SIZE(Length, 8, 8); |
| 40 |
38 template<typename CharType> | 41 template<typename CharType> |
39 static unsigned splitLength(const CharType* data, unsigned length, unsigned& int
Length, unsigned& doubleLength) | 42 static unsigned splitLength(const CharType* data, unsigned length, unsigned& int
Length, unsigned& doubleLength) |
40 { | 43 { |
41 ASSERT(length); | 44 ASSERT(length); |
42 | 45 |
43 unsigned i = 0; | 46 unsigned i = 0; |
44 while (i < length && isSpaceOrNewline(data[i])) | 47 while (i < length && isSpaceOrNewline(data[i])) |
45 ++i; | 48 ++i; |
46 if (i < length && (data[i] == '+' || data[i] == '-')) | 49 if (i < length && (data[i] == '+' || data[i] == '-')) |
47 ++i; | 50 ++i; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 if (std::isnan(result)) | 238 if (std::isnan(result)) |
236 return 0; | 239 return 0; |
237 return result; | 240 return result; |
238 } | 241 } |
239 | 242 |
240 bool Length::isCalculatedEqual(const Length& o) const | 243 bool Length::isCalculatedEqual(const Length& o) const |
241 { | 244 { |
242 return isCalculated() && (&calculationValue() == &o.calculationValue() || ca
lculationValue() == o.calculationValue()); | 245 return isCalculated() && (&calculationValue() == &o.calculationValue() || ca
lculationValue() == o.calculationValue()); |
243 } | 246 } |
244 | 247 |
245 struct SameSizeAsLength { | |
246 int32_t value; | |
247 int32_t metaData; | |
248 }; | |
249 static_assert(sizeof(Length) == sizeof(SameSizeAsLength), "length should stay sm
all"); | |
250 | |
251 } // namespace blink | 248 } // namespace blink |
OLD | NEW |