1502 Commits

Author SHA1 Message Date
James Teh
5ec432103b Bug 1821223: TextLeafPoint: Don't treat an entire table as a paragraph. r=eeejay
Table rows and cells are now treated as paragraph boundaries.
Whether a cell should be a paragraph boundary is debatable, but currently, a cell is treated as a line boundary, so this is consistent; a line shouldn't expand beyond a paragraph.

Differential Revision: https://phabricator.services.mozilla.com/D172079
2023-03-10 03:48:34 +00:00
Morgan Rae Reschenberg
60f92a62cb Bug 1820029: Inline HyperTextAccessible::TextBounds to TextLeafPoint::CharBounds r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D171503
2023-03-09 19:59:00 +00:00
Jan-Niklas Jaeschke
ebf3cd6240 Bug 1808565, part 1: Adapt Selection to support StaticRanges. r=webidl,saschanaz,masayuki,smaug
This change is necessary to support the [CSS Highlight API](https://drafts.csswg.org/css-highlight-api-1/),
which uses `Selection` internally.

To replace `nsRange` with `AbstractRange`, some sections needed to be
adapted since `nsRange`-specific features were used.
Therefore, some methods (such as `GetRangeAt()`) may only be called if
the `Selection` is *not* of type `SelectionType::eHighlight`,
as it (per spec) returns an `nsRange`.
These methods will now `MOZ_ASSERT` if called for a highlight selection.
Additional methods are implemented which return `AbstractRange`
instead and are safe to be called for every selection type.

This commit also improves support of highlight features:
- Invalidation of highlight ranges: adding/removing Ranges in-place instead of
  removing and re-adding the Selection object associated with the highlight.
- Ranges are only associated with the Selection that shares the same Document
- Fixed minor IDL issue

Differential Revision: https://phabricator.services.mozilla.com/D170582
2023-03-03 14:59:47 +00:00
James Teh
958055f388 Bug 1819802 part 1: When getting cached a11y character bounds, return a single rect rather than an array of rects. r=morgan
When hit testing, we retrieve the bounds for every character in a text leaf in a separate call.
Because we need to convert from an array of flat ints to rects, this previously meant we built the entire array for every character.
For a large text leaf, building this rect array is relatively expensive.
We only need a single rect at a time.
Therefore, RemoteAccessibleBase now returns the rect for a single requested character instead of building an array of rects.

Differential Revision: https://phabricator.services.mozilla.com/D171419
2023-03-03 03:26:21 +00:00
Morgan Rae Reschenberg
7a080d4df8 Bug 1778441: Call into HyperTextAccessible::CharBounds when computing char bounds for local-acc TextLeafPoint's r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D171285
2023-03-02 18:08:15 +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
James Teh
3d09bf554e Bug 1784752 part 1: Reset the mutation events queue and Accessible state bits before firing any mutation events. r=eeejay
See the code comments for explanation.

Differential Revision: https://phabricator.services.mozilla.com/D170556
2023-02-25 00:50:36 +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
Eitan Isaacson
8bf95c7d17 Bug 1814220 - Allow ignoring list item markers in TextLeafPoint::FindBoundary. r=Jamie
Refactor in FindBoundary to allow easier skipping of leaves in the loop.

Differential Revision: https://phabricator.services.mozilla.com/D168445
2023-02-22 04:17:31 +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
Eitan Isaacson
4cdf1e6cc0 Bug 1816536 - Fix document edge issues in FindBounary. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D169726
2023-02-21 16:37:24 +00:00
Eitan Isaacson
a8c6dc0db1 Bug 1816573 - Use flags in TextLeafPoint::FindBoundary instead of boolean arguments. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D169740
2023-02-21 16:37:23 +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
Eitan Isaacson
dbdb811bfa Bug 1811092 - P1: Add new async add/set text selection message. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D167201
2023-01-27 20:15:11 +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
9e530f224a Bug 1811834 - Clean up nsWidgetInitData. r=cmartin,geckoview-reviewers,calu
Move it to the mozilla::widget namespace.

Use enum classes for transparency, popup type, popup level, etc.

Mostly automated with sed, but there were a few manual changes required
as well in windows code because they relied on Atomic<TransparencyMode>
working (which now doesn't because TransparencyMode is 1 byte instead of
4 bytes).

Differential Revision: https://phabricator.services.mozilla.com/D167537
2023-01-23 23:58:41 +00:00
Emilio Cobos Álvarez
236a544bba Bug 1793747 - Address comment nits that I forgot to upload.
DONTBUILD

MANUAL PUSH: Trivial change CLOSED TREE
2023-01-23 11:40:23 +01: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
Nathan LaPre
b690b77391 Bug 995064: Rework group position calculation to allow intervening accs in compound ARIA widgets, r=Jamie
Transition the group position calculation - specifically the code in Update -
to Pivot such that we can handle finding siblings across intervening generic
container accessibles, such as SECTIONs. This fixes issues with finding the
values of "pos in set" and "set size" for descendant owned elements in compound
ARIA widgets. This revision also updates and adds tests for this functionality.

Differential Revision: https://phabricator.services.mozilla.com/D165756
2023-01-10 20:51:50 +00:00
Nathan LaPre
f77d2ea214 Bug 1805316: Use generic ARIA accessibles for mtable, mtr with non-table display style, r=Jamie
These MathML table elements may not have a table display style, in which case
they shouldn't be HTML table accessibles. This revision changes the logic of
MathMLMarkupMap such that mtable, mtr elements create generic ARIA accessibles
if the display style for the element is something other than 'table'. This
revision also adds a test to verify that the roles are still reported correctly,
even with this change.

Differential Revision: https://phabricator.services.mozilla.com/D165980
2023-01-09 21:03:46 +00:00
Eitan Isaacson
9bda15c625 Bug 1769824 - Move text range bounds implementation to TextLeafRange. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D166370
2023-01-09 19:56:20 +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
Olli Pettay
5d21de32ac Bug 1807812 - Remove WidgetEventTime::mTime, r=masayuki,geckoview-reviewers,m_kato
HTMLSelectEventListener changes are needed, since currently that code works somewhat by accident given that
mTime often contains totally bogus values, like PR_IntervalNow(). Those changes then reveal issues also in
browser_editAddressDialog.js.

Differential Revision: https://phabricator.services.mozilla.com/D165618
2023-01-02 12:31:40 +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
Ben Freist
ce6cd37bc7 Bug 1802799 - [refactor] Migrate NS_STYLE_TEXT_DECORATION_STYLE_* defines r=emilio,geckoview-reviewers,ohall
Differential Revision: https://phabricator.services.mozilla.com/D163177
2022-12-19 22:47:24 +00:00
Andrew McCreight
ce28c41da0 Bug 1805931, part 2 - Automated removal of uses of ROOT and UNROOT CC macros. r=smaug
As of the prior patch, these are no longer needed. I removed
these with a script, then ran clang-format on the files, then
manually reverted a few unrelated changed from the formatter.

Differential Revision: https://phabricator.services.mozilla.com/D164829
2022-12-15 19:45:01 +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
Morgan Rae Reschenberg
9bb1925772 Bug 1802386: If we can't find a PresContext or the root PresContext, bail out of WillRefresh r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D164270
2022-12-14 18:26:19 +00:00
Morgan Rae Reschenberg
a0c829b432 Bug 1804991: Issue a warning if we attempt to stringify an empty array, but don't crash r=nlapre
Differential Revision: https://phabricator.services.mozilla.com/D164391
2022-12-09 23:56:58 +00:00
James Teh
ca834233da Bug 1802040: Track the focused DocAccessibleParent on Android. r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D163707
2022-12-07 13:42:30 +00:00
Nathan LaPre
391c21b2f8 Bug 1802240: Use generic ARIA grid cell accessible for mtd elements without table style, r=Jamie
This revision changes the logic in MathMLMarkupMap such that mtd elements create
generic ARIA grid accessibles if the display style for the element is something
other than 'table'. This revision also adds a test that verifies that the roles
remain as expected, even with this change.

Differential Revision: https://phabricator.services.mozilla.com/D163898
2022-12-06 20:41:44 +00:00
Morgan Rae Reschenberg
397dcfd11b Bug 1803814: Remove Maybe wrapper from RelationData's mReverseType member r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D163858
2022-12-05 23:42:52 +00:00
James Teh
0ed15e0a86 Bug 1802268 part 2: Reinstate partial invalidation of cached HyperText offsets for local HyperTextAccessible. r=eeejay
In bug 1766794, I replaced partial invalidation of cached offsets with full cache invalidation.
I did this to simplify the code, since the offsets cache was being extended to RemoteAccessible.
This is fine for RemoteAccessible because offsets are only needed there when clients query them.
However, for local HyperTextAccessible, offsets are always required to fire text events.
Full cache invalidation there meant that many insertions into a large container was very expensive.

To fix this, reinstate the ability to partially invalidate the offsets cache.
This is largely the code I previously removed from HyperTextAccessible, with some tweaks for readability.

Differential Revision: https://phabricator.services.mozilla.com/D163418
2022-12-05 23:27:24 +00:00
James Teh
2dea45bfcf Bug 1802268 part 1: Add AccAttributes::GetMutableAttribute. r=eeejay,nlapre
We will soon have an offsets array in the parent process cache which is not built in one shot.
Instead, we will gradually cache more offsets as they are requested.
To do this, we need a way to get an array from the cache which can be modified in-place.

Differential Revision: https://phabricator.services.mozilla.com/D163417
2022-12-05 23:27:23 +00:00
Eitan Isaacson
f9fbfefda3 Bug 1801986 - Set pivot root to top remote document. r=Jamie
The pivot should never cross from remote into parent process local
containers. We need to explicitly set the root for the pivot, and
assert for this in the pivot traversal methods.

Differential Revision: https://phabricator.services.mozilla.com/D163285
2022-11-29 20:31:21 +00:00