Make namedItem return a node list only in HTMLFormControlsCollection and HTMLOptionsCollection
https://bugs.webkit.org/show_bug.cgi?id=101311

Reviewed by Darin Adler.

Source/WebCore: 

Introduce two new interfaces HTMLFormControlsCollection and HTMLOptionsCollection to be used by form.elements
and select.options. These two interfaces have the named getter and namedItem that returns a live NodeList when
there are multiple matches. Introducing these two interfaces allow us to make "regular" HTMLCollection's named
getter and namedItem return exactly one node or null as specified in HTML5:
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#collections-0

Unfortunately, HTMLOptionsCollection still has a bug that its named getter and namedItem returns
a static NodeList instead of a live NodeList (DynamicNodeList) at the moment.

Also got rid of Document::objects since it's not exposed in IDL or called anywhere.

Test: fast/dom/html-collections-namedItem.html

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* DerivedSources.pri:
* GNUmakefile.list.am:
* Target.pri:
* UseJSC.cmake:
* UseV8.cmake:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSHTMLAllCollectionCustom.cpp:
(WebCore::getNamedItems):
* bindings/js/JSHTMLCollectionCustom.cpp:
(WebCore::JSHTMLCollection::nameGetter): Now returns exactly one node or null.
(WebCore::toJS):
* bindings/js/JSHTMLFormControlsCollectionCustom.cpp: Added.
(WebCore::getNamedItems): Returns RadioNodeList when there are multiple matches.
(WebCore::JSHTMLFormControlsCollection::canGetItemsForName):
(WebCore::JSHTMLFormControlsCollection::nameGetter):
(WebCore::JSHTMLFormControlsCollection::namedItem):
* bindings/js/JSHTMLOptionsCollectionCustom.cpp:
(WebCore::getNamedItems): Returns a static NodeList when there are multiple matches.
This is a bug. It should be a live NodeList instead.
(WebCore::JSHTMLOptionsCollection::canGetItemsForName):
(WebCore::JSHTMLOptionsCollection::nameGetter):
(WebCore::JSHTMLOptionsCollection::namedItem):
* bindings/js/CodeGeneratorJS.pm: Include JSNode.js for all HTML*Collection interfaces for simplicity.
* bindings/js/CodeGeneratorV8.pm: HTMLOptionsCollection now inherits from HTMLCollection. See
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmloptionscollection
* bindings/v8/custom/V8HTMLAllCollectionCustom.cpp: Pass in isolate when we can.
(WebCore::getNamedItems): Added a comment about how we should be returning
a HTMLCollection when there are multiple matches.
(WebCore::getItem):
(WebCore::V8HTMLAllCollection::namedPropertyGetter):
(WebCore::V8HTMLAllCollection::namedItemCallback):
* bindings/v8/custom/V8HTMLCollectionCustom.cpp: Now returns exactly one node or null.
(WebCore::V8HTMLCollection::namedPropertyGetter):
(WebCore::toV8):
* bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp: Added.
(WebCore::getNamedItems): Returns RadioNodeList when there are multiple matches.
(WebCore::V8HTMLFormControlsCollection::namedPropertyGetter):
(WebCore::V8HTMLFormControlsCollection::namedItemCallback):
* bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
(WebCore::getNamedItems): Returns a static NodeList when there are multiple matches.
This is a bug. It should be a live NodeList instead.
(WebCore::V8HTMLOptionsCollection::namedPropertyGetter):
(WebCore::V8HTMLOptionsCollection::namedItemCallback):
* dom/Document.cpp: Removed Document::objects since it was not used anywhere.
* dom/Document.h:
(Document):
* dom/Element.cpp:
(WebCore::ElementRareData::ensureCachedHTMLCollection): form.elements should instantiate
a HTMLFormControlsCollection instead of a HTMLCollection.
* html/CollectionType.h:
* html/HTMLCollection.idl: Removed [Custom] since namedItem is a regular function call now.
* html/HTMLFieldSetElement.cpp:
* html/HTMLFieldSetElement.h:
* html/HTMLFormCollection.cpp: Removed.
* html/HTMLFormCollection.h: Removed.
* html/HTMLFormControlsCollection.cpp: Copied from Source/WebCore/html/HTMLFormCollection.cpp.
(WebCore::HTMLFormControlsCollection::HTMLFormControlsCollection):
(WebCore::HTMLFormControlsCollection::create):
(WebCore::HTMLFormControlsCollection::~HTMLFormControlsCollection):
(WebCore::HTMLFormControlsCollection::formControlElements):
(WebCore::HTMLFormControlsCollection::formImageElements):
(WebCore::HTMLFormControlsCollection::virtualItemAfter):
(WebCore::HTMLFormControlsCollection::namedItem):
(WebCore::HTMLFormControlsCollection::updateNameCache):
* html/HTMLFormControlsCollection.h: Copied from Source/WebCore/html/HTMLFormCollection.h.
(HTMLFormControlsCollection):
* html/HTMLFormControlsCollection.idl: Added.
* html/HTMLFormElement.cpp:
* html/HTMLFormElement.h:
* html/HTMLOptionsCollection.idl:

LayoutTests: 

Added a regression test to ensure form.elements and select.options use correct interfaces,
and named getter for those two properties return a NodeList when there are multiple matches.

Also added appropriate IDL options to HTMLOptionsCollection.idl.

* fast/dom/collection-nameditem-move-between-documents-expected.txt: Rebaselined since namedItem
now correctly returns null when there is no match. This test result demonstrates a bug that
HTMLAllCollection doesn't inherit from HTMLCollection.
* fast/dom/collection-nameditem-move-between-documents.html: Ditto.
* fast/dom/dom-constructors-expected.txt: Rebaselined.
* fast/dom/html-collections-named-getter-expected.txt: Added.
* fast/dom/html-collections-named-getter.html: Added.
* fast/dom/wrapper-classes-expected.txt: Rebaselined. Since we're exposing HTMLOptionsCollection
on the window object, the constructor property of an instance of HTMLOptionsCollection object
shows up as a function. We should update the test to support this behavior in the future.
* inspector/console/console-format-collections-expected.txt: Rebaselined.
* platform/chromium/fast/dom/gc-9-expected.txt: Rebaselined since a test case for
HTMLOptionsCollection now passes.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@135093 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index 3506423..7364ef0 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -439,6 +439,7 @@
     html/HTMLEmbedElement.idl
     html/HTMLFieldSetElement.idl
     html/HTMLFontElement.idl
+    html/HTMLFormControlsCollection.idl
     html/HTMLFormElement.idl
     html/HTMLFrameElement.idl
     html/HTMLFrameSetElement.idl
@@ -1368,7 +1369,7 @@
     html/HTMLEmbedElement.cpp
     html/HTMLFieldSetElement.cpp
     html/HTMLFontElement.cpp
