Changeset 115009 in webkit


Ignore:
Timestamp:
Apr 24, 2012 1:11:32 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

RadioNodeList support in HTMLFormElement::elements
https://bugs.webkit.org/show_bug.cgi?id=81854

Source/WebCore:

Implement RadioNodeList support spec'ed at
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#radionodelist

Patch by Rakesh KN <rakesh.kn@motorola.com> on 2012-04-24
Reviewed by Ryosuke Niwa.

Test: fast/forms/form-collection-radio-node-list.html

  • CMakeLists.txt:

Added entries for new files.

  • DerivedSources.cpp: Ditto.
  • DerivedSources.make: Ditto.
  • DerivedSources.pri: Ditto.
  • GNUmakefile.list.am: Ditto.
  • Target.pri: Ditto.
  • WebCore.gypi: Ditto.
  • WebCore.vcproj/WebCore.vcproj: Ditto.
  • WebCore.xcodeproj/project.pbxproj: Ditto.
  • bindings/js/JSHTMLCollectionCustom.cpp:

(WebCore::getNamedItems):
Modified to create RadioNodeList object when FormControlCollection has more than
one element of same name/id.

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation):
Added code to include Node.h and JSNode.h in JSRadioNodeElement.cpp.

  • bindings/v8/custom/V8HTMLCollectionCustom.cpp:

(WebCore::getNamedItems):
Modified to create RadioNodeList object when FormControlCollection has more than
one element of same name/id.

  • html/CollectionType.h:

Added new FormControls type.

  • html/HTMLCollection.cpp:

(WebCore::HTMLCollection::shouldIncludeChildren):
(WebCore::HTMLCollection::isAcceptableElement):
Handle FormControls collection type.

  • html/HTMLFormCollection.cpp:

(WebCore::HTMLFormCollection::HTMLFormCollection):
Contruct collection of FormControls type.

  • html/RadioNodeList.cpp: Added.

(WebCore):
(WebCore::RadioNodeList::RadioNodeList):
(WebCore::RadioNodeList::~RadioNodeList):
(WebCore::toRadioButtonInputElement):
(WebCore::RadioNodeList::value):
(WebCore::RadioNodeList::setValue):
(WebCore::RadioNodeList::nodeMatches):

  • html/RadioNodeList.h: Added.

(WebCore):
(RadioNodeList):
(WebCore::RadioNodeList::create):
RadioNodeList implementation.

  • html/RadioNodeList.idl: Added.

Idl for generating RadioNodeList JS/V8 bindings.

LayoutTests:

Patch by Rakesh KN <rakesh.kn@motorola.com> on 2012-04-24
Reviewed by Ryosuke Niwa.

  • fast/forms/form-collection-radio-node-list-expected.txt: Added.
  • fast/forms/form-collection-radio-node-list.html: Added.
