Commit Graph

346 Commits

Author SHA1 Message Date
Amit Prakash Ambasta
1a34bf9361 Bug 1889054 - Fix issues with non-unified builds missing header inclusions. r=emilio
Signed-off-by: Amit Prakash Ambasta <amit.prakash.ambasta@gmail.com>

Differential Revision: https://phabricator.services.mozilla.com/D207004
2024-04-09 12:09:53 +00:00
Nathan LaPre
ff4c89901f Bug 1865582: Include xlink:title in svg link name computation, r=Jamie
This revision implements HTMLLinkAccessible::NativeName, which, if the element
is present in an SVG context, checks the xlink:title attribute for the name, as
required by the accessible name specification. This revision also removes eight
expected failures from the relevant web platform test meta file.

Differential Revision: https://phabricator.services.mozilla.com/D203031
2024-03-05 19:04:46 +00:00
Eitan Isaacson
25b310a6c2 Bug 1851273 - P1: Add accessible/ios directory. r=Jamie,morgan,nlapre
Differential Revision: https://phabricator.services.mozilla.com/D187328
2024-03-04 21:11:49 +00:00
Nathan LaPre
329ac88f51 Bug 1749505: Implement conditional role mapping for aside element, r=Jamie
This revision implements the HTML-AAM spec's rules for role mapping of the aside
element. The aside element might be either 'complementary' or 'generic'
depending on the ancestor and presence of accessible name. This revision
implements these rules via a new class, HTMLAsideAccessible, which has a
NativeRole override. This revision also updates the HTMLMarkupMap to map HTML
aside elements to HTMLAsideAccessible. Finally, this revision removes related
expected failures from web platform tests.

Differential Revision: https://phabricator.services.mozilla.com/D203192
2024-03-04 18:55:09 +00:00
Nathan LaPre
13906c252f Bug 1882909: Remove unnecessary uses of const_cast from accessibility module, r=morgan
This revision removes all removable instances of const_cast from the
accessibility module. Name() was previously non-const, but is now const. Same
for ActionWalk().

Differential Revision: https://phabricator.services.mozilla.com/D203207
2024-03-04 18:46:01 +00:00
Nathan LaPre
0637f72bf7 Bug 1878358: Fix accessible name calculation for text field inputs, r=Jamie
Per the HTML-AAM spec, section 4.1.1, certain text field inputs have a specific
accessible name calculation. That computation specifies that the client should
first check the control's title attribute before checking the control's
placeholder value. This revision adjusts the code such that we check the title
first, then the placeholder; we were previously doing the reverse. This revision
also removes the expected failures from the relevant web platform test meta
file.

Differential Revision: https://phabricator.services.mozilla.com/D201877
2024-02-14 23:24:04 +00:00
James Teh
adc647d267 Bug 1870783 part 3: Do not expose expanded/collapsed state for a popover invoker if the popover is an ancestor of the invoker. r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D197039
2024-02-12 06:24:15 +00:00
Ziran Sun
584d474cc3 Bug 1867811 - Expose EXPANDED state for element with popovertarget. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D196541
2023-12-19 17:30:56 +00:00
Morgan Rae Reschenberg
b4c11c02b6 Bug 1851441: Speculative fix for image map/html area element crash r=Jamie
I think this crash may occur when the image map is being removed or when the area element is being moved.
In any case, I'm reasonably confident that the reason for this crash was a null boundingFrame passed to TransformRect, which should only happen when the image map doesn't exist / has no frame.

Also, we really shouldn't be transforming anyway, so I’ve removed the transform call.

