Commit graph

233 commits

Author SHA1 Message Date
Masayuki Nakano
01d2fe15e1 Bug 1384606 - part 3: Make nsPeekOffsetStruct and its handlers treat bool options with an EnumSet r=emilio
The constructor of `nsPeekOffsetStruct` and `nsIFrame::GetFrameFromDirection`
take too many `bool` arguments.  Therefore, adding new `bool` arguments does
not make sense.  Now, we have a useful `mozilla:EnumSet` class to treat them
with an `enum class`. Therefore, let's change `nsPeekOffsetStruct` with it.

Differential Revision: https://phabricator.services.mozilla.com/D172758
2023-03-18 04:18:53 +00:00
Iulian Moraru
6f60d5fa4d Backed out 4 changesets (bug 1384606) for causing mochitest browser a11y failures on browser_text_basics.js. CLOSED TREE
Backed out changeset 6f7176c0d6a3 (bug 1384606)
Backed out changeset 19c51e735059 (bug 1384606)
Backed out changeset eb8a5705b2d3 (bug 1384606)
Backed out changeset 39b202962261 (bug 1384606)
2023-03-17 10:40:53 +02:00
Masayuki Nakano
9cf5036656 Bug 1384606 - part 3: Make nsPeekOffsetStruct and its handlers treat bool options with an EnumSet r=emilio
The constructor of `nsPeekOffsetStruct` and `nsIFrame::GetFrameFromDirection`
take too many `bool` arguments.  Therefore, adding new `bool` arguments does
not make sense.  Now, we have a useful `mozilla:EnumSet` class to treat them
with an `enum class`. Therefore, let's change `nsPeekOffsetStruct` with it.

Differential Revision: https://phabricator.services.mozilla.com/D172758
2023-03-17 06:26:03 +00:00
Noemi Erli
585fe519f1 Backed out 4 changesets (bug 1384606) for causing build bustage in nsFrameSelection.h CLOSED TREE
Backed out changeset 917f487fdf0f (bug 1384606)
Backed out changeset 0782f42b2a99 (bug 1384606)
Backed out changeset 22099c5efaf6 (bug 1384606)
Backed out changeset f3a38b1eac88 (bug 1384606)
2023-03-17 06:54:59 +02:00
Masayuki Nakano
1387f2e7bc Bug 1384606 - part 3: Make nsPeekOffsetStruct and its handlers treat bool options with an EnumSet r=emilio
The constructor of `nsPeekOffsetStruct` and `nsIFrame::GetFrameFromDirection`
take too many `bool` arguments.  Therefore, adding new `bool` arguments does
not make sense.  Now, we have a useful `mozilla:EnumSet` class to treat them
with an `enum class`. Therefore, let's change `nsPeekOffsetStruct` with it.

Differential Revision: https://phabricator.services.mozilla.com/D172758
2023-03-17 04:22:05 +00:00
Ting-Yu Lin
0293650697 Bug 1819239 - Add script blocker to places where we assert no layout flush. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D171607
2023-03-15 17:57:38 +00:00
Ting-Yu Lin
29bbc7d7b8 Bug 1812601 - Add a null check in AccessibleCaretManager::ProvideHapticFeedback(). r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D168173
2023-01-28 20:18:47 +00:00
Ting-Yu Lin
b4c04f0197 Bug 1779269 - Fix AccessibleCaret's display on disabled form controls. r=emilio,webdriver-reviewers,whimboo,geckoview-reviewers,m_kato
A disabled form controls cannot be focused, and its frame selection is different
from the one for not-editable content. Use GetLastFocusedFrameSelection() (added
in Bug 253870) to get the correct frame selection that is visible to the user.

Add some basic tests for disabled <textarea> such as long pressing to select,
dragging, etc. They should behave the same as normal <textarea>.

Differential Revision: https://phabricator.services.mozilla.com/D151800
2022-07-21 05:44:30 +00:00
Cristian Tuns
42e074c74e Backed out changeset 429187de34ff (bug 1779269) for causing geckoview-junit failures CLOSED TREE 2022-07-14 16:04:59 -04:00
Ting-Yu Lin
b331e396e5 Bug 1779269 - Fix AccessibleCaret's display on disabled form controls. r=emilio,webdriver-reviewers,whimboo
A disabled form controls cannot be focused, and its frame selection is different
from the one for not-editable content. Use GetLastFocusedFrameSelection() (added
in Bug 253870) to get the correct frame selection that is visible to the user.

