Commit Graph

343 Commits

Author SHA1 Message Date
Sylvestre Ledru
b0fe72dee5 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-15 15:29:02 +00:00
Cristina Horotan
7388749830 Backed out 2 changesets (bug 1856795) for causing build bustage at BasicEvents.h CLOSED TREE
Backed out changeset 1d98b028923a (bug 1856795)
Backed out changeset eae2ac93e17c (bug 1856795)
2023-10-14 21:42:14 +03:00
Sylvestre Ledru
4a97019e39 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-14 17:34:26 +00:00
Morgan Rae Reschenberg
6838fa693a Bug 1853255: Make parent relative bounds for IB-split descendants account for the parent's bounding box offset r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D188523
2023-09-25 21:49:08 +00:00
Noemi Erli
136229a3e8 Backed out changeset cf2c8ac2f33c (bug 1853255) for causing failures in Browser_zero_area.js CLOSED TREE
accessible/tests/browser/bounds/browser_position.js
2023-09-20 09:19:03 +03:00
Morgan Rae Reschenberg
1dbffe7993 Bug 1853255: Make parent relative bounds for IB-split descendants account for the parent's bounding box offset r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D188523
2023-09-20 00:23:42 +00:00
James Teh
7f6c8d5cd7 Bug 1849007: Skip non-rendered characters in a11y cached character rects, since a11y only deals with rendered text. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D186521
2023-09-06 04:55:28 +00:00
James Teh
877e002509 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
d9ee2ad4ee Bug 1743749 part 2: Replace usage of atoms as cache keys with the new CacheKey aliases. r=nlapre
This was done with the following Python script:

```
import re

cacheConsts = open("accessible/base/CacheConstants.h", "rt").read()
aliases = {
  alias: atom
  for atom, alias in
  re.findall(
    r'static constexpr nsStaticAtom\*\s+(.*?)\s+=\s+(nsGkAtoms::.*?);',
    cacheConsts
  )
}

RE_ATOM = re.compile(r'(fields->SetAttribute|(?:mCachedFields|aFields)->(?:GetAttribute|GetAttributeRefPtr|GetMutableAttribute|HasAttribute|Remove|SetAttribute)(?:<.+>)?)(\(\s*)(nsGkAtoms::[a-zA-Z_]+)')

def repl(m):
  # Group 3 is the atom.
  alias = aliases.get(m.group(3))
  if not alias:
    # No alias for this atom. Return input unaltered.
    return m.group(0)
  alias = "CacheKey::" + alias
  # Groups 1 and 2 should be returned unaltered. Group 3 (the atom) is replaced
  # with the alias.
  return m.group(1) + m.group(2) + alias

for fn in (
  # Found with: git grep -l 'ields->'
  "accessible/base/CachedTableAccessible.cpp",
  "accessible/base/nsAccessibilityService.cpp",
  "accessible/base/TextLeafRange.cpp",
  "accessible/generic/LocalAccessible.cpp",
  "accessible/ipc/DocAccessibleParent.cpp",
  "accessible/ipc/RemoteAccessible.cpp",
  "accessible/ipc/RemoteAccessible.h",
  "accessible/windows/sdn/sdnAccessible.cpp",
):
  input = open(fn, "rt").read()
  output = RE_ATOM.sub(repl, input)
  open(fn, "wt").write(output)
```

Differential Revision: https://phabricator.services.mozilla.com/D184791
2023-07-31 23:09:56 +00:00
Morgan Rae Reschenberg
d6d4ed01ef Bug 1837414: Modify viewport cache to ignore frames that are visible, but have pointer-events:none r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D184449
2023-07-26 22:50:39 +00:00
Iulian Moraru
4218c3ec3d Backed out changeset 85de6d1cd724 (bug 1837414) for causing browser-a11y failures on browser_test_general.js. CLOSED TREE 2023-07-26 06:32:25 +03:00
Morgan Rae Reschenberg
5c662035a2 Bug 1837414: Modify viewport cache to ignore frames that are visible, but have pointer-events:none r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D184449
2023-07-26 02:33:25 +00:00
James Teh
16935b4b44 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
James Teh
d206d4737a 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
48b356eef4 Bug 1694573 part 5: Make LocalAccessible call Platform*Event. Remove most of the platform HandleAccEvent overrides. r=eeejay
Mac and Android still override HandleAccEvent for platform specific behaviour other than firing the event.
The Android behaviour can be unified properly in future work.

ATK is the platform layer with the most churn because there were inconsistencies in the way local and remote events were handled.
I'm reasonably sure these were unintentional inconsistencies, so I've done my best to unify them.

