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

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

Issue 1444533002: Correct UseCounter::FormNameAccessForImageElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use onlyMatchImg Created 5 years, 1 month 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 | « no previous file | 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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 if (elements.isEmpty()) 829 if (elements.isEmpty())
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());
840 if (onlyMatchImg)
sof 2015/11/13 08:21:48 Hmm, what if the <img> element doesn't appear firs
tkent 2015/11/13 08:28:25 I'd like to count only cases where this function r
sof 2015/11/13 08:33:10 Yes, this looks correct & precise as-is -- step 2
841 UseCounter::count(document(), UseCounter::FormNameAccessForImageElement) ;
839 if (elements.size() == 1) { 842 if (elements.size() == 1) {
840 returnValue.setElement(elements.at(0)); 843 returnValue.setElement(elements.at(0));
841 return; 844 return;
842 } 845 }
843 846
844 bool onlyMatchImg = !elements.isEmpty() && isHTMLImageElement(*elements.firs t());
845 returnValue.setRadioNodeList(radioNodeList(name, onlyMatchImg)); 847 returnValue.setRadioNodeList(radioNodeList(name, onlyMatchImg));
846 } 848 }
847 849
848 void HTMLFormElement::setDemoted(bool demoted) 850 void HTMLFormElement::setDemoted(bool demoted)
849 { 851 {
850 if (demoted) 852 if (demoted)
851 UseCounter::count(document(), UseCounter::DemotedFormElement); 853 UseCounter::count(document(), UseCounter::DemotedFormElement);
852 m_wasDemoted = demoted; 854 m_wasDemoted = demoted;
853 } 855 }
854 856
855 } // namespace 857 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698