Add some basic tests for disabled <textarea> such as long pressing to select,
dragging, etc. They should behave the same as normal <textarea>.

Differential Revision: https://phabricator.services.mozilla.com/D151800
2022-07-14 17:29:34 +00:00
Masayuki Nakano
c8fc1057ba Bug 1680611 - part 2: Mark nsFocusManager::SetFocusedWindowWithCallerType and its callers in nsFocusManager as MOZ_CAN_RUN_SCRIPT r=smaug,media-playback-reviewers,chunmin
Differential Revision: https://phabricator.services.mozilla.com/D147061
2022-05-26 04:37:18 +00:00
Makoto Kato
28844e8f80 Bug 1639087 - Add dragcaret event by accessible caret. r=TYLin,smaug
To support magnifying glass on GeckoView, I would like to add `dragcaret`
event and, clientX and clientX in CaretStateChangedEvent chrome event.

Actually, accessible caret fires `presscaret` and `releasecaret` when
accessbile caret is pressed or released. But when dragging this caret, no
chrome event is fired. Since magnifying glass listens to moving this caret,
I would like `dargcaret` for GeckoView.

Also, Users' dragging point is necessary to set better position of magnifying
glass windows. So I also want client point of dragging point on `presscaret`
and `dragcaret` event.

This event and properties are on layout.accessiblecaret.magnifier.enabled=true,
So this can be only for GeckoView.

Differential Revision: https://phabricator.services.mozilla.com/D137965
2022-04-08 05:11:48 +00:00
Masayuki Nakano
9adbf59c05 Bug 1740853 - part 3: Redesign nsContentUtils::ComparePoints_Fix*() as taking int64_t for the offset r=smaug
For reducing the legacy behavior emulator of `nsContentUtils::ComparePoints`
and make it simpler, this patch makes it take `int64_t` as the offset.
Additionally, it's named "ComparePoints_AllowNegativeOffsets`.

Differential Revision: https://phabricator.services.mozilla.com/D132549
2021-12-09 17:06:18 +00:00
Masayuki Nakano
c19aa5aaa5 Bug 1740853 - part 1: Make nsContentUtils::ComparePoints take uint32_t for offset in DOM nodes r=smaug
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
2021-12-09 07:51:45 +00:00
Masayuki Nakano
82e2013683 Bug 1735446 - part 4: Make Selection::GetRangeAt() take uint32_t instead of int32_t r=smaug
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
2021-12-09 07:35:09 +00:00
Sylvestre Ledru
b4f9be25d4 Bug 1519636 - Reformat recent changes to the Google coding style r=andi,necko-reviewers
Updated with clang-format version 11.0.1 (taskcluster-B6bdwSKDRF-luRQWXBuzpA)

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D105158
2021-02-15 08:49:20 +00:00
Mirko Brodesser
36372ab216 Bug 1688832: part 7) Declare AccessibleCaretManager::GetAllChildFrameRectsUnion static. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D103471
2021-01-29 18:57:30 +00:00
Mirko Brodesser
ab4314f6af Bug 1688832: part 6) Hide AccessibleCaretManager::Carets::mFirst, mSecond. r=smaug
Helps to see that they're never replaced with new instances.

Differential Revision: https://phabricator.services.mozilla.com/D103313
2021-01-29 09:46:09 +00:00
Mirko Brodesser
cff5e50b61 Bug 1688832: part 5) Add AccessibleCaretManager::Carets::GetSecond. r=smaug
Depends on D103311

Differential Revision: https://phabricator.services.mozilla.com/D103312
2021-01-28 17:28:19 +00:00
Mirko Brodesser
b0ddf0f1e6 Bug 1688832: part 4) Add AccessibleCaretManager::Carets::GetFirst. r=smaug
Will help to hide the `UniquePtr`s.

Depends on D103310

Differential Revision: https://phabricator.services.mozilla.com/D103311
2021-01-29 09:26:47 +00:00
Mirko Brodesser
97b7bf74f3 Bug 1688832: part 3) Add AccessibleCaretManager::Carets::HasVisuallyVisibleCaret. r=smaug
Depends on D103309

Differential Revision: https://phabricator.services.mozilla.com/D103310
2021-01-28 17:20:35 +00:00
Mirko Brodesser
8585eb61e5 Bug 1688832: part 2) Add AccessibleCaretManager::Carets::HasLogicallyVisibleCaret. r=smaug
Depends on D103308

Differential Revision: https://phabricator.services.mozilla.com/D103309
2021-01-28 17:02:40 +00:00
Mirko Brodesser
2ca0daf525 Bug 1688832: part 1) Encapsulate AccessibleCaretManager::mFirstCaret, mSecondCaret in mCarets. r=smaug
They belong together.

Depends on D103307

Differential Revision: https://phabricator.services.mozilla.com/D103308
2021-01-28 17:01:46 +00:00
Dorel Luca
60f26fe4de Backed out 10 changesets (bug 1688832) for causing failures in builds/worker/checkouts/gecko/layout/base/PresShell.cpp. CLOSED TREE
Backed out changeset 595e1c877517 (bug 1688832)
Backed out changeset 5b09f705ef8d (bug 1688832)
Backed out changeset d836c47aef1c (bug 1688832)
Backed out changeset a52ca43f4156 (bug 1688832)
Backed out changeset 7183b7f948a6 (bug 1688832)
Backed out changeset 766c328fa158 (bug 1688832)
Backed out changeset dcc61c66c659 (bug 1688832)
Backed out changeset bd1ad0a8f943 (bug 1688832)
Backed out changeset c190058d85b8 (bug 1688832)
Backed out changeset 0848f7977679 (bug 1688832)
2021-01-27 12:37:54 +02:00
Mirko Brodesser
9b0eb6b20d Bug 1688832: part 10) Hide UniquePtrs in AccessibleCaretManager::Carets. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D102927
2021-01-27 09:43:14 +00:00
Mirko Brodesser
063ef6804a Bug 1688832: part 9) Add non-default constructor to AccessibleCaretManager::Carets. r=TYLin
Preparation to hide the `UniquePtr`s of `Carets`.

Differential Revision: https://phabricator.services.mozilla.com/D102925
2021-01-27 09:43:08 +00:00
Mirko Brodesser
c67ce67203 Bug 1688832: part 8) Add AccessibleCaretManager::Carets::GetSecond. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D102924
2021-01-27 09:43:00 +00:00
Mirko Brodesser
875d96d72f Bug 1688832: part 7) Add AccessibleCaretManager::Carets::GetFirst. r=TYLin
Will help to hide the `UniquePtr`s.

Differential Revision: https://phabricator.services.mozilla.com/D102923
2021-01-27 09:43:42 +00:00
Mirko Brodesser
f172fe3858 Bug 1688832: part 6) Prepare AccessibleCaretManager::DispatchCaretStateChangedEvent for splitting. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D102922
2021-01-27 09:43:40 +00:00
Mirko Brodesser
45bf972c17 Bug 1688832: part 5) Add static AccessibleCaretManager::GetSelection, ::GetFrameSelection. r=TYLin
Preparation to simplify `AccessibleCaretManager::Dispatch...`.

Differential Revision: https://phabricator.services.mozilla.com/D102921
2021-01-27 09:43:37 +00:00
Mirko Brodesser
acee8474e0 Bug 1688832: part 4) Add AccessibleCaretManager::SelectionStringifyer. r=TYLin
Will help to simplify `AccessibleCaretManager::Dispatch...`.

Differential Revision: https://phabricator.services.mozilla.com/D102920
2021-01-27 09:43:35 +00:00
Mirko Brodesser
3d4ea57f64 Bug 1688832: part 3) Add AccessibleCaretManager::Carets::AreVisuallyVisible r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D102919
2021-01-27 09:43:32 +00:00
Mirko Brodesser
5394d16b24 Bug 1688832: part 2) Add AccessibleCaretManager::Carets::AreLogicallyVisible. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D102918
2021-01-27 09:43:30 +00:00
Mirko Brodesser
2d9fd75ccc Bug 1688832: part 1) Encapsulate AccessibleCaretManager::mFirstCaret, mSecondCaret in mCarets. r=TYLin
They belong together.

Differential Revision: https://phabricator.services.mozilla.com/D102917
2021-01-27 09:42:22 +00:00
Mirko Brodesser
e18a0436b9 Bug 1685303: part 28) Add virtual AccessibleCaretManager::MaybeFlushLayout. r=TYLin,smaug
In the unit-tests, flushing is not done. This was prevented implicitly
by nulling `mPresShell`. This change makes that explicit by stubbing
`MaybeFlushLayout`.

Note that `IsTerminated`, which is called in the same context is already
virtual, so I expect this to not have a noticeable performance-impact.

Depends on D102607

