<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>232141</bug_id>
          
          <creation_ts>2021-10-22 03:56:33 -0700</creation_ts>
          <short_desc>AX: Notify about children changed earlier in isolated tree mode</short_desc>
          <delta_ts>2021-11-16 05:42:23 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Accessibility</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>230259</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Carlos Garcia Campos">cgarcia</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>aboxhall</cc>
    
    <cc>andresg_22</cc>
    
    <cc>aperez</cc>
    
    <cc>apinheiro</cc>
    
    <cc>cfleizach</cc>
    
    <cc>darin</cc>
    
    <cc>dmazzoni</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>jcraig</cc>
    
    <cc>jdiggs</cc>
    
    <cc>samuel_white</cc>
    
    <cc>tyler_w</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1807628</commentid>
    <comment_count>0</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2021-10-22 03:56:33 -0700</bug_when>
    <thetext>In case of isolated tree mode the children changed notification happens after the deferred cache update like in non-isolated tree mode, but then it&apos;s deferred again by the notification post timer. This affects layout tests doing things like foo.appendChild(bar) + foo.childAtIndex(0), because in isolated tree mode foo.childAtIndex(0) returns null, the child wrapper hasn&apos;t been attached yet with the ax isolated object.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1807629</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-10-22 03:56:43 -0700</bug_when>
    <thetext>&lt;rdar://problem/84543935&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1807630</commentid>
    <comment_count>2</comment_count>
      <attachid>442147</attachid>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2021-10-22 03:58:10 -0700</bug_when>
    <thetext>Created attachment 442147
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1808177</commentid>
    <comment_count>3</comment_count>
      <attachid>442147</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2021-10-23 22:44:38 -0700</bug_when>
    <thetext>Comment on attachment 442147
Patch

