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

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

Issue 2346193002: Split CSSPrimitiveValue into CSSPrimitiveValue and CSSIdentifierValue (Closed)
Patch Set: Rebase please work 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) 37 void* operator new(size_t size)
36 { 38 {
37 return allocateObject(size, false); 39 return allocateObject(size, false);
38 } 40 }
39 static void* allocateObject(size_t size, bool isEager) 41 static void* allocateObject(size_t size, bool isEager)
40 { 42 {
41 ThreadState* state = ThreadStateFor<ThreadingTrait<CSSValue>::Affinity>: :state(); 43 ThreadState* state = ThreadStateFor<ThreadingTrait<CSSValue>::Affinity>: :state();
42 const char typeName[] = "blink::CSSValue"; 44 const char typeName[] = "blink::CSSValue";
43 return ThreadHeap::allocateOnArenaIndex(state, size, isEager ? BlinkGC:: EagerSweepArenaIndex : BlinkGC::CSSValueArenaIndex, GCInfoTrait<CSSValue>::index (), typeName); 45 return ThreadHeap::allocateOnArenaIndex(state, size, isEager ? BlinkGC:: EagerSweepArenaIndex : BlinkGC::CSSValueArenaIndex, 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 { return m_classType >= BasicShapeCircleClass && m_classType <= BasicShapeInsetClass; } 60 bool isBasicShapeValue() const { return m_classType >= BasicShapeCircleClass && m_classType <= BasicShapeInsetClass; }
55 bool isBasicShapeCircleValue() const { return m_classType == BasicShapeCircl eClass; } 61 bool isBasicShapeCircleValue() const { return m_classType == BasicShapeCircl eClass; }
56 bool isBasicShapeEllipseValue() const { return m_classType == BasicShapeElli pseClass; } 62 bool isBasicShapeEllipseValue() const { return m_classType == BasicShapeElli pseClass; }
57 bool isBasicShapePolygonValue() const { return m_classType == BasicShapePoly gonClass; } 63 bool isBasicShapePolygonValue() const { return m_classType == BasicShapePoly gonClass; }
58 bool isBasicShapeInsetValue() const { return m_classType == BasicShapeInsetC lass; } 64 bool isBasicShapeInsetValue() const { return m_classType == BasicShapeInsetC lass; }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // ~CSSValue should be public, because non-public ~CSSValue causes C2248 113 // ~CSSValue should be public, because non-public ~CSSValue causes C2248
108 // error: 'blink::CSSValue::~CSSValue' : cannot access protected member 114 // error: 'blink::CSSValue::~CSSValue' : cannot access protected member
109 // declared in class 'blink::CSSValue' when compiling 115 // declared in class 'blink::CSSValue' when compiling
110 // 'source\wtf\refcounted.h' by using msvc. 116 // 'source\wtf\refcounted.h' by using msvc.
111 ~CSSValue() { } 117 ~CSSValue() { }
112 118
113 protected: 119 protected:
114 static const size_t ClassTypeBits = 6; 120 static const size_t ClassTypeBits = 6;
115 enum ClassType { 121 enum ClassType {
116 PrimitiveClass, 122 PrimitiveClass,
123 IdentifierClass,
117 ColorClass, 124 ColorClass,
118 CounterClass, 125 CounterClass,
119 QuadClass, 126 QuadClass,
120 CustomIdentClass, 127 CustomIdentClass,
121 StringClass, 128 StringClass,
122 URIClass, 129 URIClass,
123 ValuePairClass, 130 ValuePairClass,
124 131
125 // Basic shape classes. 132 // Basic shape classes.
126 // TODO(sashab): Represent these as a single subclass, BasicShapeClass. 133 // TODO(sashab): Represent these as a single subclass, BasicShapeClass.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 return false; 260 return false;
254 return first->equals(*second); 261 return first->equals(*second);
255 } 262 }
256 263
257 #define DEFINE_CSS_VALUE_TYPE_CASTS(thisType, predicate) \ 264 #define DEFINE_CSS_VALUE_TYPE_CASTS(thisType, predicate) \
258 DEFINE_TYPE_CASTS(thisType, CSSValue, value, value->predicate, value.predica te) 265 DEFINE_TYPE_CASTS(thisType, CSSValue, value, value->predicate, value.predica te)
259 266
260 } // namespace blink 267 } // namespace blink
261 268
262 #endif // CSSValue_h 269 #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