Commit graph

306 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
2d0e69f4a1 Bug 1824957 - Remove a bunch of now completely dead XUL layout code. r=layout-reviewers,desktop-theme-reviewers,devtools-reviewers,dao,TYLin
And some related tests.

A bunch of -moz-box* properties are web exposed, so I'll file a
follow-up for hiding them.

Differential Revision: https://phabricator.services.mozilla.com/D173819
2023-03-29 21:23:55 +00:00
James Teh
7f417a6fa1 Bug 1776049: Ignore visibility when checking focusability to determine whether to create an Accessible. r=morgan
This is an extension of the fix in bug 1775684.
In that fix, I tweaked NativeInteractiveState to ignore visibility when calling nsIFrame::IsFocusable, since otherwise, an invisible document would report that nothing was focused.
That works well if an Accessible would be created for other reasons; e.g. because it has a meaningful role.
However, if an element has no semantic value except for its focusability (e.g. <span tabindex="-1">), we were failing to create an Accessible for it altogether.
Now, we also ignore visibility when checking focusability in nsAccessibilityService::MustBeAccessible.
This means that we do create an Accessible in this case.
We don't need a caching check here because we should always create an Accessible in this case, even if the document is initially invisible.

Differential Revision: https://phabricator.services.mozilla.com/D173245
2023-03-23 04:07:04 +00:00
Robert Longson
209497bfd2 Bug 1822884 - Remove eSHAPE from IsNodeOfType and replace with IsSVGGeometryElement r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D172820
2023-03-17 16:26:34 +00:00
Nathan LaPre
f7edb0b474 Bug 1494196: Create Accessible for elements with ARIA role, attributes and display: contents, r=Jamie
This revision modifies the logic in CreateAccessible such that we create
Accessibles for elements that have ARIA roles (other than presentation, none) or
other ARIA attributes, even if those elements have the display: contents style.
This revision also adds tests to verify the above.

Differential Revision: https://phabricator.services.mozilla.com/D170718
2023-03-01 05:53:30 +00:00
James Teh
5f7a89e17f Bug 1818726 part 2: Remove the aDispatchShowEvent argument to PDocAccessible::Cache. r=eeejay
This is no longer used.

Differential Revision: https://phabricator.services.mozilla.com/D171047
2023-02-28 09:19:33 +00:00
Csoregi Natalia
7ae06781c0 Backed out 2 changesets (bug 1818726) for causing failures on browser_caching_relations.js. CLOSED TREE
Backed out changeset 19b59c1f4a3b (bug 1818726)
Backed out changeset 0854bd8c6db1 (bug 1818726)
2023-02-28 06:43:35 +02:00
James Teh
3d617b7f9e Bug 1818726 part 2: Remove the aDispatchShowEvent argument to PDocAccessible::Cache. r=eeejay
This is no longer used.

Differential Revision: https://phabricator.services.mozilla.com/D171047
2023-02-28 00:03:54 +00:00
Emilio Cobos Álvarez
ef73e7c47c Bug 1767561 - Deal with inert much like we deal with visibility: hidden. r=Jamie
Needs tests but this should do.

Differential Revision: https://phabricator.services.mozilla.com/D170752
2023-02-23 19:56:47 +00:00
James Teh
f826326f5f Bug 1816346 part 2: If we force an Accessible to be created due to transform/fixed/sticky despite it being presentational, make it a generic Accessible. r=nlapre
Otherwise, semantics are exposed (e.g. for a table), which completely defeats the author's intent that this be treated as presentational.

Differential Revision: https://phabricator.services.mozilla.com/D170165
2023-02-22 04:46:50 +00:00
Butkovits Atila
d45ed2897d Backed out 2 changesets (bug 1816346) for causing failures at test_table.html. CLOSED TREE
Backed out changeset eeb78c17513c (bug 1816346)
Backed out changeset 22b32e106152 (bug 1816346)
2023-02-22 04:45:07 +02:00
James Teh
4f47e992e7 Bug 1816346 part 2: If we force an Accessible to be created due to transform/fixed/sticky despite it being presentational, make it a generic Accessible. r=nlapre
Otherwise, semantics are exposed (e.g. for a table), which completely defeats the author's intent that this be treated as presentational.