Can this be tested? Generally we expect that code will get broken over time if there’s no test</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1808309</commentid>
    <comment_count>4</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2021-10-25 00:20:38 -0700</bug_when>
    <thetext>hmm, there are indeed test failures, I thought isolated tree was not enabled in tests. I&apos;ll investigate them.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1808365</commentid>
    <comment_count>5</comment_count>
    <who name="Andres Gonzalez">andresg_22</who>
    <bug_when>2021-10-25 06:09:44 -0700</bug_when>
    <thetext>(In reply to Carlos Garcia Campos from comment #2)
&gt; Created attachment 442147 [details]
&gt; Patch

+        non-isolated tree mode, but then it&apos;s deferred again by the notification post timer. This affects layout tests
+        doing things like foo.appendChild(bar) + foo.childAtIndex(0), because in isolated tree mode foo.childAtIndex(0)
+        returns null, the child wrapper hasn&apos;t been attached yet with the ax isolated object.
+

That is true for all properties, not only for children. I believe we have to make the LayoutTests async, i.e., waitFor foo.childAtIndex(0) is not null in your example above.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1808375</commentid>
    <comment_count>6</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2021-10-25 06:38:06 -0700</bug_when>
    <thetext>(In reply to Andres Gonzalez from comment #5)
&gt; (In reply to Carlos Garcia Campos from comment #2)
&gt; &gt; Created attachment 442147 [details]
&gt; &gt; Patch
&gt; 
&gt; +        non-isolated tree mode, but then it&apos;s deferred again by the
&gt; notification post timer. This affects layout tests
&gt; +        doing things like foo.appendChild(bar) + foo.childAtIndex(0),
&gt; because in isolated tree mode foo.childAtIndex(0)
&gt; +        returns null, the child wrapper hasn&apos;t been attached yet with the
&gt; ax isolated object.
&gt; +
&gt; 
&gt; That is true for all properties, not only for children. I believe we have to
&gt; make the LayoutTests async, i.e., waitFor foo.childAtIndex(0) is not null in
&gt; your example above.

We are already notifying early other properties, though. I wonder how the tests pass in mac with isolated tree enabled.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1808386</commentid>
    <comment_count>7</comment_count>
    <who name="Andres Gonzalez">andresg_22</who>
    <bug_when>2021-10-25 07:20:55 -0700</bug_when>
    <thetext>(In reply to Carlos Garcia Campos from comment #6)
&gt; (In reply to Andres Gonzalez from comment #5)
&gt; &gt; (In reply to Carlos Garcia Campos from comment #2)
&gt; &gt; &gt; Created attachment 442147 [details]
&gt; &gt; &gt; Patch
&gt; &gt; 
&gt; &gt; +        non-isolated tree mode, but then it&apos;s deferred again by the
&gt; &gt; notification post timer. This affects layout tests
&gt; &gt; +        doing things like foo.appendChild(bar) + foo.childAtIndex(0),
&gt; &gt; because in isolated tree mode foo.childAtIndex(0)
&gt; &gt; +        returns null, the child wrapper hasn&apos;t been attached yet with the
&gt; &gt; ax isolated object.
&gt; &gt; +
&gt; &gt; 
&gt; &gt; That is true for all properties, not only for children. I believe we have to
&gt; &gt; make the LayoutTests async, i.e., waitFor foo.childAtIndex(0) is not null in
&gt; &gt; your example above.
&gt; 
&gt; We are already notifying early other properties, though. I wonder how the
&gt; tests pass in mac with isolated tree enabled.

Where are we notifying early other properties?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1808765</commentid>
    <comment_count>8</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2021-10-25 22:58:51 -0700</bug_when>
    <thetext>(In reply to Andres Gonzalez from comment #7)
&gt; (In reply to Carlos Garcia Campos from comment #6)
&gt; &gt; (In reply to Andres Gonzalez from comment #5)
&gt; &gt; &gt; (In reply to Carlos Garcia Campos from comment #2)
&gt; &gt; &gt; &gt; Created attachment 442147 [details]
&gt; &gt; &gt; &gt; Patch
&gt; &gt; &gt; 
&gt; &gt; &gt; +        non-isolated tree mode, but then it&apos;s deferred again by the
&gt; &gt; &gt; notification post timer. This affects layout tests
&gt; &gt; &gt; +        doing things like foo.appendChild(bar) + foo.childAtIndex(0),
&gt; &gt; &gt; because in isolated tree mode foo.childAtIndex(0)
&gt; &gt; &gt; +        returns null, the child wrapper hasn&apos;t been attached yet with the
&gt; &gt; &gt; ax isolated object.
&gt; &gt; &gt; +
&gt; &gt; &gt; 
&gt; &gt; &gt; That is true for all properties, not only for children. I believe we have to
&gt; &gt; &gt; make the LayoutTests async, i.e., waitFor foo.childAtIndex(0) is not null in
&gt; &gt; &gt; your example above.
&gt; &gt; 
&gt; &gt; We are already notifying early other properties, though. I wonder how the
&gt; &gt; tests pass in mac with isolated tree enabled.
&gt; 
&gt; Where are we notifying early other properties?

https://github.com/WebKit/WebKit/blob/main/Source/WebCore/accessibility/AXObjectCache.cpp#L1476
https://github.com/WebKit/WebKit/blob/main/Source/WebCore/accessibility/AXObjectCache.cpp#L1515
https://github.com/WebKit/WebKit/blob/main/Source/WebCore/accessibility/AXObjectCache.cpp#L1723
https://github.com/WebKit/WebKit/blob/main/Source/WebCore/accessibility/AXObjectCache.cpp#L1774</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1808799</commentid>
    <comment_count>9</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2021-10-26 02:08:03 -0700</bug_when>
    <thetext>I&apos;m having the same problem with AXValueChanged, I need to do an early isolated tree update for test accessibility/range-alter-by-step.html to work (in addition to bug #232298). Without that, when the value is queried after an increment/decrement, the isolated tree still contains the previous value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1810503</commentid>
    <comment_count>10</comment_count>
    <who name="Andres Gonzalez">andresg_22</who>
    <bug_when>2021-10-31 07:35:22 -0700</bug_when>
    <thetext>We cannot update the isolated tree in AXObjectCache::postNotification because it can be called in the middle of a layout, in which case the render tree is not ready for all the queries accessibility will make, or it can trigger a layout. That&apos;s why we have moved most or all notification handling to deferred handlers. This is hinted by the comment in postNotification that reads:

    // Get an accessibility object that already exists. One should not be created here
    // because a render update may be in progress and creating an AX object can re-trigger a layout

updateIsolatedTree may create new AX objects and query for lots of properties that the render tree is not ready to compute.

There may be some properties that could be updated early like some ARIA attributes, because they won&apos;t cause any changes to the render tree. But we need to special case those.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1811104</commentid>
    <comment_count>11</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2021-11-02 07:26:36 -0700</bug_when>
    <thetext>hmm, I don&apos;t think childrenChanged can be called in the middle of a layout, since render tree mutation is disallowed by layout, no? We can probably add an assert to ensure it&apos;s never called in the middle of a layout.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1814405</commentid>
    <comment_count>12</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2021-11-12 05:42:22 -0800</bug_when>
    <thetext>(In reply to Carlos Garcia Campos from comment #11)
&gt; hmm, I don&apos;t think childrenChanged can be called in the middle of a layout,
&gt; since render tree mutation is disallowed by layout, no? We can probably add
&gt; an assert to ensure it&apos;s never called in the middle of a layout.

This seems to be the case, IIUC — but I am not super familiar with the related
code, so I will tentatively r+ this, and we can wait for example until the
Monday before landing in case Andres (or anybody else) still has concerns :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1814406</commentid>
    <comment_count>13</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2021-11-12 05:59:01 -0800</bug_when>
    <thetext>I&apos;m not in a hurry to land this and there are tests failing in mac that need more investigation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1815434</commentid>
    <comment_count>14</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2021-11-16 04:03:50 -0800</bug_when>
    <thetext>I see some tests have already been rewritten to use async apis to make them pass in isolated tree mode, so maybe this won&apos;t be needed in the end. I&apos;m going to close this for now. Once I finish the ATSPI implementation I&apos;ll check if there are still tests failing because of this and if it&apos;s possible to rewrite them all or reconsider this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1815435</commentid>
    <comment_count>15</comment_count>
      <attachid>442147</attachid>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2021-11-16 04:04:06 -0800</bug_when>
    <thetext>Comment on attachment 442147
Patch

I see some tests have already be rewritten to use async apis to make them pass in isolated tree mode, so maybe this won&apos;t be needed in the end.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1815445</commentid>
    <comment_count>16</comment_count>
    <who name="Andres Gonzalez">andresg_22</who>
    <bug_when>2021-11-16 05:42:23 -0800</bug_when>
    <thetext>(In reply to Carlos Garcia Campos from comment #15)
&gt; Comment on attachment 442147 [details]
&gt; Patch
&gt; 
&gt; I see some tests have already be rewritten to use async apis to make them
&gt; pass in isolated tree mode, so maybe this won&apos;t be needed in the end.

That&apos;s right, Carlos, we are actively working in making all necessary tests async. If you find problematic tests in ATSPI, let me know and will work together to address them. Thanks!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>442147</attachid>
            <date>2021-10-22 03:58:10 -0700</date>
            <delta_ts>2021-11-16 04:04:06 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>wcore-ac-isolated-tree-children-changed.diff</filename>
            <type>text/plain</type>
            <size>1855</size>
            <attacher name="Carlos Garcia Campos">cgarcia</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZyBiL1NvdXJjZS9XZWJDb3JlL0No
YW5nZUxvZwppbmRleCAzYzczZGJhMzI5NGEuLmMwYzdhMDE4ZmE4YiAxMDA2NDQKLS0tIGEvU291
cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1NvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAt
MSwzICsxLDE5IEBACisyMDIxLTEwLTIyICBDYXJsb3MgR2FyY2lhIENhbXBvcyAgPGNnYXJjaWFA
aWdhbGlhLmNvbT4KKworICAgICAgICBBWDogTm90aWZ5IGFib3V0IGNoaWxkcmVuIGNoYW5nZWQg
ZWFybGllciBpbiBpc29sYXRlZCB0cmVlIG1vZGUKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtp
dC5vcmcvc2hvd19idWcuY2dpP2lkPTIzMjE0MQorICAgICAgICA8cmRhcjovL3Byb2JsZW0vODQ1
NDM5MzU+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAg
SW4gY2FzZSBvZiBpc29sYXRlZCB0cmVlIG1vZGUgdGhlIGNoaWxkcmVuIGNoYW5nZWQgbm90aWZp
Y2F0aW9uIGhhcHBlbnMgYWZ0ZXIgdGhlIGRlZmVycmVkIGNhY2hlIHVwZGF0ZSBsaWtlIGluCisg
ICAgICAgIG5vbi1pc29sYXRlZCB0cmVlIG1vZGUsIGJ1dCB0aGVuIGl0J3MgZGVmZXJyZWQgYWdh
aW4gYnkgdGhlIG5vdGlmaWNhdGlvbiBwb3N0IHRpbWVyLiBUaGlzIGFmZmVjdHMgbGF5b3V0IHRl
c3R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