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

Unified Diff: Source/core/svg/SVGColor.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/resolver/StyleBuilderCustom.cpp ('k') | Source/core/svg/SVGPaint.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGColor.h
diff --git a/Source/core/svg/SVGColor.h b/Source/core/svg/SVGColor.h
index 554fe77052b62af0e49a077e244593801cd12778..42875ed651673d783af09466b7e4140f94b1be03 100644
--- a/Source/core/svg/SVGColor.h
+++ b/Source/core/svg/SVGColor.h
@@ -93,6 +93,22 @@ private:
SVGColorType m_colorType;
};
+// This will catch anyone doing an unnecessary cast.
+SVGColor* toSVGColor(const SVGColor*);
+
+inline SVGColor* toSVGColor(CSSValue* value)
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isSVGColor());
+ return static_cast<SVGColor*>(value);
+}
+
+inline const SVGColor* toSVGColor(const CSSValue* value)
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isSVGColor());
+ return static_cast<const SVGColor*>(value);
+}
+
+
} // namespace WebCore
#endif // SVGColor_h
« no previous file with comments | « Source/core/css/resolver/StyleBuilderCustom.cpp ('k') | Source/core/svg/SVGPaint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698