Commit Graph
295 Commits
Author SHA1 Message Date
Leo Tenenbaum 14e83643ee Bug 2037794 - Set properties of original caret instead of drag+drop caret where needed. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D299228
2026-05-15 17:25:28 +00:00
Atila Butkovits 6706fac649 Revert "Bug 2037794 - Set properties of original caret instead of drag+drop caret where needed. r=masayuki" for causing failures at test_drag_drop_caret.html.
This reverts commit 524b0cc22b.
2026-05-15 13:53:29 +00:00
Leo Tenenbaum 524b0cc22b Bug 2037794 - Set properties of original caret instead of drag+drop caret where needed. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D299228
2026-05-15 13:07:26 +00:00
Daniel Holbert b4e4f5d2f5 Bug 2038733: Use MakeRefPtr to do allocation for local RefPtr variables, in accessible/. r=accessibility-platform-reviewers,Jamie
Differential Revision: https://phabricator.services.mozilla.com/D299763
2026-05-12 07:20:02 +00:00
Jonathan Watt 017557984b Bug 2030928. Rename mozilla::ScrollAxis to mozilla::AxisScrollParams. r=credential-management-reviewers,layout-reviewers,emilio,dimi
The current mozilla::ScrollAxis struct in PresShellForwards.h isn't a simple
axis enum. It carries information about where to scroll to along a specific
axis, and under what conditions that should happen. So 'ScrollAxis' isn't the
best name.

Now we're introducing WebIDL 'ScrollAxis' in bug 1350457:

https://drafts.csswg.org/scroll-animations-1/#scrolltimeline-interface

The extensive use of PresShellForwards.h's ScrollAxis in DOM code makes it
conflict with this new DOM enum. Rather than try to fix this through lots of
explitic namespacing, this patch renames PresShellForwards.h's ScrollAxis.

Differential Revision: https://phabricator.services.mozilla.com/D293485
2026-04-14 12:59:21 +00:00
Eitan Isaacson 9078dc5db3 Bug 2027293 - Retrieve and hold editor before calling SetSelectionBoundsAt. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D292197
2026-04-11 22:28:11 +00:00
Sylvestre Ledru eafe8b152d Bug 2023419 - Remove Emacs/Vim modelines from accessible/ r=emilio
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287834
2026-03-18 10:29:47 +00:00
Serban Stanca 5a709d4a9a Revert "Bug 2023419 - Remove Emacs/Vim modelines from accessible/ r=emilio" for causing mochitests failures in browser_action.js.
This reverts commit 2fa4815c8d.
2026-03-17 15:34:26 +00:00
Sylvestre Ledru 2fa4815c8d Bug 2023419 - Remove Emacs/Vim modelines from accessible/ r=emilio
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287834
2026-03-17 09:21:51 +00:00
Frédéric Wang 291e676b1d Bug 2008902 - Convert MathML embellish flags to mozilla::EnumSet. r=emilio,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D278100
2026-01-08 15:26:33 +00:00
Masayuki Nakano 08081920e2 Bug 1998858 - part 1: Make nsIFrame treat editable nodes always selectable r=emilio,jfkthame,layout-reviewers
As tested by `css/css-ui/user-select-none-in-editable.html`, we should
treat editable nodes as selectable even if `user-select: none` is
specified.

Then, some tests start failing due to an existing bug of caret move
when an inline element starts/ends with invisible white-spaces.
Therefore, to make them keep passing, this fixes the bug of
`nsTextFrame::PeekOffsetCharacter()`.

Differential Revision: https://phabricator.services.mozilla.com/D272608
2025-11-21 00:16:52 +00:00
Eitan Isaacson 2aa75940f5 Bug 1997461 - Introduce HTMLAbbreviationAccessible. r=morgan
Made a new subclass for abbr, this also removes a special case in
HyperTextAccessible, which is good.

Differential Revision: https://phabricator.services.mozilla.com/D270762
2025-11-11 01:28:56 +00:00
Eitan Isaacson 508bd44a39 Bug 1942799 - P1: Intro IsEditable(Root) to distinguish editable content. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D268627
2025-10-22 03:15:05 +00:00
Sandor Molnar 0a130f7757 Revert "Bug 1942799 - P6: Change mozTextAccessible to a mozAccessible category. r=Jamie" for causing build bustages @ Platform.mm
This reverts commit c06c2d185f.

Revert "Bug 1942799 - P5: Remove private mozTextAccessible extension. r=Jamie"

This reverts commit 0e6e2e8f09.

Revert "Bug 1942799 - P4: Remove specialized moxRole and provide AXTextField/AXTextArea role to contenteditable. r=Jamie"

This reverts commit b6bfacef41.