-    html/HTMLFormCollection.cpp
+    html/HTMLFormControlsCollection.cpp
     html/HTMLFormControlElement.cpp
     html/HTMLFormControlElementWithState.cpp
     html/HTMLFormElement.cpp
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 1cc0c0e..e993830 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,100 @@
+2012-11-18  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Make namedItem return a node list only in HTMLFormControlsCollection and HTMLOptionsCollection
+        https://bugs.webkit.org/show_bug.cgi?id=101311
+
+        Reviewed by Darin Adler.
+
+        Introduce two new interfaces HTMLFormControlsCollection and HTMLOptionsCollection to be used by form.elements
+        and select.options. These two interfaces have the named getter and namedItem that returns a live NodeList when
+        there are multiple matches. Introducing these two interfaces allow us to make "regular" HTMLCollection's named
+        getter and namedItem return exactly one node or null as specified in HTML5:
+        http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#collections-0
+
+        Unfortunately, HTMLOptionsCollection still has a bug that its named getter and namedItem returns
+        a static NodeList instead of a live NodeList (DynamicNodeList) at the moment.
+
+        Also got rid of Document::objects since it's not exposed in IDL or called anywhere.
+
+        Test: fast/dom/html-collections-namedItem.html
+
+        * CMakeLists.txt:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * DerivedSources.pri:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * UseJSC.cmake:
+        * UseV8.cmake:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSBindingsAllInOne.cpp:
+        * bindings/js/JSHTMLAllCollectionCustom.cpp:
+        (WebCore::getNamedItems):
+        * bindings/js/JSHTMLCollectionCustom.cpp:
+        (WebCore::JSHTMLCollection::nameGetter): Now returns exactly one node or null.
+        (WebCore::toJS):
+        * bindings/js/JSHTMLFormControlsCollectionCustom.cpp: Added.
+        (WebCore::getNamedItems): Returns RadioNodeList when there are multiple matches.
+        (WebCore::JSHTMLFormControlsCollection::canGetItemsForName):
+        (WebCore::JSHTMLFormControlsCollection::nameGetter):
+        (WebCore::JSHTMLFormControlsCollection::namedItem):
+        * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
+        (WebCore::getNamedItems): Returns a static NodeList when there are multiple matches.
+        This is a bug. It should be a live NodeList instead.
+        (WebCore::JSHTMLOptionsCollection::canGetItemsForName):
+        (WebCore::JSHTMLOptionsCollection::nameGetter):
+        (WebCore::JSHTMLOptionsCollection::namedItem):
+        * bindings/js/CodeGeneratorJS.pm: Include JSNode.js for all HTML*Collection interfaces for simplicity.
+        * bindings/js/CodeGeneratorV8.pm: HTMLOptionsCollection now inherits from HTMLCollection. See
+        http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmloptionscollection
+        * bindings/v8/custom/V8HTMLAllCollectionCustom.cpp: Pass in isolate when we can.
+        (WebCore::getNamedItems): Added a comment about how we should be returning
+        a HTMLCollection when there are multiple matches.
+        (WebCore::getItem):
+        (WebCore::V8HTMLAllCollection::namedPropertyGetter):
+        (WebCore::V8HTMLAllCollection::namedItemCallback):
+        * bindings/v8/custom/V8HTMLCollectionCustom.cpp: Now returns exactly one node or null.
+        (WebCore::V8HTMLCollection::namedPropertyGetter):
+        (WebCore::toV8):
+        * bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp: Added.
+        (WebCore::getNamedItems): Returns RadioNodeList when there are multiple matches.
+        (WebCore::V8HTMLFormControlsCollection::namedPropertyGetter):
+        (WebCore::V8HTMLFormControlsCollection::namedItemCallback):
+        * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
+        (WebCore::getNamedItems): Returns a static NodeList when there are multiple matches.
+        This is a bug. It should be a live NodeList instead.
+        (WebCore::V8HTMLOptionsCollection::namedPropertyGetter):
+        (WebCore::V8HTMLOptionsCollection::namedItemCallback):
+        * dom/Document.cpp: Removed Document::objects since it was not used anywhere.
+        * dom/Document.h:
+        (Document):
+        * dom/Element.cpp:
+        (WebCore::ElementRareData::ensureCachedHTMLCollection): form.elements should instantiate
+        a HTMLFormControlsCollection instead of a HTMLCollection.
+        * html/CollectionType.h:
+        * html/HTMLCollection.idl: Removed [Custom] since namedItem is a regular function call now.
+        * html/HTMLFieldSetElement.cpp:
+        * html/HTMLFieldSetElement.h:
+        * html/HTMLFormCollection.cpp: Removed.
+        * html/HTMLFormCollection.h: Removed.
+        * html/HTMLFormControlsCollection.cpp: Copied from Source/WebCore/html/HTMLFormCollection.cpp.
+        (WebCore::HTMLFormControlsCollection::HTMLFormControlsCollection):
+        (WebCore::HTMLFormControlsCollection::create):
+        (WebCore::HTMLFormControlsCollection::~HTMLFormControlsCollection):
+        (WebCore::HTMLFormControlsCollection::formControlElements):
+        (WebCore::HTMLFormControlsCollection::formImageElements):
+        (WebCore::HTMLFormControlsCollection::virtualItemAfter):
+        (WebCore::HTMLFormControlsCollection::namedItem):
+        (WebCore::HTMLFormControlsCollection::updateNameCache):
+        * html/HTMLFormControlsCollection.h: Copied from Source/WebCore/html/HTMLFormCollection.h.
+        (HTMLFormControlsCollection):
+        * html/HTMLFormControlsCollection.idl: Added.
+        * html/HTMLFormElement.cpp:
+        * html/HTMLFormElement.h:
+        * html/HTMLOptionsCollection.idl:
+
 2012-11-18  Kentaro Hara  <haraken@chromium.org>
 
         [V8] Rename $className to $v8InterfaceName
diff --git a/Source/WebCore/DerivedSources.cpp b/Source/WebCore/DerivedSources.cpp
index 02fcebb..af2b59d 100644
--- a/Source/WebCore/DerivedSources.cpp
+++ b/Source/WebCore/DerivedSources.cpp
@@ -163,6 +163,7 @@
 #include "JSHTMLEmbedElement.cpp"
 #include "JSHTMLFieldSetElement.cpp"
 #include "JSHTMLFontElement.cpp"
+#include "JSHTMLFormControlsCollection.cpp"
 #include "JSHTMLFormElement.cpp"
 #include "JSHTMLFrameElement.cpp"
 #include "JSHTMLFrameSetElement.cpp"
diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make
index fdf0e1e..46dfb0d 100644
--- a/Source/WebCore/DerivedSources.make
+++ b/Source/WebCore/DerivedSources.make
@@ -300,6 +300,7 @@
     $(WebCore)/html/HTMLEmbedElement.idl \
     $(WebCore)/html/HTMLFieldSetElement.idl \
     $(WebCore)/html/HTMLFontElement.idl \
+    $(WebCore)/html/HTMLFormControlsCollection.idl \
     $(WebCore)/html/HTMLFormElement.idl \
     $(WebCore)/html/HTMLFrameElement.idl \
     $(WebCore)/html/HTMLFrameSetElement.idl \
diff --git a/Source/WebCore/DerivedSources.pri b/Source/WebCore/DerivedSources.pri
index 93eeb24..e2499dd 100644
--- a/Source/WebCore/DerivedSources.pri
+++ b/Source/WebCore/DerivedSources.pri
@@ -355,6 +355,7 @@
     $$PWD/html/HTMLEmbedElement.idl \
     $$PWD/html/HTMLFieldSetElement.idl \
     $$PWD/html/HTMLFontElement.idl \
+    $$PWD/html/HTMLFormControlsCollection.idl \
     $$PWD/html/HTMLFormElement.idl \
     $$PWD/html/HTMLFrameElement.idl \
     $$PWD/html/HTMLFrameSetElement.idl \
diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am
index 4d8cb8b..07a238a 100644
--- a/Source/WebCore/GNUmakefile.list.am
+++ b/Source/WebCore/GNUmakefile.list.am
@@ -337,6 +337,8 @@
 	DerivedSources/WebCore/JSHTMLFieldSetElement.h \
 	DerivedSources/WebCore/JSHTMLFontElement.cpp \
 	DerivedSources/WebCore/JSHTMLFontElement.h \
+	DerivedSources/WebCore/JSHTMLFormControlsCollection.cpp \
+	DerivedSources/WebCore/JSHTMLFormControlsCollection.h \
 	DerivedSources/WebCore/JSHTMLFormElement.cpp \
 	DerivedSources/WebCore/JSHTMLFormElement.h \
 	DerivedSources/WebCore/JSHTMLFrameElement.cpp \
@@ -1429,6 +1431,7 @@
 	$(WebCore)/html/HTMLEmbedElement.idl \
 	$(WebCore)/html/HTMLFieldSetElement.idl \
 	$(WebCore)/html/HTMLFontElement.idl \
+	$(WebCore)/html/HTMLFormControlsCollection.idl \
 	$(WebCore)/html/HTMLFormElement.idl \
 	$(WebCore)/html/HTMLFrameElement.idl \
 	$(WebCore)/html/HTMLFrameSetElement.idl \
@@ -2305,6 +2308,7 @@
 	Source/WebCore/bindings/js/JSHTMLElementCustom.cpp \
 	Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.cpp \
 	Source/WebCore/bindings/js/JSHTMLEmbedElementCustom.h \
+	Source/WebCore/bindings/js/JSHTMLFormControlsCollectionCustom.cpp \
 	Source/WebCore/bindings/js/JSHTMLFormElementCustom.cpp \
 	Source/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp \
 	Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp \
@@ -3310,8 +3314,8 @@
 	Source/WebCore/html/HTMLFieldSetElement.h \
 	Source/WebCore/html/HTMLFontElement.cpp \
 	Source/WebCore/html/HTMLFontElement.h \
-	Source/WebCore/html/HTMLFormCollection.cpp \
-	Source/WebCore/html/HTMLFormCollection.h \
+	Source/WebCore/html/HTMLFormControlsCollection.cpp \
+	Source/WebCore/html/HTMLFormControlsCollection.h \
 	Source/WebCore/html/HTMLFormControlElement.cpp \
 	Source/WebCore/html/HTMLFormControlElement.h \
 	Source/WebCore/html/HTMLFormControlElementWithState.cpp \
diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri
index e4ed2e9..72a17f0 100644
--- a/Source/WebCore/Target.pri
+++ b/Source/WebCore/Target.pri
@@ -132,6 +132,7 @@
      bindings/js/JSHTMLDocumentCustom.cpp \
      bindings/js/JSHTMLElementCustom.cpp \
      bindings/js/JSHTMLEmbedElementCustom.cpp \
+     bindings/js/JSHTMLFormControlsCollectionCustom.cpp \
      bindings/js/JSHTMLFormElementCustom.cpp \
      bindings/js/JSHTMLFrameElementCustom.cpp \
      bindings/js/JSHTMLFrameSetElementCustom.cpp \
@@ -601,7 +602,7 @@
     html/HTMLEmbedElement.cpp \
     html/HTMLFieldSetElement.cpp \
     html/HTMLFontElement.cpp \