Differential Revision: https://phabricator.services.mozilla.com/D170165
2023-02-22 02:17:56 +00:00
Robert Longson
986ccaa6d3 Bug 1815959 - Check the content type for SVG shapes and images, not the frame r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D169369
2023-02-14 05:59:41 +00:00
James Teh
631c9ecf0a Bug 1775684 part 2: Don't create a DocAccessible if it doesn't exist yet when handling notifications for cache/tree updates. r=morgan
We only use these notifications from layout to push cache updates or insert Accessibles that were skipped during the initial build.
If the DocAccessible doesn't exist yet, creating it is pointless since we can't do this update until the tree is built.
The correct data will be included in the initial tree and cache push anyway.
Aside from pointless refresh ticks, this really shouldn't make any difference, since we don't build the initial tree until layout is ready anyway.
However, the only remotely relevant thing I can think of that's changed in the a11y code lately that might have caused a spike in these test failures is that bounds notifications might get fired earlier/more often from layout, potentially causing earlier creation of DocAccessibles.
Any change to timing might cause a shift in intermittent failures, and since this is wasteful anyway, we may as well fix it.

Differential Revision: https://phabricator.services.mozilla.com/D168911
2023-02-09 04:50:53 +00:00
James Teh
98ad175f52 Bug 1814800: Force Accessible creation if an element has position: fixed/sticky. r=nlapre
We need to know about position: fixed in the parent process a11y cache, so we always need an Accessible for such elements.
We don't cache the fact that something is position: sticky, but we need the Accessible so that it can be notified about bounds updates when it moves within its container.
Previously, we calculated bounds incorrectly if a position: fixed/sticky element wasn't included in the a11y tree.

Differential Revision: https://phabricator.services.mozilla.com/D168916
2023-02-09 04:50:52 +00:00
Nathan LaPre
dbd808364d Bug 1806356: Create an accessible if the element's frame has a transform, r=Jamie
This revision changes the logic of MustCreateAccessible such that we always create
an accessible if the content's frame has been transformed and it has children.
This ensures that we have accessibles to which we apply transforms when
calculating accessible bounds. This revision also adds tests to verify that the
accessible is created, even when the element has role="none", both initially and
as a result of an on-the-fly style change.

Differential Revision: https://phabricator.services.mozilla.com/D167760
2023-02-08 19:43:35 +00:00
Sandor Molnar
41b0aaaaac Backed out changeset b27d83c0aa57 (bug 1806356) for causint dt failures in devtools/client/netmonitor/test/browser_net_basic-search.js 2023-01-27 05:23:17 +02:00
Nathan LaPre
0f763d9ab4 Bug 1806356: Create an accessible if the element's frame has a transform, r=Jamie
This revision changes the logic of MustCreateAccessible such that we always create
an accessible if the content's frame has been transformed. This ensures that we
have accessibles to which we apply transforms when calculating accessible bounds.
This revision also adds a test to verify that the accessible is created, even
when the element has role="presentation".

Differential Revision: https://phabricator.services.mozilla.com/D167760
2023-01-26 18:40:45 +00:00
Emilio Cobos Álvarez
a822daf7cf Bug 1793747 - Clean-ups and test fixes on top of the previous patch. r=Jamie
This should be a tad simpler.

Depends on D159879

