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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSValue.h

Issue 2382653006: Split CSSPrimitiveValue into CSSPrimitiveValue and CSSIdentifierValue (Closed)
Patch Set: Make check-webkit-style happy Created 4 years, 2 months 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 * (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,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #ifndef CSSValue_h 21 #ifndef CSSValue_h
22 #define CSSValue_h 22 #define CSSValue_h
23 23
24 #include "core/CoreExport.h" 24 #include "core/CoreExport.h"
25 #include "platform/heap/Handle.h" 25 #include "platform/heap/Handle.h"
26 #include "wtf/RefPtr.h" 26 #include "wtf/RefPtr.h"
27 27
28 namespace blink { 28 namespace blink {
29 29
30 class Length;
31
30 class CORE_EXPORT CSSValue : public GarbageCollectedFinalized<CSSValue> { 32 class CORE_EXPORT CSSValue : public GarbageCollectedFinalized<CSSValue> {
31 public: 33 public:
32 // Override operator new to allocate CSSValue subtype objects onto 34 // Override operator new to allocate CSSValue subtype objects onto
33 // a dedicated heap. 35 // a dedicated heap.
34 GC_PLUGIN_IGNORE("crbug.com/443854") 36 GC_PLUGIN_IGNORE("crbug.com/443854")
35 void* operator new(size_t size) { return allocateObject(size, false); } 37 void* operator new(size_t size) { return allocateObject(size, false); }
36 static void* allocateObject(size_t size, bool isEager) { 38 static void* allocateObject(size_t size, bool isEager) {
37 ThreadState* state = 39 ThreadState* state =
38 ThreadStateFor<ThreadingTrait<CSSValue>::Affinity>::state(); 40 ThreadStateFor<ThreadingTrait<CSSValue>::Affinity>::state();
39 const char typeName[] = "blink::CSSValue"; 41 const char typeName[] = "blink::CSSValue";
40 return ThreadHeap::allocateOnArenaIndex( 42 return ThreadHeap::allocateOnArenaIndex(
41 state, size, 43 state, size,
42 isEager ? BlinkGC::EagerSweepArenaIndex : BlinkGC::CSSValueArenaIndex, 44 isEager ? BlinkGC::EagerSweepArenaIndex : BlinkGC::CSSValueArenaIndex,
43 GCInfoTrait<CSSValue>::index(), typeName); 45 GCInfoTrait<CSSValue>::index(), typeName);
44 } 46 }
45 47
48 // TODO(sashab): Remove this method and move logic to the caller.
49 static CSSValue* create(const Length& value, float zoom);
50
46 String cssText() const; 51 String cssText() const;
47 52
48 bool isPrimitiveValue() const { return m_classType == PrimitiveClass; } 53 bool isPrimitiveValue() const { return m_classType == PrimitiveClass; }
54 bool isIdentifierValue() const { return m_classType == IdentifierClass; }
49 bool isValuePair() const { return m_classType == ValuePairClass; } 55 bool isValuePair() const { return m_classType == ValuePairClass; }
50 bool isValueList() const { return m_classType >= ValueListClass; } 56 bool isValueList() const { return m_classType >= ValueListClass; }
51 57
52 bool isBaseValueList() const { return m_classType == ValueListClass; } 58 bool isBaseValueList() const { return m_classType == ValueListClass; }
53 59
54 bool isBasicShapeValue() const { 60 bool isBasicShapeValue() const {
55 return m_classType >= BasicShapeCircleClass && 61 return m_classType >= BasicShapeCircleClass &&
56 m_classType <= BasicShapeInsetClass; 62 m_classType <= BasicShapeInsetClass;
57 } 63 }
58 bool isBasicShapeCircleValue() const { 64 bool isBasicShapeCircleValue() const {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // ~CSSValue should be public, because non-public ~CSSValue causes C2248 155 // ~CSSValue should be public, because non-public ~CSSValue causes C2248
150 // error: 'blink::CSSValue::~CSSValue' : cannot access protected member 156 // error: 'blink::CSSValue::~CSSValue' : cannot access protected member
151 // declared in class 'blink::CSSValue' when compiling 157 // declared in class 'blink::CSSValue' when compiling
152 // 'source\wtf\refcounted.h' by using msvc. 158 // 'source\wtf\refcounted.h' by using msvc.
153 ~CSSValue() {} 159 ~CSSValue() {}
154 160
155 protected: 161 protected:
156 static const size_t ClassTypeBits = 6; 162 static const size_t ClassTypeBits = 6;
157 enum ClassType { 163 enum ClassType {
158 PrimitiveClass, 164 PrimitiveClass,
165 IdentifierClass,
159 ColorClass, 166 ColorClass,
160 CounterClass, 167 CounterClass,
161 QuadClass, 168 QuadClass,
162 CustomIdentClass, 169 CustomIdentClass,
163 StringClass, 170 StringClass,
164 URIClass, 171 URIClass,
165 ValuePairClass, 172 ValuePairClass,
166 173
167 // Basic shape classes. 174 // Basic shape classes.
168 // TODO(sashab): Represent these as a single subclass, BasicShapeClass. 175 // TODO(sashab): Represent these as a single subclass, BasicShapeClass.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 return first->equals(*second); 299 return first->equals(*second);
293 } 300 }
294 301
295 #define DEFINE_CSS_VALUE_TYPE_CASTS(thisType, predicate) \ 302 #define DEFINE_CSS_VALUE_TYPE_CASTS(thisType, predicate) \
296 DEFINE_TYPE_CASTS(thisType, CSSValue, value, value->predicate, \ 303 DEFINE_TYPE_CASTS(thisType, CSSValue, value, value->predicate, \
297 value.predicate) 304 value.predicate)
298 305
299 } // namespace blink 306 } // namespace blink
300 307
301 #endif // CSSValue_h 308 #endif // CSSValue_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSShadowValue.cpp ('k') | third_party/WebKit/Source/core/css/CSSValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698