-    html/HTMLFormCollection.cpp \
+    html/HTMLFormControlsCollection.cpp \
     html/HTMLFormControlElement.cpp \
     html/HTMLFormControlElementWithState.cpp \
     html/HTMLFormElement.cpp \
@@ -1761,7 +1762,7 @@
     html/HTMLEmbedElement.h \
     html/HTMLFieldSetElement.h \
     html/HTMLFontElement.h \
-    html/HTMLFormCollection.h \
+    html/HTMLFormControlsCollection.h \
     html/HTMLFormControlElement.h \
     html/HTMLFormControlElementWithState.h \
     html/HTMLFormElement.h \
diff --git a/Source/WebCore/UseJSC.cmake b/Source/WebCore/UseJSC.cmake
index 25ecb79..3d524ea 100644
--- a/Source/WebCore/UseJSC.cmake
+++ b/Source/WebCore/UseJSC.cmake
@@ -84,6 +84,7 @@
     bindings/js/JSHTMLDocumentCustom.cpp
     bindings/js/JSHTMLElementCustom.cpp
     bindings/js/JSHTMLEmbedElementCustom.cpp
+    bindings/js/JSHTMLFormControlsCollectionCustom.cpp
     bindings/js/JSHTMLFormElementCustom.cpp
     bindings/js/JSHTMLFrameElementCustom.cpp
     bindings/js/JSHTMLFrameSetElementCustom.cpp
diff --git a/Source/WebCore/UseV8.cmake b/Source/WebCore/UseV8.cmake
index 747c3f9..7329942 100644
--- a/Source/WebCore/UseV8.cmake
+++ b/Source/WebCore/UseV8.cmake
@@ -106,6 +106,7 @@
     bindings/v8/custom/V8HTMLCollectionCustom.cpp
     bindings/v8/custom/V8HTMLDocumentCustom.cpp
     bindings/v8/custom/V8HTMLElementCustom.cpp
+    bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp
     bindings/v8/custom/V8HTMLFormElementCustom.cpp
     bindings/v8/custom/V8HTMLFrameElementCustom.cpp
     bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp
diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi
index 627155b..7edd93c 100644
--- a/Source/WebCore/WebCore.gypi
+++ b/Source/WebCore/WebCore.gypi
@@ -1074,6 +1074,7 @@
             'html/HTMLEmbedElement.idl',
             'html/HTMLFieldSetElement.idl',
             'html/HTMLFontElement.idl',
+            'html/HTMLFormControlsCollection.idl',
             'html/HTMLFormElement.idl',
             'html/HTMLFrameElement.idl',
             'html/HTMLFrameSetElement.idl',
@@ -2059,6 +2060,7 @@
             'bindings/js/JSHTMLElementCustom.cpp',
             'bindings/js/JSHTMLEmbedElementCustom.cpp',
             'bindings/js/JSHTMLEmbedElementCustom.h',
+            'bindings/js/JSHTMLFormControlsCollectionCustom.cpp',
             'bindings/js/JSHTMLFormElementCustom.cpp',
             'bindings/js/JSHTMLFrameElementCustom.cpp',
             'bindings/js/JSHTMLFrameSetElementCustom.cpp',
@@ -2375,6 +2377,7 @@
             'bindings/v8/custom/V8HTMLCollectionCustom.cpp',
             'bindings/v8/custom/V8HTMLDocumentCustom.cpp',
             'bindings/v8/custom/V8HTMLElementCustom.cpp',
+            'bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp',
             'bindings/v8/custom/V8HTMLFormElementCustom.cpp',
             'bindings/v8/custom/V8HTMLFrameElementCustom.cpp',
             'bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp',
@@ -4101,8 +4104,8 @@
             'html/HTMLFieldSetElement.h',
             'html/HTMLFontElement.cpp',
             'html/HTMLFontElement.h',
-            'html/HTMLFormCollection.cpp',
-            'html/HTMLFormCollection.h',
+            'html/HTMLFormControlsCollection.cpp',
+            'html/HTMLFormControlsCollection.h',
             'html/HTMLFormControlElement.cpp',
             'html/HTMLFormControlElementWithState.cpp',
             'html/HTMLFormElement.cpp',
@@ -7610,6 +7613,8 @@
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLFieldSetElement.h',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLFontElement.cpp',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLFontElement.h',
+            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLFormControlsCollection.cpp',
+            '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLFormControlsCollection.h',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLFormElement.cpp',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLFormElement.h',
             '<(PRODUCT_DIR)/DerivedSources/WebCore/JSHTMLFrameElement.cpp',
diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
index 0406007..2edc148 100755
--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -6990,6 +6990,62 @@
 				>
 			</File>
 			<File
+				RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSHTMLFormControlsCollection.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug_Cairo_CFLite|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release_Cairo_CFLite|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug_All|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Production|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSHTMLFormControlsCollection.h"
+				>
+			</File>
+			<File
 				RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSHTMLFormElement.cpp"
 				>
 				<FileConfiguration
@@ -60506,11 +60562,11 @@
 				>
 			</File>
 			<File
-				RelativePath="..\html\HTMLFormCollection.cpp"
+				RelativePath="..\html\HTMLFormControlsCollection.cpp"
 				>
 			</File>
 			<File
-				RelativePath="..\html\HTMLFormCollection.h"
+				RelativePath="..\html\HTMLFormControlsCollection.h"
 				>
 			</File>
 			<File
@@ -68053,6 +68109,58 @@
 					>
 				</File>
 				<File
+					RelativePath="..\bindings\js\JSHTMLFormControlsCollectionCustom.cpp"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug_Cairo_CFLite|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release_Cairo_CFLite|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug_All|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Production|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
 					RelativePath="..\bindings\js\JSHTMLFormElementCustom.cpp"
 					>
 					<FileConfiguration
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index 3439424..1d6ba97 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -3750,6 +3750,7 @@
 		9A1B6F97158869C80011A8C4 /* JSDOMStringListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A1B6F96158869C80011A8C4 /* JSDOMStringListCustom.cpp */; };
 		9B0FB191140DB5790022588F /* HTTPValidation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B0FB18F140DB5790022588F /* HTTPValidation.cpp */; };
 		9B0FB192140DB5790022588F /* HTTPValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B0FB190140DB5790022588F /* HTTPValidation.h */; };
+		9B1AB07C1648C7C40051F3F2 /* JSHTMLFormControlsCollectionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B1AB07B1648C7C40051F3F2 /* JSHTMLFormControlsCollectionCustom.cpp */; };
 		9B24DE8E15194B9500C59C27 /* HTMLBDIElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B24DE8C15194B9500C59C27 /* HTMLBDIElement.h */; };
 		9B2B7AC11509850A008932CC /* MicroDataItemValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B2F7CF714562120007F8B50 /* MicroDataItemValue.cpp */; };
 		9B2D8A7914997CCF00ECEF3E /* UndoStep.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B2D8A7814997CCF00ECEF3E /* UndoStep.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -3768,6 +3769,8 @@
 		9BC6C21C13CCC97B008E0337 /* HTMLTextFormControlElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BC6C21A13CCC97B008E0337 /* HTMLTextFormControlElement.cpp */; };
 		9BD0BF9312A42BF50072FD43 /* ScopedEventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BD0BF9112A42BF50072FD43 /* ScopedEventQueue.h */; };
 		9BD0BF9412A42BF50072FD43 /* ScopedEventQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BD0BF9212A42BF50072FD43 /* ScopedEventQueue.cpp */; };
+		9BF9A8801648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9BF9A87E1648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp */; };
+		9BF9A8811648DD2F001C6B23 /* JSHTMLFormControlsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BF9A87F1648DD2F001C6B23 /* JSHTMLFormControlsCollection.h */; };
 		9F0D6B2E121BFEBA006C0288 /* InspectorProfilerAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F0D6B2C121BFEBA006C0288 /* InspectorProfilerAgent.cpp */; };
 		9F0D6B2F121BFEBA006C0288 /* InspectorProfilerAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F0D6B2D121BFEBA006C0288 /* InspectorProfilerAgent.h */; };
 		9F3B947E12241758005304E7 /* ScriptHeapSnapshot.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F3B947D12241758005304E7 /* ScriptHeapSnapshot.h */; };
@@ -4354,8 +4357,8 @@
 		A8D065AE0A2446CD005E7203 /* JSHTMLFormElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8D065AD0A2446CD005E7203 /* JSHTMLFormElementCustom.cpp */; };
 		A8D06B390A265DCD005E7203 /* HTMLNames.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = A8D06B370A265DCD005E7203 /* HTMLNames.h */; settings = {ATTRIBUTES = (); }; };
 		A8D06B3A0A265DCD005E7203 /* HTMLNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8D06B380A265DCD005E7203 /* HTMLNames.cpp */; };