Differential Revision: https://phabricator.services.mozilla.com/D183704
2023-07-19 02:56:54 +00:00
Nathan LaPre
89ac38d8ce Bug 1840732 Part 3: Remove unnecessary includes from accessible/generic, r=Jamie
This revision removes unnecessary include directives from cpp files in the
accessible/generic directory. These suggestions came from the Include What You
Use tool.

Depends on D182397

Differential Revision: https://phabricator.services.mozilla.com/D182398
2023-07-07 03:22:07 +00:00
James Teh
5842868101 Bug 1841216: Fire a11y description change event when aria-description is changed. r=nlapre
Differential Revision: https://phabricator.services.mozilla.com/D182544
2023-07-06 01:32:56 +00:00
James Teh
30229aefe2 Bug 1835728: Don't expose the display attribute in Accessible::Attributes for presentational elements for which we forced a generic Accessible. r=morgan
role="presentation" is used by pdf.js on certain spans so that display: block won't be exposed to screen readers.
Because they also have a transform, we force generic Accessibles for them.
Previously, we exposed the display attribute in this case, just like we would for any other Accessible.
To fix this, special case these presentational forced generics:

1. LocalAccessible::DisplayStyle returns null if this is a presentational element for which we forced a generic Accessible.
2. LocalAccessible::BundleFieldsForCache already used DisplayStyle, so no change was needed for the cache.
3. LocalAccessible::Attributes now uses DisplayStyle instead of calculating the display attribute itself so that it can benefit from the conditional exposure in (1).

Differential Revision: https://phabricator.services.mozilla.com/D182754
2023-07-06 00:57:57 +00:00
James Teh
6541ef4a88 Bug 1840295: Remove Windows specific ifdefs for PDocAccessible:: FocusEvent and CaretMoveEvent. r=eeejay
On Windows, focus and caret move events include the caret rectangle.
This isn't used on other platforms.
To simplify the cross-platform interface (including Platform.h), remove the ifdefs from there.
However, we use ifdefs to avoid calculating the rectangle on non-Windows platforms, instead just sending an empty rectangle.

Differential Revision: https://phabricator.services.mozilla.com/D182138
2023-07-05 04:15:27 +00:00
Eitan Isaacson
3f95e6d57a Bug 1754905 - Match Pivot API in nsIAccessiblePivot. r=Jamie
This patch does several things:
1. Remove virtual cursor doc accessible member.
2. Remove state-keeping nsAccessiblePivot implementation and replace it
   with something that is much more similar to the native Pivot
   interface.
3. Move nsIAccessiblePivot implementation to xpcom and rename it
   xpcAccessiblePivot.
4. Delete mochitests and introduce browser tests.
5. Make new xpcom implementation work on remote accessibles as well.

Differential Revision: https://phabricator.services.mozilla.com/D181813
2023-06-28 21:45:16 +00:00
Iulian Moraru
2cdfa8bd32 Backed out changeset f3095da827d9 (bug 1754905) for causing build bustages on DocAccessibleWrap. CLOSED TREE 2023-06-28 03:03:37 +03:00
Eitan Isaacson
1cb554dcd7 Bug 1754905 - Match Pivot API in nsIAccessiblePivot. r=Jamie
This patch does several things:
1. Remove virtual cursor doc accessible member.
2. Remove state-keeping nsAccessiblePivot implementation and replace it
   with something that is much more similar to the native Pivot
   interface.
3. Move nsIAccessiblePivot implementation to xpcom and rename it
   xpcAccessiblePivot.
4. Delete mochitests and introduce browser tests.
5. Make new xpcom implementation work on remote accessibles as well.

Differential Revision: https://phabricator.services.mozilla.com/D181813
2023-06-27 16:59:54 +00:00
Butkovits Atila
edfc01c6da Backed out changeset 4d92a76cedd0 (bug 1754905) for causing bustages at LocalAccessible. CLOSED TREE 2023-06-27 03:46:47 +03:00
Eitan Isaacson
890e742c09 Bug 1754905 - Match Pivot API in nsIAccessiblePivot. r=Jamie
This patch does several things:
1. Remove virtual cursor doc accessible member.
2. Remove state-keeping nsAccessiblePivot implementation and replace it
   with something that is much more similar to the native Pivot
   interface.
3. Move nsIAccessiblePivot implementation to xpcom and rename it
   xpcAccessiblePivot.
4. Delete mochitests and introduce browser tests.
5. Make new xpcom implementation work on remote accessibles as well.

