Some callers of `nsINode::ComputeIndexOf()` do not use its parent node except
calling it. These tiny methods make such callers simpler.
Differential Revision: https://phabricator.services.mozilla.com/D131337
This patch fixes only the cases if the result of `ComputeIndexOf_Deprecated()`
is used as unsigned integer with implicit or explicit cast.
Differential Revision: https://phabricator.services.mozilla.com/D131336
It's hard to fix some callers. Therefore, in this bug, we should fix only
simple cases. Therefore, we should rename existing API first.
Differential Revision: https://phabricator.services.mozilla.com/D131334
It takes text node's offset that is never larger than `INT32_T` because
`nsTextFragment` limits max text length of a text node is
`<= NS_MAX_TEXT_FRAGMENT_LENGTH`, that means equals or less than `0x1FFFFFFF`.
So that it must be safe to convert the offset to `uint32_t` from `int32_t`.
Differential Revision: https://phabricator.services.mozilla.com/D131111
They are defined as "unsigned long" by the standards. So we should use
`uint32_t` rather than `int32_t` with the methods. However, layout code
uses `int32_t` a lot for representing the offset. Therefore, this patch
adds `*_FixOffset1` etc for the cases which cannot fix easily in this patch.
Differential Revision: https://phabricator.services.mozilla.com/D131110
It's an internal API corresponding to `Selection.getRangeAt` DOM API.
I think that it should use `uint32_t` rather than `size_t` because of the
consistency with the DOM API and `Selection::RangeCount()`.
This patch fixes all callers of `GetRangeAt()`, and rewrites it with ranged-
loops unless original ones do not refer `RangeCount()` every time and may run
script in the loop.
Differential Revision: https://phabricator.services.mozilla.com/D128848
Building with --disable-xul has been busted since _at least_ bug
1082579, for more than 7 years (I didn't try to track that down
further). It's time to recognize that the option serves no purpose.
Differential Revision: https://phabricator.services.mozilla.com/D133161
I removed the sync IPDL implementation of LinkIndexOf because we can calculate this in the parent process even with the cache disabled.
Differential Revision: https://phabricator.services.mozilla.com/D132200
1. There was a Windows non-cached RemoteAccessible implementation, but it was never actually called, so I removed it.
2. The sync IPDL RemoteAccessible implementation previously provided a boolean indicating success.
I removed this because the LocalAccessible implementation doesn't have this and it doesn't seem like remote is special in this respect.
Differential Revision: https://phabricator.services.mozilla.com/D132198
-Wshadow warnings are not enabled globally, so these -Wno-shadow suppressions have no effect. I had intended to enable -Wshadow globally along with these suppressions in some directories (in bug 1272513), but that was blocked by other issues.
There are too many -Wshadow warnings (now over 2000) to realistically fix them all. We should remove all these unnecessary -Wno-shadow flags cluttering many moz.build files.
Differential Revision: https://phabricator.services.mozilla.com/D132289
As well as the caret offset, we also need to cache whether the caret is at the end of a line.
Therefore, this information has been added to caret events.
Differential Revision: https://phabricator.services.mozilla.com/D132097
The caret can be at the end of a wrapped line, but this does not have its own offset.
In this case, the way we handle the caret depends on what is being queried.
For character, we want to return no character at the position of the caret.
For word and line, we want to return the word/line before the caret.
To facilitate this conditional treatment, we use a special TextLeafPoint which represents the caret.
This is then actualized to a real point depending on the method called.
Differential Revision: https://phabricator.services.mozilla.com/D132095
1. When calculating a start offset, we usually want 0 if the offset can't be transformed, thus clipping to the start of this Accessible.
Previously, CharacterCount was always returned even when calculating a start offset.
Now, we return 0 for a start offset, CharacterCount for an end offset.
2. Sometimes, this fallback value is insufficient and we need to know explicitly whether it failed.
As well as the offset, we now return a boolean indicating this.
This will be used in a subsequent patch.
3. Even though TransformOffset only deals with positive numbers, callers usually deal with signed numbers.
Therefore, we now use int32_t insteaed of uint32_t to avoid a lot of casting.
Differential Revision: https://phabricator.services.mozilla.com/D132094
Previously, we tried to get a COM proxy even when the cache was enabled, which just crashed.
As part of this, use a RefPtr instead of manually managing references.
Differential Revision: https://phabricator.services.mozilla.com/D132104
XUL images use nsImageBoxFrame, not nsImageFrame.
AccessibleType() returns eNoType on nsImageBoxFrame.
Changing this to return eImageType seems a bit risky and adding a new type just for an assertion seems pointless.
Therefore, we just check the frame type.
Differential Revision: https://phabricator.services.mozilla.com/D132051
Add nsIAutoCompleteResult.isRemovableAt method, to indicate whether the value
is removable, and do nothing for Shift+Delete on the item when the value is
not removable.
Depends on D131740
Differential Revision: https://phabricator.services.mozilla.com/D131741
1. Use dom events in RootAccessible to fire ACTIVE state changes.
2. Add DOMMenuItemInactive events to nsListControlFrame and fire it on
the previously active option.
3. Don't fire those DOM events on collapsed combo boxes.
4. Add ACTIVE state change events for collapsed combo box options.
Differential Revision: https://phabricator.services.mozilla.com/D130298
Have ARIAActiveDescendantIDMaybeMoved call ARIAActiveDescendantChanged regardless of
widget focus state. The latter already checks if the widget is focused. This gives us
a chance to fire and ACTIVE state change regardless of focus state.
If an id or aria-activedescendant attribute is about to change, fire an
ACTIVE state change on the previously active accessible.
Differential Revision: https://phabricator.services.mozilla.com/D130296
By allowing async DOM events to be dispatched, and advancing the refresh
driver we can force some calls to NotificationController::WillRefresh
and flush out any pending notifications or events.
This lets us more reliably catch unexpected events without the need for
a sentinel event at the end.
Differential Revision: https://phabricator.services.mozilla.com/D130295
1. Use dom events in RootAccessible to fire ACTIVE state changes.
2. Add DOMMenuItemInactive events to nsListControlFrame and fire it on
the previously active option.
3. Don't fire those DOM events on collapsed combo boxes.
4. Add ACTIVE state change events for collapsed combo box options.
Differential Revision: https://phabricator.services.mozilla.com/D130298
Have ARIAActiveDescendantIDMaybeMoved call ARIAActiveDescendantChanged regardless of
widget focus state. The latter already checks if the widget is focused. This gives us
a chance to fire and ACTIVE state change regardless of focus state.
If an id or aria-activedescendant attribute is about to change, fire an
ACTIVE state change on the previously active accessible.
Differential Revision: https://phabricator.services.mozilla.com/D130296
By allowing async DOM events to be dispatched, and advancing the refresh
driver we can force some calls to NotificationController::WillRefresh
and flush out any pending notifications or events.
This lets us more reliably catch unexpected events without the need for
a sentinel event at the end.
Differential Revision: https://phabricator.services.mozilla.com/D130295
With the rewrite, we reduce the dependency of lwbrk LineBreaker::Next(),
WordBreaker::Next(), and their `int32_t` sentinel values
NS_LINEBREAKER_NEED_MORE_TEXT and NS_WORDBREAKER_NEED_MORE_TEXT.
Differential Revision: https://phabricator.services.mozilla.com/D130392
`profiler_thread_is_being_profiled` is used a lot for markers, so it makes sense to have a specialized version, which is a bit shorter, and lives in ProfilerMarkers.h.
Differential Revision: https://phabricator.services.mozilla.com/D130009
With the rewrite, we reduce the dependency of lwbrk LineBreaker::Next(),
WordBreaker::Next(), and their `int32_t` sentinel values
NS_LINEBREAKER_NEED_MORE_TEXT and NS_WORDBREAKER_NEED_MORE_TEXT.
Differential Revision: https://phabricator.services.mozilla.com/D130392