Revert "Bug 1942799 - P3: Remove specialized moxRequired, moxInvalid and moxValue. r=morgan"

This reverts commit 34472dcf24.

Revert "Bug 1942799 - P2: Make root editables multiline by default and expose value. r=morgan"

This reverts commit c1c636ea74.

Revert "Bug 1942799 - P1: Intro IsEditable(Root) to distinguish editable content. r=morgan"

This reverts commit 35f6ad2187.
2025-10-21 18:16:20 +00:00
Eitan Isaacson 35f6ad2187 Bug 1942799 - P1: Intro IsEditable(Root) to distinguish editable content. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D268627
2025-10-21 17:06:14 +00:00
serge-sans-paille def70ad6d7 Bug 1993115 - Cleanup mfbt/IntegerRange.h r=emilio
Use inline friend operator declaration, which in turns disable
comparison between iterators over integer of different types.

Also remove useless inclusion in the process.

Differential Revision: https://phabricator.services.mozilla.com/D267876
2025-10-08 15:00:52 +00:00
James Teh 6fe00ec561 Bug 1979204: Invalidate cached HyperText offsets when relocating a child within its parent. r=eeejay
Previously, we did this for insertion and removal, but not relocation.
This meant that if something queried HyperText offsets soon after a child was relocated, the HyperText offset cache could be stale.
This could result in very broken expectations such as an embedded object having more than 1 offset.
This was causing an assertion, but could likely result in other obscure problems too.

Differential Revision: https://phabricator.services.mozilla.com/D259210
2025-07-31 03:30:08 +00:00
Eitan Isaacson 75f3d184f9 Bug 1966812 - Cache rect bounds in DocAccessibleParent. r=Jamie
Moved GetCaretRect to HyperTextAccessibleBase. I could see this living
in TextLeafPoint, but it is a bit confusing when a point is a caret and
when it is a simple offset. I think we would need to either add an
mIsCaret field to the class, or have a special static CaretBounds
method.

Differential Revision: https://phabricator.services.mozilla.com/D256377
2025-07-15 23:30:32 +00:00
Alexandru Marc 83bc2bce51 Revert "Bug 1966812 - Cache rect bounds in DocAccessibleParent. r=Jamie" for causing ba failures @ browser_caret_rect.js
This reverts commit 12c9970d79.
2025-07-14 22:31:51 +00:00
Eitan Isaacson 12c9970d79 Bug 1966812 - Cache rect bounds in DocAccessibleParent. r=Jamie
Moved GetCaretRect to HyperTextAccessibleBase. I could see this living
in TextLeafPoint, but it is a bit confusing when a point is a caret and
when it is a simple offset. I think we would need to either add an
mIsCaret field to the class, or have a special static CaretBounds
method.

Differential Revision: https://phabricator.services.mozilla.com/D256377
2025-07-14 21:01:37 +00:00
James Teh d950998711 Bug 1946645: Remove HyperTextAccessible::SelectionCount and SelectionBoundsAt. r=morgan
These are implemented in HyperTextAccessibleBase.
Having local and remote use the same implementation makes things simpler, more consistent, easier to test and easier to reason about.
This is also necessary in order to properly test the fix in the next patch.

This breaks the rare edge case of selecting only empty containers for LocalAccessible.
This never worked for RemoteAccessible anyway, which is the majority of content now.
Bug 1973154 has been filed for this.

These functions were the only callers of HyperTextAccessible::GetSelectionDOMRanges, so that has been removed as well.
However, GetSelectionDOMRanges had an early return to deal with bug 1840574.
That early return has been migrated to HyperTextAccessible::SelectionRanges, which is called by the HyperTextAccessibleBase implementations of SelectionCount and SelectionBoundsAt, thus ensuring that we still handle the case in bug 1840574.

Differential Revision: https://phabricator.services.mozilla.com/D254466
2025-06-24 00:11:33 +00:00
James Teh 7932ffe32b Bug 1963996: Clear the selection if IAccessibleTextSelectionContainer::setSelections is called with nSelections set to 0. r=eeejay
I removed this behaviour in bug 1951573.
Unfortunately, it turns out that contrary to the spec (which says "1 or more selections"), NVDA depends on this behaviour.
Reinstate this by supporting kRemoveAllExistingSelectedRanges in HyperTextAccessibleBase::RemoveFromSelection and using that.

Differential Revision: https://phabricator.services.mozilla.com/D247875
2025-05-08 06:52:14 +00:00
James Teh b24c675911 Bug 1907225: HyperTextAccessible::DOMPointToOffset: If a text node doesn't have an Accessible, don't use an offset relative to that text node. r=eeejay
This was causing an assertion when firing caret events where the element containing the caret is aria-hidden, since the offset we produced was effectively bogus for the target Accessible.
Doing this is bad authoring, but we need to at least ensure the offset is valid.
Arguably, we shouldn't fire caret events at all in this case, but this is a trickier, riskier fix and I don't think it makes sense to spend time on that to compensate for bad authoring.