Differential Revision: https://phabricator.services.mozilla.com/D193460
2023-11-15 22:37:29 +00:00
James Teh
53b2e98767 Bug 1661923: Expose file input as a button in the a11y tree rather than a group. r=eeejay
A file input contains two native anonymous children: the Browse button and the file name label.
Previously, we exposed the file input as a group in the a11y tree and its anonymous children as children of that group.
While this is semantically correct, it causes several problems for screen readers.
First, if the author provides a label or description, that gets exposed on the group.
Some screen readers ignore either one or the other depending on the screen reader, what the author specified and how the user navigated there.
Second, the file name label isn't focusable and wasn't associated to the group in any way aside from being a child.
This meant that a screen reader user might not perceive it in some cases.

Since most users understand a file input as a single control anyway, we now just expose the input as a simple button containing two text leaves.
However, unlike most buttons, we need to append the text to the name even if the author specifies a name.
As a bonus, this simplifies some code, since we no longer need to redirect focus or events.

An additional problem was that the file input previously returned false for LocalAccessible::IsWidget, which meant that a wrapping HTML label wasn't associated correctly.
This has been fixed as well, although this fix could have applied just as easily to the previous group implementation.

Differential Revision: https://phabricator.services.mozilla.com/D191264
2023-10-23 23:38:13 +00:00
Vincent Hilla
1273773f91 Bug 1066940 - Align return type of HTMLFormElement::elements with spec. r=dom-core,webidl,peterv
Differential Revision: https://phabricator.services.mozilla.com/D188246
2023-09-14 16:37:14 +00:00
James Teh
23fd30a006 Bug 1845883: Remove HyperTextAccessibleWrap. r=nlapre
This is now just an alias for HyperTextAccessible on all platforms.
This was done with the following bash script:

```
cd accessible
find -name HyperTextAccessibleWrap.h -delete
sed -i 's/#include "HyperTextAccessibleWrap.h"/#include "HyperTextAccessible.h"/;/"HyperTextAccessibleWrap.h",/d;s/HyperTextAccessibleWrap/HyperTextAccessible/g' `git grep -l HyperTextAccessibleWrap`
```

Differential Revision: https://phabricator.services.mozilla.com/D184796
2023-08-02 01:42:17 +00:00
James Teh
97a388f4f8 Bug 1845863: Expose HTML placeholder for RemoteAccessible. r=nlapre
We previously cached aria-placeholder, but not HTML placeholder.
These both map to the placeholder object attribute exposed by Accessible::Attributes, but they are retrieved differently internally.

