Chromium Code Reviews| 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 length.m_type = Auto; | |
|
tkent
2014/05/27 00:13:29
Why do we need do length.m_type=Auto though |lengt
Inactive
2014/05/27 00:33:29
We basically want to make sure that |length|'s des
| |
| 128 } | |
| 129 | |
| 130 Length& operator=(Length&& length) | |
| 131 { | |
| 132 if (this == &length) | |
| 133 return *this; | |
| 134 | |
| 135 if (isCalculated()) | |
| 136 decrementCalculatedRef(); | |
| 137 | |
| 138 memcpy(this, &length, sizeof(Length)); | |
| 139 length.m_type = Auto; | |
|
tkent
2014/05/27 00:13:29
Ditto.
I understand length.incrementCalculatedRef
| |
| 140 return *this; | |
| 141 } | |
| 142 #endif | |
| 143 | |
| 123 ~Length() | 144 ~Length() |
| 124 { | 145 { |
| 125 if (isCalculated()) | 146 if (isCalculated()) |
| 126 decrementCalculatedRef(); | 147 decrementCalculatedRef(); |
| 127 } | 148 } |
| 128 | 149 |
| 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)); } | 150 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); } | 151 bool operator!=(const Length& o) const { return !(*this == o); } |
| 131 | 152 |
| 132 const Length& operator*=(float v) | 153 const Length& operator*=(float v) |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 bool m_quirk; | 339 bool m_quirk; |
| 319 unsigned char m_type; | 340 unsigned char m_type; |
| 320 bool m_isFloat; | 341 bool m_isFloat; |
| 321 }; | 342 }; |
| 322 | 343 |
| 323 PLATFORM_EXPORT Vector<Length> parseHTMLAreaElementCoords(const String&); | 344 PLATFORM_EXPORT Vector<Length> parseHTMLAreaElementCoords(const String&); |
| 324 | 345 |
| 325 } // namespace WebCore | 346 } // namespace WebCore |
| 326 | 347 |
| 327 #endif // Length_h | 348 #endif // Length_h |
| OLD | NEW |