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

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

Issue 1185843010: bindings: Moves custom getters/setters to the prototype chain. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed a review comment. Created 5 years, 6 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 25 matching lines...) Expand all
36 #include "bindings/core/v8/V8HTMLOptionElement.h" 36 #include "bindings/core/v8/V8HTMLOptionElement.h"
37 #include "bindings/core/v8/V8Node.h" 37 #include "bindings/core/v8/V8Node.h"
38 #include "bindings/core/v8/V8NodeList.h" 38 #include "bindings/core/v8/V8NodeList.h"
39 #include "core/dom/ExceptionCode.h" 39 #include "core/dom/ExceptionCode.h"
40 #include "core/html/HTMLOptionElement.h" 40 #include "core/html/HTMLOptionElement.h"
41 #include "core/html/HTMLOptionsCollection.h" 41 #include "core/html/HTMLOptionsCollection.h"
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::lengthAttributeSetterCustom(v8::Local<v8::Value> v alue, const v8::PropertyCallbackInfo<void>& info) 46 void V8HTMLOptionsCollection::lengthAttributeSetterCustom(v8::Local<v8::Value> v alue, const v8::FunctionCallbackInfo<v8::Value>& info)
47 { 47 {
48 HTMLOptionsCollection* impl = V8HTMLOptionsCollection::toImpl(info.Holder()) ; 48 HTMLOptionsCollection* impl = V8HTMLOptionsCollection::toImpl(info.Holder()) ;
49 unsigned newLength = 0; 49 unsigned newLength = 0;
50 double currentLength; 50 double currentLength;
51 if (!v8Call(value->NumberValue(info.GetIsolate()->GetCurrentContext()), curr entLength)) 51 if (!v8Call(value->NumberValue(info.GetIsolate()->GetCurrentContext()), curr entLength))
52 return; 52 return;
53 ExceptionState exceptionState(ExceptionState::SetterContext, "length", "HTML OptionsCollection", info.Holder(), info.GetIsolate()); 53 ExceptionState exceptionState(ExceptionState::SetterContext, "length", "HTML OptionsCollection", info.Holder(), info.GetIsolate());
54 if (!std::isnan(currentLength) && !std::isinf(currentLength)) { 54 if (!std::isnan(currentLength) && !std::isinf(currentLength)) {
55 if (currentLength < 0.0) 55 if (currentLength < 0.0)
56 exceptionState.throwDOMException(IndexSizeError, "The value provided (" + String::number(currentLength) + ") is negative. Lengths must be greater th an or equal to 0."); 56 exceptionState.throwDOMException(IndexSizeError, "The value provided (" + String::number(currentLength) + ") is negative. Lengths must be greater th an or equal to 0.");
57 else if (currentLength > static_cast<double>(UINT_MAX)) 57 else if (currentLength > static_cast<double>(UINT_MAX))
58 newLength = UINT_MAX; 58 newLength = UINT_MAX;
59 else 59 else
60 newLength = static_cast<unsigned>(currentLength); 60 newLength = static_cast<unsigned>(currentLength);
61 } 61 }
62 62
63 if (exceptionState.throwIfNeeded()) 63 if (exceptionState.throwIfNeeded())
64 return; 64 return;
65 65
66 impl->setLength(newLength, exceptionState); 66 impl->setLength(newLength, exceptionState);
67 } 67 }
68 68
69 } // namespace blink 69 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/custom/V8ErrorEventCustom.cpp ('k') | Source/bindings/core/v8/custom/V8MessageEventCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698