| Index: third_party/WebKit/Source/core/html/HTMLFormElement.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/HTMLFormElement.cpp b/third_party/WebKit/Source/core/html/HTMLFormElement.cpp
|
| index df13f4ae99b00da2b2a88f7e8a7701bc476d2865..c4c074b6aa191a4f1dc86b52343df885740aebe4 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLFormElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLFormElement.cpp
|
| @@ -812,8 +812,17 @@ void HTMLFormElement::anonymousNamedGetter(const AtomicString& name, RadioNodeLi
|
| ASSERT(!elements.isEmpty());
|
|
|
| bool onlyMatchImg = !elements.isEmpty() && isHTMLImageElement(*elements.first());
|
| - if (onlyMatchImg)
|
| + if (onlyMatchImg) {
|
| UseCounter::count(document(), UseCounter::FormNameAccessForImageElement);
|
| + // The following code has performance impact, but it should be small
|
| + // because <img> access via <form> name getter is rarely used.
|
| + for (auto& element : elements) {
|
| + if (isHTMLImageElement(*element) && !element->isDescendantOf(this)) {
|
| + UseCounter::count(document(), UseCounter::FormNameAccessForNonDescendantImageElement);
|
| + break;
|
| + }
|
| + }
|
| + }
|
| if (elements.size() == 1) {
|
| returnValue.setElement(elements.at(0));
|
| return;
|
|
|