Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(685)

Side by Side Diff: Source/bindings/core/v8/custom/V8HTMLOptionsCollectionCustom.cpp

Issue 537403002: bindings: Renames from/toInternalPointer, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "core/html/HTMLSelectElement.h" 42 #include "core/html/HTMLSelectElement.h"
43 43
44 namespace blink { 44 namespace blink {
45 45
46 void V8HTMLOptionsCollection::addMethodCustom(const v8::FunctionCallbackInfo<v8: :Value>& info) 46 void V8HTMLOptionsCollection::addMethodCustom(const v8::FunctionCallbackInfo<v8: :Value>& info)
47 { 47 {
48 ExceptionState exceptionState(ExceptionState::ExecutionContext, "add", "HTML OptionsCollection", info.Holder(), info.GetIsolate()); 48 ExceptionState exceptionState(ExceptionState::ExecutionContext, "add", "HTML OptionsCollection", info.Holder(), info.GetIsolate());
49 if (!V8HTMLOptionElement::hasInstance(info[0], info.GetIsolate())) { 49 if (!V8HTMLOptionElement::hasInstance(info[0], info.GetIsolate())) {
50 exceptionState.throwTypeError("The element provided was not an HTMLOptio nElement."); 50 exceptionState.throwTypeError("The element provided was not an HTMLOptio nElement.");
51 } else { 51 } else {
52 HTMLOptionsCollection* impl = V8HTMLOptionsCollection::toNative(info.Hol der()); 52 HTMLOptionsCollection* impl = V8HTMLOptionsCollection::toImpl(info.Holde r());
53 HTMLOptionElement* option = V8HTMLOptionElement::toNative(v8::Handle<v8: :Object>(v8::Handle<v8::Object>::Cast(info[0]))); 53 HTMLOptionElement* option = V8HTMLOptionElement::toImpl(v8::Handle<v8::O bject>(v8::Handle<v8::Object>::Cast(info[0])));
54 54
55 if (info.Length() < 2) { 55 if (info.Length() < 2) {
56 impl->add(option, exceptionState); 56 impl->add(option, exceptionState);
57 } else { 57 } else {
58 int index = toInt32(info[1], exceptionState); 58 int index = toInt32(info[1], exceptionState);
59 if (exceptionState.throwIfNeeded()) 59 if (exceptionState.throwIfNeeded())
60 return; 60 return;
61 61
62 impl->add(option, index, exceptionState); 62 impl->add(option, index, exceptionState);
63 } 63 }
64 } 64 }
65 65
66 exceptionState.throwIfNeeded(); 66 exceptionState.throwIfNeeded();
67 } 67 }
68 68
69 void V8HTMLOptionsCollection::lengthAttributeSetterCustom(v8::Local<v8::Value> v alue, const v8::PropertyCallbackInfo<void>& info) 69 void V8HTMLOptionsCollection::lengthAttributeSetterCustom(v8::Local<v8::Value> v alue, const v8::PropertyCallbackInfo<void>& info)
70 { 70 {
71 HTMLOptionsCollection* impl = V8HTMLOptionsCollection::toNative(info.Holder( )); 71 HTMLOptionsCollection* impl = V8HTMLOptionsCollection::toImpl(info.Holder()) ;
72 double v = value->NumberValue(); 72 double v = value->NumberValue();
73 unsigned newLength = 0; 73 unsigned newLength = 0;
74 ExceptionState exceptionState(ExceptionState::SetterContext, "length", "HTML OptionsCollection", info.Holder(), info.GetIsolate()); 74 ExceptionState exceptionState(ExceptionState::SetterContext, "length", "HTML OptionsCollection", info.Holder(), info.GetIsolate());
75 if (!std::isnan(v) && !std::isinf(v)) { 75 if (!std::isnan(v) && !std::isinf(v)) {
76 if (v < 0.0) 76 if (v < 0.0)
77 exceptionState.throwDOMException(IndexSizeError, "The value provided (" + String::number(v) + ") is negative. Lengths must be greater than or equal to 0."); 77 exceptionState.throwDOMException(IndexSizeError, "The value provided (" + String::number(v) + ") is negative. Lengths must be greater than or equal to 0.");
78 else if (v > static_cast<double>(UINT_MAX)) 78 else if (v > static_cast<double>(UINT_MAX))
79 newLength = UINT_MAX; 79 newLength = UINT_MAX;
80 else 80 else
81 newLength = static_cast<unsigned>(v); 81 newLength = static_cast<unsigned>(v);
82 } 82 }
83 83
84 if (exceptionState.throwIfNeeded()) 84 if (exceptionState.throwIfNeeded())
85 return; 85 return;
86 86
87 impl->setLength(newLength, exceptionState); 87 impl->setLength(newLength, exceptionState);
88 } 88 }
89 89
90 } // namespace blink 90 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/custom/V8HTMLDocumentCustom.cpp ('k') | Source/bindings/core/v8/custom/V8HTMLPlugInElementCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698