Differential Revision: https://phabricator.services.mozilla.com/D181813
2023-06-27 00:05:16 +00:00
James Teh
5ad1c25e81 Bug 1831035 part 5: Remove the (now empty) platform specific DocAccessibleChild classes and rename DocAccessibleChildBase to DocAccessibleChild. r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D181850
2023-06-26 21:20:13 +00:00
Stanca Serban
d2b4fb46e0 Backed out changeset 8be4693aecbb (bug 1754905) for causing bustages in xpcAccessiblePivot.h. CLOSED TREE 2023-06-24 03:22:31 +03:00
Eitan Isaacson
3c36e899fd Bug 1754905 - Match Pivot API in nsIAccessiblePivot. r=Jamie
This patch does several things:
1. Remove virtual cursor doc accessible member.
2. Remove state-keeping nsAccessiblePivot implementation and replace it
   with something that is much more similar to the native Pivot
   interface.
3. Move nsIAccessiblePivot implementation to xpcom and rename it
   xpcAccessiblePivot.
4. Delete mochitests and introduce browser tests.
5. Make new xpcom implementation work on remote accessibles as well.

Differential Revision: https://phabricator.services.mozilla.com/D181813
2023-06-23 23:22:34 +00:00
Emilio Cobos Álvarez
529c9ee321 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
Morgan Rae Reschenberg
6a1068692c Bug 1837024: Only do fuzzy hittesting on descendants of clipped accs r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D181166
2023-06-21 22:42:07 +00:00
Eitan Isaacson
f06c32d5d5 Bug 1839515 - Remove pivot text navigation API. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D181576
2023-06-21 21:15:47 +00:00
Norisz Fay
63828a0456 Backed out changeset 8178c74a4c65 (bug 1839515) for causing mochitest failures on browser_events_vcchange.js 2023-06-21 22:21:29 +03:00
Eitan Isaacson
9abea69b99 Bug 1839515 - Remove pivot text navigation API. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D181576
2023-06-21 17:55:06 +00:00
James Teh
6c835a9eb6 Bug 1838540: Don't recurse in ApplyARIAState on a grid cell if the cell is also a table. r=nlapre
This can only happen due to authoring error; <table role=gridcell outside of an ARIA grid isn't valid.
Nevertheless, we would previously recurse infinitely in this case in ApplyARIAState.
Prevent this by not recursing if IsTable() is true.

Differential Revision: https://phabricator.services.mozilla.com/D181026
2023-06-15 22:48:17 +00:00
James Teh
81e86bad27 Bug 1837430: Fix LocalAccessible::EmbeddedChildAt such that it returns a remote document if appropriate. r=morgan
In bug 1834006, I unified the ATK child retrieval code so that it uses Accessible::EmbeddedChildAt, rather than having different code paths for local, remote, local OuterDocAccessibles embedding remote documents, etc.
Unfortunately, LocalAccessible::EmbeddedChildAt previously didn't handle remote document children, even though LocalAccessible::EmbeddedChildCount returned 1.
This meant that we weren't returning a child at all in this case on Linux, resulting in a broken tree.
To fix this, make LocalAccessible::EmbeddedChildAt fall back to ChildAt instead of LocalChildAt.

Differential Revision: https://phabricator.services.mozilla.com/D180606
2023-06-14 01:44:50 +00:00
James Teh
641a36002e Bug 1837825: Always cache the src of images, even those with alt text. r=morgan
Unfortunately, authors providing useless alt text is becoming increasingly common, so in the real world, we can't assume that having alt text makes an image accessible.

Differential Revision: https://phabricator.services.mozilla.com/D180608
2023-06-13 00:20:51 +00:00
James Teh
8401e7c2ef 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
c27aa8cbfa Bug 1832228 part 2: Remove TableAccessible and TableCellAccessible. r=nlapre
These classes are no longer used.
The remaining XUL subclasses now derive from Table*AccessibleBase.
XULTreeGridAccessible depended on some methods in TableAccessible which are no longer used by anything else, so these have been moved into XULTreeGridAccessible itself.

Differential Revision: https://phabricator.services.mozilla.com/D179802
2023-06-08 09:50:28 +00:00
James Teh
bfa76bed8b Bug 1832228 part 1: Remove ARIAGridAccessible, ARIARowAccessible and most of ARIAGridCellAccessible. r=nlapre
We now use CachedTableAccessible for ARIA tables and grids, so most of the code in the ARIA table classes was unused.

1. Remove ARIAGridAccessible and ARIARowAccessible completely.
2. ARIAGridCellAccessible no longer derives from TableCellAccessible.
3. Remove most of ARIAGridCellAccessible.
4. We still use ARIAGridCellAccessible to differentiate between valid and invalid cells. Valid cells create an ARIAGridCellAccessible and ARIAGridCellAccessible::IsTableCell() returns true due to mGenericTypes. Invalid cells don't get an ARIAGridCellAccessible, so IsTableCell() returns false on those.
5. We also keep the code in ARIAGridCellAccessible to expose some states and attributes.
6. The code for creating ARIAGridCellAccessible in CreateAccessible has been refactored, both for simplification and to fix bugs. display: contents tables now properly get the table and table cell interfaces; i.e. IsTable() and IsTableCell() return true when appropriate. Walking non-generic ancestors should fix ARIA tables with intervening generics, though this will be dealt with fully in a separate bug.