Differential Revision: https://phabricator.services.mozilla.com/D167446
2023-01-23 09:19:43 +00:00
Jihye Hong
85bfb346b9 Bug 1793747 - Omit the element hidden by 'content-visibility:hidden' from the accessibility tree r=emilio,Jamie
There is an issue that when the element is hidden because its ancestor has 'content-visibility:hidden', it still appears in the accessibility tree.
Depending on CSS Containment Spec (https://www.w3.org/TR/css-contain-2/#cv-a11y),
it should be omitted from the accessibility tree.
This change fixes the issue above.

The approach is not to create the node in accessibility tree if the element has any ancestor specified with 'content-visibility:hidden'.

This patch can be tested such as:
(1) Check if the accessibility tree is created correctly
  ./mach test accessible/tests/browser/tree/browser_css_content_visibility.js
(2) Check if the accessibility tree is updated correctly
  ./mach test accessible/tests/browser/e10s/browser_treeupdate_csscontentvisibility.js

Differential Revision: https://phabricator.services.mozilla.com/D159879
2023-01-23 09:19:43 +00:00
Morgan Rae Reschenberg
ad2f396003 Bug 1793941: Don't fire EVENT_TABLE_STYLING_CHANGED when the cache is enabled r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D166117
2023-01-11 22:34:04 +00:00
Sandor Molnar
cc2d0f07e4 Backed out changeset f5ee2900f8e3 (bug 1793941) for causing mochitest failures in accessible/tests/mochitest/events/test_stylechange.html CLOSED TREE 2023-01-11 20:40:37 +02:00
Morgan Rae Reschenberg
d260be60d5 Bug 1793941: Don't fire EVENT_TABLE_STYLING_CHANGED when the cache is enabled r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D166117
2023-01-11 17:06:33 +00:00
Emilio Cobos Álvarez
4f1f5e7314 Bug 1805414 - Remove nsMenuFrame and nsMenuParent. r=smaug,Jamie,desktop-theme-reviewers,settings-reviewers,dao
Move most the event handling stuff to the DOM. I've left nsMenuBarFrame
for now, but I will be removing that in the future.

The basic set up is:

  * nsMenuParent becomes XULMenuParentElement (menubar or popup, manages
    the current active menu item)

  * nsMenuFrame -> XULButtonElements that return true for IsMenu().
    Can't use XULMenuElement because of <button type=menu>, which
    behaves like a, well, menu.

This makes the a11y events for menus (DOMMenuItem{Active,Inactive}) make
sense (before that we were firing duplicate Inactive events etc, and the
event order was rather suspicious).

Differential Revision: https://phabricator.services.mozilla.com/D164210
2023-01-04 19:01:13 +00:00
Csoregi Natalia
9807a6e6e8 Backed out changeset f11c529b2407 (bug 1805414) for failures on test_submenuClose.xhtml and nsMenuPopupFrame.cpp. CLOSED TREE 2023-01-04 01:48:30 +02:00
Emilio Cobos Álvarez
3d82727505 Bug 1805414 - Remove nsMenuFrame and nsMenuParent. r=smaug,Jamie,desktop-theme-reviewers,settings-reviewers,dao
Move most the event handling stuff to the DOM. I've left nsMenuBarFrame
for now, but I will be removing that in the future.

The basic set up is:

  * nsMenuParent becomes XULMenuParentElement (menubar or popup, manages
    the current active menu item)

  * nsMenuFrame -> XULButtonElements that return true for IsMenu().
    Can't use XULMenuElement because of <button type=menu>, which
    behaves like a, well, menu.

This makes the a11y events for menus (DOMMenuItem{Active,Inactive}) make
sense (before that we were firing duplicate Inactive events etc, and the
event order was rather suspicious).

Differential Revision: https://phabricator.services.mozilla.com/D164210
2023-01-03 22:06:01 +00:00
James Teh
f133cff3c3 Bug 1806486: If we're forced to create an Accessible for a MathML element which wouldn't normally have one, make it a HyperTextAccessible. r=nlapre
Certain MathML elements such as annotation and annotation-xml don't normally get an Accessible.
However, we force create Accessibles in some cases; e.g. if the element is focusable.
When this happens for these MathML elements (e.g. annotation-xml with a tabindex), we previously created AccessibleWraps which don't support text.
This meant that text formatting information was unavailable and caused assertions when pushing the cache.
To fix this, use HyperTextAccessibleWrap instead.

As a drive-by fix, also use HyperTextAccessibleWrap instead of HyperTextAccessible for content MathML elements.
This was almost certainly a typo when this was implemented.
This wouldn't have been noticeable in tests and some native platforms, but some platforms (e.g. Mac and Windows) do have some overrides in HyperTextAccessibleWrap, so we should use those.

Differential Revision: https://phabricator.services.mozilla.com/D165252
2022-12-21 21:21:11 +00:00
James Teh
a970a1087e Bug 1800736: Use HyperTextAccessible for <svg> and <g> elements. r=nlapre
These can contain <foreignobject>, which contains HTML but does not normally create its own Accessible.
This means that these Accessibles could have TextLeafAccessible children.
TextLeafAccessible children must always have a HyperTextAccessible as a parent.
Therefore, we must use HyperTextAccessible for <svg> and <g>.
As well as fixing assertions, this allows text formatting to be queried for <foreignobject> content, which was previously broken.

Differential Revision: https://phabricator.services.mozilla.com/D164636
2022-12-15 02:21:24 +00:00
James Teh
09faad9a85 Bug 1802297: Don't fire show events for the initial a11y tree push. r=eeejay
After bug 1779156, show events were fired from RecvCache, rather than from RecvShowEvent.
This was done to ensure that cache data was available when the event was fired.
However, because RecvCache fired a show event for every initial cache push, this meant that it also fired one for the document itself, plus all the document's initial direct children.
Firing an event for the document caused problems for ATK, since the parent was null for all top level documents.
This also meant we were firing a lot of unnecessary show events, which could be a performance problem for documents with a lot of initial direct children.
To fix this, provide an explicit argument to PDocAccessible::Cache specifying whether to dispatch a show event or not.
This replaces the existing aFinal argument, which was never used.

Differential Revision: https://phabricator.services.mozilla.com/D163192
2022-11-29 05:06:46 +00:00
James Teh
1fc8f98cd1 Bug 1778433 part 2: Change references to defunct *AccessibleWrap types to use the corresponding *Accessible classes. r=nlapre
These are effectively type aliases on all platforms now and are no longer necessary.

Differential Revision: https://phabricator.services.mozilla.com/D162456
2022-11-22 04:55:11 +00:00
Emilio Cobos Álvarez
9ae8258a6e Bug 1799460 - a11y fixes for my previous changes. r=Jamie
The button tweak is needed because now if you have:

  <button>
    <label value="foo">
  </button>

There is a text node for the value (generated content), and the <button>
shouldn't steal it.

I was getting crashes without it because XULButtonAccessible isn't
hypertext (so I wonder if the IsText() code-path can even be reached?).

Same issue with XULComboboxAccessible, fixed the same way by preventing
text there (preserving behavior).

Setting crop="center" now reframes, so test_label needs to change.

Differential Revision: https://phabricator.services.mozilla.com/D162011
2022-11-16 16:27:59 +00:00
Nathan LaPre
ce54599766 Bug 1748585: Remove img elements with alt="" from the a11y tree, r=Jamie
This revision changes the logic for creation and updating of accessibles
corresponding to elements that produce image accessibles, such that alt=""
(without click listeners or any other aria attributes that force an accessible)
will effectively remove that element's accessible from the accessibility tree.
Next, this revision removes the concept of eNoNameOnPurpose from accessible name
handling, since it's now unnecessary now that alt="" means "don't create an
accessible" in most cases. This revision also adds tests to verify the
functionality and updates existing tests.

Differential Revision: https://phabricator.services.mozilla.com/D160706
2022-11-09 20:05:01 +00:00
Marian-Vasile Laza
f0f79d68f1 Backed out changeset e521fea384c5 (bug 1748585) for causing accessibility crashes (bug 1799208). 2022-11-05 23:52:36 +02:00
Nathan LaPre
8c8a637b75 Bug 1748585: Remove img elements with alt="" from the a11y tree, r=Jamie
This revision changes the logic for creation and updating of accessibles
corresponding to img elements such that alt="" (without click listeners or any
other aria attribute that forces an accessible) will effectively remove that
img's accessible from the accessibility tree. Next, this revision removes the
concept of eNoNameOnPurpose from accessible name handling, since it's now
unnecessary now that alt="" means "don't create an accessible" in most cases.
This revision also adds tests to verify the functionality and updates existing tests.

Differential Revision: https://phabricator.services.mozilla.com/D160706
2022-11-03 19:28:49 +00:00
Eitan Isaacson
bbb5780267 Bug 1798037 - Notify of bounds change if root doc element is given. r=morgan
DocAccessible::GetAccessible() won't return the document if a root element
like body is passed. We need to check for that in NotifyOfPossibleBoundsChange
and use the document accessible in that case.

We can't modify GetAccessible() because that is not that method is used
extensively and that is not the expected behavior.

Differential Revision: https://phabricator.services.mozilla.com/D160677
2022-11-02 19:08:10 +00:00
Michael Comella
d5ba5471ee Bug 1798388 - add profiler markers for common accessibility functions. r=eeejay
Here is a sample profile with the new markers: https://share.firefox.dev/3DMY1cs

Differential Revision: https://phabricator.services.mozilla.com/D160847
2022-11-02 16:23:24 +00:00
Adam Vandolder
0be4513261 Bug 1665151 - Part 2: Expose custom element default accessibility attributes. r=edgar,Jamie,credential-management-reviewers,sgalich
Differential Revision: https://phabricator.services.mozilla.com/D159237
2022-11-02 14:50:56 +00:00
James Teh
ff93da3728 Bug 1793748: Don't treat a role="row" as a table row if it has an invalid parent. r=morgan
Previously, we were inconsistent in what we treated as a table row in various places.
This caused breakage after bug 1726124, since nsAccUtils::TableFor() started returning a table when an ARIA row had an invalid parent, but Filters::GetRow wouldn't find such a row
This was causing broken expectations (and consequently, an extremely long loop) in TableCellAccessible::PrevColHeader.
To fix this, avoid creating an ARIARowAccessible (and thus ARIAGridCellAccessibles) if the row's parent isn't valid.
This way, there aren't conflicting expectations because the TableCellAccessible code can never run.
Furthermore, clients don't get a broken table cell interface on invalid cells, which was a problem even before bug 1726124.

Differential Revision: https://phabricator.services.mozilla.com/D159679
2022-10-19 21:50:22 +00:00
Emilio Cobos Álvarez
4e978b56b5 Bug 1689816 - Implement <tabpanels> and <deck> without XUL layout. r=Gijs,Jamie,morgan,preferences-reviewers,mconley,TYLin
Gijs for front-end bits, layout for the new CSS properties and the
removal of nsDeckFrame / nsStackLayout, Jamie and Morgan for the a11y
changes.

As discussed in the bug, the main tricky part here is handling a11y
correctly. For <deck>, that's trivial (just use `visibility: hidden` to
hide the panels visually, while removing the unselected panels from the
a11y tree).