Differential Revision: https://phabricator.services.mozilla.com/D240579
2025-03-14 03:13:04 +00:00
Tom Schuster b8d11d463f Bug 1951893 - Remove unneeded StaticAtom suffixes. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D240598
2025-03-11 11:36:09 +00:00
James Teh 5f2cb7e5d1 Bug 1951573 part 4: Remove HyperTextAccessible::SetSelectionRange. r=eeejay
There were still some callers of SetSelectionRange, but these can now all be trivially converted to use SetSelectionBoundsAt (which calls TextLeafRange::SetSelection).

Differential Revision: https://phabricator.services.mozilla.com/D240277
2025-03-05 23:42:51 +00:00
James Teh db6b4008a2 Bug 1948149: HyperTextAccessible::DOMPointToOffset: For a text node, constrain the offset to the length of the TextLeafAccessible. r=nlapre
Sometimes, text in the accessibility tree can be out of date with DOM briefly because the accessibility engine updates text asynchronously.
When this happens, DOMPointToOffset can be called on a text node with an offset which is valid for DOM, but not yet valid for accessibility.
Previously, we ended up producing an invalid HyperText offset, causing a crash.
The best we can do in this case is gracefully constrain the offset to the text in the accessibility tree.

In the scenario in this bug report, the user was typing into the address bar.
The address bar added and selected text due to an autocomplete suggestion.
After the DOM update but before the accessibility tree was updated, a UIA client queried the selection.
Since selection is retrieved from DOM, this resulted in an offset that didn't exist in the accessibility tree.
Now that the offset is constrained, this will no longer result in a crash.

Differential Revision: https://phabricator.services.mozilla.com/D238413
2025-02-18 21:36:58 +00:00
James Teh b3e63ee46b Bug 1946643: Remove HyperTextAccessible::CaretLineNumber, since the HyperTextAccessibleBase implementation supports both local and remote. r=nlapre
Differential Revision: https://phabricator.services.mozilla.com/D237513
2025-02-13 00:54:07 +00:00
Masayuki Nakano da4abce2d9 Bug 1945714 - Rename RangeBoundaryBase::Container() to GetContainer() r=jjaschke,dom-core
Usually, we name methods as `GetFoo()` if they may return `nullptr`, on the
other hand, we name methods as `Foo()` if they won't return `nullptr`.

`RangeBoundaryBase::Container()` may return `nullptr`.  So, this name may cause
misleading of some developers.  Let's rename it as `GetContainer()`.

This does not change anything for avoiding merge conflict with the other
landings.

Differential Revision: https://phabricator.services.mozilla.com/D236796
2025-02-10 01:29:40 +00:00
Masayuki Nakano e595f1e9aa Bug 1945711 - part 3: Make some callers of nsContentUtils::ComparePoints use the RangeBoundaryBase version r=jjaschke,dom-core
There are some callers of parent/offset version which computes offset before.
However, the offset may not be used.  Therefore, the callers should use
`RangeBoundaryBase` version.

Additionally, if only one of the pairs is computed from `RangeBoundaryBase`,
such callers should use the `RangeBoundaryBase` version too because the offset
computation may be skipped.  In this case, temporary `RangeBoundaryBase` should
be a `RawRangeBoundary` and whose `aRangeIsMutationObserver` should be set to
`RangeBoundaryIsMutationObserved::No` to avoid immediately to compute the child
node from `aOffset`.  I think that this should be default to
`RangeBoundaryIsMutationObserved::No` in the future, but for now, we should just
make the users explicitly set it to `RangeBoundaryIsMutationObserved::No` for
avoiding regressions.

Differential Revision: https://phabricator.services.mozilla.com/D236793
2025-02-10 01:29:39 +00:00
Jan-Niklas Jaeschke 32b0a740b7 Bug 1933738, part 2 - Change all calls to nsFrameSelection::GetSelection(eNormal) to nsFrameSelection::NormalSelection(). r=emilio
`nsFrameSelection::NormalSelection()` returns a `Selection&`, which eliminates the need for nullptr check at call sites.
This simplifies the code in some places and removes unnecessarily indented blocks.

Differential Revision: https://phabricator.services.mozilla.com/D230583
2024-11-29 07:31:58 +00:00
Emilio Cobos Álvarez 1123d2e75f Bug 1926031 - Make Selection::ScrollIntoView take ScrollFlags. r=jjaschke,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D226389
2024-10-22 09:58:02 +00:00
Emilio Cobos Álvarez 6a6f7270d4 Bug 1926031 - Remove unused SCROLL_FOR_CARET_MOVE. r=jjaschke,masayuki
No point in keeping the code around.

