<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:darin&#64;apple.com" title="Darin Adler &lt;darin&#64;apple.com&gt;"> <span class="fn">Darin Adler</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - AX: AXObjectCache should try to use an unignored accessibilityObject when posting a selection notification when on the border between two accessibilityObjects"
   href="https://bugs.webkit.org/show_bug.cgi?id=146177">bug 146177</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #255452 Flags</td>
           <td>review?
           </td>
           <td>review+
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - AX: AXObjectCache should try to use an unignored accessibilityObject when posting a selection notification when on the border between two accessibilityObjects"
   href="https://bugs.webkit.org/show_bug.cgi?id=146177#c8">Comment # 8</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - AX: AXObjectCache should try to use an unignored accessibilityObject when posting a selection notification when on the border between two accessibilityObjects"
   href="https://bugs.webkit.org/show_bug.cgi?id=146177">bug 146177</a>
              from <span class="vcard"><a class="email" href="mailto:darin&#64;apple.com" title="Darin Adler &lt;darin&#64;apple.com&gt;"> <span class="fn">Darin Adler</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=255452&amp;action=diff" name="attach_255452" title="patch">attachment 255452</a> <a href="attachment.cgi?id=255452&amp;action=edit" title="patch">[details]</a></span>
patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=255452&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=255452&amp;action=review</a>

<span class="quote">&gt; Source/WebCore/accessibility/AXObjectCache.cpp:1010
&gt; +    AccessibilityObject* object = getOrCreate(node);
&gt; +    postTextStateChangeNotification(object, intent, selection);</span >

Would read better without the local variable.

<span class="quote">&gt; Source/WebCore/accessibility/AXObjectCache.cpp:1028
&gt; +    if (object &amp;&amp; object-&gt;accessibilityIsIgnored()) {</span >

Does getOrCreate actually ever return null? The name makes it sound like it wouldn’t.

<span class="quote">&gt; Source/WebCore/accessibility/AXObjectCache.cpp:1030
&gt; +            if (AccessibilityObject *nextSibling = object-&gt;nextSiblingUnignored(1))</span >

Incorrect formatting for WebKit coding style; * is in the wrong place. Also, I suggest using auto or auto* for this.

<span class="quote">&gt; Source/WebCore/accessibility/AXObjectCache.cpp:1033
&gt; +            if (AccessibilityObject *previousSibling = object-&gt;previousSiblingUnignored(1))</span >

Ditto.

<span class="quote">&gt; Source/WebCore/accessibility/AccessibilityObject.cpp:464
&gt; +    if (limit &lt; 0)
&gt; +        limit = std::numeric_limits&lt;int&gt;::max();</span >

This seems unnecessarily complex. If the default should be std::numeric_limits&lt;int&gt;::max(), then lets specify that default in the header, instead of making negative numbers magic. Also, we never use this feature, always passing 1 for limit, so this is dead untested code.

<span class="quote">&gt; Source/WebCore/accessibility/AccessibilityObject.cpp:465
&gt; +    for (previous = this-&gt;previousSibling(); previous &amp;&amp; previous-&gt;accessibilityIsIgnored(); previous = previous-&gt;previousSibling()) {</span >

Normally we’d write this without this-&gt;

<span class="quote">&gt; Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm:447
&gt; +        if ((userInfo = dictionaryRemovingNonSupportedTypes(userInfo)))
&gt; +            info = [NSDictionary dictionaryWithObjectsAndKeys:notificationName, &#64;&quot;notificationName&quot;, userInfo, &#64;&quot;userInfo&quot;, nil];
&gt; +        else
&gt;              info = [NSDictionary dictionaryWithObjectsAndKeys:notificationName, &#64;&quot;notificationName&quot;, nil];</span >

Looks OK, but there is one sleazy shortcut we could take. No need to do the null check on userInfo because if it’s nil it will do the right thing, terminating the list early.

<span class="quote">&gt; Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.mm:100
&gt; +    static Class cls = nil;
&gt; +    if (!cls)
&gt; +        cls = NSClassFromString(&#64;&quot;WebAccessibilityObjectWrapper&quot;);</span >

This is C++; no need for the if statement. This works:

    static Class cls = objc_getClass(&quot;WebAccessibilityObjectWrapper&quot;);

In fact, I would have just added &quot;static&quot; to the existing code instead of adding a new function. And even that change is not really needed; just makes this patch bigger for no significant benefit.

<span class="quote">&gt; Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.mm:129
&gt; +        return AccessibilityUIElement::makeJSAccessibilityUIElement(context, AccessibilityUIElement(value));</span >

Is the explicit conversation to AccessibilityUIElement needed? Does it compile if you just leave it Oout?

<span class="quote">&gt; Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.mm:152
&gt; +    for (NSString *key in dictionary) {</span >

Probably more efficient to use the method that enumerates with a block, since it gives both key and value and eliminates all the hash table lookups.

<span class="quote">&gt; Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.mm:154
&gt; +        auto propertyName = adopt([key createJSStringRef]);</span >

Not great to do this outside the if since it’s only used inside the if.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>