OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 ASSERT(V8DOMWrapper::maybeDOMWrapper(object)); | 66 ASSERT(V8DOMWrapper::maybeDOMWrapper(object)); |
67 ASSERT(V8DOMWrapper::domWrapperType(object) != &V8Node::info); | 67 ASSERT(V8DOMWrapper::domWrapperType(object) != &V8Node::info); |
68 Collection* collection = toNativeCollection<Collection>(object); | 68 Collection* collection = toNativeCollection<Collection>(object); |
69 AtomicString propertyName = toAtomicWebCoreStringWithNullCheck(name); | 69 AtomicString propertyName = toAtomicWebCoreStringWithNullCheck(name); |
70 return getV8Object<ItemType>(collection->namedItem(propertyName)); | 70 return getV8Object<ItemType>(collection->namedItem(propertyName)); |
71 } | 71 } |
72 | 72 |
73 // A template of named property accessor of collections. | 73 // A template of named property accessor of collections. |
74 template<class Collection, class ItemType> static v8::Handle<v8::Value> collecti
onNamedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) | 74 template<class Collection, class ItemType> static v8::Handle<v8::Value> collecti
onNamedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) |
75 { | 75 { |
76 v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototype
Chain(name); | 76 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
77 | 77 return notHandledByInterceptor(); |
78 if (!value.IsEmpty()) | |
79 return value; | |
80 | |
81 // Search local callback properties next to find IDL defined | |
82 // properties. | |
83 if (info.Holder()->HasRealNamedCallbackProperty(name)) | 78 if (info.Holder()->HasRealNamedCallbackProperty(name)) |
84 return notHandledByInterceptor(); | 79 return notHandledByInterceptor(); |
| 80 |
85 return getNamedPropertyOfCollection<Collection, ItemType>(name, info.Holder(
)); | 81 return getNamedPropertyOfCollection<Collection, ItemType>(name, info.Holder(
)); |
86 } | 82 } |
87 | 83 |
88 // Returns the property at the index of a collection. | 84 // Returns the property at the index of a collection. |
89 template<class Collection, class ItemType> static v8::Handle<v8::Value> getIndex
edPropertyOfCollection(uint32_t index, v8::Local<v8::Object> object) | 85 template<class Collection, class ItemType> static v8::Handle<v8::Value> getIndex
edPropertyOfCollection(uint32_t index, v8::Local<v8::Object> object) |
90 { | 86 { |
91 // FIXME: Assert that object must be a collection type. | 87 // FIXME: Assert that object must be a collection type. |
92 ASSERT(V8DOMWrapper::maybeDOMWrapper(object)); | 88 ASSERT(V8DOMWrapper::maybeDOMWrapper(object)); |
93 ASSERT(V8DOMWrapper::domWrapperType(object) != &V8Node::info); | 89 ASSERT(V8DOMWrapper::domWrapperType(object) != &V8Node::info); |
94 Collection* collection = toNativeCollection<Collection>(object); | 90 Collection* collection = toNativeCollection<Collection>(object); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 template<class Collection> static void setCollectionStringIndexedGetter(v8::Hand
le<v8::FunctionTemplate> desc) | 174 template<class Collection> static void setCollectionStringIndexedGetter(v8::Hand
le<v8::FunctionTemplate> desc) |
179 { | 175 { |
180 desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionStringIndexedP
ropertyGetter<Collection>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collecti
on>); | 176 desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionStringIndexedP
ropertyGetter<Collection>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collecti
on>); |
181 } | 177 } |
182 | 178 |
183 v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::V
alue>, HTMLSelectElement*); | 179 v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::V
alue>, HTMLSelectElement*); |
184 | 180 |
185 } // namespace WebCore | 181 } // namespace WebCore |
186 | 182 |
187 #endif // V8Collection_h | 183 #endif // V8Collection_h |
OLD | NEW |