Differential Revision: https://phabricator.services.mozilla.com/D179801
2023-06-08 09:50:28 +00:00
James Teh
2ee4be5f92 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
16aa5c42a9 Bug 1833313: Remove all remaining a11y cache checks and non-caching code except for Mac specific bits. r=morgan,geckoview-reviewers,calu
Differential Revision: https://phabricator.services.mozilla.com/D178146
2023-05-28 23:42:12 +00:00
Eitan Isaacson
bcfcace8fe Bug 1826869 - Cache doc mime type and make available via DocAccessibleParent. r=morgan,ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D178887
2023-05-26 22:17:13 +00:00
Sandor Molnar
d1c4b13412 Backed out changeset dbb7e27f8464 (bug 1833313) for causing android gv-junit crashes. CLOSED TREE 2023-05-24 14:08:03 +03:00
James Teh
de23c323b0 Bug 1833313: Remove all remaining a11y cache checks and non-caching code except for Mac specific bits. r=morgan,geckoview-reviewers,calu
Differential Revision: https://phabricator.services.mozilla.com/D178146
2023-05-24 10:10:46 +00:00
James Teh
446bf3da6e Bug 1821956 part 6: Remove event deferral and sync text change events from Windows PDocAccessible. r=nlapre
We only needed to defer events because of the need to wait for a parent COM proxy.
Similarly, sync text change events (as opposed to async) were only necessary with the COM proxy architecture.
Now that there are no COM proxies, neither of these are necessary.

Differential Revision: https://phabricator.services.mozilla.com/D177899
2023-05-21 22:23:47 +00:00
James Teh
ddfdb64368 Bug 1821955 part 5: Change all CtW pref checks to use a11y::IsCacheActive. r=eeejay,taskgraph-reviewers,bhearsum
This was done using the following script:

```
matchingFiles=`git grep -l accessibility_cache_enabled`
sed -i 's/StaticPrefs::accessibility_cache_enabled_AtStartup/a11y::IsCacheActive/' $matchingFiles
for f in $matchingFiles; do
  usesA11yPref=
  grep -q StaticPrefs::accessibility_ $f && usesA11yPref=1
  hasA11yInclude=
  grep -q 'nsAccessibilityService.h' $f && hasA11yInclude=1
  if [ -z $usesA11yPref ] && [ -z $hasA11yInclude ]; then
    sed -i 's,mozilla/StaticPrefs_accessibility.h,nsAccessibilityService.h,' $f
  elif [ -z $usesA11yPref ] && [ $hasA11yInclude ]; then
    sed -i '/"mozilla.StaticPrefs_accessibility.h"/d' $f
  elif [ $usesA11yPref ] && [ -z $hasA11yInclude ]; then
    sed -i '/"mozilla.StaticPrefs_accessibility.h"/a#include "nsAccessibilityService.h"' $f
  fi
done
```

Differential Revision: https://phabricator.services.mozilla.com/D177722
2023-05-19 02:56:48 +00:00
Morgan Rae Reschenberg
387579bf42 Bug 1825411: Cache scroll position for unscrolled scroll frames r=nlapre
Differential Revision: https://phabricator.services.mozilla.com/D176093
2023-05-08 20:51:12 +00:00
Morgan Rae Reschenberg
774a540677 Bug 1825611: Cache overflow r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D175193
2023-05-08 20:51:11 +00:00
Natalia Csoregi
8c6d9dd6d9 Backed out 6 changesets (bug 1825611, bug 1825411, bug 1828373) for failures on /browser_general.js. CLOSED TREE
Backed out changeset fa9772a45927 (bug 1825411)
Backed out changeset 51f495933300 (bug 1828373)
Backed out changeset 74462e3c7265 (bug 1825611)
Backed out changeset 683910281b5d (bug 1825611)
Backed out changeset 7e2ffdd02a98 (bug 1825611)
Backed out changeset 920bae37ff3e (bug 1825611)
2023-05-04 02:31:02 +03:00
Morgan Rae Reschenberg
93364a39bd Bug 1825411: Cache scroll position for unscrolled scroll frames r=nlapre
Differential Revision: https://phabricator.services.mozilla.com/D176093
2023-05-03 22:26:40 +00:00
Morgan Rae Reschenberg
2769c69de2 Bug 1825611: Cache overflow r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D175193
2023-05-03 22:26:39 +00:00