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

Side by Side Diff: Source/core/html/forms/RadioButtonGroupScope.cpp

Issue 656723005: Use C++11 features in core/html (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use meaningful names Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 ASSERT(m_members.contains(button)); 106 ASSERT(m_members.contains(button));
107 bool wasValid = isValid(); 107 bool wasValid = isValid();
108 if (button->checked()) { 108 if (button->checked()) {
109 setCheckedButton(button); 109 setCheckedButton(button);
110 } else { 110 } else {
111 if (m_checkedButton == button) 111 if (m_checkedButton == button)
112 m_checkedButton = nullptr; 112 m_checkedButton = nullptr;
113 } 113 }
114 if (wasValid != isValid()) 114 if (wasValid != isValid())
115 setNeedsValidityCheckForAllButtons(); 115 setNeedsValidityCheckForAllButtons();
116 typedef WillBeHeapHashSet<RawPtrWillBeMember<HTMLInputElement> >::const_iter ator Iterator; 116 for (const auto& inputElement : m_members) {
117 Iterator end = m_members.end(); 117 inputElement->pseudoStateChanged(CSSSelector::PseudoIndeterminate);
118 for (Iterator it = m_members.begin(); it != end; ++it) {
119 (*it)->pseudoStateChanged(CSSSelector::PseudoIndeterminate);
120 } 118 }
121 } 119 }
122 120
123 void RadioButtonGroup::requiredAttributeChanged(HTMLInputElement* button) 121 void RadioButtonGroup::requiredAttributeChanged(HTMLInputElement* button)
124 { 122 {
125 ASSERT(button->type() == InputTypeNames::radio); 123 ASSERT(button->type() == InputTypeNames::radio);
126 ASSERT(m_members.contains(button)); 124 ASSERT(m_members.contains(button));
127 bool wasValid = isValid(); 125 bool wasValid = isValid();
128 if (button->isRequired()) { 126 if (button->isRequired()) {
129 ++m_requiredCount; 127 ++m_requiredCount;
(...skipping 28 matching lines...) Expand all
158 } 156 }
159 if (!wasValid) { 157 if (!wasValid) {
160 // A radio button not in a group is always valid. We need to make it 158 // A radio button not in a group is always valid. We need to make it
161 // valid only if the group was invalid. 159 // valid only if the group was invalid.
162 button->setNeedsValidityCheck(); 160 button->setNeedsValidityCheck();
163 } 161 }
164 } 162 }
165 163
166 void RadioButtonGroup::setNeedsValidityCheckForAllButtons() 164 void RadioButtonGroup::setNeedsValidityCheckForAllButtons()
167 { 165 {
168 typedef WillBeHeapHashSet<RawPtrWillBeMember<HTMLInputElement> >::const_iter ator Iterator; 166 for (const auto& inputElement : m_members) {
169 Iterator end = m_members.end(); 167 HTMLInputElement* button = inputElement;
170 for (Iterator it = m_members.begin(); it != end; ++it) {
171 HTMLInputElement* button = *it;
172 ASSERT(button->type() == InputTypeNames::radio); 168 ASSERT(button->type() == InputTypeNames::radio);
173 button->setNeedsValidityCheck(); 169 button->setNeedsValidityCheck();
174 } 170 }
175 } 171 }
176 172
177 bool RadioButtonGroup::contains(HTMLInputElement* button) const 173 bool RadioButtonGroup::contains(HTMLInputElement* button) const
178 { 174 {
179 return m_members.contains(button); 175 return m_members.contains(button);
180 } 176 }
181 177
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 277 }
282 278
283 void RadioButtonGroupScope::trace(Visitor* visitor) 279 void RadioButtonGroupScope::trace(Visitor* visitor)
284 { 280 {
285 #if ENABLE(OILPAN) 281 #if ENABLE(OILPAN)
286 visitor->trace(m_nameToGroupMap); 282 visitor->trace(m_nameToGroupMap);
287 #endif 283 #endif
288 } 284 }
289 285
290 } // namespace 286 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698