For <tabpanels> however we need to do something special. We do want to
hide stuff visually, but we want to preserve the contents in the a11y
tree.

For that, the easiest fix is introducing a new privileged CSS property
(-moz-subtree-hidden-only-visually), which takes care of not painting
the frame, but marks stuff offscreen in the accessibility tree. This is
not intended to be a property used widely.

Other than that, the changes are relatively straight-forward, though
some of the accessible/mac changes I could get a sanity-check on.

Differential Revision: https://phabricator.services.mozilla.com/D157875
2022-09-27 04:18:16 +00:00
Marian-Vasile Laza
f54a464c90 Backed out changeset 2f74f8f2ed19 (bug 1689816) for causing reftest failures on skip-ink-multiline-position.html. 2022-09-26 23:24:03 +03:00
Emilio Cobos Álvarez
f875681246 Bug 1689816 - Implement <tabpanels> and <deck> without XUL layout. r=Gijs,Jamie,morgan,preferences-reviewers,mconley,TYLin
Gijs for front-end bits, layout for the new CSS properties and the
removal of nsDeckFrame / nsStackLayout, Jamie and Morgan for the a11y
changes.

As discussed in the bug, the main tricky part here is handling a11y
correctly. For <deck>, that's trivial (just use `visibility: hidden` to
hide the panels visually, while removing the unselected panels from the
a11y tree).

