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

Unified Diff: Source/core/html/HTMLFormElement.cpp

Issue 15556003: Auto-generate V8HTMLFormElement::namedPropertyGetter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Introduce DoNotCheckJSProperty Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLFormElement.h ('k') | Source/core/html/HTMLFormElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLFormElement.cpp
diff --git a/Source/core/html/HTMLFormElement.cpp b/Source/core/html/HTMLFormElement.cpp
index 28cdbca7cc0bca41ec692b135d232bb6cbfc6822..45eed9d1ca82581b9bc22b66024e48bcaa60ad28 100644
--- a/Source/core/html/HTMLFormElement.cpp
+++ b/Source/core/html/HTMLFormElement.cpp
@@ -34,6 +34,7 @@
#include "core/dom/Document.h"
#include "core/dom/Event.h"
#include "core/dom/EventNames.h"
+#include "core/dom/NamedNodesCollection.h"
#include "core/dom/NodeRenderingContext.h"
#include "core/dom/NodeTraversal.h"
#include "core/fileapi/FileList.h"
@@ -707,4 +708,30 @@ void HTMLFormElement::copyNonAttributePropertiesFromElement(const Element& sourc
HTMLElement::copyNonAttributePropertiesFromElement(source);
}
+void HTMLFormElement::anonymousNamedGetter(const AtomicString& name, RefPtr<NodeList>& returnValue1, RefPtr<Node>& returnValue2)
+{
+ // Call getNamedElements twice, first time check if it has a value
+ // and let HTMLFormElement update its cache.
+ // See issue: 867404
+ {
+ Vector<RefPtr<Node> > elements;
+ getNamedElements(name, elements);
+ if (elements.isEmpty())
+ return;
+ }
+
+ // Second call may return different results from the first call,
+ // but if the first the size cannot be zero.
+ Vector<RefPtr<Node> > elements;
+ getNamedElements(name, elements);
+ ASSERT(!elements.isEmpty());
+
+ if (elements.size() == 1) {
+ returnValue2 = elements.at(0);
+ return;
+ }
+
+ returnValue1 = NamedNodesCollection::create(elements);
+}
+
} // namespace
« no previous file with comments | « Source/core/html/HTMLFormElement.h ('k') | Source/core/html/HTMLFormElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698