[Webkit-unassigned] [Bug 73156] [Microdata] Implement HTMLPropertiesCollection collection.namedItem()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Feb 28 07:45:14 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=73156


Kentaro Hara <haraken at chromium.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #129238|commit-queue?               |commit-queue-
               Flag|                            |




--- Comment #25 from Kentaro Hara <haraken at chromium.org>  2012-02-28 07:45:14 PST ---
(From update of attachment 129238)
View in context: https://bugs.webkit.org/attachment.cgi?id=129238&action=review

> Source/WebCore/html/HTMLPropertiesCollection.cpp:210
> +bool HTMLPropertiesCollection::hasNamedItem(const AtomicString& name) const

Thanks for the optimization! But I am a bit afraid that the optimization might be too complicated and error-prone. Now hasNamedItem() looks like a copy & paste of findPropertiesOfAnItem().

How about the following, more "modest" optimization? (I know this is less optimized than your patch though.)

bool HTMLPropertiesCollection::hasNamedItem(const AtomicString& name) const
{
    if (!base()->isHTMLElement() || !toHTMLElement(base())->fastHasAttribute(itemscopeAttr))
        return false;

    m_properties.clear();
    findPropetiesOfAnItem(base());
    for (size_t i = 0; i < m_properties.size(); ++i) {
        DOMSettableTokenList* itemProperty = m_properties[i]->itemProp();
        if (itemProperty->tokens().contains(name))
            return true;
    }
    return false
}

Anyway, it might be a good idea to split the patch for implementing the named getter and the patch for optimizing it. How about committing this patch with the "modest" optimization for now? If you found that the hasNamedItem() performance is _really_ critical, you can try to optimize hasNamedItem() in another patch. WDYT?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list