[webkit-reviews] review granted: [Bug 121769] CTTE: StaticNodeLists often contain only Elements, we shouldn't store them as Vector<RefPtr<Node>> in those cases : [Attachment 212307] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Sep 22 14:44:32 PDT 2013


Andreas Kling <akling at apple.com> has granted Sam Weinig <sam at webkit.org>'s
request for review:
Bug 121769: CTTE: StaticNodeLists often contain only Elements, we shouldn't
store them as Vector<RefPtr<Node>> in those cases
https://bugs.webkit.org/show_bug.cgi?id=121769

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

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


r=me

> Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp:46
> +    Vector<Ref<Element>> namedItems;
>      collection->impl()->namedItems(propertyNameToAtomicString(propertyName),
namedItems);

Would be nice to make namedItems() return a vector instead of taking an
out-parameter.

> Source/WebCore/dom/StaticNodeList.cpp:69
> +    return 0;

nullptr

> Source/WebCore/dom/StaticNodeList.cpp:75
> +    size_t length = m_elements.size();
> +    for (size_t i = 0; i < length; ++i) {

Modern WebKit style would be:
for (unsigned i = 0, length = m_elements.size(); i < length; ++i) {

> Source/WebCore/dom/StaticNodeList.cpp:81
> +    return 0;

nullptr

> Source/WebCore/dom/StaticNodeList.h:80
> +    virtual Node* item(unsigned index) const OVERRIDE;
> +    virtual Node* namedItem(const AtomicString&) const OVERRIDE;

Can we make these return Element* instead? (C++ supports covariant return types
for virtuals, no?)


More information about the webkit-reviews mailing list