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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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