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

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

Issue 148013008: Use stricter typing for HTMLCollection named getter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
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 29 matching lines...) Expand all
40 #include "core/dom/NamedNodesCollection.h" 40 #include "core/dom/NamedNodesCollection.h"
41 #include "core/html/HTMLOptionElement.h" 41 #include "core/html/HTMLOptionElement.h"
42 #include "core/html/HTMLOptionsCollection.h" 42 #include "core/html/HTMLOptionsCollection.h"
43 #include "core/html/HTMLSelectElement.h" 43 #include "core/html/HTMLSelectElement.h"
44 44
45 namespace WebCore { 45 namespace WebCore {
46 46
47 template<typename CallbackInfo> 47 template<typename CallbackInfo>
48 static void getNamedItems(HTMLOptionsCollection* collection, const AtomicString& name, const CallbackInfo& info) 48 static void getNamedItems(HTMLOptionsCollection* collection, const AtomicString& name, const CallbackInfo& info)
49 { 49 {
50 Vector<RefPtr<Node> > namedItems; 50 Vector<RefPtr<Element> > namedItems;
51 collection->namedItems(name, namedItems); 51 collection->namedItems(name, namedItems);
52 52
53 if (!namedItems.size()) { 53 if (!namedItems.size()) {
54 v8SetReturnValueNull(info); 54 v8SetReturnValueNull(info);
55 return; 55 return;
56 } 56 }
57 57
58 if (namedItems.size() == 1) { 58 if (namedItems.size() == 1) {
59 v8SetReturnValueFast(info, namedItems.at(0).release(), collection); 59 v8SetReturnValueFast(info, namedItems.at(0).release(), collection);
60 return; 60 return;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 newLength = static_cast<unsigned>(v); 108 newLength = static_cast<unsigned>(v);
109 } 109 }
110 110
111 if (exceptionState.throwIfNeeded()) 111 if (exceptionState.throwIfNeeded())
112 return; 112 return;
113 113
114 imp->setLength(newLength, exceptionState); 114 imp->setLength(newLength, exceptionState);
115 } 115 }
116 116
117 } // namespace WebCore 117 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp ('k') | Source/core/dom/NamedNodesCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698