[webkit-reviews] review granted: [Bug 215790] Crash in WebCore::AccessibilityRenderObject::textUnderElement in isolated tree mode. : [Attachment 407165] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Aug 24 20:10:37 PDT 2020


Darin Adler <darin at apple.com> has granted Andres Gonzalez
<andresg_22 at apple.com>'s request for review:
Bug 215790: Crash in WebCore::AccessibilityRenderObject::textUnderElement in
isolated tree mode.
https://bugs.webkit.org/show_bug.cgi?id=215790

Attachment 407165: Patch

https://bugs.webkit.org/attachment.cgi?id=407165&action=review




--- Comment #4 from Darin Adler <darin at apple.com> ---
Comment on attachment 407165
  --> https://bugs.webkit.org/attachment.cgi?id=407165
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407165&action=review

Changes here seem good, but the mix of the real fix and name changes makes this
hard to review. Maybe separate out the name changes into a patch that has no
behavior change?

> Source/WebCore/accessibility/AccessibilityObject.h:76
>  struct AccessibilityText {
> -    String text;
> -    AccessibilityTextSource textSource;
> -    
> -    AccessibilityText(const String& t, const AccessibilityTextSource& s)
> -	   : text(t)
> -	   , textSource(s)
> +    String m_text;
> +    AccessibilityTextSource m_source;
> +
> +    AccessibilityText(const String& text, AccessibilityTextSource source)
> +	   : m_text(text)
> +	   , m_source(source)
>      { }
>  };

These name changes are not a good idea.

Generally, public data members do not have "m_" prefixes. That’s why these
didn’t have them.

> Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp:490
> +	       std::for_each(change.m_properties.begin(),
change.m_properties.end(), [&object] (auto&& property) {
> +		   object->setProperty(property.key, WTFMove(property.value));
> +	       });

Why use for_each here instead of a range-based for loop?

    for (auto& property : change.m_properties)
	object->setProperty(property.key, WTFMove(property.value));

> Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h:315
> +    AXID m_axID { InvalidAXID }; // ID of the object whose properties
changed.
> +    AXPropertyMap m_properties; // Changed properties.

These should have structure-style names, without the "m_" prefix. We use the
"m_" prefix for private or protected data members of classes, not for structure
members.


More information about the webkit-reviews mailing list