OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2007-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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 RefPtr<Node> result = imp->item(index); | 50 RefPtr<Node> result = imp->item(index); |
51 if (!result) | 51 if (!result) |
52 return notHandledByInterceptor(); | 52 return notHandledByInterceptor(); |
53 | 53 |
54 return toV8(result.release()); | 54 return toV8(result.release()); |
55 } | 55 } |
56 | 56 |
57 v8::Handle<v8::Value> V8NamedNodeMap::namedPropertyGetter(v8::Local<v8::String>
name, const v8::AccessorInfo& info) | 57 v8::Handle<v8::Value> V8NamedNodeMap::namedPropertyGetter(v8::Local<v8::String>
name, const v8::AccessorInfo& info) |
58 { | 58 { |
59 INC_STATS("DOM.NamedNodeMap.NamedPropertyGetter"); | 59 INC_STATS("DOM.NamedNodeMap.NamedPropertyGetter"); |
60 // Search the prototype chain first. | |
61 v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototype
Chain(name); | |
62 if (!value.IsEmpty()) | |
63 return value; | |
64 | 60 |
65 // Then look for IDL defined properties on the object itself. | 61 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| 62 return notHandledByInterceptor(); |
66 if (info.Holder()->HasRealNamedCallbackProperty(name)) | 63 if (info.Holder()->HasRealNamedCallbackProperty(name)) |
67 return notHandledByInterceptor(); | 64 return notHandledByInterceptor(); |
68 | 65 |
69 // Finally, search the DOM. | |
70 NamedNodeMap* imp = V8NamedNodeMap::toNative(info.Holder()); | 66 NamedNodeMap* imp = V8NamedNodeMap::toNative(info.Holder()); |
71 RefPtr<Node> result = imp->getNamedItem(toWebCoreString(name)); | 67 RefPtr<Node> result = imp->getNamedItem(toWebCoreString(name)); |
72 if (!result) | 68 if (!result) |
73 return notHandledByInterceptor(); | 69 return notHandledByInterceptor(); |
74 | 70 |
75 return toV8(result.release()); | 71 return toV8(result.release()); |
76 } | 72 } |
77 | 73 |
78 v8::Handle<v8::Value> toV8(NamedNodeMap* impl) | 74 v8::Handle<v8::Value> toV8(NamedNodeMap* impl) |
79 { | 75 { |
80 if (!impl) | 76 if (!impl) |
81 return v8::Null(); | 77 return v8::Null(); |
82 v8::Handle<v8::Object> wrapper = V8NamedNodeMap::wrap(impl); | 78 v8::Handle<v8::Object> wrapper = V8NamedNodeMap::wrap(impl); |
83 // Add a hidden reference from named node map to its owner node. | 79 // Add a hidden reference from named node map to its owner node. |
84 Element* element = impl->element(); | 80 Element* element = impl->element(); |
85 if (!wrapper.IsEmpty() && element) | 81 if (!wrapper.IsEmpty() && element) |
86 V8DOMWrapper::setNamedHiddenReference(wrapper, "ownerNode", toV8(element
)); | 82 V8DOMWrapper::setNamedHiddenReference(wrapper, "ownerNode", toV8(element
)); |
87 return wrapper; | 83 return wrapper; |
88 } | 84 } |
89 | 85 |
90 } // namespace WebCore | 86 } // namespace WebCore |
OLD | NEW |