| 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 if (namedItems.size() == 1) { | 59 if (namedItems.size() == 1) { |
| 60 v8SetReturnValueFast(callbackInfo, namedItems.at(0).release(), collectio
n); | 60 v8SetReturnValueFast(callbackInfo, namedItems.at(0).release(), collectio
n); |
| 61 return; | 61 return; |
| 62 } | 62 } |
| 63 | 63 |
| 64 v8SetReturnValueFast(callbackInfo, NamedNodesCollection::create(namedItems),
collection); | 64 v8SetReturnValueFast(callbackInfo, NamedNodesCollection::create(namedItems),
collection); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void V8HTMLOptionsCollection::namedItemMethodCustom(const v8::FunctionCallbackIn
fo<v8::Value>& args) | 67 void V8HTMLOptionsCollection::namedItemMethodCustom(const v8::FunctionCallbackIn
fo<v8::Value>& info) |
| 68 { | 68 { |
| 69 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, args[0]); | 69 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); |
| 70 HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(args.Holder()
); | 70 HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(info.Holder()
); |
| 71 getNamedItems(imp, name, args); | 71 getNamedItems(imp, name, info); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void V8HTMLOptionsCollection::addMethodCustom(const v8::FunctionCallbackInfo<v8:
:Value>& args) | 74 void V8HTMLOptionsCollection::addMethodCustom(const v8::FunctionCallbackInfo<v8:
:Value>& info) |
| 75 { | 75 { |
| 76 if (!V8HTMLOptionElement::HasInstance(args[0], args.GetIsolate(), worldType(
args.GetIsolate()))) { | 76 if (!V8HTMLOptionElement::HasInstance(info[0], info.GetIsolate(), worldType(
info.GetIsolate()))) { |
| 77 setDOMException(TypeMismatchError, args.GetIsolate()); | 77 setDOMException(TypeMismatchError, info.GetIsolate()); |
| 78 return; | 78 return; |
| 79 } | 79 } |
| 80 HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(args.Holder()
); | 80 HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(info.Holder()
); |
| 81 HTMLOptionElement* option = V8HTMLOptionElement::toNative(v8::Handle<v8::Obj
ect>(v8::Handle<v8::Object>::Cast(args[0]))); | 81 HTMLOptionElement* option = V8HTMLOptionElement::toNative(v8::Handle<v8::Obj
ect>(v8::Handle<v8::Object>::Cast(info[0]))); |
| 82 | 82 |
| 83 ExceptionState es(args.GetIsolate()); | 83 ExceptionState es(info.GetIsolate()); |
| 84 if (args.Length() < 2) | 84 if (info.Length() < 2) |
| 85 imp->add(option, es); | 85 imp->add(option, es); |
| 86 else { | 86 else { |
| 87 bool ok; | 87 bool ok; |
| 88 V8TRYCATCH_VOID(int, index, toInt32(args[1], ok)); | 88 V8TRYCATCH_VOID(int, index, toInt32(info[1], ok)); |
| 89 if (!ok) | 89 if (!ok) |
| 90 es.throwDOMException(TypeMismatchError, ExceptionMessages::failedToE
xecute("add", "HTMLOptionsCollection", "The index provided could not be interpre
ted as an integer.")); | 90 es.throwDOMException(TypeMismatchError, ExceptionMessages::failedToE
xecute("add", "HTMLOptionsCollection", "The index provided could not be interpre
ted as an integer.")); |
| 91 else | 91 else |
| 92 imp->add(option, index, es); | 92 imp->add(option, index, es); |
| 93 } | 93 } |
| 94 | 94 |
| 95 es.throwIfNeeded(); | 95 es.throwIfNeeded(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void V8HTMLOptionsCollection::lengthAttributeSetterCustom(v8::Local<v8::String>
name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) | 98 void V8HTMLOptionsCollection::lengthAttributeSetterCustom(v8::Local<v8::String>
name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 110 newLength = static_cast<unsigned>(v); | 110 newLength = static_cast<unsigned>(v); |
| 111 } | 111 } |
| 112 | 112 |
| 113 if (es.throwIfNeeded()) | 113 if (es.throwIfNeeded()) |
| 114 return; | 114 return; |
| 115 | 115 |
| 116 imp->setLength(newLength, es); | 116 imp->setLength(newLength, es); |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace WebCore | 119 } // namespace WebCore |
| OLD | NEW |