For <tabpanels> however we need to do something special. We do want to
hide stuff visually, but we want to preserve the contents in the a11y
tree.

For that, the easiest fix is introducing a new privileged CSS property
(-moz-subtree-hidden-only-visually), which takes care of not painting
the frame, but marks stuff offscreen in the accessibility tree. This is
not intended to be a property used widely.

Other than that, the changes are relatively straight-forward, though
some of the accessible/mac changes I could get a sanity-check on.

Differential Revision: https://phabricator.services.mozilla.com/D157875
2022-09-26 17:40:30 +00:00
Emilio Cobos Álvarez
d76233d103 Bug 1789168 - Allow emulated -moz-box (which creates flexbox containers) to be used as a tab panel. r=eeejay
I don't understand why we don't allow any box through, but for now this
is a safer change to restore the previous behavior when emulated flex
box is used.

Differential Revision: https://phabricator.services.mozilla.com/D158002
2022-09-23 16:16:14 +00:00
Morgan Rae Reschenberg
d143da6750 Bug 1788547: Null check table acc exists before firing styling changed event, add assert for debugging r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D156987
2022-09-13 19:57:53 +00:00
Morgan Rae Reschenberg
70e8d2d0be Bug 1786086: [Part 2] Queue table cache update when TableLayoutGuessMaybeChanged is called r=Jamie
Depends on D155131