-		A8DF3FCE097FA0FC0052981B /* HTMLFormCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = A8DF3FC6097FA0FB0052981B /* HTMLFormCollection.h */; };
-		A8DF3FCF097FA0FC0052981B /* HTMLFormCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8DF3FC7097FA0FB0052981B /* HTMLFormCollection.cpp */; };
+		A8DF3FCE097FA0FC0052981B /* HTMLFormControlsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = A8DF3FC6097FA0FB0052981B /* HTMLFormControlsCollection.h */; };
+		A8DF3FCF097FA0FC0052981B /* HTMLFormControlsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8DF3FC7097FA0FB0052981B /* HTMLFormControlsCollection.cpp */; };
 		A8DF3FD0097FA0FC0052981B /* HTMLCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = A8DF3FC8097FA0FB0052981B /* HTMLCollection.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A8DF3FD1097FA0FC0052981B /* HTMLCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8DF3FC9097FA0FB0052981B /* HTMLCollection.cpp */; };
 		A8DF3FD2097FA0FC0052981B /* HTMLBaseFontElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8DF3FCA097FA0FB0052981B /* HTMLBaseFontElement.h */; };
@@ -11035,6 +11038,8 @@
 		9A1B6F96158869C80011A8C4 /* JSDOMStringListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMStringListCustom.cpp; sourceTree = "<group>"; };
 		9B0FB18F140DB5790022588F /* HTTPValidation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPValidation.cpp; sourceTree = "<group>"; };
 		9B0FB190140DB5790022588F /* HTTPValidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPValidation.h; sourceTree = "<group>"; };
+		9B1AB0791648C69D0051F3F2 /* HTMLFormControlsCollection.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLFormControlsCollection.idl; sourceTree = "<group>"; };
+		9B1AB07B1648C7C40051F3F2 /* JSHTMLFormControlsCollectionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFormControlsCollectionCustom.cpp; sourceTree = "<group>"; };
 		9B24DE8C15194B9500C59C27 /* HTMLBDIElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLBDIElement.h; sourceTree = "<group>"; };
 		9B2D8A7814997CCF00ECEF3E /* UndoStep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UndoStep.h; sourceTree = "<group>"; };
 		9B2F7CF714562120007F8B50 /* MicroDataItemValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MicroDataItemValue.cpp; sourceTree = "<group>"; };
@@ -11054,6 +11059,8 @@
 		9BC6C21A13CCC97B008E0337 /* HTMLTextFormControlElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLTextFormControlElement.cpp; sourceTree = "<group>"; };
 		9BD0BF9112A42BF50072FD43 /* ScopedEventQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScopedEventQueue.h; sourceTree = "<group>"; };
 		9BD0BF9212A42BF50072FD43 /* ScopedEventQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScopedEventQueue.cpp; sourceTree = "<group>"; };
+		9BF9A87E1648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFormControlsCollection.cpp; sourceTree = "<group>"; };
+		9BF9A87F1648DD2F001C6B23 /* JSHTMLFormControlsCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLFormControlsCollection.h; sourceTree = "<group>"; };
 		9F0D6B2C121BFEBA006C0288 /* InspectorProfilerAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorProfilerAgent.cpp; sourceTree = "<group>"; };
 		9F0D6B2D121BFEBA006C0288 /* InspectorProfilerAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorProfilerAgent.h; sourceTree = "<group>"; };
 		9F3B947D12241758005304E7 /* ScriptHeapSnapshot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptHeapSnapshot.h; sourceTree = "<group>"; };
@@ -11538,8 +11545,8 @@
 		A8D065AD0A2446CD005E7203 /* JSHTMLFormElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFormElementCustom.cpp; sourceTree = "<group>"; };
 		A8D06B370A265DCD005E7203 /* HTMLNames.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLNames.h; sourceTree = "<group>"; };
 		A8D06B380A265DCD005E7203 /* HTMLNames.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLNames.cpp; sourceTree = "<group>"; };
-		A8DF3FC6097FA0FB0052981B /* HTMLFormCollection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLFormCollection.h; sourceTree = "<group>"; };
-		A8DF3FC7097FA0FB0052981B /* HTMLFormCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLFormCollection.cpp; sourceTree = "<group>"; };
+		A8DF3FC6097FA0FB0052981B /* HTMLFormControlsCollection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLFormControlsCollection.h; sourceTree = "<group>"; };
+		A8DF3FC7097FA0FB0052981B /* HTMLFormControlsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLFormControlsCollection.cpp; sourceTree = "<group>"; };
 		A8DF3FC8097FA0FB0052981B /* HTMLCollection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLCollection.h; sourceTree = "<group>"; };
 		A8DF3FC9097FA0FB0052981B /* HTMLCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLCollection.cpp; sourceTree = "<group>"; };
 		A8DF3FCA097FA0FB0052981B /* HTMLBaseFontElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLBaseFontElement.h; sourceTree = "<group>"; };
@@ -17586,8 +17593,9 @@
 				A8CFF7980A156978000A4234 /* HTMLFontElement.cpp */,
 				A8CFF79C0A156978000A4234 /* HTMLFontElement.h */,
 				1AE2A9F50A1CDA5700B42B25 /* HTMLFontElement.idl */,
-				A8DF3FC7097FA0FB0052981B /* HTMLFormCollection.cpp */,
-				A8DF3FC6097FA0FB0052981B /* HTMLFormCollection.h */,
+				A8DF3FC7097FA0FB0052981B /* HTMLFormControlsCollection.cpp */,
+				A8DF3FC6097FA0FB0052981B /* HTMLFormControlsCollection.h */,
+				9B1AB0791648C69D0051F3F2 /* HTMLFormControlsCollection.idl */,
 				A81369B3097374F500D74463 /* HTMLFormControlElement.cpp */,
 				A81369B2097374F500D74463 /* HTMLFormControlElement.h */,
 				E14F1C4214B5DAC600EA9009 /* HTMLFormControlElementWithState.cpp */,
@@ -18473,6 +18481,8 @@
 				1AE2AA130A1CDAB300B42B25 /* JSHTMLFieldSetElement.h */,
 				1AE2AA140A1CDAB300B42B25 /* JSHTMLFontElement.cpp */,
 				1AE2AA150A1CDAB300B42B25 /* JSHTMLFontElement.h */,
+				9BF9A87E1648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp */,
+				9BF9A87F1648DD2F001C6B23 /* JSHTMLFormControlsCollection.h */,
 				A8D064F90A23C0CC005E7203 /* JSHTMLFormElement.cpp */,
 				A8D064FA0A23C0CC005E7203 /* JSHTMLFormElement.h */,
 				BC4918C00BFEA050009D6316 /* JSHTMLFrameElement.cpp */,
@@ -20521,6 +20531,7 @@
 				BC5823F40C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp */,
 				BC6D44BD0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp */,
 				E1AD14201295EA6B00ACA989 /* JSHTMLEmbedElementCustom.h */,
+				9B1AB07B1648C7C40051F3F2 /* JSHTMLFormControlsCollectionCustom.cpp */,
 				A8D065AD0A2446CD005E7203 /* JSHTMLFormElementCustom.cpp */,
 				BC2ED7A40C6C0F3600920BFF /* JSHTMLFrameElementCustom.cpp */,
 				BCD41ABA0C060DE800C0E446 /* JSHTMLFrameSetElementCustom.cpp */,
@@ -23771,7 +23782,7 @@
 				A81369D4097374F600D74463 /* HTMLFieldSetElement.h in Headers */,
 				A8CFF7A60A156978000A4234 /* HTMLFontElement.h in Headers */,
 				977B386F122883E900B81FF8 /* HTMLFormattingElementList.h in Headers */,
-				A8DF3FCE097FA0FC0052981B /* HTMLFormCollection.h in Headers */,
+				A8DF3FCE097FA0FC0052981B /* HTMLFormControlsCollection.h in Headers */,
 				A81369CE097374F600D74463 /* HTMLFormControlElement.h in Headers */,
 				E14F1C4514B5DAC600EA9009 /* HTMLFormControlElementWithState.h in Headers */,
 				A81369D0097374F600D74463 /* HTMLFormElement.h in Headers */,
@@ -24157,6 +24168,7 @@
 				E1AD14211295EA6B00ACA989 /* JSHTMLEmbedElementCustom.h in Headers */,
 				1AE2AA270A1CDAB400B42B25 /* JSHTMLFieldSetElement.h in Headers */,
 				1AE2AA290A1CDAB400B42B25 /* JSHTMLFontElement.h in Headers */,
+				9BF9A8811648DD2F001C6B23 /* JSHTMLFormControlsCollection.h in Headers */,
 				A8D064FC0A23C0CC005E7203 /* JSHTMLFormElement.h in Headers */,
 				BC4918C70BFEA050009D6316 /* JSHTMLFrameElement.h in Headers */,
 				BC926F810C0552470082776B /* JSHTMLFrameSetElement.h in Headers */,
