| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 3 Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
| 4 Copyright (C) 2011 Rik Cabanier (cabanier@adobe.com) | 4 Copyright (C) 2011 Rik Cabanier (cabanier@adobe.com) |
| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 | 103 |
| 104 if (m_isFloat) | 104 if (m_isFloat) |
| 105 m_floatValue = static_cast<float>(m_floatValue * v); | 105 m_floatValue = static_cast<float>(m_floatValue * v); |
| 106 else | 106 else |
| 107 m_intValue = static_cast<int>(m_intValue * v); | 107 m_intValue = static_cast<int>(m_intValue * v); |
| 108 | 108 |
| 109 return *this; | 109 return *this; |
| 110 } | 110 } |
| 111 | 111 |
| 112 inline float value() const | 112 int value() const |
| 113 { | 113 { |
| 114 return getFloatValue(); | |
| 115 } | |
| 116 | |
| 117 int intValue() const | |
| 118 { | |
| 119 if (isCalculated()) { | 114 if (isCalculated()) { |
| 120 ASSERT_NOT_REACHED(); | 115 ASSERT_NOT_REACHED(); |
| 121 return 0; | 116 return 0; |
| 122 } | 117 } |
| 123 return getIntValue(); | 118 return getIntValue(); |
| 124 } | 119 } |
| 125 | 120 |
| 121 // FIXME: When we switch to sub-pixel layout, value will return float by def
ault, and this will inherit |
| 122 // the current implementation of value(). |
| 123 int intValue() const |
| 124 { |
| 125 return value(); |
| 126 } |
| 127 |
| 126 float percent() const | 128 float percent() const |
| 127 { | 129 { |
| 128 ASSERT(type() == Percent); | 130 ASSERT(type() == Percent); |
| 129 return getFloatValue(); | 131 return getFloatValue(); |
| 130 } | 132 } |
| 131 | 133 |
| 132 PassRefPtr<CalculationValue> calculationValue() const; | 134 PassRefPtr<CalculationValue> calculationValue() const; |
| 133 | 135 |
| 134 LengthType type() const { return static_cast<LengthType>(m_type); } | 136 LengthType type() const { return static_cast<LengthType>(m_type); } |
| 135 bool quirk() const { return m_quirk; } | 137 bool quirk() const { return m_quirk; } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 unsigned char m_type; | 293 unsigned char m_type; |
| 292 bool m_isFloat; | 294 bool m_isFloat; |
| 293 }; | 295 }; |
| 294 | 296 |
| 295 PassOwnArrayPtr<Length> newCoordsArray(const String&, int& len); | 297 PassOwnArrayPtr<Length> newCoordsArray(const String&, int& len); |
| 296 PassOwnArrayPtr<Length> newLengthArray(const String&, int& len); | 298 PassOwnArrayPtr<Length> newLengthArray(const String&, int& len); |
| 297 | 299 |
| 298 } // namespace WebCore | 300 } // namespace WebCore |
| 299 | 301 |
| 300 #endif // Length_h | 302 #endif // Length_h |
| OLD | NEW |