Commit graph

244 commits

Author SHA1 Message Date
Masayuki Nakano
cd53d5600e 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
Masayuki Nakano
fe9fef936b Bug 1816581 - part 1: Make CaretAssociationHint an enum class r=emilio
For forward-decl-able.

Differential Revision: https://phabricator.services.mozilla.com/D197283
2023-12-27 04:42:09 +00:00
Masayuki Nakano
02ee2a0c6f Bug 1820290 - Rename PeekOffsetOption::ScrollViewStop for consistency r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D193622
2023-11-21 08:05:19 +00:00
Emilio Cobos Álvarez
50daad8922 Bug 1817122 - Make AsyncEventDispatcher(Event) take ownership of the event. r=smaug,media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D190059
2023-10-04 19:37:39 +00:00
Emilio Cobos Álvarez
bd1b363ff9 Bug 1824886 - Rewrite AnonymousContent to use a shadow tree. r=smaug,TYLin,sfoster,devtools-reviewers,nchevobbe
Subtle things:

 * We now have shadow trees in NAC, inception! Only a couple lines of
   code in the style system had to be changed to match :host rules and
   so properly.

 * Had to make highlighters.css contentaccessible, because otherwise we
   can't load it from the shadow tree. I don't think it's a big deal.

 * I removed some of the code from highlighters.css that claimed that
   stuff inherited from the html element. That's just no longer true.

 * Had to switch from `setAttribute("style", ...)` to `.style = ...;`.
   This is needed because CSSOM from chrome code bypasses CSP (as
   AnonymousContent did), but setAttribute() doesn't, see bug 1424474.

Differential Revision: https://phabricator.services.mozilla.com/D173998
2023-07-09 11:34:05 +00:00
Stanca Serban
15c8455338 Backed out changeset 1c835137f532 (bug 1824886) for causing multiple failures. CLOSED TREE 2023-07-06 02:11:59 +03:00
Emilio Cobos Álvarez
3338831b84 Bug 1824886 - Rewrite AnonymousContent to use a shadow tree. r=smaug,TYLin,sfoster,devtools-reviewers,nchevobbe
Subtle things:

 * We now have shadow trees in NAC, inception! Only a couple lines of
   code in the style system had to be changed to match :host rules and
   so properly.

 * Had to make highlighters.css contentaccessible, because otherwise we
   can't load it from the shadow tree. I don't think it's a big deal.

 * I removed some of the code from highlighters.css that claimed that
   stuff inherited from the html element. That's just no longer true.

 * Had to switch from `setAttribute("style", ...)` to `.style = ...;`.
   This is needed because CSSOM from chrome code bypasses CSP (as
   AnonymousContent did), but setAttribute() doesn't, see bug 1424474.

Differential Revision: https://phabricator.services.mozilla.com/D173998
2023-07-05 21:59:44 +00:00
Cosmin Sabou
fb92d5f42f Backed out 2 changesets (bug 1824886) for causing failures on browser_all_files_referenced.js. CLOSED TREE
Backed out changeset 650ef77d1c4d (bug 1824886)
Backed out changeset 1c835137f532 (bug 1824886)
2023-07-06 00:42:53 +03:00
Emilio Cobos Álvarez
454c0b932e Bug 1824886 - Rewrite AnonymousContent to use a shadow tree. r=smaug,TYLin,sfoster,devtools-reviewers,nchevobbe
Subtle things:

 * We now have shadow trees in NAC, inception! Only a couple lines of
   code in the style system had to be changed to match :host rules and
   so properly.

 * Had to make highlighters.css contentaccessible, because otherwise we
   can't load it from the shadow tree. I don't think it's a big deal.

 * I removed some of the code from highlighters.css that claimed that
   stuff inherited from the html element. That's just no longer true.

 * Had to switch from `setAttribute("style", ...)` to `.style = ...;`.
   This is needed because CSSOM from chrome code bypasses CSP (as
   AnonymousContent did), but setAttribute() doesn't, see bug 1424474.

Differential Revision: https://phabricator.services.mozilla.com/D173998
2023-07-05 18:21:31 +00:00
Peter Van der Beken
6010b195d7 Bug 1814870 - HTML pattern attribute should set v flag for regular expressions. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D180201
2023-06-08 12:10:09 +00:00
Ting-Yu Lin
4d649b94d5 Bug 1833081 - Don't show AccessibleCaret when selected text is scrolled back into view via keyboard. r=webdriver-reviewers,emilio,jdescottes
Note: Per my local test, the testcase is not 100% reliable because the selection
highlight can disappear intermittently for unknown reason after Step 2. As a
result, the testcase intermittently fails *without* my patch, but it's still
better than no test at all.

Differential Revision: https://phabricator.services.mozilla.com/D179027
2023-06-05 18:27:17 +00:00
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