Location:
trunk
Files:
5 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r115008 r115009  
     12012-04-24  Rakesh KN  <rakesh.kn@motorola.com>
     2
     3        RadioNodeList support in HTMLFormElement::elements
     4        https://bugs.webkit.org/show_bug.cgi?id=81854
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * fast/forms/form-collection-radio-node-list-expected.txt: Added.
     9        * fast/forms/form-collection-radio-node-list.html: Added.
     10
    1112012-04-24  Philippe Normand  <pnormand@igalia.com>
    212
  • trunk/Source/WebCore/CMakeLists.txt

    r114870 r115009  
    324324    html/MediaController.idl
    325325    html/MediaError.idl
     326    html/RadioNodeList.idl
    326327    html/TextMetrics.idl
    327328    html/TimeRanges.idl
     
    846847    html/PluginDocument.cpp
    847848    html/RadioInputType.cpp
     849    html/RadioNodeList.cpp
    848850    html/RangeInputType.cpp
    849851    html/ResetInputType.cpp
  • trunk/Source/WebCore/ChangeLog

    r115007 r115009  
     12012-04-24  Rakesh KN  <rakesh.kn@motorola.com>
     2
     3        RadioNodeList support in HTMLFormElement::elements
     4        https://bugs.webkit.org/show_bug.cgi?id=81854
     5
     6        Implement RadioNodeList support spec'ed at
     7        http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#radionodelist
     8
     9        Reviewed by Ryosuke Niwa.
     10
     11        Test: fast/forms/form-collection-radio-node-list.html
     12
     13        * CMakeLists.txt:
     14        Added entries for new files.
     15        * DerivedSources.cpp: Ditto.
     16        * DerivedSources.make: Ditto.
     17        * DerivedSources.pri: Ditto.
     18        * GNUmakefile.list.am: Ditto.
     19        * Target.pri: Ditto.
     20        * WebCore.gypi: Ditto.
     21        * WebCore.vcproj/WebCore.vcproj: Ditto.
     22        * WebCore.xcodeproj/project.pbxproj: Ditto.
     23        * bindings/js/JSHTMLCollectionCustom.cpp:
     24        (WebCore::getNamedItems):
     25        Modified to create RadioNodeList object when FormControlCollection has more than
     26        one element of same name/id.
     27        * bindings/scripts/CodeGeneratorJS.pm:
     28        (GenerateImplementation):
     29        Added code to include Node.h and JSNode.h in JSRadioNodeElement.cpp.
     30        * bindings/v8/custom/V8HTMLCollectionCustom.cpp:
     31        (WebCore::getNamedItems):
     32        Modified to create RadioNodeList object when FormControlCollection has more than
     33        one element of same name/id.
     34        * html/CollectionType.h:
     35        Added new FormControls type.
     36        * html/HTMLCollection.cpp:
     37        (WebCore::HTMLCollection::shouldIncludeChildren):
     38        (WebCore::HTMLCollection::isAcceptableElement):
     39        Handle FormControls collection type.
     40        * html/HTMLFormCollection.cpp:
     41        (WebCore::HTMLFormCollection::HTMLFormCollection):
     42        Contruct collection of FormControls type.
     43        * html/RadioNodeList.cpp: Added.
     44        (WebCore):
     45        (WebCore::RadioNodeList::RadioNodeList):
     46        (WebCore::RadioNodeList::~RadioNodeList):
     47        (WebCore::toRadioButtonInputElement):
     48        (WebCore::RadioNodeList::value):
     49        (WebCore::RadioNodeList::setValue):
     50        (WebCore::RadioNodeList::nodeMatches):
     51        * html/RadioNodeList.h: Added.
     52        (WebCore):
     53        (RadioNodeList):
     54        (WebCore::RadioNodeList::create):
     55        RadioNodeList implementation.
     56        * html/RadioNodeList.idl: Added.
     57        Idl for generating RadioNodeList JS/V8 bindings.
     58
    1592012-04-24  Benjamin Poulain  <bpoulain@apple.com>
    260
  • trunk/Source/WebCore/DerivedSources.cpp

    r112490 r115009  
    266266#include "JSProcessingInstruction.cpp"
    267267#include "JSProgressEvent.cpp"
     268#include "JSRadioNodeList.cpp"
    268269#include "JSRange.cpp"
    269270#include "JSRangeException.cpp"
  • trunk/Source/WebCore/DerivedSources.make

    r114069 r115009  
    336336    $(WebCore)/html/MediaController.idl \
    337337    $(WebCore)/html/MediaError.idl \
     338    $(WebCore)/html/RadioNodeList.idl \
    338339    $(WebCore)/html/TextMetrics.idl \
    339340    $(WebCore)/html/TimeRanges.idl \
  • trunk/Source/WebCore/DerivedSources.pri

    r114042 r115009  
    384384    $$PWD/html/MediaController.idl \
    385385    $$PWD/html/MediaError.idl \
     386    $$PWD/html/RadioNodeList.idl \
    386387    $$PWD/html/TextMetrics.idl \
    387388    $$PWD/html/TimeRanges.idl \
  • trunk/Source/WebCore/GNUmakefile.list.am

    r114890 r115009  
    461461        DerivedSources/WebCore/JSProgressEvent.cpp \
    462462        DerivedSources/WebCore/JSProgressEvent.h \
     463        DerivedSources/WebCore/JSRadioNodeList.cpp \
     464        DerivedSources/WebCore/JSRadioNodeList.h \
    463465        DerivedSources/WebCore/JSRange.cpp \
    464466        DerivedSources/WebCore/JSRangeException.cpp \
     
    874876        $(WebCore)/html/MediaKeyError.idl \
    875877        $(WebCore)/html/MediaKeyEvent.idl \
     878        $(WebCore)/html/RadioNodeList.idl \
    876879        $(WebCore)/html/TextMetrics.idl \
    877880        $(WebCore)/html/TimeRanges.idl \
     
    25252528        Source/WebCore/html/RangeInputType.cpp \
    25262529        Source/WebCore/html/RangeInputType.h \
     2530    Source/WebCore/html/RadioNodeList.cpp \
     2531    Source/WebCore/html/RadioNodeList.h \
    25272532        Source/WebCore/html/ResetInputType.cpp \
    25282533        Source/WebCore/html/ResetInputType.h \
  • trunk/Source/WebCore/Target.pri

    r114890 r115009  
    827827    html/PluginDocument.cpp \
    828828    html/RadioInputType.cpp \
     829    html/RadioNodeList.cpp \
    829830    html/RangeInputType.cpp \
    830831    html/ResetInputType.cpp \
     
    19661967    html/PluginDocument.h \
    19671968    html/PublicURLManager.h \
     1969    html/RadioNodeList.h \
    19681970    html/StepRange.h \
    19691971    html/TextDocument.h \
  • trunk/Source/WebCore/WebCore.gypi

    r114991 r115009  
    10711071            'html/MediaKeyError.idl',
    10721072            'html/MediaKeyEvent.idl',
     1073            'html/RadioNodeList.idl',
    10731074            'html/TextMetrics.idl',
    10741075            'html/TimeRanges.idl',
     
    56075608            'html/RadioInputType.cpp',
    56085609            'html/RadioInputType.h',
     5610            'html/RadioNodeList.cpp',
     5611            'html/RadioNodeList.h',
    56095612            'html/RangeInputType.cpp',
    56105613            'html/RangeInputType.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r114892 r115009  
    1265912659                        </File>
    1266012660                        <File
     12661                                RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSRadioNodeList.cpp"
     12662                                >
     12663                                <FileConfiguration
     12664                                        Name="Debug|Win32"
     12665                                        ExcludedFromBuild="true"
     12666                                        >
     12667                                        <Tool
     12668                                                Name="VCCLCompilerTool"
     12669                                        />
     12670                                </FileConfiguration>
     12671                                <FileConfiguration
     12672                                        Name="Release|Win32"
     12673                                        ExcludedFromBuild="true"
     12674                                        >
     12675                                        <Tool
     12676                                                Name="VCCLCompilerTool"
     12677                                        />
     12678                                </FileConfiguration>
     12679                                <FileConfiguration
     12680                                        Name="Debug_Cairo_CFLite|Win32"
     12681                                        ExcludedFromBuild="true"
     12682                                        >
     12683                                        <Tool
     12684                                                Name="VCCLCompilerTool"
     12685                                        />
     12686                                </FileConfiguration>
     12687                                <FileConfiguration
     12688                                        Name="Release_Cairo_CFLite|Win32"
     12689                                        ExcludedFromBuild="true"
     12690                                        >
     12691                                        <Tool
     12692                                                Name="VCCLCompilerTool"
     12693                                        />
     12694                                </FileConfiguration>
     12695                                <FileConfiguration
     12696                                        Name="Debug_All|Win32"
     12697                                        ExcludedFromBuild="true"
     12698                                        >
     12699                                        <Tool
     12700                                                Name="VCCLCompilerTool"
     12701                                        />
     12702                                </FileConfiguration>
     12703                                <FileConfiguration
     12704                                        Name="Production|Win32"
     12705                                        ExcludedFromBuild="true"
     12706                                        >
     12707                                        <Tool
     12708                                                Name="VCCLCompilerTool"
     12709                                        />
     12710                                </FileConfiguration>
     12711                        </File>
     12712                        <File
     12713                                RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSRadioNodeList.h"
     12714                                >
     12715                        </File>
     12716                        <File
    1266112717                                RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSRange.cpp"
    1266212718                                >
     
    6208762143                        </File>
    6208862144                        <File
     62145                                RelativePath="..\html\RadioNodeList.cpp"
     62146                                >
     62147                        </File>
     62148                        <File
     62149                                RelativePath="..\html\RadioNodeList.h"
     62150                                >
     62151                        </File>
     62152                        <File
    6208962153                                RelativePath="..\html\RangeInputType.cpp"
    6209062154                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r114890 r115009  
    51185118                B6566270120B1227006EA85C /* JSIDBTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = B656626E120B1227006EA85C /* JSIDBTransaction.h */; };
    51195119                B6566271120B1227006EA85C /* JSIDBTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B656626F120B1227006EA85C /* JSIDBTransaction.cpp */; };
     5120                B658FFA11522EF3A00DD5595 /* JSRadioNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B658FF9F1522EF3A00DD5595 /* JSRadioNodeList.cpp */; };
     5121                B658FFA21522EF3A00DD5595 /* JSRadioNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = B658FFA01522EF3A00DD5595 /* JSRadioNodeList.h */; };
     5122                B658FFA51522EFAA00DD5595 /* RadioNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B658FFA31522EFAA00DD5595 /* RadioNodeList.cpp */; };
     5123                B658FFA61522EFAA00DD5595 /* RadioNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = B658FFA41522EFAA00DD5595 /* RadioNodeList.h */; };
    51205124                B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */ = {isa = PBXBuildFile; fileRef = B776D43A1104525D00BEB0EC /* PrintContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
    51215125                B734B181119B9911006587BD /* FontTranscoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B734B180119B9911006587BD /* FontTranscoder.cpp */; };
     
    1219312197                B656626E120B1227006EA85C /* JSIDBTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBTransaction.h; sourceTree = "<group>"; };
    1219412198                B656626F120B1227006EA85C /* JSIDBTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBTransaction.cpp; sourceTree = "<group>"; };
     12199                B658FF9F1522EF3A00DD5595 /* JSRadioNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRadioNodeList.cpp; sourceTree = "<group>"; };
     12200                B658FFA01522EF3A00DD5595 /* JSRadioNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRadioNodeList.h; sourceTree = "<group>"; };
     12201                B658FFA31522EFAA00DD5595 /* RadioNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RadioNodeList.cpp; sourceTree = "<group>"; };
     12202                B658FFA41522EFAA00DD5595 /* RadioNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RadioNodeList.h; sourceTree = "<group>"; };
    1219512203                B734B180119B9911006587BD /* FontTranscoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FontTranscoder.cpp; path = transcoder/FontTranscoder.cpp; sourceTree = "<group>"; };
    1219612204                B734B182119B991D006587BD /* FontTranscoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FontTranscoder.h; path = transcoder/FontTranscoder.h; sourceTree = "<group>"; };
     
    1683216840                        isa = PBXGroup;
    1683316841                        children = (
     16842                                B658FFA31522EFAA00DD5595 /* RadioNodeList.cpp */,
     16843                                B658FFA41522EFAA00DD5595 /* RadioNodeList.h */,
    1683416844                                49484FAE102CF01E00187DD3 /* canvas */,
    1683516845                                97C1F5511228558800EDE616 /* parser */,
     
    1773617746                        isa = PBXGroup;
    1773717747                        children = (
     17748                                B658FF9F1522EF3A00DD5595 /* JSRadioNodeList.cpp */,
     17749                                B658FFA01522EF3A00DD5595 /* JSRadioNodeList.h */,
    1773817750                                49EECEF2105070C400099FAB /* JSArrayBuffer.cpp */,
    1773917751                                49EECEF3105070C400099FAB /* JSArrayBuffer.h */,
     
    2480524817                                CECADFCE1537791D00E37068 /* TextInsertionBaseCommand.h in Headers */,
    2480624818                                9831AE4A154225C900FE2644 /* ReferrerPolicy.h in Headers */,
     24819                B658FFA21522EF3A00DD5595 /* JSRadioNodeList.h in Headers */,
     24820                B658FFA61522EFAA00DD5595 /* RadioNodeList.h in Headers */,
    2480724821                        );
    2480824822                        runOnlyForDeploymentPostprocessing = 0;
     
    2781627830                                CECADFC8153778FF00E37068 /* DictationCommand.cpp in Sources */,
    2781727831                                CECADFCD1537791D00E37068 /* TextInsertionBaseCommand.cpp in Sources */,
     27832                B658FFA11522EF3A00DD5595 /* JSRadioNodeList.cpp in Sources */,
     27833                B658FFA51522EFAA00DD5595 /* RadioNodeList.cpp in Sources */,
    2781827834                        );
    2781927835                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp

    r113387 r115009  
    2929#include "JSNode.h"
    3030#include "JSNodeList.h"
     31#include "JSRadioNodeList.h"
    3132#include "Node.h"
     33#include "RadioNodeList.h"
    3234#include "StaticNodeList.h"
    3335#include <wtf/Vector.h>
     
    4648{
    4749    Vector<RefPtr<Node> > namedItems;
    48     collection->impl()->namedItems(identifierToAtomicString(propertyName), namedItems);
     50    const AtomicString& name = identifierToAtomicString(propertyName);
     51    collection->impl()->namedItems(name, namedItems);
    4952
    5053    if (namedItems.isEmpty())
     
    5255    if (namedItems.size() == 1)
    5356        return toJS(exec, collection->globalObject(), namedItems[0].get());
     57
     58    if (collection->impl()->type() == FormControls)
     59       return toJS(exec, collection->globalObject(), RadioNodeList::create(name, toElement(collection->impl()->base())).get());
    5460
    5561    // FIXME: HTML5 specifies that this should be a DynamicNodeList.
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r114887 r115009  
    22232223        }
    22242224        push(@implContent, "}\n\n");
    2225         if ($interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection") {
     2225        if ($interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection" or $interfaceName eq "RadioNodeList") {
    22262226            $implIncludes{"JSNode.h"} = 1;
    22272227            $implIncludes{"Node.h"} = 1;
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp

    r114972 r115009  
    3333
    3434#include "HTMLCollection.h"
     35#include "RadioNodeList.h"
    3536#include "V8Binding.h"
    3637#include "V8HTMLAllCollection.h"
     
    3940#include "V8NodeList.h"
    4041#include "V8Proxy.h"
     42#include "V8RadioNodeList.h"
    4143
    4244namespace WebCore {
     
    5254    if (namedItems.size() == 1)
    5355        return toV8(namedItems.at(0).release(), isolate);
     56
     57    if (collection->type() == FormControls)
     58       return toV8(RadioNodeList::create(name, toElement(collection->base())).get());
    5459
    5560    return toV8(V8NamedNodesCollection::create(namedItems), isolate);
  • trunk/Source/WebCore/html/CollectionType.h

    r110340 r115009  
    6060#endif
    6161
     62    FormControls,
    6263    OtherCollection
    6364};
  • trunk/Source/WebCore/html/HTMLCollection.cpp

    r112555 r115009  
    6868    case ItemProperties:
    6969#endif
     70    case FormControls:
    7071        return true;
    7172    case NodeChildren:
     
    149150        return element->isHTMLElement() && element->fastHasAttribute(itempropAttr);
    150151#endif
     152    case FormControls:
    151153    case DocumentNamedItems:
    152154    case OtherCollection:
  • trunk/Source/WebCore/html/HTMLFormCollection.cpp

    r107477 r115009  
    3737
    3838HTMLFormCollection::HTMLFormCollection(HTMLFormElement* form)
    39     : HTMLCollection(form, OtherCollection)
     39    : HTMLCollection(form, FormControls)
    4040    , currentPos(0)
    4141{
Note: See TracChangeset for help on using the changeset viewer.