@@ -26989,7 +27001,7 @@
 				A81369D5097374F600D74463 /* HTMLFieldSetElement.cpp in Sources */,
 				A8CFF7A20A156978000A4234 /* HTMLFontElement.cpp in Sources */,
 				977B386E122883E900B81FF8 /* HTMLFormattingElementList.cpp in Sources */,
-				A8DF3FCF097FA0FC0052981B /* HTMLFormCollection.cpp in Sources */,
+				A8DF3FCF097FA0FC0052981B /* HTMLFormControlsCollection.cpp in Sources */,
 				A81369CF097374F600D74463 /* HTMLFormControlElement.cpp in Sources */,
 				E14F1C4414B5DAC600EA9009 /* HTMLFormControlElementWithState.cpp in Sources */,
 				A81369D1097374F600D74463 /* HTMLFormElement.cpp in Sources */,
@@ -27404,6 +27416,8 @@
 				BC6D44BE0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp in Sources */,
 				1AE2AA260A1CDAB400B42B25 /* JSHTMLFieldSetElement.cpp in Sources */,
 				1AE2AA280A1CDAB400B42B25 /* JSHTMLFontElement.cpp in Sources */,
+				9BF9A8801648DD2F001C6B23 /* JSHTMLFormControlsCollection.cpp in Sources */,
+				9B1AB07C1648C7C40051F3F2 /* JSHTMLFormControlsCollectionCustom.cpp in Sources */,
 				A8D064FB0A23C0CC005E7203 /* JSHTMLFormElement.cpp in Sources */,
 				A8D065AE0A2446CD005E7203 /* JSHTMLFormElementCustom.cpp in Sources */,
 				BC4918C60BFEA050009D6316 /* JSHTMLFrameElement.cpp in Sources */,
diff --git a/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp b/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
index 565ab82..22fd4e5 100644
--- a/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -89,6 +89,7 @@
 #include "JSHTMLDocumentCustom.cpp"
 #include "JSHTMLElementCustom.cpp"
 #include "JSHTMLEmbedElementCustom.cpp"
+#include "JSHTMLFormControlsCollectionCustom.cpp"
 #include "JSHTMLFormElementCustom.cpp"
 #include "JSHTMLFrameElementCustom.cpp"
 #include "JSHTMLFrameSetElementCustom.cpp"
diff --git a/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp b/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
index 5561bca..10dc069 100644
--- a/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
@@ -50,9 +50,8 @@
     if (namedItems.size() == 1)
         return toJS(exec, collection->globalObject(), namedItems[0].get());
 
-    // FIXME: HTML5 specifies that this should be a DynamicNodeList.
-    // FIXME: HTML5 specifies that non-HTMLOptionsCollection collections should return
-    // the first matching item instead of a NodeList.
+    // FIXME: HTML5 specification says this should be a HTMLCollection.
+    // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlallcollection
     return toJS(exec, collection->globalObject(), StaticNodeList::adopt(namedItems).get());
 }
 
diff --git a/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp b/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp
index 0badc05..a185781 100644
--- a/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp
@@ -20,11 +20,13 @@
 #include "config.h"
 #include "JSHTMLCollection.h"
 
-#include "HTMLCollection.h"
-#include "HTMLOptionsCollection.h"
 #include "HTMLAllCollection.h"
+#include "HTMLCollection.h"
+#include "HTMLFormControlsCollection.h"
+#include "HTMLOptionsCollection.h"
 #include "JSDOMBinding.h"
 #include "JSHTMLAllCollection.h"
+#include "JSHTMLFormControlsCollection.h"
 #include "JSHTMLOptionsCollection.h"
 #include "JSNode.h"
 #include "JSNodeList.h"
@@ -39,26 +41,6 @@
 
 namespace WebCore {
 
-static JSValue getNamedItems(ExecState* exec, JSHTMLCollection* collection, PropertyName propertyName)
-{
-    Vector<RefPtr<Node> > namedItems;
-    const AtomicString& name = propertyNameToAtomicString(propertyName);
-    collection->impl()->namedItems(name, namedItems);
-
-    if (namedItems.isEmpty())
-        return jsUndefined();
-    if (namedItems.size() == 1)
-        return toJS(exec, collection->globalObject(), namedItems[0].get());
-
-    if (collection->impl()->type() == FormControls)
-       return toJS(exec, collection->globalObject(), collection->impl()->base()->radioNodeList(name).get());
-
-    // FIXME: HTML5 specifies that this should be a DynamicNodeList.
-    // FIXME: HTML5 specifies that non-HTMLOptionsCollection collections should return
-    // the first matching item instead of a NodeList.
-    return toJS(exec, collection->globalObject(), StaticNodeList::adopt(namedItems).get());
-}
-
 bool JSHTMLCollection::canGetItemsForName(ExecState*, HTMLCollection* collection, PropertyName propertyName)
 {
     return collection->hasNamedItem(propertyNameToAtomicString(propertyName));
@@ -66,13 +48,9 @@
 
 JSValue JSHTMLCollection::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
 {
-    JSHTMLCollection* thisObj = jsCast<JSHTMLCollection*>(asObject(slotBase));
-    return getNamedItems(exec, thisObj, propertyName);
-}
-
-JSValue JSHTMLCollection::namedItem(ExecState* exec)
-{
-    return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)->value(exec)));
+    JSHTMLCollection* collection = jsCast<JSHTMLCollection*>(asObject(slotBase));
+    const AtomicString& name = propertyNameToAtomicString(propertyName);
+    return toJS(exec, collection->globalObject(), collection->impl()->namedItem(name));
 }
 
 JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, HTMLCollection* collection)
@@ -86,18 +64,17 @@
         return wrapper;
 
     switch (collection->type()) {
-        case SelectOptions:
-            wrapper = CREATE_DOM_WRAPPER(exec, globalObject, HTMLOptionsCollection, collection);
-            break;
-        case DocAll:
-            wrapper = CREATE_DOM_WRAPPER(exec, globalObject, HTMLAllCollection, collection);
-            break;
-        default:
-            wrapper = CREATE_DOM_WRAPPER(exec, globalObject, HTMLCollection, collection);
-            break;
+    case FormControls:
+        return CREATE_DOM_WRAPPER(exec, globalObject, HTMLFormControlsCollection, collection);
+    case SelectOptions:
+        return CREATE_DOM_WRAPPER(exec, globalObject, HTMLOptionsCollection, collection);
+    case DocAll:
+        return CREATE_DOM_WRAPPER(exec, globalObject, HTMLAllCollection, collection);
+    default:
+        break;
     }
 
-    return wrapper;
+    return CREATE_DOM_WRAPPER(exec, globalObject, HTMLCollection, collection);
 }
 
 } // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSHTMLFormControlsCollectionCustom.cpp b/Source/WebCore/bindings/js/JSHTMLFormControlsCollectionCustom.cpp
new file mode 100644
index 0000000..01c3060
--- /dev/null
+++ b/Source/WebCore/bindings/js/JSHTMLFormControlsCollectionCustom.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "HTMLFormControlsCollection.h"
+
+
+#include "HTMLAllCollection.h"
+#include "JSDOMBinding.h"
+#include "JSHTMLCollection.h"
+#include "JSHTMLFormControlsCollection.h"
+#include "JSNode.h"
+#include "JSNodeList.h"
+#include "JSRadioNodeList.h"
+#include "Node.h"
+#include "RadioNodeList.h"
+#include <wtf/Vector.h>
+#include <wtf/text/AtomicString.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+static JSValue getNamedItems(ExecState* exec, JSHTMLFormControlsCollection* collection, PropertyName propertyName)
+{
+    Vector<RefPtr<Node> > namedItems;
+    const AtomicString& name = propertyNameToAtomicString(propertyName);
+    collection->impl()->namedItems(name, namedItems);
+
+    if (namedItems.isEmpty())
+        return jsUndefined();
+    if (namedItems.size() == 1)
+        return toJS(exec, collection->globalObject(), namedItems[0].get());
+
+    ASSERT(collection->impl()->type() == FormControls);
+    return toJS(exec, collection->globalObject(), collection->impl()->base()->radioNodeList(name).get());
+}
+
+bool JSHTMLFormControlsCollection::canGetItemsForName(ExecState*, HTMLFormControlsCollection* collection, PropertyName propertyName)
+{
+    return collection->hasNamedItem(propertyNameToAtomicString(propertyName));
+}
+
+JSValue JSHTMLFormControlsCollection::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
+{
+    JSHTMLFormControlsCollection* thisObj = jsCast<JSHTMLFormControlsCollection*>(asObject(slotBase));
+    return getNamedItems(exec, thisObj, propertyName);
+}
+
+JSValue JSHTMLFormControlsCollection::namedItem(ExecState* exec)
+{
+    return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)->value(exec)));
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp b/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp
index f497da0..023033f 100644
--- a/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp
@@ -28,6 +28,8 @@
 #include "JSHTMLOptionElement.h"
 #include "JSHTMLSelectElement.h"
 #include "JSHTMLSelectElementCustom.h"
+#include "JSNodeList.h"
+#include "StaticNodeList.h"
 
 #include <wtf/MathExtras.h>
 
