WebCore/ChangeLog

 12009-10-26 Tony Chang <tony@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Rollback r50027 (chromium build fixes for r50041) since
 6 r50041-r50043 have been rolled out.
 7
 8 No new tests. (OOPS!)
 9
 10 * WebCore.gypi:
 11 * bindings/scripts/CodeGeneratorV8.pm:
 12 * bindings/v8/custom/V8CustomBinding.h:
 13 * bindings/v8/custom/V8HTMLAllCollectionCustom.cpp: Removed.
 14 * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
 15
1162009-10-21 Jeremy Orlow <jorlow@chromium.org>
217
318 Reviewed by Darin Adler.

WebCore/WebCore.gypi

678678 'bindings/v8/custom/V8FileListCustom.cpp',
679679 'bindings/v8/custom/V8HTMLAudioElementConstructor.cpp',
680680 'bindings/v8/custom/V8HTMLAudioElementConstructor.h',
681  'bindings/v8/custom/V8HTMLAllCollectionCustom.cpp',
682681 'bindings/v8/custom/V8HTMLCanvasElementCustom.cpp',
683682 'bindings/v8/custom/V8HTMLCollectionCustom.cpp',
684683 'bindings/v8/custom/V8HTMLDataGridElementCustom.cpp',

WebCore/bindings/scripts/CodeGeneratorV8.pm

@@sub AddClassForwardIfNeeded
215215sub GetImplementationFileName
216216{
217217 my $iface = shift;
 218 return "HTMLCollection.h" if $iface eq "HTMLAllCollection";
218219 return "Event.h" if $iface eq "DOMTimeStamp";
219220 return "NamedAttrMap.h" if $iface eq "NamedNodeMap";
220221 return "NameNodeList.h" if $iface eq "NodeList";

@@END
13961397 }
13971398
13981399 # Set the class name. This is used when printing objects.
1399  push(@implContent, " desc->SetClassName(v8::String::New(\"${interfaceName}\"));\n");
 1400 push(@implContent, " desc->SetClassName(v8::String::New(\"" . GetClassName(${interfaceName}) . "\"));\n");
14001401
14011402 if ($has_constants) {
14021403 push(@implContent, <<END);

@@sub GenerateFunctionCallString()
16231624}
16241625
16251626
 1627# Get the class name used for printing javascript DOM-object wrappers.
 1628sub GetClassName
 1629{
 1630 my $type = shift;
 1631 return "HTMLCollection" if $type eq "HTMLAllCollection";
 1632 return $type;
 1633}
 1634
 1635
16261636sub GetTypeFromSignature
16271637{
16281638 my $signature = shift;

@@sub IsRefPtrType
17001710 return 1 if $type eq "EventListener";
17011711 return 1 if $type eq "FileList";
17021712 return 1 if $type eq "HTMLCollection";
1703  return 1 if $type eq "HTMLAllCollection";
17041713 return 1 if $type eq "HTMLDocument";
17051714 return 1 if $type eq "HTMLElement";
17061715 return 1 if $type eq "HTMLOptionsCollection";

WebCore/bindings/v8/custom/V8CustomBinding.h

@@namespace WebCore {
299299 DECLARE_CALLBACK(HTMLCollectionNamedItem);
300300 DECLARE_CALLBACK(HTMLCollectionCallAsFunction);
301301
302  DECLARE_CALLBACK(HTMLAllCollectionItem);
303  DECLARE_CALLBACK(HTMLAllCollectionNamedItem);
304  DECLARE_CALLBACK(HTMLAllCollectionCallAsFunction);
305 
306302 DECLARE_CALLBACK(HTMLSelectElementRemove);
307303
308304 DECLARE_CALLBACK(HTMLOptionsCollectionRemove);

@@namespace WebCore {
527523 DECLARE_INDEXED_PROPERTY_SETTER(HTMLOptionsCollection);
528524 DECLARE_NAMED_PROPERTY_GETTER(HTMLSelectElementCollection);
529525 DECLARE_INDEXED_PROPERTY_SETTER(HTMLSelectElementCollection);
530  DECLARE_NAMED_PROPERTY_GETTER(HTMLAllCollection);
531526 DECLARE_NAMED_PROPERTY_GETTER(HTMLCollection);
532527
533528#if ENABLE(3D_CANVAS)

WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp

1 /*
2  * Copyright (C) 2009 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  * * Neither the name of Google Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #include "config.h"
32 #include "HTMLAllCollection.h"
33 
34 #include "V8Binding.h"
35 #include "V8Collection.h"
36 #include "V8CustomBinding.h"
37 #include "V8Proxy.h"
38 
39 namespace WebCore {
40 
41 NAMED_PROPERTY_GETTER(HTMLAllCollection)
42 {
43  INC_STATS("DOM.HTMLAllCollection.NamedPropertyGetter");
44  // Search the prototype chain first.
45  v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
46 
47  if (!value.IsEmpty())
48  return value;
49 
50  // Search local callback properties next to find IDL defined
51  // properties.
52  if (info.Holder()->HasRealNamedCallbackProperty(name))
53  return v8::Handle<v8::Value>();
54 
55  // Finally, search the DOM structure.
56  HTMLAllCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLAllCollection>(V8ClassIndex::HTMLALLCOLLECTION, info.Holder());
57  return getNamedItemsFromCollection(imp, v8StringToAtomicWebCoreString(name));
58 }
59 
60 CALLBACK_FUNC_DECL(HTMLAllCollectionItem)
61 {
62  INC_STATS("DOM.HTMLAllCollection.item()");
63  HTMLAllCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLAllCollection>(V8ClassIndex::HTMLALLCOLLECTION, args.Holder());
64  return getItemFromCollection(imp, args[0]);
65 }
66 
67 CALLBACK_FUNC_DECL(HTMLAllCollectionNamedItem)
68 {
69  INC_STATS("DOM.HTMLAllCollection.namedItem()");
70  HTMLAllCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLAllCollection>(V8ClassIndex::HTMLALLCOLLECTION, args.Holder());
71  v8::Handle<v8::Value> result = getNamedItemsFromCollection(imp, toWebCoreString(args[0]));
72 
73  if (result.IsEmpty())
74  return v8::Undefined();
75 
76  return result;
77 }
78 
79 CALLBACK_FUNC_DECL(HTMLAllCollectionCallAsFunction)
80 {
81  INC_STATS("DOM.HTMLAllCollection.callAsFunction()");
82  if (args.Length() < 1)
83  return v8::Undefined();
84 
85  HTMLAllCollection* imp = V8DOMWrapper::convertToNativeObject<HTMLAllCollection>(V8ClassIndex::HTMLALLCOLLECTION, args.Holder());
86 
87  if (args.Length() == 1)
88  return getItemFromCollection(imp, args[0]);
89 
90  // If there is a second argument it is the index of the item we want.
91  String name = toWebCoreString(args[0]);
92  v8::Local<v8::Uint32> index = args[1]->ToArrayIndex();
93  if (index.IsEmpty())
94  return v8::Undefined();
95 
96  unsigned current = index->Uint32Value();
97  Node* node = imp->namedItem(name);
98  while (node) {
99  if (!current)
100  return V8DOMWrapper::convertNodeToV8Object(node);
101 
102  node = imp->nextNamedItem(name);
103  current--;
104  }
105 
106  return v8::Undefined();
107 }
108 
109 } // namespace WebCore

WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp

3232#include "HTMLDocument.h"
3333
3434#include "Frame.h"
35 #include "HTMLAllCollection.h"
3635#include "HTMLCollection.h"
3736#include "HTMLIFrameElement.h"
3837#include "HTMLNames.h"