Hello WebKittens, 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 super class. - 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. Gyuyoung.
_______________________________________________ webkit-dev mailing list firstname.lastname@example.org https://lists.webkit.org/mailman/listinfo/webkit-dev