[Webkit-unassigned] [Bug 47810] [HTML5] Add DOMSettableTokenList

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 22 10:24:26 PDT 2010


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





--- Comment #25 from Erik Arvidsson <arv at chromium.org>  2010-10-22 10:24:26 PST ---
(From update of attachment 71521)
View in context: https://bugs.webkit.org/attachment.cgi?id=71521&action=review

The more I think about this the more I think we could probably use SettableDOMTokenList for classList as well since we do allow setValue from C++. I don't really think we need DOMTokenList at all in C++.

For the ClassList class we could just override how we get the tokens and how we update the DOM.

> WebCore/html/ClassList.cpp:63
> +    if (!m_classNamesNeedsUpdate)

I think I may have misguided you.

SpaceSplitString is already smart enough to actually not build the vector until needed. When calling set() it will only clear the current vector and keep the string for the future.

The problem was that you were calling add and remove (which rebuild the vector) after we already called setAttribute (which in turn call set() on the SpaceSplitString) so we lost the optimization.

I think this whole method can be removed since classList is always up to date due to reset being called when someone sets the class attribute.

> WebCore/html/ClassList.cpp:74
> +    // We need this ulgy const_cast to conform with the className attribute

typo

> WebCore/html/ClassList.cpp:89
> +    // We need this ulgy const_cast to conform with the className attribute

typo

> WebCore/html/ClassList.cpp:118
> +    m_classNamesNeedsUpdate = true;

This line is not needed since reset gets called due to setAttribute

> WebCore/html/ClassList.cpp:138
> +    m_classNamesNeedsUpdate = true;

same here

... and now there are no more places where it gets set to true so that means that updateClassNamesForQuirksModeIfNeeded is a noop

> WebCore/html/ClassList.h:57
> +    void reset(const String&);

why don't we rename this to setValue for consistency?

-- 
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