| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 template<class CallbackInfo> | 59 template<class CallbackInfo> |
| 60 static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v
8::Value> argument, const CallbackInfo& callbackInfo) | 60 static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v
8::Value> argument, const CallbackInfo& callbackInfo) |
| 61 { | 61 { |
| 62 v8::Local<v8::Uint32> index = argument->ToArrayIndex(); | 62 v8::Local<v8::Uint32> index = argument->ToArrayIndex(); |
| 63 if (index.IsEmpty()) { | 63 if (index.IsEmpty()) { |
| 64 v8::Handle<v8::Value> result = getNamedItems(collection, toWebCoreString
(argument->ToString()), callbackInfo); | 64 v8::Handle<v8::Value> result = getNamedItems(collection, toWebCoreString
(argument->ToString()), callbackInfo); |
| 65 | 65 |
| 66 if (result.IsEmpty()) | 66 if (result.IsEmpty()) |
| 67 return v8::Undefined(); | 67 return v8::Undefined(callbackInfo.GetIsolate()); |
| 68 | 68 |
| 69 return result; | 69 return result; |
| 70 } | 70 } |
| 71 | 71 |
| 72 RefPtr<Node> result = collection->item(index->Uint32Value()); | 72 RefPtr<Node> result = collection->item(index->Uint32Value()); |
| 73 return toV8(result.release(), callbackInfo.Holder(), callbackInfo.GetIsolate
()); | 73 return toV8(result.release(), callbackInfo.Holder(), callbackInfo.GetIsolate
()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void V8HTMLAllCollection::itemMethodCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& args) | 76 void V8HTMLAllCollection::itemMethodCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& args) |
| 77 { | 77 { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 if (index.IsEmpty()) | 110 if (index.IsEmpty()) |
| 111 return; | 111 return; |
| 112 | 112 |
| 113 if (Node* node = imp->namedItemWithIndex(name, index->Uint32Value())) { | 113 if (Node* node = imp->namedItemWithIndex(name, index->Uint32Value())) { |
| 114 v8SetReturnValueFast(args, node, imp); | 114 v8SetReturnValueFast(args, node, imp); |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace WebCore | 119 } // namespace WebCore |
| OLD | NEW |