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

Unified Diff: Source/core/svg/SVGPaint.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/svg/SVGColor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGPaint.h
diff --git a/Source/core/svg/SVGPaint.h b/Source/core/svg/SVGPaint.h
index f4f387dde152f64b63ffb32572d4ab58be031c92..9d6379be521004414ebed00aa1c0e6231f9a2a5c 100644
--- a/Source/core/svg/SVGPaint.h
+++ b/Source/core/svg/SVGPaint.h
@@ -116,6 +116,21 @@ private:
String m_uri;
};
+// This will catch anyone doing an unnecessary cast.
+SVGPaint* toSVGPaint(const SVGColor*);
+
+inline SVGPaint* toSVGPaint(CSSValue* value)
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isSVGPaint());
+ return static_cast<SVGPaint*>(value);
+}
+
+inline const SVGPaint* toSVGPaint(const CSSValue* value)
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isSVGPaint());
+ return static_cast<const SVGPaint*>(value);
+}
+
} // namespace WebCore
#endif // SVGPaint_h
« no previous file with comments | « Source/core/svg/SVGColor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698