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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLFormElement.cpp

Issue 1535803003: Add two UseCounters for form.imageName and form.elements.imageName. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFormControlsCollection.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 return; 830 return;
831 } 831 }
832 832
833 // Second call may return different results from the first call, 833 // Second call may return different results from the first call,
834 // but if the first the size cannot be zero. 834 // but if the first the size cannot be zero.
835 WillBeHeapVector<RefPtrWillBeMember<Element>> elements; 835 WillBeHeapVector<RefPtrWillBeMember<Element>> elements;
836 getNamedElements(name, elements); 836 getNamedElements(name, elements);
837 ASSERT(!elements.isEmpty()); 837 ASSERT(!elements.isEmpty());
838 838
839 bool onlyMatchImg = !elements.isEmpty() && isHTMLImageElement(*elements.firs t()); 839 bool onlyMatchImg = !elements.isEmpty() && isHTMLImageElement(*elements.firs t());
840 if (onlyMatchImg) 840 if (onlyMatchImg) {
841 UseCounter::count(document(), UseCounter::FormNameAccessForImageElement) ; 841 UseCounter::count(document(), UseCounter::FormNameAccessForImageElement) ;
842 // The following code has performance impact, but it should be small
843 // because <img> access via <form> name getter is rarely used.
844 for (auto& element : elements) {
845 if (isHTMLImageElement(*element) && !element->isDescendantOf(this)) {
846 UseCounter::count(document(), UseCounter::FormNameAccessForNonDe scendantImageElement);
847 break;
848 }
849 }
850 }
842 if (elements.size() == 1) { 851 if (elements.size() == 1) {
843 returnValue.setElement(elements.at(0)); 852 returnValue.setElement(elements.at(0));
844 return; 853 return;
845 } 854 }
846 855
847 returnValue.setRadioNodeList(radioNodeList(name, onlyMatchImg)); 856 returnValue.setRadioNodeList(radioNodeList(name, onlyMatchImg));
848 } 857 }
849 858
850 void HTMLFormElement::setDemoted(bool demoted) 859 void HTMLFormElement::setDemoted(bool demoted)
851 { 860 {
852 if (demoted) 861 if (demoted)
853 UseCounter::count(document(), UseCounter::DemotedFormElement); 862 UseCounter::count(document(), UseCounter::DemotedFormElement);
854 m_wasDemoted = demoted; 863 m_wasDemoted = demoted;
855 } 864 }
856 865
857 } // namespace 866 } // namespace
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLFormControlsCollection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698