| 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
|
|
|