OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 return result; | 70 return result; |
71 } | 71 } |
72 | 72 |
73 RefPtr<Node> result = collection->item(index->Uint32Value()); | 73 RefPtr<Node> result = collection->item(index->Uint32Value()); |
74 return toV8(result.release()); | 74 return toV8(result.release()); |
75 } | 75 } |
76 | 76 |
77 v8::Handle<v8::Value> V8HTMLCollection::namedPropertyGetter(v8::Local<v8::String
> name, const v8::AccessorInfo& info) | 77 v8::Handle<v8::Value> V8HTMLCollection::namedPropertyGetter(v8::Local<v8::String
> name, const v8::AccessorInfo& info) |
78 { | 78 { |
79 INC_STATS("DOM.HTMLCollection.NamedPropertyGetter"); | 79 INC_STATS("DOM.HTMLCollection.NamedPropertyGetter"); |
80 // Search the prototype chain first. | |
81 v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototype
Chain(name); | |
82 | 80 |
83 if (!value.IsEmpty()) | 81 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
84 return value; | 82 return notHandledByInterceptor(); |
| 83 if (info.Holder()->HasRealNamedCallbackProperty(name)) |
| 84 return notHandledByInterceptor(); |
85 | 85 |
86 // Search local callback properties next to find IDL defined | |
87 // properties. | |
88 if (info.Holder()->HasRealNamedCallbackProperty(name)) | |
89 return v8::Handle<v8::Value>(); | |
90 | |
91 // Finally, search the DOM structure. | |
92 HTMLCollection* imp = V8HTMLCollection::toNative(info.Holder()); | 86 HTMLCollection* imp = V8HTMLCollection::toNative(info.Holder()); |
93 return getNamedItems(imp, v8StringToAtomicWebCoreString(name)); | 87 return getNamedItems(imp, v8StringToAtomicWebCoreString(name)); |
94 } | 88 } |
95 | 89 |
96 v8::Handle<v8::Value> V8HTMLCollection::itemCallback(const v8::Arguments& args) | 90 v8::Handle<v8::Value> V8HTMLCollection::itemCallback(const v8::Arguments& args) |
97 { | 91 { |
98 INC_STATS("DOM.HTMLCollection.item()"); | 92 INC_STATS("DOM.HTMLCollection.item()"); |
99 HTMLCollection* imp = V8HTMLCollection::toNative(args.Holder()); | 93 HTMLCollection* imp = V8HTMLCollection::toNative(args.Holder()); |
100 return getItem(imp, args[0]); | 94 return getItem(imp, args[0]); |
101 } | 95 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 137 } |
144 | 138 |
145 v8::Handle<v8::Value> toV8(HTMLCollection* impl) | 139 v8::Handle<v8::Value> toV8(HTMLCollection* impl) |
146 { | 140 { |
147 if (impl->type() == DocAll) | 141 if (impl->type() == DocAll) |
148 return toV8(static_cast<HTMLAllCollection*>(impl)); | 142 return toV8(static_cast<HTMLAllCollection*>(impl)); |
149 return V8HTMLCollection::wrap(impl); | 143 return V8HTMLCollection::wrap(impl); |
150 } | 144 } |
151 | 145 |
152 } // namespace WebCore | 146 } // namespace WebCore |
OLD | NEW |