This also fixes LocalAccessible::Attributes to always prefer HTML placeholder over aria-placeholder as per the ARIA spec.
Previously, the attribute we preferred was somewhat indeterminate (from the user's perspective) due to the ordering of hash maps.

Differential Revision: https://phabricator.services.mozilla.com/D184795
2023-08-02 01:42:17 +00:00
James Teh
c68c3ca8b3 Bug 1844238 part 1: Change includes of Role.h to mozilla/a11y/Role.h. r=eeejay
Role.h will soon be generated, but it is generated within the obj dir, so local includes won't work.
Our C++ style guide says we should prefer exported includes wherever possible anyway.

This was done with this shell command inside the accessible/ directory:

```
sed -i 's,#include "Role.h",#include "mozilla/a11y/Role.h",' `git grep -l '#include "Role.h"'`
```

Differential Revision: https://phabricator.services.mozilla.com/D183940
2023-07-26 02:19:41 +00:00
Nathan LaPre
f8b9470054 Bug 854796: Anchor, area elements without href shouldn't have link role, r=Jamie,devtools-reviewers
Per the HTML-AAM spec, a and area elements without href attributes should have
generic roles. This revision implements this preference by creating hypertext
accessibles when said elements lack href attributes (or click listeners). A
byproduct of this change is recognizing that a elements have no intrinsic role
mapping; they could be generics or links. This revision handles situations
where href or click listeners might appear or dissapear, and recreates the
accessibles when necessary. Since image map areas are handled by their
containing image maps, this revision specializes HTMLAreaAccessible::NativeRole
to account for the discrepancy that we can't account for in the markup map.
This revision also changes the relevant WPT test expectations, updates existing
tests that this change affects, and adds tests to verify that changing href
and click listeners dynamically changes the role appropriately.

Differential Revision: https://phabricator.services.mozilla.com/D183550
2023-07-24 19:31:29 +00:00
James Teh
4d6b8a2e6c Bug 1843389: HTMLTableCellAccessible::Col/RowExtent: Get the table frame from layout instead of walking the a11y tree. r=nlapre
In some edge cases (such as in accessible/tests/crashtests/1472024-1.html), there can be an outer HTML table which contains an inner table according to layout, but the inner table isn't included in the a11y tree.
The inner table has no semantic value, so including it wouldn't be appropriate.
However, HTMLTableAccessible::Col/RowExtent previously retrieved the table using the a11y tree, which meant we used the layout frame for the outer table instead of the inner table.
This resulted in assertions.
To fix this, always ask the cell's layout frame for the correct table frame, rather than walking the a11y tree.
As a bonus, this simplifies and trims the code somewhat.

Differential Revision: https://phabricator.services.mozilla.com/D184066
2023-07-21 04:03:39 +00:00
James Teh
4ff50c7676 Bug 1765968: Call QueueCacheUpdate instead of SendCache wherever possible. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D183950
2023-07-21 02:24:44 +00:00
James Teh
0cc53ffbc5 Bug 1843825 part 1: Remove unused Gecko a11y roles. r=eeejay
Some of these roles were duplicates, while others were just never used.
This removes the following roles:

- TITLEBAR
- GRIP
- SOUND
- CURSOR
- CARET
- WINDOW
- CHART
- BORDER
- COLUMN
- HELPBALLOON
- CHARACTER
- INDICATOR
- DROPLIST
- DIAL
- HOTKEYFIELD
- EQUATION
- BUTTONDROPDOWNGRID
- CLOCK
- SPLITBUTTON
- IPADDRESS
- ACCEL_LABEL
- ARROW
- COLOR_CHOOSER
- DESKTOP_ICON
- DESKTOP_FRAME
- DIRECTORY_PANE
- FILE_CHOOSER
- FONT_CHOOSER
- GLASS_PANE
- HTML_CONTAINER
- ICON
- LAYERED_PANE
- OPTION_PANE
- POPUP_MENU
- ROOT_PANE
- SCROLL_PANE
- SPLIT_PANE
- TABLE_COLUMN_HEADER
- TABLE_ROW_HEADER
- TEAR_OFF_MENU_ITEM
- TERMINAL
- VIEWPORT
- HEADER
- FOOTER
- RULER
- AUTOCOMPLETE
- EDITBAR
- PAGE
- REDUNDANT_OBJECT
- IME
- CALENDAR
- EMBEDDED_OBJECT

Differential Revision: https://phabricator.services.mozilla.com/D183716
2023-07-19 02:51:29 +00:00
Nathan LaPre
8cc0caf4f2 Bug 1840732 Part 6: Remove unnecessary includes from accessible/html, r=Jamie
This revision removes unnecssary include directives from cpp files in the
accessible/html directory. These suggestions came from the Include What You Use
tool.

Depends on D182400

Differential Revision: https://phabricator.services.mozilla.com/D182401
2023-07-07 03:22:08 +00:00
Nathan LaPre
20a234326d Bug 1804054: Identify nested tables with non-zero cell border width as data tables,r=Jamie
This revision changes the table classification algorithm such that tables with
cells that have non-zero border width are identified as data tables. This revision
moves the check for border width above the nested table check, since we consider
that to be a more pertinent indicator. This revision also adds a test to verify
the changes.

Differential Revision: https://phabricator.services.mozilla.com/D181825
2023-06-23 19:54:28 +00:00
Emilio Cobos Álvarez
4cc6758558 Bug 1839922 - Remove usage of {Has,Get}Attr(kNameSpaceID_None, ..). r=edgar
We have more readable and faster versions (that just omit the namespace
arg).

Mostly done via sed, with a couple helpers to use the faster lookups
where possible.

Differential Revision: https://phabricator.services.mozilla.com/D181795
2023-06-23 10:01:32 +00:00
James Teh
7ae0834dd8 Bug 1832228 part 3: Rename TableAccessibleBase to TableAccessible and TableCellAccessibleBase to TableCellAccessible. r=nlapre
Now that the local-only TableAccessible and TableCellAccessible have been removed, we no longer need this Base suffix for the unified classes.
Aside from renaming the header files, most of the rest of this was done with the following script:

```
function replace {
  sed -i 's/'$1'/'$2'/g' `git grep -l $1`
}
replace TableAccessibleBase TableAccessible
replace TableCellAccessibleBase TableCellAccessible
replace AsTableBase AsTable
replace AsTableCellBase AsTableCell
```

Differential Revision: https://phabricator.services.mozilla.com/D179803
2023-06-08 09:50:28 +00:00
James Teh
9ecdad92e8 Bug 1832261: Remove most of HTMLTable*Accessible. r=nlapre
We now use CachedTableAccessible for HTML tables, so much of the code in the HTMLTable*Accessible classes was unused.
However, we still depend on these classes for some data needed to build the cached table.

1. HTMLTableAccessible and HTMLTableCellAccessible no longer derive from TableAccessible and TableCellAccessible, respectively. Instead, callers which need specific access to HTML table data use the HTMLTable*Accessible class directly.
2. All table specific methods have been removed except those that provide data required to build a CachedTableAccessible. The remaining methods are those for querying the row/column span (which depends on layout) and getting the caption (which depends on DOM).
3. HTMLTable*Accessible are now used for all <table>, <td>, <th> and <tr> elements and MathML equivalents. ARIA*Accessible are never used for these elements. This improves consistency, simplifies the code and means that behavior specific to these HTML elements is handled in these classes, rather than in the ARIA classes as well.
4. The table and row roles are now specified in HTMLMarkupMap and MathMLMarkupMap, rather than overriding NativeRole.  Cell roles are still handled in a NativeRole override; see the code comments for details.
5. IsProbablyLayoutTable has been moved from TableAccessible to HTMLTableAccessible, as it is only relevant for HTML tables, not for ARIA tables.
6. HTMLTableHeaderCellAccessible::NativeRole has been rewritten such that it no longer depends on querying table coordinates, as that would now require building a CachedTableAccessible, which would be very wasteful here. This replaces TableCellAccessible::HeaderCellRole, which has been removed.

Differential Revision: https://phabricator.services.mozilla.com/D179799
2023-06-08 09:50:28 +00:00
James Teh
bd9bd8733b Bug 1835967: Remove TableAccessibleBase::Select/UnselectCol/Row. r=nlapre
Differential Revision: https://phabricator.services.mozilla.com/D179513
2023-06-07 01:40:25 +00:00
Eitan Isaacson
6b7c34dbea Bug 1826856 - Remove sync AnchorURIAt method. r=Jamie
We can get the URI using the Value method that is already cached when
caching is enabled.

Differential Revision: https://phabricator.services.mozilla.com/D176067
2023-04-25 16:34:12 +00:00
Eitan Isaacson
489d1d11a0 Bug 1826857 - Move AnchorAt to Accessible and remove sync IPC. r=Jamie
Because the implementation only needs the accessible type and tree, we
don't need to make an IPC call here.

Differential Revision: https://phabricator.services.mozilla.com/D175288
2023-04-17 17:54:35 +00:00
Eitan Isaacson
4a2d824c2a Bug 1826855 - Remove AnchorCount sync IPC message and implement in Accessible. r=Jamie
AnchorCount only needs the accessible type and child count. We already
cache that with or without CtW.

Differential Revision: https://phabricator.services.mozilla.com/D175273
2023-04-17 17:54:34 +00:00
Andi-Bogdan Postelnicu
10f49d4180 Bug 1660405 - Move away from mozilla::IsNaN in favor of std::isnan. r=nbp,media-playback-reviewers,sergesanspaille,padenot
Differential Revision: https://phabricator.services.mozilla.com/D173035
2023-03-22 11:35:33 +00:00
Stanca Serban
e31a178029 Backed out 7 changesets (bug 1660405) for causing bustages on Linux x64 opt. CLOSED TREE
Backed out changeset ad1a5f59214f (bug 1660405)
Backed out changeset a39e95f0aafe (bug 1660405)
Backed out changeset 48629ee0d70d (bug 1660405)
Backed out changeset 8419b99aab60 (bug 1660405)
Backed out changeset 535cc12c8bed (bug 1660405)
Backed out changeset e27052da4927 (bug 1660405)
Backed out changeset 11b0f9cf8091 (bug 1660405)
2023-03-22 13:05:53 +02:00
Andi-Bogdan Postelnicu
a5d28acdd6 Bug 1660405 - Move away from mozilla::IsNaN in favor of std::isnan. r=nbp,media-playback-reviewers,sergesanspaille,padenot
Differential Revision: https://phabricator.services.mozilla.com/D173035
2023-03-22 09:27:56 +00:00
Sean Feng
a039c090eb Bug 1818413 - Add some null pointer checks in HTMLImageMapAccessible::UpdateChildAreas r=Jamie
Given Bug 1815913 made the initialization of ImageMap earlier,
calling HTMLImageMapAccessible::UpdateChildAreas along with that
can lead to some null pointer crashes when reading mContent.

This patch adds some null pointer checks to fix this.

Differential Revision: https://phabricator.services.mozilla.com/D171889
2023-03-08 15:40:52 +00:00
Andi-Bogdan Postelnicu
d7e8a09c21 Bug 1519636 - Reformat recent changes to the Google coding style. r=glandium
Updated with clang-format version 15.0.5 (taskcluster-MKK8dHUpQkGfPLA793lizg)
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D168658
2023-02-13 15:02:07 +00:00
Ben Freist
476cccc35c Bug 1808888 - [refactor] Migrate NS_STYLE_LIST_STYLE_POSITION_* defines r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D166140
2023-01-09 07:07:13 +00:00
Nathan LaPre
96461033cd Bug 1711273: Preserve columnheader, rowheader roles with certain CSS displays set, r=Jamie
This revision addresses an issue with th elements within tables that don't have
the table CSS display style. In these cases, where we create an
ARIAGridCellAccessible for a th, we fail to report rowheader and columnheader
properly, since ARIAGridCellAccessible doesn't know how to handle th elements.
This revision fixes the problem by moving the th NativeRole logic into the
TableCellAccessible class, then calling that logic from both the ARIA grid cell
accessible NativeRole and from HTMLTableHeaderCellAccessible, as before. This
revision also updates tests reliant on the old behavior, including beefing up
an existing test aimed at this bug specifically.

Differential Revision: https://phabricator.services.mozilla.com/D163371
2022-12-01 20:17:32 +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
Ting-Yu Lin
5a69e0e771 Bug 1799732 Part 1 - Replace GetChildList(kPrincipalList) with PrincipalChildList(). r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D161862
2022-11-12 04:38:52 +00:00
Noemi Erli
7c40c0e983 Backed out 3 changesets (bug 1799732) for causing build bustages in nsIFrame.cpp CLOSED TREE
Backed out changeset e559f9dbc76f (bug 1799732)
Backed out changeset c40fda7a8b0b (bug 1799732)
Backed out changeset 1f84bfb41ab8 (bug 1799732)
2022-11-12 02:16:45 +02:00
Ting-Yu Lin
15dcf36084 Bug 1799732 Part 1 - Replace GetChildList(kPrincipalList) with PrincipalChildList(). r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D161862
2022-11-11 23:44:16 +00:00
Morgan Rae Reschenberg
93144325ec Bug 1799204: Update cached layout_guess when relevant HTML attr changes are obseved r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D161339
2022-11-08 21:52:48 +00:00
Stanca Serban
7e4d1c009a Backed out changeset 835a66221d99 (bug 1799204) for causing mochitests failures on browser_table.js.CLOSED TREE 2022-11-08 21:27:58 +02:00
Morgan Rae Reschenberg
e6edd38fd7 Bug 1799204: Update cached layout_guess when relevant HTML attr changes are obseved r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D161339
2022-11-08 17:56:58 +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
Morgan Rae Reschenberg
dbeec6c2f2 Bug 1787284: [Part 2] Cache name and create radio name pivot rule r=eeejay
Depends on D158892

Differential Revision: https://phabricator.services.mozilla.com/D159118
2022-10-27 20:32:18 +00:00
Csoregi Natalia
34701eeef7 Backed out 4 changesets (bug 1787284) for causing failures on browser_caching_relations.js. CLOSED TREE
Backed out changeset fe4a5fa0fa27 (bug 1787284)
Backed out changeset 54e0b1365f89 (bug 1787284)
Backed out changeset c6db418af190 (bug 1787284)
Backed out changeset fda6706bb580 (bug 1787284)
2022-10-21 02:43:42 +03:00
Morgan Rae Reschenberg
91b749da9e Bug 1787284: [Part 2] Cache name and create radio name pivot rule r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D159118
2022-10-20 21:40:06 +00:00
Morgan Rae Reschenberg
019604b467 Bug 1787274: Manually add combobox lists, options to the viewport cache r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D159768
2022-10-20 16:33:01 +00:00
James Teh
45537045d3 Bug 1794319: Remove a11y::EventTree, as it has been dead code for 6 years. r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D158918
2022-10-11 01:41:42 +00:00
Nathan LaPre
b5c69b9980 Bug 1788143 - Rely on selection state to determine combo box value, r=Jamie
Previously, we were not firing active state change events for the options in
<select> elements when the drop-down was expanded. This leads to possibly-stale
cached 'active' state in the parent process, which can cause Firefox to report
incorrect combo box values based on stale state. Rather than fire more 'active'
state change events to fix the problem, this revision addresses the problem by
not firing 'active' state change events for combo boxes at all, and instead
relying on the selection state when determining the combo box value in the
parent process. This revision also adds a test to verify that the behavior is
as expected.

Differential Revision: https://phabricator.services.mozilla.com/D156627
2022-09-13 16:18:52 +00:00
Daniel Holbert
c6ad0aa8e2 Bug 1472024 part 2: Add curly braces around if-controlled statements in HTMLTableAccessible.cpp. r=eeejay
This patch doesn't impact behavior.

This changes the code to align with this Mozilla coding style rule:
"Always brace controlled statements, even a single-line consequent [...]"
https://firefox-source-docs.mozilla.org/code-quality/coding-style/coding_style_cpp.html#control-structures

Depends on D155123

Differential Revision: https://phabricator.services.mozilla.com/D155143
2022-08-25 20:31:17 +00:00
Daniel Holbert
90e860f7bd Bug 1472024 part 1: Check for & gracefully handle failure return values from HTMLTableCellAccessible::GetCellIndexes. r=eeejay
HTMLTableCellAccessible::GetCellIndexes can fail via its NS_ENSURE_STATE macro,
and this patch updates its callsites to account for that possibility.  In each
case, I've just copied the existing graceful-fallback behavior that the
surrounding code uses for other unexpected conditions.

Note that I'm intentionally not using NS_ENSURE_SUCCESS in my error-handling
here, to avoid redundant warning-spam.  (In the failure scenario,
GetCellIndexes will already have spammed a warning, via its own aforementioned
NS_ENSURE_STATE call; it's usually not useful to repeat the warning in the
caller.)

Differential Revision: https://phabricator.services.mozilla.com/D155123
2022-08-23 17:30:19 +00:00