RESOLVED FIXED 25217
Clean up SVGLocatable.cpp
https://bugs.webkit.org/show_bug.cgi?id=25217
Summary Clean up SVGLocatable.cpp
Eric Seidel (no email)
Reported 2009-04-15 12:22:59 PDT
Clean up SVGLocatable.cpp See attached (simple) patch.
Attachments
Simplify nearestViewportElement and farthestViewportElement using isViewportElement and a for loop (4.97 KB, patch)
2009-04-15 12:23 PDT, Eric Seidel (no email)
sam: review+
Eric Seidel (no email)
Comment 1 2009-04-15 12:23:49 PDT
Created attachment 29511 [details] Simplify nearestViewportElement and farthestViewportElement using isViewportElement and a for loop WebCore/ChangeLog | 16 +++++++++ WebCore/svg/SVGLocatable.cpp | 72 ++++++++++++++++-------------------------- 2 files changed, 43 insertions(+), 45 deletions(-)
Simon Fraser (smfr)
Comment 2 2009-04-15 12:29:21 PDT
Comment on attachment 29511 [details] Simplify nearestViewportElement and farthestViewportElement using isViewportElement and a for loop > +static bool isViewportElement(Node* node) > { > - Node* n = e->parentNode(); > - while (n && !n->isDocumentNode()) { > - if (n->hasTagName(SVGNames::svgTag) || n->hasTagName(SVGNames::symbolTag) || > - n->hasTagName(SVGNames::imageTag)) > - return static_cast<SVGElement*>(n); > + if (node->hasTagName(SVGNames::svgTag) > + || node->hasTagName(SVGNames::symbolTag) > #if ENABLE(SVG_FOREIGN_OBJECT) > - if (n->hasTagName(SVGNames::foreignObjectTag)) > - return static_cast<SVGElement*>(n); > + || node->hasTagName(SVGNames::foreignObjectTag) > #endif > + || node->hasTagName(SVGNames::imageTag)) > + return true; > + return false; You could just do return node->hasTagName(SVGNames::svgTag) || ....... r=me either way.
Eric Seidel (no email)
Comment 3 2009-04-15 12:33:39 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ... M WebCore/ChangeLog M WebCore/svg/SVGLocatable.cpp Committed r42552
Note You need to log in before you can comment on or make changes to this bug.