@@ -35,6 +37,37 @@
 
 namespace WebCore {
 
+static JSValue getNamedItems(ExecState* exec, JSHTMLOptionsCollection* collection, PropertyName propertyName)
+{
+    Vector<RefPtr<Node> > namedItems;
+    const AtomicString& name = propertyNameToAtomicString(propertyName);
+    collection->impl()->namedItems(name, namedItems);
+
+    if (namedItems.isEmpty())
+        return jsUndefined();
+    if (namedItems.size() == 1)
+        return toJS(exec, collection->globalObject(), namedItems[0].get());
+
+    // FIXME: HTML5 specifies that this should be a DynamicNodeList.
+    return toJS(exec, collection->globalObject(), StaticNodeList::adopt(namedItems).get());
+}
+
+bool JSHTMLOptionsCollection::canGetItemsForName(ExecState*, HTMLOptionsCollection* collection, PropertyName propertyName)
+{
+    return collection->hasNamedItem(propertyNameToAtomicString(propertyName));
+}
+
+JSValue JSHTMLOptionsCollection::nameGetter(ExecState* exec, JSValue slotBase, PropertyName propertyName)
+{
+    JSHTMLOptionsCollection* thisObj = jsCast<JSHTMLOptionsCollection*>(asObject(slotBase));
+    return getNamedItems(exec, thisObj, propertyName);
+}
+
+JSValue JSHTMLOptionsCollection::namedItem(ExecState* exec)
+{
+    return getNamedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)->value(exec)));
+}
+
 void JSHTMLOptionsCollection::setLength(ExecState* exec, JSValue value)
 {
     HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(impl());
diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
index c352802..37107a3 100644
--- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -398,7 +398,7 @@
 
     my @getOwnPropertySlotImpl = ();
 
-    if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection" or $interfaceName eq "HTMLPropertiesCollection") {
+    if ($interfaceName eq "NamedNodeMap" or $interfaceName =~ /^HTML\w*Collection$/) {
         push(@getOwnPropertySlotImpl, "    ${namespaceMaybe}JSValue proto = thisObject->prototype();\n");
         push(@getOwnPropertySlotImpl, "    if (proto.isObject() && jsCast<${namespaceMaybe}JSObject*>(asObject(proto))->hasProperty(exec, propertyName))\n");
         push(@getOwnPropertySlotImpl, "        return false;\n\n");
@@ -490,7 +490,7 @@
         push(@implContent, "        return false;\n");
     }
     
-    if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection" or $interfaceName eq "HTMLPropertiesCollection") {
+    if ($interfaceName eq "NamedNodeMap" or $interfaceName =~ /^HTML\w*Collection$/) {
         push(@getOwnPropertyDescriptorImpl, "    ${namespaceMaybe}JSValue proto = thisObject->prototype();\n");
         push(@getOwnPropertyDescriptorImpl, "    if (proto.isObject() && jsCast<${namespaceMaybe}JSObject*>(asObject(proto))->hasProperty(exec, propertyName))\n");
         push(@getOwnPropertyDescriptorImpl, "        return false;\n\n");
@@ -2430,7 +2430,7 @@
             push(@implContent, "    return toJS(exec, thisObj->globalObject(), static_cast<$implClassName*>(thisObj->impl())->item(index));\n");
         }
         push(@implContent, "}\n\n");
-        if ($interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection" or $interfaceName eq "RadioNodeList") {
+        if ($interfaceName =~ /^HTML\w*Collection$/ or $interfaceName eq "RadioNodeList") {
             $implIncludes{"JSNode.h"} = 1;
             $implIncludes{"Node.h"} = 1;
         }
@@ -2446,7 +2446,7 @@
         push(@implContent, "        return jsNaN();\n");
         push(@implContent, "    return JSValue(result);\n");
         push(@implContent, "}\n\n");
-        if ($interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection") {
+        if ($interfaceName =~ /^HTML\w*Collection$/) {
             $implIncludes{"JSNode.h"} = 1;
             $implIncludes{"Node.h"} = 1;
         }
diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
index cc27655..8accb7a 100644
--- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -2532,13 +2532,6 @@
     my $interfaceName = $dataNode->name;
     my $hasCustomNamedGetter = $dataNode->extendedAttributes->{"CustomNamedGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"};
 
-    # FIXME: Remove hard-coded HTMLOptionsCollection reference by changing HTMLOptionsCollection to not inherit
-    # from HTMLCollection per W3C spec (http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#HTMLOptionsCollection).
-    if ($interfaceName eq "HTMLOptionsCollection") {
-        $interfaceName = "HTMLCollection";
-        $hasCustomNamedGetter = 1;
-    }
-
     if ($interfaceName eq "HTMLAppletElement" || $interfaceName eq "HTMLEmbedElement" || $interfaceName eq "HTMLObjectElement") {
         $hasCustomNamedGetter = 1;
     }
diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
index 627058c..ee60772 100644
--- a/Source/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
+++ b/Source/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
@@ -51,6 +51,8 @@
     if (namedItems.size() == 1)
         return toV8(namedItems.at(0).release(), creationContext, isolate);
 
+    // FIXME: HTML5 specification says this should be a HTMLCollection.
+    // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlallcollection
     return toV8(V8NamedNodesCollection::create(namedItems), creationContext, isolate);
 }
 
diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
index dff4991..bae278a 100644
--- a/Source/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
+++ b/Source/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp
@@ -32,33 +32,15 @@
 #include "V8HTMLCollection.h"
 
 #include "HTMLCollection.h"
-#include "RadioNodeList.h"
 #include "V8Binding.h"
 #include "V8HTMLAllCollection.h"
+#include "V8HTMLFormControlsCollection.h"
+#include "V8HTMLOptionsCollection.h"
 #include "V8NamedNodesCollection.h"
 #include "V8Node.h"
-#include "V8NodeList.h"
-#include "V8RadioNodeList.h"
 
 namespace WebCore {
 
-static v8::Handle<v8::Value> getNamedItems(HTMLCollection* collection, AtomicString name, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
-{
-    Vector<RefPtr<Node> > namedItems;
-    collection->namedItems(name, namedItems);
-
-    if (!namedItems.size())
-        return v8Undefined();
-
-    if (namedItems.size() == 1)
-        return toV8(namedItems.at(0).release(), creationContext, isolate);
-
-    if (collection->type() == FormControls)
-        return toV8(collection->base()->radioNodeList(name).get(), creationContext, isolate);
-
-    return toV8(V8NamedNodesCollection::create(namedItems), creationContext, isolate);
-}
-
 v8::Handle<v8::Value> V8HTMLCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
 {
     INC_STATS("DOM.HTMLCollection.NamedPropertyGetter");
@@ -69,26 +51,26 @@
         return v8Undefined();
 
     HTMLCollection* imp = V8HTMLCollection::toNative(info.Holder());
-    return getNamedItems(imp, toWebCoreAtomicString(name), info.Holder(), info.GetIsolate());
-}
-
-v8::Handle<v8::Value> V8HTMLCollection::namedItemCallback(const v8::Arguments& args)
-{
-    INC_STATS("DOM.HTMLCollection.namedItem()");
-    HTMLCollection* imp = V8HTMLCollection::toNative(args.Holder());
-    v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]), args.Holder(), args.GetIsolate());
-
-    if (result.IsEmpty())
-        return v8::Undefined();
-
-    return result;
+    Node* item = imp->namedItem(toWebCoreAtomicString(name));
+    if (!item)
+        return v8Undefined();
+    return toV8(item, info.Holder(), info.GetIsolate());
 }
 
 v8::Handle<v8::Object> wrap(HTMLCollection* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
 {
     ASSERT(impl);
-    if (impl->type() == DocAll)
+    switch (impl->type()) {
+    case FormControls:
+        return wrap(static_cast<HTMLFormControlsCollection*>(impl), creationContext, isolate);
+    case SelectOptions:
+        return wrap(static_cast<HTMLOptionsCollection*>(impl), creationContext, isolate);
+    case DocAll:
         return wrap(static_cast<HTMLAllCollection*>(impl), creationContext, isolate);
+    default:
+        break;
+    }
+
     return V8HTMLCollection::createWrapper(impl, creationContext, isolate);
 }
 
diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp
new file mode 100644
index 0000000..40f2ff9
--- /dev/null
+++ b/Source/WebCore/bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "V8HTMLFormControlsCollection.h"
+
+#include "HTMLCollection.h"
+#include "RadioNodeList.h"
+#include "V8Binding.h"
+#include "V8Node.h"
+#include "V8RadioNodeList.h"
+
+namespace WebCore {
+
+static v8::Handle<v8::Value> getNamedItems(HTMLFormControlsCollection* collection, const AtomicString& name, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+    Vector<RefPtr<Node> > namedItems;
+    collection->namedItems(name, namedItems);
+
+    if (!namedItems.size())
+        return v8Undefined();
+
+    if (namedItems.size() == 1)
+        return toV8(namedItems.at(0).release(), creationContext, isolate);
+
+    return toV8(collection->base()->radioNodeList(name).get(), creationContext, isolate);
+}
+
+v8::Handle<v8::Value> V8HTMLFormControlsCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+    INC_STATS("DOM.HTMLCollection.NamedPropertyGetter");
+
+    if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
+        return v8Undefined();
+    if (info.Holder()->HasRealNamedCallbackProperty(name))
+        return v8Undefined();
+
+    HTMLFormControlsCollection* imp = V8HTMLFormControlsCollection::toNative(info.Holder());
+    return getNamedItems(imp, toWebCoreAtomicString(name), info.Holder(), info.GetIsolate());
+}
+
+v8::Handle<v8::Value> V8HTMLFormControlsCollection::namedItemCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.HTMLCollection.namedItem()");
+    HTMLFormControlsCollection* imp = V8HTMLFormControlsCollection::toNative(args.Holder());
+    v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]), args.Holder(), args.GetIsolate());
+
+    if (result.IsEmpty())
+        return v8::Undefined(args.GetIsolate());
+
+    return result;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
index b223c23..c54cebd 100644
--- a/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
+++ b/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
@@ -39,10 +39,51 @@
 #include "V8Collection.h"
 #include "V8HTMLOptionElement.h"
 #include "V8HTMLSelectElementCustom.h"