Differential Revision: https://phabricator.services.mozilla.com/D155132
2022-08-30 23:12:20 +00:00
Morgan Rae Reschenberg
c6c9f2d743 Bug 1726124: [Part 1] Generalise nsAccUtils::TableFor for table parts r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D155276
2022-08-30 23:12:18 +00:00
Cosmin Sabou
3840d81095 Backed out 5 changesets (bug 1726124, bug 1786086) for failures on browser_table.js. CLOSED TREE
Backed out changeset 169c9576cb7b (bug 1786086)
Backed out changeset 76dd155c66b8 (bug 1786086)
Backed out changeset 25a5c81eded3 (bug 1786086)
Backed out changeset 1c5f2f67382b (bug 1726124)
Backed out changeset 8c82b5407ff3 (bug 1726124)
2022-08-29 21:22:27 +03:00
Morgan Rae Reschenberg
f8da65f648 Bug 1786086: [Part 2] Queue table cache update when TableLayoutGuessMaybeChanged is called r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D155132
2022-08-29 17:18:33 +00:00
Morgan Rae Reschenberg
77f810cf5c Bug 1726124: [Part 1] Generalise nsAccUtils::TableFor for table parts r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D155276
2022-08-29 17:18:32 +00:00
James Teh
bb8a4b5e7e Bug 1779975: Check whether a LocalAccessible has its own content before trying to get MarkupMapInfo from it. r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D152254
2022-07-22 00:05:21 +00:00
James Teh
bbcfab7595 Bug 1779303: Don't add null attribute values for RemoteAccessibles with markup attributes that must be fetched from DOM. r=morgan
Some markup elements expose Accessible attributes which must be retrieved from DOM; e.g. the datetime attribute of the datetime element.
We don't cache these yet for RemoteAccessible.
Previously, these were unintentionally exposed from MarkupAttributes with null values.
For now, these should be skipped instead until we have caching code for them.
This fixes crashes whenever a client tries to fetch attributes from such an element.

Differential Revision: https://phabricator.services.mozilla.com/D151659
2022-07-14 00:21:27 +00:00
James Teh
d0d3ec2479 Bug 1757121 part 4: Acquire the Android lock while shutting down the accessibility service. r=eeejay
RemoteAccessibleBase::Attributes will soon use the service to query markup attributes.
Thus, the service must not shut down while a client call is being handled on the UI thread.

Differential Revision: https://phabricator.services.mozilla.com/D150722
2022-07-12 02:45:57 +00:00