| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 Length& operator=(const Length& length) | 113 Length& operator=(const Length& length) |
| 114 { | 114 { |
| 115 if (length.isCalculated()) | 115 if (length.isCalculated()) |
| 116 length.incrementCalculatedRef(); | 116 length.incrementCalculatedRef(); |
| 117 if (isCalculated()) | 117 if (isCalculated()) |
| 118 decrementCalculatedRef(); | 118 decrementCalculatedRef(); |
| 119 memcpy(this, &length, sizeof(Length)); | 119 memcpy(this, &length, sizeof(Length)); |
| 120 return *this; | 120 return *this; |
| 121 } | 121 } |
| 122 | 122 |
| 123 #if COMPILER_SUPPORTS(CXX_RVALUE_REFERENCES) |
| 124 Length(Length&& length) |
| 125 { |
| 126 memcpy(this, &length, sizeof(Length)); |
| 127 |
| 128 // Reset |length|'s type to Auto to make sure its destructor |
| 129 // won't call decrementCalculatedRef() as we don't call |
| 130 // incrementCalculatedRef() here. |
| 131 length.m_type = Auto; |
| 132 } |
| 133 |
| 134 Length& operator=(Length&& length) |
| 135 { |
| 136 if (this == &length) |
| 137 return *this; |
| 138 |
| 139 if (isCalculated()) |
| 140 decrementCalculatedRef(); |
| 141 |
| 142 memcpy(this, &length, sizeof(Length)); |
| 143 |
| 144 // Reset |length|'s type to Auto to make sure its destructor |
| 145 // won't call decrementCalculatedRef() as we don't call |
| 146 // incrementCalculatedRef() here. |
| 147 length.m_type = Auto; |
| 148 |
| 149 return *this; |
| 150 } |
| 151 #endif |
| 152 |
| 123 ~Length() | 153 ~Length() |
| 124 { | 154 { |
| 125 if (isCalculated()) | 155 if (isCalculated()) |
| 126 decrementCalculatedRef(); | 156 decrementCalculatedRef(); |
| 127 } | 157 } |
| 128 | 158 |
| 129 bool operator==(const Length& o) const { return (m_type == o.m_type) && (m_q
uirk == o.m_quirk) && (isUndefined() || (getFloatValue() == o.getFloatValue()) |
| isCalculatedEqual(o)); } | 159 bool operator==(const Length& o) const { return (m_type == o.m_type) && (m_q
uirk == o.m_quirk) && (isUndefined() || (getFloatValue() == o.getFloatValue()) |
| isCalculatedEqual(o)); } |
| 130 bool operator!=(const Length& o) const { return !(*this == o); } | 160 bool operator!=(const Length& o) const { return !(*this == o); } |
| 131 | 161 |
| 132 const Length& operator*=(float v) | 162 const Length& operator*=(float v) |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 bool m_quirk; | 348 bool m_quirk; |
| 319 unsigned char m_type; | 349 unsigned char m_type; |
| 320 bool m_isFloat; | 350 bool m_isFloat; |
| 321 }; | 351 }; |
| 322 | 352 |
| 323 PLATFORM_EXPORT Vector<Length> parseHTMLAreaElementCoords(const String&); | 353 PLATFORM_EXPORT Vector<Length> parseHTMLAreaElementCoords(const String&); |
| 324 | 354 |
| 325 } // namespace WebCore | 355 } // namespace WebCore |
| 326 | 356 |
| 327 #endif // Length_h | 357 #endif // Length_h |
| OLD | NEW |