Bug 119990

Summary: Add toSVGStopElement(Node* node) to clean-up a static_cast<SVGStopElement*>
Product: WebKit Reporter: Gyuyoung Kim <gyuyoung.kim>
Component: SVGAssignee: Gyuyoung Kim <gyuyoung.kim>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, d-r, esprehn+autocc, fmalita, glenn, kondapallykalyan, pdr, schenney, zimmermann
Priority: P2 Keywords: BlinkMergeCandidate
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing none

Description Gyuyoung Kim 2013-08-18 20:30:55 PDT
This patch adds toSVGStopElement(Node* node) in order to remove remained static_cast<SVGStopElement*>.

Blink merge from https://src.chromium.org/viewvc/blink?view=rev&revision=156274
Comment 1 Gyuyoung Kim 2013-08-18 20:34:03 PDT
Created attachment 209046 [details]
Patch
Comment 2 Darin Adler 2013-08-18 23:00:25 PDT
Comment on attachment 209046 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=209046&action=review

I am OK with this, but there might be a slightly better way. It seems unfortunate to use isGradientStop in one case and use hasTagName in the other.

> Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp:639
> -    SVGStopElement* stopElement = static_cast<SVGStopElement*>(stop.node());
> +    SVGStopElement* stopElement = toSVGStopElement(stop.node());

How about just using toSVGStopElement(toSVGElement(stop.node())) here instead?
Comment 3 Gyuyoung Kim 2013-08-18 23:42:42 PDT
Created attachment 209059 [details]
Patch for landing
Comment 4 Gyuyoung Kim 2013-08-18 23:43:41 PDT
(In reply to comment #2)
> (From update of attachment 209046 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=209046&action=review
> 
> I am OK with this, but there might be a slightly better way. It seems unfortunate to use isGradientStop in one case and use hasTagName in the other.
> 
> > Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp:639
> > -    SVGStopElement* stopElement = static_cast<SVGStopElement*>(stop.node());
> > +    SVGStopElement* stopElement = toSVGStopElement(stop.node());
> 
> How about just using toSVGStopElement(toSVGElement(stop.node())) here instead?

Hi Darin, thank you for your nice comment. :) I also agree with your nice suggestion.
Comment 5 WebKit Commit Bot 2013-08-19 01:43:51 PDT
Comment on attachment 209059 [details]
Patch for landing

Clearing flags on attachment: 209059

Committed r154267: <http://trac.webkit.org/changeset/154267>
Comment 6 WebKit Commit Bot 2013-08-19 01:43:54 PDT
All reviewed patches have been landed.  Closing bug.