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

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

Issue 26261009: Add toSVGColor|Paint() to cleanup static_cast<>, and use it (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cover static_cast<const SVGPaint|Color*> Created 7 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 * 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 return toCSSFilterValue(this)->customCssText(); 296 return toCSSFilterValue(this)->customCssText();
297 case CSSArrayFunctionValueClass: 297 case CSSArrayFunctionValueClass:
298 return toCSSArrayFunctionValue(this)->customCssText(); 298 return toCSSArrayFunctionValue(this)->customCssText();
299 case CSSMixFunctionValueClass: 299 case CSSMixFunctionValueClass:
300 return toCSSMixFunctionValue(this)->customCssText(); 300 return toCSSMixFunctionValue(this)->customCssText();
301 case CSSShaderClass: 301 case CSSShaderClass:
302 return toCSSShaderValue(this)->customCssText(); 302 return toCSSShaderValue(this)->customCssText();
303 case VariableClass: 303 case VariableClass:
304 return toCSSVariableValue(this)->value(); 304 return toCSSVariableValue(this)->value();
305 case SVGColorClass: 305 case SVGColorClass:
306 return static_cast<const SVGColor*>(this)->customCssText(); 306 return toSVGColor(this)->customCssText();
307 case SVGPaintClass: 307 case SVGPaintClass:
308 return static_cast<const SVGPaint*>(this)->customCssText(); 308 return toSVGPaint(this)->customCssText();
309 case CSSSVGDocumentClass: 309 case CSSSVGDocumentClass:
310 return toCSSSVGDocumentValue(this)->customCssText(); 310 return toCSSSVGDocumentValue(this)->customCssText();
311 } 311 }
312 ASSERT_NOT_REACHED(); 312 ASSERT_NOT_REACHED();
313 return String(); 313 return String();
314 } 314 }
315 315
316 String CSSValue::serializeResolvingVariables(const HashMap<AtomicString, String> & variables) const 316 String CSSValue::serializeResolvingVariables(const HashMap<AtomicString, String> & variables) const
317 { 317 {
318 switch (classType()) { 318 switch (classType()) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 case CSSMixFunctionValueClass: 426 case CSSMixFunctionValueClass:
427 delete toCSSMixFunctionValue(this); 427 delete toCSSMixFunctionValue(this);
428 return; 428 return;
429 case CSSShaderClass: 429 case CSSShaderClass:
430 delete toCSSShaderValue(this); 430 delete toCSSShaderValue(this);
431 return; 431 return;
432 case VariableClass: 432 case VariableClass:
433 delete toCSSVariableValue(this); 433 delete toCSSVariableValue(this);
434 return; 434 return;
435 case SVGColorClass: 435 case SVGColorClass:
436 delete static_cast<SVGColor*>(this); 436 delete toSVGColor(this);
437 return; 437 return;
438 case SVGPaintClass: 438 case SVGPaintClass:
439 delete static_cast<SVGPaint*>(this); 439 delete toSVGPaint(this);
440 return; 440 return;
441 case CSSSVGDocumentClass: 441 case CSSSVGDocumentClass:
442 delete toCSSSVGDocumentValue(this); 442 delete toCSSSVGDocumentValue(this);
443 return; 443 return;
444 } 444 }
445 ASSERT_NOT_REACHED(); 445 ASSERT_NOT_REACHED();
446 } 446 }
447 447
448 PassRefPtr<CSSValue> CSSValue::cloneForCSSOM() const 448 PassRefPtr<CSSValue> CSSValue::cloneForCSSOM() const
449 { 449 {
450 switch (classType()) { 450 switch (classType()) {
451 case PrimitiveClass: 451 case PrimitiveClass:
452 return toCSSPrimitiveValue(this)->cloneForCSSOM(); 452 return toCSSPrimitiveValue(this)->cloneForCSSOM();
453 case ValueListClass: 453 case ValueListClass:
454 return toCSSValueList(this)->cloneForCSSOM(); 454 return toCSSValueList(this)->cloneForCSSOM();
455 case ImageClass: 455 case ImageClass:
456 case CursorImageClass: 456 case CursorImageClass:
457 return toCSSImageValue(this)->cloneForCSSOM(); 457 return toCSSImageValue(this)->cloneForCSSOM();
458 case CSSFilterClass: 458 case CSSFilterClass:
459 return toCSSFilterValue(this)->cloneForCSSOM(); 459 return toCSSFilterValue(this)->cloneForCSSOM();
460 case CSSArrayFunctionValueClass: 460 case CSSArrayFunctionValueClass:
461 return toCSSArrayFunctionValue(this)->cloneForCSSOM(); 461 return toCSSArrayFunctionValue(this)->cloneForCSSOM();
462 case CSSMixFunctionValueClass: 462 case CSSMixFunctionValueClass:
463 return toCSSMixFunctionValue(this)->cloneForCSSOM(); 463 return toCSSMixFunctionValue(this)->cloneForCSSOM();
464 case CSSTransformClass: 464 case CSSTransformClass:
465 return toCSSTransformValue(this)->cloneForCSSOM(); 465 return toCSSTransformValue(this)->cloneForCSSOM();
466 case ImageSetClass: 466 case ImageSetClass:
467 return toCSSImageSetValue(this)->cloneForCSSOM(); 467 return toCSSImageSetValue(this)->cloneForCSSOM();
468 case SVGColorClass: 468 case SVGColorClass:
469 return static_cast<const SVGColor*>(this)->cloneForCSSOM(); 469 return toSVGColor(this)->cloneForCSSOM();
470 case SVGPaintClass: 470 case SVGPaintClass:
471 return static_cast<const SVGPaint*>(this)->cloneForCSSOM(); 471 return toSVGPaint(this)->cloneForCSSOM();
472 default: 472 default:
473 ASSERT(!isSubtypeExposedToCSSOM()); 473 ASSERT(!isSubtypeExposedToCSSOM());
474 return TextCloneCSSValue::create(classType(), cssText()); 474 return TextCloneCSSValue::create(classType(), cssText());
475 } 475 }
476 } 476 }
477 477
478 } 478 }
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8CSSValueCustom.cpp ('k') | Source/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698