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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 return result; | 80 return result; |
81 } | 81 } |
82 | 82 |
83 RefPtrWillBeRawPtr<Element> result = collection->item(index->Uint32Value()); | 83 RefPtrWillBeRawPtr<Element> result = collection->item(index->Uint32Value()); |
84 return toV8(result.release(), info.Holder(), info.GetIsolate()); | 84 return toV8(result.release(), info.Holder(), info.GetIsolate()); |
85 } | 85 } |
86 | 86 |
87 void V8HTMLAllCollection::itemMethodCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) | 87 void V8HTMLAllCollection::itemMethodCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) |
88 { | 88 { |
89 HTMLAllCollection* impl = V8HTMLAllCollection::toNative(info.Holder()); | 89 HTMLAllCollection* impl = V8HTMLAllCollection::toImpl(info.Holder()); |
90 v8SetReturnValue(info, getItem(impl, info[0], info)); | 90 v8SetReturnValue(info, getItem(impl, info[0], info)); |
91 } | 91 } |
92 | 92 |
93 void V8HTMLAllCollection::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) | 93 void V8HTMLAllCollection::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) |
94 { | 94 { |
95 if (info.Length() < 1) | 95 if (info.Length() < 1) |
96 return; | 96 return; |
97 | 97 |
98 HTMLAllCollection* impl = V8HTMLAllCollection::toNative(info.Holder()); | 98 HTMLAllCollection* impl = V8HTMLAllCollection::toImpl(info.Holder()); |
99 Node& ownerNode = impl->ownerNode(); | 99 Node& ownerNode = impl->ownerNode(); |
100 | 100 |
101 UseCounter::count(ownerNode.document(), UseCounter::DocumentAllLegacyCall); | 101 UseCounter::count(ownerNode.document(), UseCounter::DocumentAllLegacyCall); |
102 | 102 |
103 if (info.Length() == 1) { | 103 if (info.Length() == 1) { |
104 v8SetReturnValue(info, getItem(impl, info[0], info)); | 104 v8SetReturnValue(info, getItem(impl, info[0], info)); |
105 return; | 105 return; |
106 } | 106 } |
107 | 107 |
108 // If there is a second argument it is the index of the item we want. | 108 // If there is a second argument it is the index of the item we want. |
109 TOSTRING_VOID(V8StringResource<>, name, info[0]); | 109 TOSTRING_VOID(V8StringResource<>, name, info[0]); |
110 v8::Local<v8::Uint32> index = info[1]->ToArrayIndex(); | 110 v8::Local<v8::Uint32> index = info[1]->ToArrayIndex(); |
111 if (index.IsEmpty()) | 111 if (index.IsEmpty()) |
112 return; | 112 return; |
113 | 113 |
114 if (Node* node = impl->namedItemWithIndex(name, index->Uint32Value())) { | 114 if (Node* node = impl->namedItemWithIndex(name, index->Uint32Value())) { |
115 v8SetReturnValueFast(info, node, impl); | 115 v8SetReturnValueFast(info, node, impl); |
116 return; | 116 return; |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 } // namespace blink | 120 } // namespace blink |
OLD | NEW |