Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 static const size_t ValueListSeparatorBits = 2; | 179 static const size_t ValueListSeparatorBits = 2; |
| 180 enum ValueListSeparator { | 180 enum ValueListSeparator { |
| 181 SpaceSeparator, | 181 SpaceSeparator, |
| 182 CommaSeparator, | 182 CommaSeparator, |
| 183 SlashSeparator | 183 SlashSeparator |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 ClassType getClassType() const { return static_cast<ClassType>(m_classType); } | 186 ClassType getClassType() const { return static_cast<ClassType>(m_classType); } |
| 187 | 187 |
| 188 explicit CSSValue(ClassType classType) | 188 explicit CSSValue(ClassType classType) |
| 189 : m_primitiveUnitType(0) | 189 : m_classType(classType) |
| 190 , m_hasCachedCSSText(false) | |
| 191 , m_valueListSeparator(SpaceSeparator) | |
| 192 , m_classType(classType) | |
| 193 { | 190 { |
| 194 } | 191 } |
| 195 | 192 |
| 196 // NOTE: This class is non-virtual for memory and performance reasons. | 193 // NOTE: This class is non-virtual for memory and performance reasons. |
| 197 // Don't go making it virtual again unless you know exactly what you're doin g! | 194 // Don't go making it virtual again unless you know exactly what you're doin g! |
| 198 | 195 |
| 199 private: | 196 private: |
| 200 void destroy(); | 197 void destroy(); |
| 201 | 198 |
| 202 protected: | |
| 203 // The bits in this section are only used by specific subclasses but kept he re | |
| 204 // to maximize struct packing. | |
| 205 | |
| 206 // CSSPrimitiveValue bits: | |
| 207 unsigned m_primitiveUnitType : 7; // CSSPrimitiveValue::UnitType | |
| 208 mutable unsigned m_hasCachedCSSText : 1; | |
| 209 | |
| 210 unsigned m_valueListSeparator : ValueListSeparatorBits; | |
|
esprehn
2016/08/11 05:42:35
this was done so these bits can pack with m_classT
| |
| 211 | |
| 212 private: | |
| 213 unsigned m_classType : ClassTypeBits; // ClassType | 199 unsigned m_classType : ClassTypeBits; // ClassType |
| 214 }; | 200 }; |
| 215 | 201 |
| 216 template<typename CSSValueType, size_t inlineCapacity> | 202 template<typename CSSValueType, size_t inlineCapacity> |
| 217 inline bool compareCSSValueVector(const HeapVector<Member<CSSValueType>, inlineC apacity>& firstVector, const HeapVector<Member<CSSValueType>, inlineCapacity>& s econdVector) | 203 inline bool compareCSSValueVector(const HeapVector<Member<CSSValueType>, inlineC apacity>& firstVector, const HeapVector<Member<CSSValueType>, inlineCapacity>& s econdVector) |
| 218 { | 204 { |
| 219 size_t size = firstVector.size(); | 205 size_t size = firstVector.size(); |
| 220 if (size != secondVector.size()) | 206 if (size != secondVector.size()) |
| 221 return false; | 207 return false; |
| 222 | 208 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 return false; | 245 return false; |
| 260 return first->equals(*second); | 246 return first->equals(*second); |
| 261 } | 247 } |
| 262 | 248 |
| 263 #define DEFINE_CSS_VALUE_TYPE_CASTS(thisType, predicate) \ | 249 #define DEFINE_CSS_VALUE_TYPE_CASTS(thisType, predicate) \ |
| 264 DEFINE_TYPE_CASTS(thisType, CSSValue, value, value->predicate, value.predica te) | 250 DEFINE_TYPE_CASTS(thisType, CSSValue, value, value->predicate, value.predica te) |
| 265 | 251 |
| 266 } // namespace blink | 252 } // namespace blink |
| 267 | 253 |
| 268 #endif // CSSValue_h | 254 #endif // CSSValue_h |
| OLD | NEW |