[webkit-reviews] review granted: [Bug 118286] is/toHTMLStyleElement should use Element* for its argument : [Attachment 205893] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 2 05:08:07 PDT 2013


Andreas Kling <akling at apple.com> has granted Kangil Han
<kangil.han at samsung.com>'s request for review:
Bug 118286: is/toHTMLStyleElement should use Element* for its argument
https://bugs.webkit.org/show_bug.cgi?id=118286

Attachment 205893: Patch
https://bugs.webkit.org/attachment.cgi?id=205893&action=review

------- Additional Comments from Andreas Kling <akling at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=205893&action=review


r=me, but...

> Source/WebCore/dom/Node.cpp:2539
>      for (Node* child = firstChild(); child; child = child->nextSibling()) {
> -	   if (isHTMLStyleElement(child) &&
toHTMLStyleElement(child)->isRegisteredAsScoped())
> -	       count++;
> +	   if (child->isElementNode()) {
> +	       Element* element = toElement(child);
> +	       if (isHTMLStyleElement(element) &&
toHTMLStyleElement(element)->isRegisteredAsScoped())
> +		   count++;
> +	   }
>      }

You can simplify this loop by using ElementTraversal:

for (Element* element = ElementTraversal::firstWithin(this); element; element =
ElementTraversal::next(element, this)) {
    if (isHTMLStyleElement(element) &&
toHTMLStyleElement(element)->isRegisteredAsScoped())
	count++;
}


More information about the webkit-reviews mailing list