[webkit-dev] Type cast by using toFoo()
gyuyoung.kim at webkit.org
Mon Sep 30 03:39:01 PDT 2013
I have focused on using toFoo() for SVG and CSS instead of using
static_cast<>. Because I think there are some advantages when we use it.
- Bad type cast can be detected by using ASSERTION in toFoo(). The
toFoo() function has an ASSERTION to check if source value is a proper
- Unnecessary local variables can be removed. There are some local
variables, which are only used once in WebKit. In those cases, we don’t
need to use a local variable. Besides, we can remove unnecessary ASSERTION
because toFoo() already has it.
- I believe toFoo() can improve code readability.
Currently, HTML, SVG Elements support toHTML|SVGFooElement() and CSSValue
also starts to support toCSSFooValue(). Please check if there is toFoo()
when you need to use static_cast<> in HTML, SVG and CSS module.
Finally I plan to add this toFoo() policy to the WebKit style checker.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev