Previously, the test asserted that the line offsets for an embedded object should be an empty range.
This is actually incorrect, since there is content on the line (an empty text box and a button).
Update this with the correct result, but mark it as an expected failure.
The new implementation fixes this, so once we enable it by default, we can assert success.
Differential Revision: https://phabricator.services.mozilla.com/D125670
We won't use HyperTextAccessible for building the cache.
However, we have a lot of existing single process mochitests for HyperTextAccessible.
Putting it behind this pref makes it easy for us to run those tests against this new text implementation.
Eventually, we want to use this implementation for both local and remote Accessibles.
Differential Revision: https://phabricator.services.mozilla.com/D124778
This implementation uses WordBreaker and a bunch of code to emulate layout's handling of punctuation, space, words spanning across nodes, words broken due to lines, etc.
While this does mean we're effectively duplicating layout, there are a couple of advantages.
First, PeekOffset has a lot of quirks which have caused us problems in the past and are difficult to debug.
They don't matter so much for other consumers, but a11y is very sensitive to these kinds of bugs.
Having our own logic means we can make changes as needed without potentially affecting other PeekOffset consumers.
Second, while the implementation currently only works on LocalAccessibles (because we don't have text in RemoteAccessible yet), it's been designed so that it should be very easy to adapt for RemoteAccessible.
It already walks the unified Accessible tree, so it just has to be taught how to get text from RemoteAccessible once that's possible.
This means we don't have to cache word boundaries; they can be calculated on demand in the parent process.
Differential Revision: https://phabricator.services.mozilla.com/D124775
This adds TextLeafPoint::FindBoundary, which will be the main entry point for finding single boundaries.
FindBoundary searches individual Accessibles for a boundary, walking the a11y tree and continuing the search if a boundary isn't found.
Support for line start boundaries uses layout to determine line edges, but otherwise traverses the accessibility tree.
This avoids depending on PeekOffset, which has a lot of quirks that cause problems for a11y.
More importantly, it's possible to find line boundaries within a single LocalAccessible using the lower level FindPrev/NextLineStartSameLocalAcc methods.
This will be useful for line boundary caching, since we want to cache this info on individual Accessibles.
In contrast, PeekOffset might walk outside the current Accessible, which makes caching more difficult.
Differential Revision: https://phabricator.services.mozilla.com/D124774
Previously, to check whether two frames were on the same line, you had to call nsIFrame::GetLineNumber on both of them.
If the lines were in a different containing block, this wastefully created line iterators.
With this new method, you can get the containing blocks for both frames and only create a single line iterator if the blocks are the same.
To achieve this, nsIFrame::CanProvideLineIterator was also added and is used by GetContainingBlockForLine.
Accessibility will use this new functionality in its new text boundary implementation.
Differential Revision: https://phabricator.services.mozilla.com/D126433
Add a wrapper for `ucal_getHostTimeZone` to `mozilla::intl::TimeZone`. This
function is only used for the "testing" function framework.
Differential Revision: https://phabricator.services.mozilla.com/D126198
Add setters to change ICU's default time zone.
1. `SetDefaultTimeZone()` sets the default time zone from a time zone identifier.
2. `SetDefaultTimeZoneFromHostTimeZone()` synchronizes the default time zone with
the host system's time zone.
The two new methods will be used in the next part to replace ICU calls in
`js::DateTimeInfo::internalResyncICUDefaultTimeZone()`.
Differential Revision: https://phabricator.services.mozilla.com/D126196
Now that `DateTime` works even when `MOZ_SYSTEM_ICU` is set, we no longer have
to check for `MOZ_SYSTEM_ICU` in "jsdate.cpp". This also allows to remove the
`MOZ_SYSTEM_ICU` checks in "vm/Time", because those were only called from
"jsdate.cpp" when `MOZ_SYSTEM_ICU` was set.
Differential Revision: https://phabricator.services.mozilla.com/D126195
Updates `DateTime` to use `mozilla::intl::TimeZone` for all time zone computations
when `JS_HAS_INTL_API` is defined. We no longer have to check `!MOZ_SYSTEM_ICU`,
because `mozilla::intl::TimeZone` supports ICU's C++ and C-API.
Differential Revision: https://phabricator.services.mozilla.com/D126194
Make `FormatBuffer`'s allocation policy configurable, so we can it use with
`js::SystemAllocPolicy` in the next patch. This implies that the `JSContext*`
member has to be removed, too.
Differential Revision: https://phabricator.services.mozilla.com/D126193
ICU doesn't provide a C-API for time zone functions, but instead requires to
use `UCalendar`. This adds a noticeable overhead, because whenever time zone
offsets are computed, it's first necessary to set the time on a `UCalendar`,
which triggers a recomputation of all calendar fields. And because time zone
offset computation is used for JavaScript's `Date`, which is widely used, we
should avoid performance regressions compared to the current code which is
using the ICU C++ API.
We can only safely use the ICU C++ API when we don't use the system ICU,
because C++ doesn't have a stable ABI, so the ICU C++ API code paths are only
taken when `MOZ_SYSTEM_ICU` is `false`.
Differential Revision: https://phabricator.services.mozilla.com/D126192
Add four additional methods to `mozilla::intl::TimeZone`:
1. `GetDSTOffsetMs()` to return the daylight saving offset at a specific UTC time.
2. `GetOffsetMs()` to return the time zone offset at a specific UTC time.
3. `GetUTCOffsetMs()` to return the UTC offset at a specific local time.
4. `GetDisplayName()` to return the display name of a time zone.
All four methods will be used to replace ICU calls in "js/src/vm/DateTime.cpp".
Differential Revision: https://phabricator.services.mozilla.com/D126191
We can use QM_TO_RESULT (instead of MOZ_TO_RESULT) because QM_WARNONLY_TRY
doesn't propagate errors, so no other adjustment is needed.
Differential Revision: https://phabricator.services.mozilla.com/D125314
Use `mozilla::intl::Calendar` instead of directly calling ICU in
`intl_GetCalendarInfo`. This implies that the days of the week are now ordered
the same way as in the "Intl Locale Info API" and the "Temporal" proposal, i.e.
starting from Monday=1 to Sunday=7.
Differential Revision: https://phabricator.services.mozilla.com/D126228