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

Unified Diff: third_party/WebKit/Source/core/html/HTMLFormControlsCollection.cpp

Issue 2548453003: FIELDSET element: |elements| IDL attribute should return an HTMLCollection, not HTMLFormControlsCol… (Closed)
Patch Set: blank lines Created 4 years 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 | « third_party/WebKit/Source/core/html/HTMLFieldSetElement.idl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLFormControlsCollection.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLFormControlsCollection.cpp b/third_party/WebKit/Source/core/html/HTMLFormControlsCollection.cpp
index 2e17b5628f8400dd80bb7f4476a895cee6b096c3..28d36bc6cceae816a6b059997d4eb0895c871295 100644
--- a/third_party/WebKit/Source/core/html/HTMLFormControlsCollection.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFormControlsCollection.cpp
@@ -27,7 +27,6 @@
#include "bindings/core/v8/RadioNodeListOrElement.h"
#include "core/HTMLNames.h"
#include "core/frame/UseCounter.h"
-#include "core/html/HTMLFieldSetElement.h"
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLImageElement.h"
#include "wtf/HashSet.h"
@@ -43,7 +42,7 @@ HTMLFormControlsCollection::HTMLFormControlsCollection(ContainerNode& ownerNode)
: HTMLCollection(ownerNode, FormControls, OverridesItemAfter),
m_cachedElement(nullptr),
m_cachedElementOffsetInArray(0) {
- DCHECK(isHTMLFormElement(ownerNode) || isHTMLFieldSetElement(ownerNode));
+ DCHECK(isHTMLFormElement(ownerNode));
}
HTMLFormControlsCollection* HTMLFormControlsCollection::create(
@@ -57,10 +56,7 @@ HTMLFormControlsCollection::~HTMLFormControlsCollection() {}
const FormAssociatedElement::List&
HTMLFormControlsCollection::formControlElements() const {
- DCHECK(isHTMLFormElement(ownerNode()) || isHTMLFieldSetElement(ownerNode()));
- if (isHTMLFormElement(ownerNode()))
- return toHTMLFormElement(ownerNode()).associatedElements();
- return toHTMLFieldSetElement(ownerNode()).associatedElements();
+ return toHTMLFormElement(ownerNode()).associatedElements();
}
const HeapVector<Member<HTMLImageElement>>&
@@ -162,23 +158,20 @@ void HTMLFormControlsCollection::updateIdNameCache() const {
}
}
- if (isHTMLFormElement(ownerNode())) {
- // HTMLFormControlsCollection doesn't support named getter for IMG
- // elements. However we still need to handle IMG elements here because
- // HTMLFormElement named getter relies on this.
- const HeapVector<Member<HTMLImageElement>>& imageElementsArray =
- formImageElements();
- for (unsigned i = 0; i < imageElementsArray.size(); ++i) {
- HTMLImageElement* element = imageElementsArray[i];
- const AtomicString& idAttrVal = element->getIdAttribute();
- const AtomicString& nameAttrVal = element->getNameAttribute();
- if (!idAttrVal.isEmpty() &&
- !foundInputElements.contains(idAttrVal.impl()))
- cache->addElementWithId(idAttrVal, element);
- if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal &&
- !foundInputElements.contains(nameAttrVal.impl()))
- cache->addElementWithName(nameAttrVal, element);
- }
+ // HTMLFormControlsCollection doesn't support named getter for IMG
+ // elements. However we still need to handle IMG elements here because
+ // HTMLFormElement named getter relies on this.
+ const HeapVector<Member<HTMLImageElement>>& imageElementsArray =
+ formImageElements();
+ for (unsigned i = 0; i < imageElementsArray.size(); ++i) {
+ HTMLImageElement* element = imageElementsArray[i];
+ const AtomicString& idAttrVal = element->getIdAttribute();
+ const AtomicString& nameAttrVal = element->getNameAttribute();
+ if (!idAttrVal.isEmpty() && !foundInputElements.contains(idAttrVal.impl()))
+ cache->addElementWithId(idAttrVal, element);
+ if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal &&
+ !foundInputElements.contains(nameAttrVal.impl()))
+ cache->addElementWithName(nameAttrVal, element);
}
// Set the named item cache last as traversing the tree may cause cache
@@ -204,10 +197,6 @@ void HTMLFormControlsCollection::namedGetter(
// This path never returns a RadioNodeList for <img> because
// onlyMatchingImgElements flag is false by default.
returnValue.setRadioNodeList(ownerNode().radioNodeList(name));
- if (isHTMLFieldSetElement(ownerNode()))
- UseCounter::count(
- document(),
- UseCounter::FormControlsCollectionReturnsRadioNodeListForFieldSet);
}
void HTMLFormControlsCollection::supportedPropertyNames(Vector<String>& names) {
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFieldSetElement.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698