Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(910)

Side by Side Diff: sky/engine/platform/Length.h

Issue 722723003: Re-land 714393002 after fixing android build. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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) 123 Length(Length&& length)
125 { 124 {
126 memcpy(this, &length, sizeof(Length)); 125 memcpy(this, &length, sizeof(Length));
127 126
128 // Reset |length|'s type to Auto to make sure its destructor 127 // Reset |length|'s type to Auto to make sure its destructor
129 // won't call decrementCalculatedRef() as we don't call 128 // won't call decrementCalculatedRef() as we don't call
130 // incrementCalculatedRef() here. 129 // incrementCalculatedRef() here.
131 length.m_type = Auto; 130 length.m_type = Auto;
132 } 131 }
133 132
134 Length& operator=(Length&& length) 133 Length& operator=(Length&& length)
135 { 134 {
136 if (this == &length) 135 if (this == &length)
137 return *this; 136 return *this;
138 137
139 if (isCalculated()) 138 if (isCalculated())
140 decrementCalculatedRef(); 139 decrementCalculatedRef();
141 140
142 memcpy(this, &length, sizeof(Length)); 141 memcpy(this, &length, sizeof(Length));
143 142
144 // Reset |length|'s type to Auto to make sure its destructor 143 // Reset |length|'s type to Auto to make sure its destructor
145 // won't call decrementCalculatedRef() as we don't call 144 // won't call decrementCalculatedRef() as we don't call
146 // incrementCalculatedRef() here. 145 // incrementCalculatedRef() here.
147 length.m_type = Auto; 146 length.m_type = Auto;
148 147
149 return *this; 148 return *this;
150 } 149 }
151 #endif
152 150
153 ~Length() 151 ~Length()
154 { 152 {
155 if (isCalculated()) 153 if (isCalculated())
156 decrementCalculatedRef(); 154 decrementCalculatedRef();
157 } 155 }
158 156
159 bool operator==(const Length& o) const { return (m_type == o.m_type) && (m_q uirk == o.m_quirk) && (isMaxSizeNone() || (getFloatValue() == o.getFloatValue()) || isCalculatedEqual(o)); } 157 bool operator==(const Length& o) const { return (m_type == o.m_type) && (m_q uirk == o.m_quirk) && (isMaxSizeNone() || (getFloatValue() == o.getFloatValue()) || isCalculatedEqual(o)); }
160 bool operator!=(const Length& o) const { return !(*this == o); } 158 bool operator!=(const Length& o) const { return !(*this == o); }
161 159
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 float m_floatValue; 344 float m_floatValue;
347 }; 345 };
348 bool m_quirk; 346 bool m_quirk;
349 unsigned char m_type; 347 unsigned char m_type;
350 bool m_isFloat; 348 bool m_isFloat;
351 }; 349 };
352 350
353 } // namespace blink 351 } // namespace blink
354 352
355 #endif // Length_h 353 #endif // Length_h
OLDNEW
« no previous file with comments | « sky/engine/core/html/parser/MarkupTokenizerInlines.h ('k') | sky/engine/platform/PlatformExport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698