| 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 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 double number() const { ASSERT(isNumber()); return m_number; } | 63 double number() const { ASSERT(isNumber()); return m_number; } |
| 64 | 64 |
| 65 bool operator==(const BorderImageLength& other) const | 65 bool operator==(const BorderImageLength& other) const |
| 66 { | 66 { |
| 67 return m_type == other.m_type && m_length == other.m_length && m_number
== other.m_number; | 67 return m_type == other.m_type && m_length == other.m_length && m_number
== other.m_number; |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool isZero() const | 70 bool isZero() const |
| 71 { | 71 { |
| 72 return (isLength() && m_length.isZero()) || (isNumber() && m_number); | 72 if (isLength()) |
| 73 return m_length.isZero(); |
| 74 |
| 75 ASSERT(isNumber()); |
| 76 return !m_number; |
| 73 } | 77 } |
| 74 | 78 |
| 75 private: | 79 private: |
| 76 // Ideally we would put the 2 following fields in a union, but Length has a
constructor, | 80 // Ideally we would put the 2 following fields in a union, but Length has a
constructor, |
| 77 // a destructor and a copy assignment which isn't allowed. | 81 // a destructor and a copy assignment which isn't allowed. |
| 78 Length m_length; | 82 Length m_length; |
| 79 double m_number; | 83 double m_number; |
| 80 enum { | 84 enum { |
| 81 LengthType, | 85 LengthType, |
| 82 NumberType | 86 NumberType |
| 83 } m_type; | 87 } m_type; |
| 84 }; | 88 }; |
| 85 | 89 |
| 86 } // namespace blink | 90 } // namespace blink |
| 87 | 91 |
| 88 #endif // BorderImageLength_h | 92 #endif // BorderImageLength_h |
| OLD | NEW |