Commit graph

251 commits

Author SHA1 Message Date
Ting-Yu Lin
00acdab2d5 Bug 1896516 Part 6 - Remove nsIScrollableFrame usages in nsLayoutUtils. r=layout-reviewers,emilio
Convert `nsIScrollableFrame` to `ScrollContainerFrame` for all the APIs in
nsLayoutUtils, and then adapt other callers until everything compiles.

In `nsLayoutUtils::CalculateBasicFrameMetrics()`'s documentation,
s/ComputeFrameMetrics/ComputeScrollMetadata/ because the method was renamed in
https://hg.mozilla.org/mozilla-central/rev/cb2023f50288

Differential Revision: https://phabricator.services.mozilla.com/D211493
2024-05-30 06:32:20 +00:00
Sebastian Hengst
ccb101be8f 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
b9b60828e7 Bug 1896516 Part 6 - Remove nsIScrollableFrame usages in nsLayoutUtils. r=layout-reviewers,emilio
Convert `nsIScrollableFrame` to `ScrollContainerFrame` for all the APIs in
nsLayoutUtils, and then adapt other callers until everything compiles.

In `nsLayoutUtils::CalculateBasicFrameMetrics()`'s documentation,
s/ComputeFrameMetrics/ComputeScrollMetadata/ because the method was renamed in
https://hg.mozilla.org/mozilla-central/rev/cb2023f50288

Differential Revision: https://phabricator.services.mozilla.com/D211493
2024-05-28 04:46:18 +00:00
Daniel Holbert
cfb8b32810 Bug 1896711 part 3: Use MakeRefPtr/MakeAndAddRef to reduce boilerplate, in layout/base. r=TYLin
Also remove some unnecessary null-checks for objects that we're allocating
infallibly.

Differential Revision: https://phabricator.services.mozilla.com/D210389
2024-05-15 07:29:20 +00:00
Emilio Cobos Álvarez
3b42787268 Bug 1895208 - Refactor IsFocusable checks to take flags rather than bool arguments. r=smaug
This doesn't change behavior on its own, but it's likely we want to make
the tab focusability more complicated in bug 1895184, and this will make
changes to this area less painful.

Differential Revision: https://phabricator.services.mozilla.com/D209525
2024-05-06 21:54:37 +00:00
Emilio Cobos Álvarez
e7f43ecf6f Bug 1860328 - Track nsCaret position at the DOM level. r=sefeng,masayuki
This should avoid a bunch of paint invalidation issues with our caret
code (and seems simpler anyways).

Differential Revision: https://phabricator.services.mozilla.com/D204434
2024-03-18 09:12:57 +00:00
Masayuki Nakano
0bd548362f Bug 1872302 - Make nsIFrame::PeekOffsetForLine never dig into native anonymous subtree r=emilio
`Selection.modify` with `"line"` calls `nsIFrame::PeekOffsetForLine` (which
is also used to move caret). To compute the destination,
`nsIFrame::PeekOffsetForLine` is used, but it may return a native anonymous
node because its helper function, `GetSelectionClosestFrame`, does not check
the boundary.  On the other hand, it's used by pointing device event handlers
too.  In this case, it needs to return a native anonymous node.  Therefore,
the helper method requires additional flag to consider whether it can return
native anonymous node.

Differential Revision: https://phabricator.services.mozilla.com/D198358
2024-01-17 01:10:47 +00:00
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