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

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

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Post-merge Created 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Andreas Kling (kling@webkit.org) 2 * Copyright (C) 2011 Andreas Kling (kling@webkit.org)
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 15 matching lines...) Expand all
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "core/css/CSSValue.h" 28 #include "core/css/CSSValue.h"
29 29
30 #include "core/css/CSSBorderImageSliceValue.h" 30 #include "core/css/CSSBorderImageSliceValue.h"
31 #include "core/css/CSSCanvasValue.h" 31 #include "core/css/CSSCanvasValue.h"
32 #include "core/css/CSSContentDistributionValue.h" 32 #include "core/css/CSSContentDistributionValue.h"
33 #include "core/css/CSSCounterValue.h" 33 #include "core/css/CSSCounterValue.h"
34 #include "core/css/CSSCrossfadeValue.h" 34 #include "core/css/CSSCrossfadeValue.h"
35 #include "core/css/CSSCursorImageValue.h" 35 #include "core/css/CSSCursorImageValue.h"
36 #include "core/css/CSSCustomPropertyDeclaration.h"
36 #include "core/css/CSSFontFaceSrcValue.h" 37 #include "core/css/CSSFontFaceSrcValue.h"
37 #include "core/css/CSSFontFeatureValue.h" 38 #include "core/css/CSSFontFeatureValue.h"
38 #include "core/css/CSSFunctionValue.h" 39 #include "core/css/CSSFunctionValue.h"
39 #include "core/css/CSSGradientValue.h" 40 #include "core/css/CSSGradientValue.h"
40 #include "core/css/CSSGridLineNamesValue.h" 41 #include "core/css/CSSGridLineNamesValue.h"
41 #include "core/css/CSSGridTemplateAreasValue.h" 42 #include "core/css/CSSGridTemplateAreasValue.h"
42 #include "core/css/CSSImageSetValue.h" 43 #include "core/css/CSSImageSetValue.h"
43 #include "core/css/CSSImageValue.h" 44 #include "core/css/CSSImageValue.h"
44 #include "core/css/CSSInheritedValue.h" 45 #include "core/css/CSSInheritedValue.h"
45 #include "core/css/CSSInitialValue.h" 46 #include "core/css/CSSInitialValue.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 case ValueListClass: 146 case ValueListClass:
146 return compareCSSValues<CSSValueList>(*this, other); 147 return compareCSSValues<CSSValueList>(*this, other);
147 case ValuePairClass: 148 case ValuePairClass:
148 return compareCSSValues<CSSValuePair>(*this, other); 149 return compareCSSValues<CSSValuePair>(*this, other);
149 case ImageSetClass: 150 case ImageSetClass:
150 return compareCSSValues<CSSImageSetValue>(*this, other); 151 return compareCSSValues<CSSImageSetValue>(*this, other);
151 case CSSSVGDocumentClass: 152 case CSSSVGDocumentClass:
152 return compareCSSValues<CSSSVGDocumentValue>(*this, other); 153 return compareCSSValues<CSSSVGDocumentValue>(*this, other);
153 case CSSContentDistributionClass: 154 case CSSContentDistributionClass:
154 return compareCSSValues<CSSContentDistributionValue>(*this, other); 155 return compareCSSValues<CSSContentDistributionValue>(*this, other);
156 case VariableClass:
157 return compareCSSValues<CSSCustomPropertyDeclaration>(*this, other);
155 } 158 }
156 ASSERT_NOT_REACHED(); 159 ASSERT_NOT_REACHED();
157 return false; 160 return false;
158 } 161 }
159 return false; 162 return false;
160 } 163 }
161 164
162 String CSSValue::cssText() const 165 String CSSValue::cssText() const
163 { 166 {
164 switch (classType()) { 167 switch (classType()) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 case ValuePairClass: 216 case ValuePairClass:
214 return toCSSValuePair(this)->customCSSText(); 217 return toCSSValuePair(this)->customCSSText();
215 case ValueListClass: 218 case ValueListClass:
216 return toCSSValueList(this)->customCSSText(); 219 return toCSSValueList(this)->customCSSText();
217 case ImageSetClass: 220 case ImageSetClass:
218 return toCSSImageSetValue(this)->customCSSText(); 221 return toCSSImageSetValue(this)->customCSSText();
219 case CSSSVGDocumentClass: 222 case CSSSVGDocumentClass:
220 return toCSSSVGDocumentValue(this)->customCSSText(); 223 return toCSSSVGDocumentValue(this)->customCSSText();
221 case CSSContentDistributionClass: 224 case CSSContentDistributionClass:
222 return toCSSContentDistributionValue(this)->customCSSText(); 225 return toCSSContentDistributionValue(this)->customCSSText();
226 case VariableClass:
227 // TODO(leviw): We don't allow custom properties in CSSOM yet
228 ASSERT_NOT_REACHED();
223 } 229 }
224 ASSERT_NOT_REACHED(); 230 ASSERT_NOT_REACHED();
225 return String(); 231 return String();
226 } 232 }
227 233
228 void CSSValue::destroy() 234 void CSSValue::destroy()
229 { 235 {
230 switch (classType()) { 236 switch (classType()) {
231 case BorderImageSliceClass: 237 case BorderImageSliceClass:
232 delete toCSSBorderImageSliceValue(this); 238 delete toCSSBorderImageSliceValue(this);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 return; 314 return;
309 case ImageSetClass: 315 case ImageSetClass:
310 delete toCSSImageSetValue(this); 316 delete toCSSImageSetValue(this);
311 return; 317 return;
312 case CSSSVGDocumentClass: 318 case CSSSVGDocumentClass:
313 delete toCSSSVGDocumentValue(this); 319 delete toCSSSVGDocumentValue(this);
314 return; 320 return;
315 case CSSContentDistributionClass: 321 case CSSContentDistributionClass:
316 delete toCSSContentDistributionValue(this); 322 delete toCSSContentDistributionValue(this);
317 return; 323 return;
324 case VariableClass:
325 delete toCSSCustomPropertyDeclaration(this);
326 return;
318 } 327 }
319 ASSERT_NOT_REACHED(); 328 ASSERT_NOT_REACHED();
320 } 329 }
321 330
322 void CSSValue::finalizeGarbageCollectedObject() 331 void CSSValue::finalizeGarbageCollectedObject()
323 { 332 {
324 switch (classType()) { 333 switch (classType()) {
325 case BorderImageSliceClass: 334 case BorderImageSliceClass:
326 toCSSBorderImageSliceValue(this)->~CSSBorderImageSliceValue(); 335 toCSSBorderImageSliceValue(this)->~CSSBorderImageSliceValue();
327 return; 336 return;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 return; 411 return;
403 case ImageSetClass: 412 case ImageSetClass:
404 toCSSImageSetValue(this)->~CSSImageSetValue(); 413 toCSSImageSetValue(this)->~CSSImageSetValue();
405 return; 414 return;
406 case CSSSVGDocumentClass: 415 case CSSSVGDocumentClass:
407 toCSSSVGDocumentValue(this)->~CSSSVGDocumentValue(); 416 toCSSSVGDocumentValue(this)->~CSSSVGDocumentValue();
408 return; 417 return;
409 case CSSContentDistributionClass: 418 case CSSContentDistributionClass:
410 toCSSContentDistributionValue(this)->~CSSContentDistributionValue(); 419 toCSSContentDistributionValue(this)->~CSSContentDistributionValue();
411 return; 420 return;
421 case VariableClass:
422 return;
Timothy Loh 2015/09/30 02:09:27 need to destruct?
412 } 423 }
413 ASSERT_NOT_REACHED(); 424 ASSERT_NOT_REACHED();
414 } 425 }
415 426
416 DEFINE_TRACE(CSSValue) 427 DEFINE_TRACE(CSSValue)
417 { 428 {
418 switch (classType()) { 429 switch (classType()) {
419 case BorderImageSliceClass: 430 case BorderImageSliceClass:
420 toCSSBorderImageSliceValue(this)->traceAfterDispatch(visitor); 431 toCSSBorderImageSliceValue(this)->traceAfterDispatch(visitor);
421 return; 432 return;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 return; 507 return;
497 case ImageSetClass: 508 case ImageSetClass:
498 toCSSImageSetValue(this)->traceAfterDispatch(visitor); 509 toCSSImageSetValue(this)->traceAfterDispatch(visitor);
499 return; 510 return;
500 case CSSSVGDocumentClass: 511 case CSSSVGDocumentClass:
501 toCSSSVGDocumentValue(this)->traceAfterDispatch(visitor); 512 toCSSSVGDocumentValue(this)->traceAfterDispatch(visitor);
502 return; 513 return;
503 case CSSContentDistributionClass: 514 case CSSContentDistributionClass:
504 toCSSContentDistributionValue(this)->traceAfterDispatch(visitor); 515 toCSSContentDistributionValue(this)->traceAfterDispatch(visitor);
505 return; 516 return;
517 case VariableClass:
518 return;
Timothy Loh 2015/09/30 02:09:27 need to trace?
506 } 519 }
507 ASSERT_NOT_REACHED(); 520 ASSERT_NOT_REACHED();
508 } 521 }
509 522
510 } 523 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698