2010-09-27 Erik Arvidsson <arv@chromium.org>
authorarv@chromium.org <arv@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Sep 2010 23:12:11 +0000 (23:12 +0000)
committerarv@chromium.org <arv@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Sep 2010 23:12:11 +0000 (23:12 +0000)
commite4f1cb58af44e3cf3e3eff5e378ab4cc360da08f
tree0524eebe92d03da3e584cbab33e98d8611024d97
parent786785b0ab3607d4fc4f7bdf03b1cab177777150
2010-09-27  Erik Arvidsson  <arv@chromium.org>

        Reviewed by Darin Adler.

        Implement HTML 5's HTMLElement.classList property
        https://bugs.webkit.org/show_bug.cgi?id=20709

        * fast/dom/HTMLElement/class-list-expected.txt: Added.
        * fast/dom/HTMLElement/class-list-gc-expected.txt: Added.
        * fast/dom/HTMLElement/class-list-gc.html: Added.
        * fast/dom/HTMLElement/class-list-quirks-expected.txt: Added.
        * fast/dom/HTMLElement/class-list-quirks.html: Added.
        * fast/dom/HTMLElement/class-list.html: Added.
        * fast/dom/HTMLElement/script-tests/class-list-gc.js: Added.
        (gc):
        * fast/dom/HTMLElement/script-tests/class-list.js: Added.
        (createElement):
        * fast/dom/Window/window-properties-expected.txt:
        * fast/dom/Window/window-property-descriptors-expected.txt:
        * fast/dom/prototype-inheritance-2-expected.txt:
        * fast/dom/prototype-inheritance-expected.txt:
        * fast/js/global-constructors-expected.txt:
        * perf/class-list-remove-expected.txt: Added.
        * perf/class-list-remove.html: Added.
2010-09-27  Erik Arvidsson  <arv@chromium.org>

        Reviewed by Darin Adler.

        Implement HTML 5's HTMLElement.classList property
        https://bugs.webkit.org/show_bug.cgi?id=20709

        This adds a DOMTokenList class that is used for the classList property. DOMTokenList uses a SpaceSplitString for fast
        contains check. In standards mode the existing classNames is used but in quirks mode we use an internal SpaceSplitString
        because classList is always case sensitive.

        Tests: fast/dom/HTMLElement/class-list-gc.html
               fast/dom/HTMLElement/class-list-quirks.html
               fast/dom/HTMLElement/class-list.html
               perf/class-list-remove.html

        * Android.derived.jscbindings.mk:
        * Android.derived.v8bindings.mk:
        * Android.jscbindings.mk:
        * CMakeLists.txt:
        * DerivedSources.cpp:
        * DerivedSources.make:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pri:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/gobject/GNUmakefile.am:
        * bindings/js/JSElementCustom.cpp:
        (WebCore::JSElement::markChildren): Make sure that we keep the wrapper while the element is alive.
        * bindings/scripts/CodeGeneratorJS.pm: DOMTokenList has a string indexed getter.
        * bindings/scripts/CodeGeneratorV8.pm:
        * bindings/v8/custom/V8DOMTokenListCustom.cpp: Added.
        (WebCore::toV8):
        * dom/Element.cpp:
        (WebCore::Element::classList):
        (WebCore::Element::optionalClassList):
        * dom/Element.h:
        * dom/ElementRareData.h: This now has an OwnPtr to a ClassList if the Element::classList is ever called.
        * dom/SpaceSplitString.h:
        (WebCore::SpaceSplitString::isNull):
        * dom/StyledElement.cpp:
        (WebCore::StyledElement::classAttributeChanged): Update the classList if it exists.
        * dom/StyledElement.h:
        * html/DOMTokenList.cpp: Added.
        (WebCore::validateToken):
        (WebCore::DOMTokenList::DOMTokenList):
        (WebCore::DOMTokenList::ref):
        (WebCore::DOMTokenList::deref):
        (WebCore::DOMTokenList::length):
        (WebCore::DOMTokenList::item):
        (WebCore::DOMTokenList::contains):
        (WebCore::DOMTokenList::containsInternal): The internal methods do no validation of the token.
        (WebCore::DOMTokenList::add):
        (WebCore::DOMTokenList::addInternal):
        (WebCore::DOMTokenList::remove):
        (WebCore::DOMTokenList::removeInternal):
        (WebCore::DOMTokenList::toggle):
        (WebCore::DOMTokenList::toString):
        (WebCore::DOMTokenList::reset):
        (WebCore::DOMTokenList::classNames):
        * html/DOMTokenList.h: Added.
        (WebCore::DOMTokenList::create):
        (WebCore::DOMTokenList::element):
        * html/DOMTokenList.idl: Added.
        * html/HTMLElement.idl:
        * page/DOMWindow.cpp:
        * page/DOMWindow.idl:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68440 268f45cc-cd09-0410-ab3c-d52691b4dbfc
46 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLElement/class-list-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLElement/class-list-gc-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLElement/class-list-gc.html [new file with mode: 0644]
LayoutTests/fast/dom/HTMLElement/class-list-quirks-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLElement/class-list-quirks.html [new file with mode: 0644]
LayoutTests/fast/dom/HTMLElement/class-list.html [new file with mode: 0644]
LayoutTests/fast/dom/HTMLElement/script-tests/class-list-gc.js [new file with mode: 0644]
LayoutTests/fast/dom/HTMLElement/script-tests/class-list.js [new file with mode: 0644]
LayoutTests/fast/dom/Window/window-properties-expected.txt
LayoutTests/fast/dom/Window/window-property-descriptors-expected.txt
LayoutTests/fast/dom/prototype-inheritance-2-expected.txt
LayoutTests/fast/dom/prototype-inheritance-expected.txt
LayoutTests/fast/js/global-constructors-expected.txt
LayoutTests/perf/class-list-remove-expected.txt [new file with mode: 0644]
LayoutTests/perf/class-list-remove.html [new file with mode: 0644]
WebCore/Android.derived.jscbindings.mk
WebCore/Android.derived.v8bindings.mk
WebCore/Android.jscbindings.mk
WebCore/CMakeLists.txt
WebCore/ChangeLog
WebCore/DerivedSources.cpp
WebCore/DerivedSources.make
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pri
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/gobject/GNUmakefile.am
WebCore/bindings/js/JSElementCustom.cpp
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/bindings/scripts/CodeGeneratorV8.pm
WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp [new file with mode: 0644]
WebCore/dom/Element.cpp
WebCore/dom/Element.h
WebCore/dom/ElementRareData.h
WebCore/dom/SpaceSplitString.h
WebCore/dom/StyledElement.cpp
WebCore/dom/StyledElement.h
WebCore/html/DOMTokenList.cpp [new file with mode: 0644]
WebCore/html/DOMTokenList.h [new file with mode: 0644]
WebCore/html/DOMTokenList.idl [new file with mode: 0644]
WebCore/html/HTMLElement.idl
WebCore/page/DOMWindow.cpp
WebCore/page/DOMWindow.idl