Changeset 201659 in webkit
- Timestamp:
- Jun 3, 2016 2:36:51 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r201549 r201659 1397 1397 dom/CDATASection.cpp 1398 1398 dom/CharacterData.cpp 1399 dom/CheckedRadioButtons.cpp1400 1399 dom/ChildListMutationScope.cpp 1401 1400 dom/ChildNodeList.cpp … … 1492 1491 dom/PseudoElement.cpp 1493 1492 dom/QualifiedName.cpp 1493 dom/RadioButtonGroups.cpp 1494 1494 dom/Range.cpp 1495 1495 dom/RegisteredEventListener.cpp -
trunk/Source/WebCore/ChangeLog
r201655 r201659 1 2016-06-03 Benjamin Poulain <benjamin@webkit.org> 2 3 Rename CheckedRadioButtons into RadioButtonGroups 4 https://bugs.webkit.org/show_bug.cgi?id=158326 5 6 Reviewed by Alex Christensen. 7 8 CheckedRadioButtons handles the set of all the Radio Button Groups 9 for a particular form or document. 10 The name is wrong and apparently comes from former uses of this class 11 (see the comment above the class declaration). 12 13 This patch renames "CheckedRadioButtons" to "RadioButtonGroups" to reflect that it handles 14 all the Radio Button Group from a given context (form or document). 15 Internally it has a set of RadioButtonGroup but that is never explicitely 16 exposed. 17 18 * CMakeLists.txt: 19 * WebCore.xcodeproj/project.pbxproj: 20 * dom/CheckedRadioButtons.cpp: 21 (WebCore::RadioButtonGroup::isEmpty): Deleted. 22 (WebCore::RadioButtonGroup::isRequired): Deleted. 23 (WebCore::RadioButtonGroup::checkedButton): Deleted. 24 (WebCore::RadioButtonGroup::RadioButtonGroup): Deleted. 25 (WebCore::RadioButtonGroup::isValid): Deleted. 26 (WebCore::RadioButtonGroup::members): Deleted. 27 (WebCore::RadioButtonGroup::setCheckedButton): Deleted. 28 (WebCore::RadioButtonGroup::add): Deleted. 29 (WebCore::RadioButtonGroup::updateCheckedState): Deleted. 30 (WebCore::RadioButtonGroup::requiredAttributeChanged): Deleted. 31 (WebCore::RadioButtonGroup::remove): Deleted. 32 (WebCore::RadioButtonGroup::updateValidityForAllButtons): Deleted. 33 (WebCore::RadioButtonGroup::contains): Deleted. 34 (WebCore::CheckedRadioButtons::CheckedRadioButtons): Deleted. 35 (WebCore::CheckedRadioButtons::~CheckedRadioButtons): Deleted. 36 (WebCore::CheckedRadioButtons::addButton): Deleted. 37 (WebCore::CheckedRadioButtons::groupMembers): Deleted. 38 (WebCore::CheckedRadioButtons::updateCheckedState): Deleted. 39 (WebCore::CheckedRadioButtons::requiredAttributeChanged): Deleted. 40 (WebCore::CheckedRadioButtons::checkedButtonForGroup): Deleted. 41 (WebCore::CheckedRadioButtons::isInRequiredGroup): Deleted. 42 (WebCore::CheckedRadioButtons::removeButton): Deleted. 43 * dom/RadioButtonGroups.cpp: Renamed from Source/WebCore/dom/CheckedRadioButtons.cpp. 44 (WebCore::RadioButtonGroup::isEmpty): 45 (WebCore::RadioButtonGroup::isRequired): 46 (WebCore::RadioButtonGroup::checkedButton): 47 (WebCore::RadioButtonGroup::RadioButtonGroup): 48 (WebCore::RadioButtonGroup::isValid): 49 (WebCore::RadioButtonGroup::members): 50 (WebCore::RadioButtonGroup::setCheckedButton): 51 (WebCore::RadioButtonGroup::add): 52 (WebCore::RadioButtonGroup::updateCheckedState): 53 (WebCore::RadioButtonGroup::requiredAttributeChanged): 54 (WebCore::RadioButtonGroup::remove): 55 (WebCore::RadioButtonGroup::updateValidityForAllButtons): 56 (WebCore::RadioButtonGroup::contains): 57 (WebCore::RadioButtonGroups::RadioButtonGroups): 58 (WebCore::RadioButtonGroups::~RadioButtonGroups): 59 (WebCore::RadioButtonGroups::addButton): 60 (WebCore::RadioButtonGroups::groupMembers): 61 (WebCore::RadioButtonGroups::updateCheckedState): 62 (WebCore::RadioButtonGroups::requiredAttributeChanged): 63 (WebCore::RadioButtonGroups::checkedButtonForGroup): 64 (WebCore::RadioButtonGroups::isInRequiredGroup): 65 (WebCore::RadioButtonGroups::removeButton): 66 * dom/RadioButtonGroups.h: Renamed from Source/WebCore/dom/CheckedRadioButtons.h. 67 * html/FormController.h: 68 (WebCore::FormController::radioButtonGroups): 69 (WebCore::FormController::checkedRadioButtons): Deleted. 70 * html/HTMLFormElement.h: 71 * html/HTMLInputElement.cpp: 72 (WebCore::HTMLInputElement::~HTMLInputElement): 73 (WebCore::HTMLInputElement::setChecked): 74 (WebCore::HTMLInputElement::didMoveToNewDocument): 75 (WebCore::HTMLInputElement::requiredAttributeChanged): 76 (WebCore::HTMLInputElement::isInRequiredRadioButtonGroup): 77 (WebCore::HTMLInputElement::radioButtonGroup): 78 (WebCore::HTMLInputElement::checkedRadioButtonForGroup): 79 (WebCore::HTMLInputElement::radioButtonGroups): 80 (WebCore::HTMLInputElement::addToRadioButtonGroup): 81 (WebCore::HTMLInputElement::removeFromRadioButtonGroup): 82 (WebCore::HTMLInputElement::checkedRadioButtons): Deleted. 83 * html/HTMLInputElement.h: 84 1 85 2016-06-03 Chris Dumez <cdumez@apple.com> 2 86 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r201633 r201659 3765 3765 93F6F1ED127F70B10055CB06 /* WebGLContextEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F6F1EA127F70B10055CB06 /* WebGLContextEvent.cpp */; }; 3766 3766 93F6F1EE127F70B10055CB06 /* WebGLContextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F6F1EB127F70B10055CB06 /* WebGLContextEvent.h */; }; 3767 93F925430F7EF5B8007E37C9 /* CheckedRadioButtons.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F925410F7EF5B8007E37C9 /* CheckedRadioButtons.h */; settings = {ATTRIBUTES = (Private, ); }; };3768 93F925440F7EF5B8007E37C9 /* CheckedRadioButtons.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F925420F7EF5B8007E37C9 /* CheckedRadioButtons.cpp */; };3767 93F925430F7EF5B8007E37C9 /* RadioButtonGroups.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F925410F7EF5B8007E37C9 /* RadioButtonGroups.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3768 93F925440F7EF5B8007E37C9 /* RadioButtonGroups.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F925420F7EF5B8007E37C9 /* RadioButtonGroups.cpp */; }; 3769 3769 93F9B6570BA0F35E00854064 /* DOMHTMLCanvasElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93F9B6540BA0F35E00854064 /* DOMHTMLCanvasElement.mm */; }; 3770 3770 93F9B6580BA0F35E00854064 /* DOMHTMLCanvasElementInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F9B6550BA0F35E00854064 /* DOMHTMLCanvasElementInternal.h */; }; … … 11418 11418 93F8B3060A300FEA00F61AB8 /* CodeGeneratorJS.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = CodeGeneratorJS.pm; path = ../scripts/CodeGeneratorJS.pm; sourceTree = "<group>"; wrapsLines = 0; }; 11419 11419 93F8B3070A300FEA00F61AB8 /* generate-bindings.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = "generate-bindings.pl"; path = "scripts/generate-bindings.pl"; sourceTree = "<group>"; }; 11420 93F925410F7EF5B8007E37C9 /* CheckedRadioButtons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CheckedRadioButtons.h; sourceTree = "<group>"; };11421 93F925420F7EF5B8007E37C9 /* CheckedRadioButtons.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CheckedRadioButtons.cpp; sourceTree = "<group>"; };11420 93F925410F7EF5B8007E37C9 /* RadioButtonGroups.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RadioButtonGroups.h; sourceTree = "<group>"; }; 11421 93F925420F7EF5B8007E37C9 /* RadioButtonGroups.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RadioButtonGroups.cpp; sourceTree = "<group>"; }; 11422 11422 93F9B6540BA0F35E00854064 /* DOMHTMLCanvasElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMHTMLCanvasElement.mm; sourceTree = "<group>"; }; 11423 11423 93F9B6550BA0F35E00854064 /* DOMHTMLCanvasElementInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLCanvasElementInternal.h; sourceTree = "<group>"; }; … … 24239 24239 6550B696099DF0270090D781 /* CharacterData.h */, 24240 24240 93EEC1E609C2877700C515D1 /* CharacterData.idl */, 24241 93F925420F7EF5B8007E37C9 /* CheckedRadioButtons.cpp */,24242 93F925410F7EF5B8007E37C9 /* CheckedRadioButtons.h */,24243 24241 D619A305144E00BE004BC302 /* ChildListMutationScope.cpp */, 24244 24242 D619A306144E00BE004BC302 /* ChildListMutationScope.h */, … … 24519 24517 550A0BC7085F6039007353D6 /* QualifiedName.cpp */, 24520 24518 550A0BC8085F6039007353D6 /* QualifiedName.h */, 24519 93F925420F7EF5B8007E37C9 /* RadioButtonGroups.cpp */, 24520 93F925410F7EF5B8007E37C9 /* RadioButtonGroups.h */, 24521 24521 F523D30302DE4476018635CA /* Range.cpp */, 24522 24522 F523D30402DE4476018635CA /* Range.h */, … … 25279 25279 B2C3DA2A0D006C1D00EF6F26 /* CharsetData.h in Headers */, 25280 25280 F55B3DB21251F12D003EF269 /* CheckboxInputType.h in Headers */, 25281 93F925430F7EF5B8007E37C9 /* CheckedRadioButtons.h in Headers */,25281 93F925430F7EF5B8007E37C9 /* RadioButtonGroups.h in Headers */, 25282 25282 D619A308144E00BE004BC302 /* ChildListMutationScope.h in Headers */, 25283 25283 A81872200977D3C0005826D9 /* ChildNodeList.h in Headers */, … … 29223 29223 9326DC0C09DAD5D600AFC847 /* CharsetData.cpp in Sources */, 29224 29224 F55B3DB11251F12D003EF269 /* CheckboxInputType.cpp in Sources */, 29225 93F925440F7EF5B8007E37C9 /* CheckedRadioButtons.cpp in Sources */,29225 93F925440F7EF5B8007E37C9 /* RadioButtonGroups.cpp in Sources */, 29226 29226 D619A307144E00BE004BC302 /* ChildListMutationScope.cpp in Sources */, 29227 29227 A81872250977D3C0005826D9 /* ChildNodeList.cpp in Sources */, -
trunk/Source/WebCore/dom/DOMAllInOne.cpp
r197924 r201659 35 35 #include "CDATASection.cpp" 36 36 #include "CharacterData.cpp" 37 #include "CheckedRadioButtons.cpp"38 37 #include "ChildListMutationScope.cpp" 39 38 #include "ChildNodeList.cpp" … … 130 129 // https://bugs.webkit.org/show_bug.cgi?id=146586 131 130 // #include "QualifiedName.cpp" 131 #include "RadioButtonGroups.cpp" 132 132 #include "Range.cpp" 133 133 #include "RegisteredEventListener.cpp" -
trunk/Source/WebCore/dom/RadioButtonGroups.cpp
r201658 r201659 20 20 21 21 #include "config.h" 22 #include "CheckedRadioButtons.h" 22 #include "RadioButtonGroups.h" 23 24 #include "HTMLInputElement.h" 23 25 #include "Range.h" 24 25 #include "HTMLInputElement.h"26 26 #include <wtf/HashSet.h> 27 27 … … 41 41 bool contains(HTMLInputElement*) const; 42 42 Vector<HTMLInputElement*> members() const; 43 43 44 44 private: 45 45 void updateValidityForAllButtons(); … … 70 70 return members; 71 71 } 72 72 73 73 void RadioButtonGroup::setCheckedButton(HTMLInputElement* button) 74 74 { … … 177 177 // compiler from generating them as inlines. So we don't need to to define 178 178 // RadioButtonGroup in the header. 179 CheckedRadioButtons::CheckedRadioButtons()180 { 181 } 182 183 CheckedRadioButtons::~CheckedRadioButtons()184 { 185 } 186 187 void CheckedRadioButtons::addButton(HTMLInputElement* element)179 RadioButtonGroups::RadioButtonGroups() 180 { 181 } 182 183 RadioButtonGroups::~RadioButtonGroups() 184 { 185 } 186 187 void RadioButtonGroups::addButton(HTMLInputElement* element) 188 188 { 189 189 ASSERT(element->isRadioButton()); … … 200 200 } 201 201 202 Vector<HTMLInputElement*> CheckedRadioButtons::groupMembers(const HTMLInputElement& element) const202 Vector<HTMLInputElement*> RadioButtonGroups::groupMembers(const HTMLInputElement& element) const 203 203 { 204 204 ASSERT(element.isRadioButton()); 205 205 if (!element.isRadioButton()) 206 206 return { }; 207 207 208 208 auto* name = element.name().impl(); 209 209 if (!name) … … 215 215 return group->members(); 216 216 } 217 218 void CheckedRadioButtons::updateCheckedState(HTMLInputElement* element)217 218 void RadioButtonGroups::updateCheckedState(HTMLInputElement* element) 219 219 { 220 220 ASSERT(element->isRadioButton()); … … 229 229 } 230 230 231 void CheckedRadioButtons::requiredAttributeChanged(HTMLInputElement* element)231 void RadioButtonGroups::requiredAttributeChanged(HTMLInputElement* element) 232 232 { 233 233 ASSERT(element->isRadioButton()); … … 242 242 } 243 243 244 HTMLInputElement* CheckedRadioButtons::checkedButtonForGroup(const AtomicString& name) const244 HTMLInputElement* RadioButtonGroups::checkedButtonForGroup(const AtomicString& name) const 245 245 { 246 246 if (!m_nameToGroupMap) … … 251 251 } 252 252 253 bool CheckedRadioButtons::isInRequiredGroup(HTMLInputElement* element) const253 bool RadioButtonGroups::isInRequiredGroup(HTMLInputElement* element) const 254 254 { 255 255 ASSERT(element->isRadioButton()); … … 262 262 } 263 263 264 void CheckedRadioButtons::removeButton(HTMLInputElement* element)264 void RadioButtonGroups::removeButton(HTMLInputElement* element) 265 265 { 266 266 ASSERT(element->isRadioButton()); -
trunk/Source/WebCore/dom/RadioButtonGroups.h
r201658 r201659 1 1 /* 2 * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008, 2009, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 19 19 */ 20 20 21 #ifndef CheckedRadioButtons_h 22 #define CheckedRadioButtons_h 21 #pragma once 23 22 24 23 #include <memory> … … 32 31 class RadioButtonGroup; 33 32 34 // FIXME: Rename the class. The class was a simple map from a name to a checked 35 // radio button. It manages RadioButtonGroup objects now. 36 class CheckedRadioButtons { 33 class RadioButtonGroups { 37 34 public: 38 CheckedRadioButtons();39 ~ CheckedRadioButtons();35 RadioButtonGroups(); 36 ~RadioButtonGroups(); 40 37 void addButton(HTMLInputElement*); 41 38 void updateCheckedState(HTMLInputElement*); … … 45 42 bool isInRequiredGroup(HTMLInputElement*) const; 46 43 Vector<HTMLInputElement*> groupMembers(const HTMLInputElement&) const; 47 44 48 45 private: 49 46 typedef HashMap<AtomicStringImpl*, std::unique_ptr<RadioButtonGroup>> NameToGroupMap; … … 52 49 53 50 } // namespace WebCore 54 55 #endif // CheckedRadioButtons_h -
trunk/Source/WebCore/html/FormController.h
r176290 r201659 23 23 #define FormController_h 24 24 25 #include " CheckedRadioButtons.h"25 #include "RadioButtonGroups.h" 26 26 #include <wtf/Forward.h> 27 27 #include <wtf/ListHashSet.h> … … 78 78 ~FormController(); 79 79 80 CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; }80 RadioButtonGroups& radioButtonGroups() { return m_radioButtonGroups; } 81 81 82 82 void registerFormElementWithState(HTMLFormControlElementWithState*); … … 103 103 static void formStatesFromStateVector(const Vector<String>&, SavedFormStateMap&); 104 104 105 CheckedRadioButtons m_checkedRadioButtons;105 RadioButtonGroups m_radioButtonGroups; 106 106 FormElementListHashSet m_formElementsWithState; 107 107 SavedFormStateMap m_savedFormStateMap; -
trunk/Source/WebCore/html/HTMLFormElement.h
r197626 r201659 25 25 #define HTMLFormElement_h 26 26 27 #include "CheckedRadioButtons.h"28 27 #include "FormState.h" 29 28 #include "FormSubmission.h" 30 29 #include "HTMLElement.h" 30 #include "RadioButtonGroups.h" 31 31 #include <memory> 32 32 … … 132 132 #endif 133 133 134 CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; }134 RadioButtonGroups& radioButtonGroups() { return m_radioButtonGroups; } 135 135 136 136 const Vector<FormAssociatedElement*>& associatedElements() const { return m_associatedElements; } … … 186 186 std::unique_ptr<PastNamesMap> m_pastNamesMap; 187 187 188 CheckedRadioButtons m_checkedRadioButtons;188 RadioButtonGroups m_radioButtonGroups; 189 189 190 190 unsigned m_associatedElementsBeforeIndex; -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r200895 r201659 159 159 // We should unregister it to avoid accessing a deleted object. 160 160 if (isRadioButton()) 161 document().formController(). checkedRadioButtons().removeButton(this);161 document().formController().radioButtonGroups().removeButton(this); 162 162 #if ENABLE(TOUCH_EVENTS) 163 163 if (m_hasTouchEventHandler) … … 855 855 setNeedsStyleRecalc(); 856 856 857 if ( CheckedRadioButtons* buttons = checkedRadioButtons())857 if (RadioButtonGroups* buttons = radioButtonGroups()) 858 858 buttons->updateCheckedState(this); 859 859 if (renderer() && renderer()->style().hasAppearance()) … … 1496 1496 oldDocument->unregisterForDocumentSuspensionCallbacks(this); 1497 1497 if (isRadioButton()) 1498 oldDocument->formController(). checkedRadioButtons().removeButton(this);1498 oldDocument->formController().radioButtonGroups().removeButton(this); 1499 1499 #if ENABLE(TOUCH_EVENTS) 1500 1500 if (m_hasTouchEventHandler) … … 1529 1529 { 1530 1530 HTMLTextFormControlElement::requiredAttributeChanged(); 1531 if ( CheckedRadioButtons* buttons = checkedRadioButtons())1531 if (RadioButtonGroups* buttons = radioButtonGroups()) 1532 1532 buttons->requiredAttributeChanged(this); 1533 1533 m_inputType->requiredAttributeChanged(); … … 1773 1773 { 1774 1774 ASSERT(isRadioButton()); 1775 if ( CheckedRadioButtons* buttons = checkedRadioButtons())1775 if (RadioButtonGroups* buttons = radioButtonGroups()) 1776 1776 return buttons->isInRequiredGroup(this); 1777 1777 return false; … … 1780 1780 Vector<HTMLInputElement*> HTMLInputElement::radioButtonGroup() const 1781 1781 { 1782 CheckedRadioButtons* buttons = checkedRadioButtons();1782 RadioButtonGroups* buttons = radioButtonGroups(); 1783 1783 if (!buttons) 1784 1784 return { }; … … 1788 1788 HTMLInputElement* HTMLInputElement::checkedRadioButtonForGroup() const 1789 1789 { 1790 if ( CheckedRadioButtons* buttons = checkedRadioButtons())1790 if (RadioButtonGroups* buttons = radioButtonGroups()) 1791 1791 return buttons->checkedButtonForGroup(name()); 1792 1792 return 0; 1793 1793 } 1794 1794 1795 CheckedRadioButtons* HTMLInputElement::checkedRadioButtons() const1795 RadioButtonGroups* HTMLInputElement::radioButtonGroups() const 1796 1796 { 1797 1797 if (!isRadioButton()) 1798 1798 return 0; 1799 1799 if (HTMLFormElement* formElement = form()) 1800 return &formElement-> checkedRadioButtons();1800 return &formElement->radioButtonGroups(); 1801 1801 if (inDocument()) 1802 return &document().formController(). checkedRadioButtons();1802 return &document().formController().radioButtonGroups(); 1803 1803 return 0; 1804 1804 } … … 1806 1806 inline void HTMLInputElement::addToRadioButtonGroup() 1807 1807 { 1808 if ( CheckedRadioButtons* buttons = checkedRadioButtons())1808 if (RadioButtonGroups* buttons = radioButtonGroups()) 1809 1809 buttons->addButton(this); 1810 1810 } … … 1812 1812 inline void HTMLInputElement::removeFromRadioButtonGroup() 1813 1813 { 1814 if ( CheckedRadioButtons* buttons = checkedRadioButtons())1814 if (RadioButtonGroups* buttons = radioButtonGroups()) 1815 1815 buttons->removeButton(this); 1816 1816 } -
trunk/Source/WebCore/html/HTMLInputElement.h
r200041 r201659 37 37 namespace WebCore { 38 38 39 class CheckedRadioButtons;40 39 class DragData; 41 40 class FileList; … … 46 45 class InputType; 47 46 class ListAttributeTargetObserver; 47 class RadioButtonGroups; 48 48 class TextControlInnerTextElement; 49 49 class URL; … … 422 422 423 423 // Returns null if this isn't associated with any radio button group. 424 CheckedRadioButtons* checkedRadioButtons() const;424 RadioButtonGroups* radioButtonGroups() const; 425 425 void addToRadioButtonGroup(); 426 426 void removeFromRadioButtonGroup();
Note: See TracChangeset
for help on using the changeset viewer.