+#include "V8NamedNodesCollection.h"
 #include "V8Node.h"
+#include "V8NodeList.h"
 
 namespace WebCore {
 
+static v8::Handle<v8::Value> getNamedItems(HTMLOptionsCollection* collection, const AtomicString& name, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+    Vector<RefPtr<Node> > namedItems;
+    collection->namedItems(name, namedItems);
+
+    if (!namedItems.size())
+        return v8Undefined();
+
+    if (namedItems.size() == 1)
+        return toV8(namedItems.at(0).release(), creationContext, isolate);
+
+    return toV8(V8NamedNodesCollection::create(namedItems), creationContext, isolate);
+}
+
+v8::Handle<v8::Value> V8HTMLOptionsCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+    INC_STATS("DOM.HTMLCollection.NamedPropertyGetter");
+
+    if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
+        return v8Undefined();
+    if (info.Holder()->HasRealNamedCallbackProperty(name))
+        return v8Undefined();
+
+    HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(info.Holder());
+    return getNamedItems(imp, toWebCoreAtomicString(name), info.Holder(), info.GetIsolate());
+}
+
+v8::Handle<v8::Value> V8HTMLOptionsCollection::namedItemCallback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.HTMLCollection.namedItem()");
+    HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(args.Holder());
+    v8::Handle<v8::Value> result = getNamedItems(imp, toWebCoreString(args[0]), args.Holder(), args.GetIsolate());
+
+    if (result.IsEmpty())
+        return v8::Undefined(args.GetIsolate());
+
+    return result;
+}
+
 v8::Handle<v8::Value> V8HTMLOptionsCollection::removeCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.HTMLOptionsCollection.remove()");
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index 3a3d177..eea2984 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -4397,11 +4397,6 @@
     return cachedCollection(DocEmbeds);
 }
 
