[webkit-reviews] review granted: [Bug 91306] Iterating over HTMLCollection backwards is O(n^2) : [Attachment 152402] Fixed a bug

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Jul 14 00:01:21 PDT 2012


Anders Carlsson <andersca at apple.com> has granted Ryosuke Niwa
<rniwa at webkit.org>'s request for review:
Bug 91306: Iterating over HTMLCollection backwards is O(n^2)
https://bugs.webkit.org/show_bug.cgi?id=91306

Attachment 152402: Fixed a bug
https://bugs.webkit.org/attachment.cgi?id=152402&action=review

------- Additional Comments from Anders Carlsson <andersca at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=152402&action=review


> Source/WebCore/html/HTMLCollection.cpp:245
> +    if (forward)
> +	   return onlyIncludeDirectChildren ? previous->nextSibling() :
previous->traverseNextNode(base);
> +    return onlyIncludeDirectChildren ? previous->previousSibling() :
previous->traversePreviousNode(base);

This is one of the cases where i prefer

if (forward)
    return ...
else
    return ...


More information about the webkit-reviews mailing list