Differential Revision: https://phabricator.services.mozilla.com/D102608
2021-01-22 12:18:05 +00:00
Mirko Brodesser
bda25fa56c Bug 1685303: part 26) Correct typo in AccessibleCaretManager::mAyncPanZoomState. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D102606
2021-01-21 23:37:21 +00:00
Mirko Brodesser
8dab90eba1 Bug 1685303: part 25) Hide AccessibleCaretManager::LayoutFlusher::mFlushing. r=TYLin
Depends on D102414

Differential Revision: https://phabricator.services.mozilla.com/D102415
2021-01-20 23:31:44 +00:00
Mirko Brodesser
f7d4eee8e5 Bug 1685303: part 24) Encapsulate LayoutFlusher from AccessibleCaretManager. r=TYLin
Encapsulates flushing-related functionality.

Please see part 25) for further simplifcation of `LayoutFlusher`.

Depends on D102413

Differential Revision: https://phabricator.services.mozilla.com/D102414
2021-01-20 23:31:42 +00:00
Mirko Brodesser
4a9742216a Bug 1685303: part 23) Declare AccessibleCaretManager::GetEditingHostForFrame static. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D102413
2021-01-20 23:30:06 +00:00
Mirko Brodesser
c51f73c054 Bug 1685303: part 22) Qualify arguments of AccessibleCaretManager::UpdateCaretsForAlwaysTilt const. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D102311
2021-01-20 10:15:08 +00:00
Mirko Brodesser
282d9a0708 Bug 1685303: part 21) Rename HideCarets to HideCaretsAndDispatchCaretStateChangedEvent. r=TYLin
It reflects clearer what the method does.

Differential Revision: https://phabricator.services.mozilla.com/D102303
2021-01-20 10:15:08 +00:00
Mirko Brodesser
d7bf5cbe1f Bug 1685303: part 20) const-correct internals of `AccessibleCaretManager::DispatchCaretStateChangedEvent. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D102302
2021-01-20 10:11:20 +00:00
Mirko Brodesser
32745c95ff Bug 1685303: part 19) Encapsulate DesiredAsyncPanZoomState from AccessibleCaretManager. r=TYLin
The wording is less ambigous and more `const`-access is allowed.

Differential Revision: https://phabricator.services.mozilla.com/D102301
2021-01-20 10:13:37 +00:00
Mirko Brodesser
3e7a8c2653 Bug 1685303: part 17) Slightly refactor AccessibleCaretManager::FlushLayout. r=TYLin
Now the method states clearer what it does.

Differential Revision: https://phabricator.services.mozilla.com/D102192
2021-01-20 10:13:07 +00:00
Mirko Brodesser
34292507e2 Bug 1685303: part 18) Add some const-correctness to AccessibleCaretManager::GetCaretMode. r=smaug
Might later help to clean up the dependencies to `Selection`.

Differential Revision: https://phabricator.services.mozilla.com/D102199
2021-01-18 16:23:12 +00:00
Mirko Brodesser
217ea6c8ea Bug 1685303: part 14) Annotate SelectByTypeAtPoint with MOZ_CAN_RUN_SCRIPT. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D101762
2021-01-15 09:28:07 +00:00
Mirko Brodesser
c0d32bffc5 Bug 1685303: part 10) Annotate nsFrameSelection::HandleClick with MOZ_CAN_RUN_SCRIPT. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D101598
2021-01-14 13:24:36 +00:00
Masayuki Nakano
269faceec3 Bug 1357365 - part 5: Make TypeInState::OnSelectionChange stop keeping link style for new inserting content when selection is changed by JS r=m_kato,edgar
This is the most important situation.  If selection is collapsed to a edge of a
link, the other browsers does not insert new content into the link.  So, from
the point of view of web developers, this cause should work exactly same as
the other browsers.

Note that the new failures in `editing/run/inserttext.html` are passed only
on Gecko.  So, the test should be updated after fixing this bug.

Differential Revision: https://phabricator.services.mozilla.com/D101004
2021-01-13 01:55:40 +00:00
Mirko Brodesser
fe32930e22 Bug 1685303: part 6) Add verbose logging to AccessibleCaretManager::SelectWord. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D101356
2021-01-11 15:09:52 +00:00
Emilio Cobos Álvarez
bd8cffdd58 Bug 1351248 - Simplify nsIFrame::IsFocusable API. r=layout-reviewers,mats
We always compute the tabindex value, so just return it to the caller
all the time. This allows us to use early-returns which makes the code a
bit easier to follow.

This patch shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D100423
2021-01-03 23:30:51 +00:00