RESOLVED FIXED 137128
Add support for is<SVGDocument>() / downcast<SVGDocument>()
https://bugs.webkit.org/show_bug.cgi?id=137128
Summary Add support for is<SVGDocument>() / downcast<SVGDocument>()
Chris Dumez
Reported 2014-09-25 14:14:09 PDT
Add support for is<SVGDocument>() / downcast<SVGDocument>() by using the SPECIALIZE_TYPE_TRAITS_*() macro, instead of the DOCUMENT_TYPE_CASTS() one.
Attachments
Patch (11.64 KB, patch)
2014-09-25 14:17 PDT, Chris Dumez
no flags
Patch (13.10 KB, patch)
2014-09-25 16:39 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2014-09-25 14:17:21 PDT
WebKit Commit Bot
Comment 2 2014-09-25 14:19:22 PDT
Attachment 238671 [details] did not pass style-queue: ERROR: Source/WebCore/svg/SVGDocument.h:57: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ryosuke Niwa
Comment 3 2014-09-25 16:26:20 PDT
Comment on attachment 238671 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=238671&action=review > Source/WebCore/page/EventHandler.cpp:763 > + if (is<SVGDocument>(m_frame.document()) > + && downcast<SVGDocument>(*m_frame.document()).zoomAndPanEnabled()) { We can probably fit this in one line instead. > Source/WebCore/page/Frame.cpp:971 > + if (is<SVGDocument>(document)) { > + if (!downcast<SVGDocument>(*document).zoomAndPanEnabled()) Why don't we check both of these conditions in one if statement instead? > Source/WebCore/page/FrameView.cpp:1964 > + if (is<SVGDocument>(frame().document())) { > + if (SVGSVGElement* svg = downcast<SVGDocument>(*frame().document()).rootElement()) { Ditto. > Source/WebCore/svg/graphics/SVGImage.cpp:71 > - SVGSVGElement* rootElement = toSVGDocument(m_page->mainFrame().document())->rootElement(); > + SVGSVGElement* rootElement = downcast<SVGDocument>(*m_page->mainFrame().document()).rootElement(); Should we add a helper function to get the root element or nullptr? Repeating the code over and over isn't so great...
Chris Dumez
Comment 4 2014-09-25 16:39:06 PDT
WebKit Commit Bot
Comment 5 2014-09-25 16:42:05 PDT
Attachment 238682 [details] did not pass style-queue: ERROR: Source/WebCore/svg/SVGDocument.h:57: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 9 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Commit Bot
Comment 6 2014-09-25 17:35:08 PDT
Comment on attachment 238682 [details] Patch Clearing flags on attachment: 238682 Committed r173987: <http://trac.webkit.org/changeset/173987>
WebKit Commit Bot
Comment 7 2014-09-25 17:35:15 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.