Title: [242311] trunk/Source/WebCore
Revision
242311
Author
[email protected]
Date
2019-03-02 09:33:20 -0800 (Sat, 02 Mar 2019)

Log Message

Improve some comments
https://bugs.webkit.org/show_bug.cgi?id=195243

Reviewed by Daniel Bates.

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper _addAccessibilityObject:toTextMarkerArray:]):
Fix a typo in a comment.

* dom/RadioButtonGroups.cpp: Fix a typo in a comment.
(WebCore::RadioButtonGroups::checkedButtonForGroup const): Use nullptr instead of 0.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::~HTMLInputElement): Improved a comment, but sadly made
it a bit longer. Use nullptr instead of 0.
(WebCore::HTMLInputElement::didMoveToNewDocument): Added a comment.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (242310 => 242311)


--- trunk/Source/WebCore/ChangeLog	2019-03-02 16:28:46 UTC (rev 242310)
+++ trunk/Source/WebCore/ChangeLog	2019-03-02 17:33:20 UTC (rev 242311)
@@ -1,3 +1,22 @@
+2019-03-02  Darin Adler  <[email protected]>
+
+        Improve some comments
+        https://bugs.webkit.org/show_bug.cgi?id=195243
+
+        Reviewed by Daniel Bates.
+
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper _addAccessibilityObject:toTextMarkerArray:]):
+        Fix a typo in a comment.
+
+        * dom/RadioButtonGroups.cpp: Fix a typo in a comment.
+        (WebCore::RadioButtonGroups::checkedButtonForGroup const): Use nullptr instead of 0.
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::~HTMLInputElement): Improved a comment, but sadly made
+        it a bit longer. Use nullptr instead of 0.
+        (WebCore::HTMLInputElement::didMoveToNewDocument): Added a comment.
+
 2019-03-01  Wenson Hsieh  <[email protected]>
 
         [Datalist] fast/forms/datalist/datalist-child-validation.html crashes with a debug assertion in isValidFormControlElement()

Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (242310 => 242311)


--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2019-03-02 16:28:46 UTC (rev 242310)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2019-03-02 17:33:20 UTC (rev 242311)
@@ -2076,7 +2076,7 @@
     if ([array containsObject:wrapper])
         return YES;
     
-    // Explicity set that this is now an element (in case other logic tries to override).
+    // Explicitly set that this is now an element (in case other logic tries to override).
     [wrapper setValue:@YES forKey:@"isAccessibilityElement"];    
     [array addObject:wrapper];
     return YES;

Modified: trunk/Source/WebCore/dom/RadioButtonGroups.cpp (242310 => 242311)


--- trunk/Source/WebCore/dom/RadioButtonGroups.cpp	2019-03-02 16:28:46 UTC (rev 242310)
+++ trunk/Source/WebCore/dom/RadioButtonGroups.cpp	2019-03-02 17:33:20 UTC (rev 242311)
@@ -186,11 +186,9 @@
 
 // ----------------------------------------------------------------
 
-// Explicity define empty constructor and destructor in order to prevent the
-// compiler from generating them as inlines. So we don't need to to define
-// RadioButtonGroup in the header.
+// Explicitly define default constructor and destructor here outside the header
+// so we can compile the header without including the definition of RadioButtonGroup.
 RadioButtonGroups::RadioButtonGroups() = default;
-
 RadioButtonGroups::~RadioButtonGroups() = default;
 
 void RadioButtonGroups::addButton(HTMLInputElement& element)
@@ -254,7 +252,7 @@
 HTMLInputElement* RadioButtonGroups::checkedButtonForGroup(const AtomicString& name) const
 {
     if (!m_nameToGroupMap)
-        return 0;
+        return nullptr;
     m_nameToGroupMap->checkConsistency();
     RadioButtonGroup* group = m_nameToGroupMap->get(name.impl());
     return group ? group->checkedButton() : nullptr;

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (242310 => 242311)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2019-03-02 16:28:46 UTC (rev 242310)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2019-03-02 17:33:20 UTC (rev 242311)
@@ -165,11 +165,15 @@
 
     // Need to remove form association while this is still an HTMLInputElement
     // so that virtual functions are called correctly.
-    setForm(0);
-    // setForm(0) may register this to a document-level radio button group.
-    // We should unregister it to avoid accessing a deleted object.
+    setForm(nullptr);
+
+    // This is needed for a radio button that was not in a form, and also for
+    // a radio button that was in a form. The call to setForm(nullptr) above
+    // actually adds the button to the document groups in the latter case.
+    // That is inelegant, but harmless since we remove it here.
     if (isRadioButton())
         document().formController().radioButtonGroups().removeButton(*this);
+
 #if ENABLE(TOUCH_EVENTS)
     if (m_hasTouchEventHandler)
         document().didRemoveEventTargetNode(*this);
@@ -1563,8 +1567,12 @@
         oldDocument.unregisterForDocumentSuspensionCallbacks(*this);
         newDocument.registerForDocumentSuspensionCallbacks(*this);
     }
+
+    // We call this even for radio buttons in forms; it's harmless because the
+    // removeButton function is written to be safe for buttons not in any group.
     if (isRadioButton())
         oldDocument.formController().radioButtonGroups().removeButton(*this);
+
 #if ENABLE(TOUCH_EVENTS)
     if (m_hasTouchEventHandler) {
         oldDocument.didRemoveEventTargetNode(*this);
@@ -1892,12 +1900,12 @@
         return { };
     return buttons->groupMembers(*this);
 }
-    
+
 HTMLInputElement* HTMLInputElement::checkedRadioButtonForGroup() const
 {
     if (RadioButtonGroups* buttons = radioButtonGroups())
         return buttons->checkedButtonForGroup(name());
-    return 0;
+    return nullptr;
 }
 
 RadioButtonGroups* HTMLInputElement::radioButtonGroups() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to