OLD | NEW |
1 /* | 1 /* |
2 Copyright (c) 2013, Opera Software ASA. All rights reserved. | 2 Copyright (c) 2013, Opera Software ASA. All rights reserved. |
3 | 3 |
4 This library is free software; you can redistribute it and/or | 4 This library is free software; you can redistribute it and/or |
5 modify it under the terms of the GNU Library General Public | 5 modify it under the terms of the GNU Library General Public |
6 License as published by the Free Software Foundation; either | 6 License as published by the Free Software Foundation; either |
7 version 2 of the License, or (at your option) any later version. | 7 version 2 of the License, or (at your option) any later version. |
8 | 8 |
9 This library is distributed in the hope that it will be useful, | 9 This library is distributed in the hope that it will be useful, |
10 but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 bool isNumber() const { return m_length.isRelative(); } | 43 bool isNumber() const { return m_length.isRelative(); } |
44 bool isLength() const { return !isNumber(); } | 44 bool isLength() const { return !isNumber(); } |
45 | 45 |
46 const Length& length() const { ASSERT(isLength()); return m_length; } | 46 const Length& length() const { ASSERT(isLength()); return m_length; } |
47 Length& length() { ASSERT(isLength()); return m_length; } | 47 Length& length() { ASSERT(isLength()); return m_length; } |
48 | 48 |
49 double number() const { ASSERT(isNumber()); return m_length.value(); } | 49 double number() const { ASSERT(isNumber()); return m_length.value(); } |
50 | 50 |
51 Length unifiedLength() const { return m_length; } | |
52 | |
53 bool operator==(const LengthOrNumber& o) const | 51 bool operator==(const LengthOrNumber& o) const |
54 { | 52 { |
55 return m_length == o.m_length; | 53 return m_length == o.m_length; |
56 } | 54 } |
57 | 55 |
58 bool isZero() const | 56 bool isZero() const |
59 { | 57 { |
60 return m_length.isZero(); | 58 return m_length.isZero(); |
61 } | 59 } |
62 | 60 |
63 private: | 61 private: |
64 Length m_length; | 62 Length m_length; |
65 }; | 63 }; |
66 | 64 |
67 } // namespace WebCore | 65 } // namespace WebCore |
68 | 66 |
69 #endif // LengthOrNumber_h | 67 #endif // LengthOrNumber_h |
OLD | NEW |