Bug 1474771 - Adjust accessibility test_list.html to deal with frames having NS_FRAME...
commit7e9c9d9319db80e91a75b0ed897953a33ee9192e
authorL. David Baron <dbaron@dbaron.org>
Wed, 3 Jul 2019 05:30:30 +0000 (3 05:30 +0000)
committerL. David Baron <dbaron@dbaron.org>
Wed, 3 Jul 2019 05:30:30 +0000 (3 05:30 +0000)
tree8ee192068d49d2db57711043fa1c8404518afddf
parent45bc14a50b8988dcf686e238b70f98d1b8cbf846
Bug 1474771 - Adjust accessibility test_list.html to deal with frames having NS_FRAME_IS_DIRTY more often.  r=Jamie

`NS_FRAME_IS_DIRTY` being set on a frame has always meant that that
frame and all of its descendants need to be reflowed.  What the main
patch on this bug is changing is when it gets propagated to descendants;
prior to that patch it gets propagated during reflow, whereas after the
patch it gets propagated when the bit is set.  This means that
`NS_FRAME_IS_DIRTY` is now (after the patch) a somewhat more reliable
indicator of whether a frame requires reflow than it was before.

However, this has a strange interaction with the particular sequence of
operations that test_list.html performs.  In particular, test_list.html:
 (1) makes a style change that requires reflow,
 (2) flushes style (but not layout), and
 (3) gets the name of an accessible whose layout was dirtied by the style change.

Getting this name ends up here:
```
nsTextFrame::GetRenderedText at layout/generic/nsTextFrame.cpp:9600
nsTextEquivUtils::AppendTextEquivFromTextContent at accessible/base/nsTextEquivUtils.cpp:127
nsTextEquivUtils::AppendFromAccessible at accessible/base/nsTextEquivUtils.cpp:174
nsTextEquivUtils::AppendFromAccessibleChildren at accessible/base/nsTextEquivUtils.cpp:162
nsTextEquivUtils::GetNameFromSubtree at accessible/base/nsTextEquivUtils.cpp:39
mozilla::a11y::Accessible::NativeName at accessible/generic/Accessible.cpp:1991
mozilla::a11y::HyperTextAccessible::NativeName at accessible/generic/HyperTextAccessible.cpp:1760
mozilla::a11y::Accessible::Name at accessible/generic/Accessible.cpp:149
mozilla::a11y::xpcAccessible::GetName at accessible/xpcom/xpcAccessible.cpp:245
NS_InvokeByIndex at xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_x86_64_unix.S:106
```

What the main patch in the bug has changed is whether this `nsTextFrame`
has the `NS_FRAME_IS_DIRTY` bit set at this point.  This means that
`GetRenderedText` will bail out without reporting the text, because the
frame is marked dirty.

On the assumption that this action -- getting accessible names while
frames are dirty -- is an artificial situation set up in the test and
not a real-world situation that we need to care about, I'm proposing
that we make the straightforward adjustment to the test:  flush layout
in addition to flushing style at step (2) above, so that the test works
again.  As long as that assumption is correct, I think this should be
fine.  (I'd note that this is the *only* test that breaks as a result of
the patch.)

If, on the other hand, we actually do care about what accessible names
return while layout state is dirty and reflow is needed, we should
probably improve `nsTextFrame::GetRenderedText` so that it can somehow
report useful state even when `NS_FRAME_IS_DIRTY` is set, or something
else more complicated.

Differential Revision: https://phabricator.services.mozilla.com/D36423

--HG--
extra : moz-landing-system : lando
accessible/tests/mochitest/name/test_list.html