Differential Revision: https://phabricator.services.mozilla.com/D226387
2024-10-22 09:34:28 +00:00
James Teh eb0d0a4072 Bug 1837126: Don't set the selection range when HyperTextAccessibleBase::PasteText is called with TEXT_OFFSET_CARET. r=eeejay
If no text is selected, this is the same as passing the caret offset, since the selection range is already where we want it.
However, if text is selected, this allows the caller to replace it, just as it would be when pasting using the keyboard or GUI.
Note that this doesn't break any existing expectations because TEXT_OFFSET_CARET was never supported for this method previously.

This allows us to remove the DeleteText call from Android SessionAccessibility::Paste.
This separate DeleteText call was causing problems because it could result in the deletion and the insertion happening in two separate ticks, resulting in incorrect events.
Now, this should always happen in a single tick.

Differential Revision: https://phabricator.services.mozilla.com/D226108
2024-10-20 22:35:34 +00:00
Ting-Yu Lin 6985a5b20e Bug 1896516 Part 8 - Remove nsIScrollableFrame usages under accessible/. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D211495
2024-05-30 06:32:20 +00:00
Sebastian Hengst bf4dfe53f8 Backed out 15 changesets (bug 1896516) for causing scrolling crashes on macOS. a=backout
Backed out changeset fd6904338812 (bug 1896516)
Backed out changeset 2977ff81a23e (bug 1896516)
Backed out changeset c8a6b0e526d6 (bug 1896516)
Backed out changeset 3c06f22da72b (bug 1896516)
Backed out changeset f63b0c4335fe (bug 1896516)
Backed out changeset 6f7ab8adfa6e (bug 1896516)
Backed out changeset 997c9249dbed (bug 1896516)
Backed out changeset c964fccd5180 (bug 1896516)
Backed out changeset 7b481b747b7a (bug 1896516)
Backed out changeset 42e1bbe0ecb6 (bug 1896516)
Backed out changeset 717dac08b607 (bug 1896516)
Backed out changeset 2f0817331dbe (bug 1896516)
Backed out changeset b765169a7a8f (bug 1896516)
Backed out changeset a2d37b98273c (bug 1896516)
Backed out changeset ea9ecb543e66 (bug 1896516)
2024-05-29 11:22:52 +02:00
Ting-Yu Lin 1378119f9d Bug 1896516 Part 8 - Remove nsIScrollableFrame usages under accessible/. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D211495
2024-05-28 04:46:19 +00:00
Masayuki Nakano 0f8ffe6344 Bug 1878191 - Fix 2 iterating loops of selection ranges r=smaug,Jamie
These loops may run script.

In  `HyperTextAccessible`, it calls
`RemoveRangeAndUnselectFramesAndNotifyListeners`. So, chrome script which is not
directly related to this module may run in each call.  I think that using
`RemoveAllRanges` is better for here.  Before bug 1735446, this loop tried
to keep first range, but accidentally, I changed this loop delete all ranges.
However, `SetSelectionBoundsAt` will add a range if it's required and there is
no bug reports.  Therefore, I think keep the new behavior is better.

In `nsRange::DeleteFromDocument`, the loop may run mutation events too.
Therefore, it needs to store all ranges first.  Then, the preceding patch
changes the behavior here if a selection range is moved to different root.
Previously, it was deleted, but now, they are not touched.

Depends on D200606

Differential Revision: https://phabricator.services.mozilla.com/D200607
2024-02-07 04:34:38 +00:00
James Teh 46c636e07b Bug 1840574: Don't try to get the selection in HyperTextAccessible::GetSelectionDOMRanges if the initial tree hasn't been constructed yet. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D199601
2024-01-30 01:19:23 +00:00
Masayuki Nakano 441e111542 Bug 1816581 - part 6: Move the static methods used for moving caret or considering caret geometry into new utility class r=emilio
The methods are in `nsCaret`, `nsFrameSelection` and `dom::Selection`.  That
makes harder to read, and they are called each other, so, they are reused for
different purpose.  Therefore, it must be better to move them into a new class.
Then, the name differences may become more unclear.  If you think so, feel free
to request renaming some methods of them.

Differential Revision: https://phabricator.services.mozilla.com/D197288
2023-12-27 04:42:12 +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
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
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
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
James Teh a385baf40d Bug 1837332: Remove unused HyperTextAccessible::EnclosingRange/VisibleRanges/RangeByChild/RangeAtPoint, TextRange::EmbeddedChildren/Text and xpcAccessibleTextRange::ScrollIntoView. r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D180301
2023-06-14 00:43:11 +00:00