-PassRefPtr<HTMLCollection> Document::objects()
-{
-    return cachedCollection(DocObjects);
-}
-
 PassRefPtr<HTMLCollection> Document::scripts()
 {
     return cachedCollection(DocScripts);
diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h
index 92a32cb..440cfa2 100644
--- a/Source/WebCore/dom/Document.h
+++ b/Source/WebCore/dom/Document.h
@@ -439,7 +439,6 @@
     PassRefPtr<HTMLCollection> links();
     PassRefPtr<HTMLCollection> forms();
     PassRefPtr<HTMLCollection> anchors();
-    PassRefPtr<HTMLCollection> objects();
     PassRefPtr<HTMLCollection> scripts();
     PassRefPtr<HTMLCollection> all();
     void removeCachedHTMLCollection(HTMLCollection*, CollectionType);
diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp
index 18e13df..08bd6ea 100644
--- a/Source/WebCore/dom/Element.cpp
+++ b/Source/WebCore/dom/Element.cpp
@@ -46,7 +46,7 @@
 #include "HTMLCollection.h"
 #include "HTMLDocument.h"
 #include "HTMLElement.h"
-#include "HTMLFormCollection.h"
+#include "HTMLFormControlsCollection.h"
 #include "HTMLFrameOwnerElement.h"
 #include "HTMLLabelElement.h"
 #include "HTMLNames.h"
@@ -2337,7 +2337,7 @@
         collection = HTMLOptionsCollection::create(element);
     } else if (type == FormControls) {
         ASSERT(element->hasTagName(formTag) || element->hasTagName(fieldsetTag));
-        collection = HTMLFormCollection::create(element);
+        collection = HTMLFormControlsCollection::create(element);
 #if ENABLE(MICRODATA)
     } else if (type == ItemProperties) {
         collection = HTMLPropertiesCollection::create(element);
diff --git a/Source/WebCore/html/CollectionType.h b/Source/WebCore/html/CollectionType.h
index ab03ce6..82064f6 100644
--- a/Source/WebCore/html/CollectionType.h
+++ b/Source/WebCore/html/CollectionType.h
@@ -31,7 +31,6 @@
     DocImages,    // all <img> elements in the document
     DocApplets,   // all <object> and <applet> elements
     DocEmbeds,    // all <embed> elements
-    DocObjects,   // all <object> elements
     DocForms,     // all <form> elements
     DocLinks,     // all <a> _and_ <area> elements with a value for href
     DocAnchors,   // all <a> elements with a value for name
diff --git a/Source/WebCore/html/HTMLCollection.cpp b/Source/WebCore/html/HTMLCollection.cpp
index 1ecb644..d9668a1 100644
--- a/Source/WebCore/html/HTMLCollection.cpp
+++ b/Source/WebCore/html/HTMLCollection.cpp
@@ -51,7 +51,6 @@
     case DocForms:
     case DocImages:
     case DocLinks:
-    case DocObjects:
     case DocScripts:
     case DocumentNamedItems:
     case MapAreas:
@@ -83,7 +82,6 @@
     case DocImages:
     case DocApplets:
     case DocEmbeds:
-    case DocObjects:
     case DocForms:
     case DocLinks:
     case DocAnchors:
@@ -117,7 +115,6 @@
     switch (type) {
     case DocImages:
     case DocEmbeds:
-    case DocObjects:
     case DocForms:
     case DocAnchors: // Depends on name attribute.
     case DocScripts:
@@ -214,8 +211,6 @@
         return element->hasLocalName(appletTag) || (element->hasLocalName(objectTag) && static_cast<HTMLObjectElement*>(element)->containsJavaApplet());
     case DocEmbeds:
         return element->hasLocalName(embedTag);
-    case DocObjects:
-        return element->hasLocalName(objectTag);
     case DocLinks:
         return (element->hasLocalName(aTag) || element->hasLocalName(areaTag)) && element->fastHasAttribute(hrefAttr);
     case DocAnchors:
diff --git a/Source/WebCore/html/HTMLCollection.idl b/Source/WebCore/html/HTMLCollection.idl
index 8650428..1e175df 100644
--- a/Source/WebCore/html/HTMLCollection.idl
+++ b/Source/WebCore/html/HTMLCollection.idl
@@ -28,7 +28,7 @@
 ] interface HTMLCollection {
     readonly attribute unsigned long length;
     Node item(in [Optional=DefaultIsUndefined] unsigned long index);
-    [Custom] Node namedItem(in [Optional=DefaultIsUndefined] DOMString name);
+    Node namedItem(in [Optional=DefaultIsUndefined] DOMString name);
 
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
     NodeList tags(in [Optional=DefaultIsUndefined] DOMString name);
diff --git a/Source/WebCore/html/HTMLFieldSetElement.cpp b/Source/WebCore/html/HTMLFieldSetElement.cpp
index 73ff537..0c297bd 100644
--- a/Source/WebCore/html/HTMLFieldSetElement.cpp
+++ b/Source/WebCore/html/HTMLFieldSetElement.cpp
@@ -25,7 +25,7 @@
 #include "config.h"
 #include "HTMLFieldSetElement.h"
 
-#include "HTMLFormCollection.h"
+#include "HTMLCollection.h"
 #include "HTMLLegendElement.h"
 #include "HTMLNames.h"
 #include "HTMLObjectElement.h"
diff --git a/Source/WebCore/html/HTMLFieldSetElement.h b/Source/WebCore/html/HTMLFieldSetElement.h
index e483beb..83c8880 100644
--- a/Source/WebCore/html/HTMLFieldSetElement.h
+++ b/Source/WebCore/html/HTMLFieldSetElement.h
@@ -31,7 +31,6 @@
 
 class FormAssociatedElement;
 class HTMLCollection;
-class HTMLFormCollection;
 
 class HTMLFieldSetElement : public HTMLFormControlElement {
 public:
diff --git a/Source/WebCore/html/HTMLFormCollection.cpp b/Source/WebCore/html/HTMLFormControlsCollection.cpp
similarity index 87%
rename from Source/WebCore/html/HTMLFormCollection.cpp
rename to Source/WebCore/html/HTMLFormControlsCollection.cpp
index a5cc6ac..6ef2586 100644
--- a/Source/WebCore/html/HTMLFormCollection.cpp
+++ b/Source/WebCore/html/HTMLFormControlsCollection.cpp
@@ -21,7 +21,7 @@
  */
 
 #include "config.h"
-#include "HTMLFormCollection.h"
+#include "HTMLFormControlsCollection.h"
 
 #include "HTMLFieldSetElement.h"
 #include "HTMLFormControlElement.h"
@@ -36,22 +36,22 @@
 // Since the collections are to be "live", we have to do the
 // calculation every time if anything has changed.
 
-HTMLFormCollection::HTMLFormCollection(Element* base)
+HTMLFormControlsCollection::HTMLFormControlsCollection(Element* base)
     : HTMLCollection(base, FormControls, OverridesItemAfter)
 {
     ASSERT(base->hasTagName(formTag) || base->hasTagName(fieldsetTag));
 }
 
-PassRefPtr<HTMLFormCollection> HTMLFormCollection::create(Element* base)
+PassRefPtr<HTMLFormControlsCollection> HTMLFormControlsCollection::create(Element* base)
 {
-    return adoptRef(new HTMLFormCollection(base));
+    return adoptRef(new HTMLFormControlsCollection(base));
 }
 
-HTMLFormCollection::~HTMLFormCollection()
+HTMLFormControlsCollection::~HTMLFormControlsCollection()
 {
 }
 
-const Vector<FormAssociatedElement*>& HTMLFormCollection::formControlElements() const
+const Vector<FormAssociatedElement*>& HTMLFormControlsCollection::formControlElements() const
 {
     ASSERT(base());
     ASSERT(base()->hasTagName(formTag) || base()->hasTagName(fieldsetTag));
@@ -60,14 +60,14 @@
     return static_cast<HTMLFieldSetElement*>(base())->associatedElements();
 }
 
-const Vector<HTMLImageElement*>& HTMLFormCollection::formImageElements() const
+const Vector<HTMLImageElement*>& HTMLFormControlsCollection::formImageElements() const
 {
     ASSERT(base());
     ASSERT(base()->hasTagName(formTag));
     return static_cast<HTMLFormElement*>(base())->imageElements();
 }
 
-Element* HTMLFormCollection::virtualItemAfter(unsigned& offset, Element* previousItem) const
+Element* HTMLFormControlsCollection::virtualItemAfter(unsigned& offset, Element* previousItem) const
 {
     const Vector<FormAssociatedElement*>& elementsArray = formControlElements();
     if (previousItem)
@@ -104,7 +104,7 @@
     return 0;
 }
 
-Node* HTMLFormCollection::namedItem(const AtomicString& name) const
+Node* HTMLFormControlsCollection::namedItem(const AtomicString& name) const
 {
     // http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/nameditem.asp
     // This method first searches for an object with a matching id
@@ -118,7 +118,7 @@
     return firstNamedItem(formControlElements(), imagesElements, nameAttr, name);
 }
 
-void HTMLFormCollection::updateNameCache() const
+void HTMLFormControlsCollection::updateNameCache() const
 {
     if (hasNameCache())
         return;
diff --git a/Source/WebCore/html/HTMLFormCollection.h b/Source/WebCore/html/HTMLFormControlsCollection.h
similarity index 84%
rename from Source/WebCore/html/HTMLFormCollection.h
rename to Source/WebCore/html/HTMLFormControlsCollection.h
index 978a26f..76f96d5 100644
--- a/Source/WebCore/html/HTMLFormCollection.h
+++ b/Source/WebCore/html/HTMLFormControlsCollection.h
@@ -20,8 +20,8 @@
  *
  */
 
-#ifndef HTMLFormCollection_h
-#define HTMLFormCollection_h
+#ifndef HTMLFormControlsCollection_h
+#define HTMLFormControlsCollection_h
 
 #include "HTMLCollection.h"
 
@@ -31,19 +31,20 @@
 class HTMLElement;
 class HTMLImageElement;
 class QualifiedName;
+
 // This class is just a big hack to find form elements even in malformed HTML elements.
 // The famous <table><tr><form><td> problem.
 
-class HTMLFormCollection : public HTMLCollection {
+class HTMLFormControlsCollection : public HTMLCollection {
 public:
-    static PassRefPtr<HTMLFormCollection> create(Element*);
+    static PassRefPtr<HTMLFormControlsCollection> create(Element*);
 
-    virtual ~HTMLFormCollection();
+    virtual ~HTMLFormControlsCollection();
 
     virtual Node* namedItem(const AtomicString& name) const;
 
 private:
-    HTMLFormCollection(Element*);
+    HTMLFormControlsCollection(Element*);
 
     virtual void updateNameCache() const;
 
@@ -52,6 +53,6 @@
     virtual Element* virtualItemAfter(unsigned& offsetInArray, Element*) const OVERRIDE;
 };
 
-} //namespace
+} // namespace
 
 #endif
diff --git a/Source/WebCore/html/HTMLFormControlsCollection.idl b/Source/WebCore/html/HTMLFormControlsCollection.idl
new file mode 100644
index 0000000..99fafee
--- /dev/null
+++ b/Source/WebCore/html/HTMLFormControlsCollection.idl
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2006, 2007, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+[
+    IndexedGetter,
+    NamedGetter,
+    GenerateIsReachable=ImplBaseRoot,
+    V8DependentLifetime,
+] interface HTMLFormControlsCollection : HTMLCollection {
+    [Custom] Node namedItem(in [Optional=DefaultIsUndefined] DOMString name);
+};
diff --git a/Source/WebCore/html/HTMLFormElement.cpp b/Source/WebCore/html/HTMLFormElement.cpp
index 0519ecbf..578b970 100644
--- a/Source/WebCore/html/HTMLFormElement.cpp
+++ b/Source/WebCore/html/HTMLFormElement.cpp
@@ -40,8 +40,8 @@
 #include "Frame.h"
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
+#include "HTMLCollection.h"
 #include "HTMLDocument.h"
-#include "HTMLFormCollection.h"
 #include "HTMLImageElement.h"
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
diff --git a/Source/WebCore/html/HTMLFormElement.h b/Source/WebCore/html/HTMLFormElement.h
index a56a739..d9c9ab5 100644
--- a/Source/WebCore/html/HTMLFormElement.h
+++ b/Source/WebCore/html/HTMLFormElement.h
@@ -38,7 +38,6 @@
 class HTMLFormControlElement;
 class HTMLImageElement;
 class HTMLInputElement;
-class HTMLFormCollection;
 class TextEncoding;
 
 class HTMLFormElement : public HTMLElement {
diff --git a/Source/WebCore/html/HTMLOptionsCollection.idl b/Source/WebCore/html/HTMLOptionsCollection.idl
index 4327bbdc..0a3eb74 100644
--- a/Source/WebCore/html/HTMLOptionsCollection.idl
+++ b/Source/WebCore/html/HTMLOptionsCollection.idl
@@ -20,11 +20,16 @@
 
 [
     JSGenerateToNativeObject,
-    CustomIndexedSetter
+    CustomIndexedSetter,
+    NamedGetter,
+    GenerateIsReachable=ImplBaseRoot,
+    V8DependentLifetime,
 ] interface HTMLOptionsCollection : HTMLCollection {
-             attribute long selectedIndex;
-             [CustomSetter] attribute unsigned long length
-                    setter raises (DOMException);
+    attribute long selectedIndex;
+    [CustomSetter] attribute unsigned long length
+        setter raises (DOMException);
+
+    [Custom] Node namedItem(in [Optional=DefaultIsUndefined] DOMString name);
 
     [Custom] void add(in [Optional=DefaultIsUndefined] HTMLOptionElement option, 
                       in [Optional] unsigned long index)
@@ -32,8 +37,7 @@
     [Custom] void remove(in [Optional=DefaultIsUndefined] unsigned long index);
 
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
-    Node item(in unsigned long index); 
-    Node namedItem(in DOMString name); 
+    Node item(in unsigned long index);
 #endif
 };
 
diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl
index dc2a2dc..ef06190 100644
--- a/Source/WebCore/page/DOMWindow.idl
+++ b/Source/WebCore/page/DOMWindow.idl
@@ -470,6 +470,8 @@
 
     attribute HTMLCollectionConstructor HTMLCollection;
     attribute HTMLAllCollectionConstructor HTMLAllCollection;
+    attribute HTMLFormControlsCollectionConstructor HTMLFormControlsCollection;
+    attribute HTMLOptionsCollectionConstructor HTMLOptionsCollection;
     [Conditional=MICRODATA] attribute HTMLPropertiesCollectionConstructor HTMLPropertiesCollection;
     attribute HTMLUnknownElementConstructor HTMLUnknownElement;