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

Unified Diff: third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.cpp

Issue 2264943002: Add UseCounters for name attribute matching of <map> and <input type=radio> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months 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/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.cpp
diff --git a/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.cpp b/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.cpp
index 8742f4e2487a03e695dc56e1602a3bb7fbcf1c8f..8a9167c7ae27c6485a4b7458a24f49504c3fb583 100644
--- a/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.cpp
+++ b/third_party/WebKit/Source/core/html/forms/RadioButtonGroupScope.cpp
@@ -232,10 +232,18 @@ void RadioButtonGroupScope::addButton(HTMLInputElement* element)
if (!m_nameToGroupMap)
m_nameToGroupMap = new NameToGroupMap;
- Member<RadioButtonGroup>& group = m_nameToGroupMap->add(element->name(), nullptr).storedValue->value;
- if (!group)
- group = RadioButtonGroup::create();
- group->add(element);
+ auto keyValue = m_nameToGroupMap->add(element->name(), nullptr).storedValue;
+ if (!keyValue->value) {
+ keyValue->value = RadioButtonGroup::create();
+ } else {
+ if (keyValue->key == element->name())
+ UseCounter::count(element->document(), UseCounter::RadioNameMatchingStrict);
+ else if (equalIgnoringASCIICase(keyValue->key, element->name()))
+ UseCounter::count(element->document(), UseCounter::RadioNameMatchingASCIICaseless);
+ else
+ UseCounter::count(element->document(), UseCounter::RadioNameMatchingCaseFolding);
+ }
+ keyValue->value->add(element);
}
void RadioButtonGroupScope::updateCheckedState(HTMLInputElement* element)
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698