Commit graph

338 commits

Author SHA1 Message Date
Ting-Yu Lin
1e80f659a2 Bug 1896516 Part 11 - Remove nsIScrollableFrame usages under layout/, widget/, and toolkit/. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D211498
2024-05-30 06:32:22 +00:00
Ting-Yu Lin
df8ff2d9ac Bug 1896516 Part 3 - Change GetScrollTargetFrame() to return ScrollContainerFrame. r=layout-reviewers,emilio
Also, simplify some callers of `GetScrollTargetFrame()` to drop
`nsIScrollableFrame*` and unnecessary `do_QueryFrame`. We'll continue removing
more `nsIScrollableFrame*` in later parts.

Differential Revision: https://phabricator.services.mozilla.com/D211490
2024-05-30 06:32:18 +00:00
Ting-Yu Lin
f13f5fc5d4 Bug 1896516 Part 1 - Rename PresShell::GetRootScrollFrame(), and make it return ScrollContainerFrame. r=layout-reviewers,emilio
In theory, changing the return type from `nsIFrame*` to `ScrollContainerFrame*`
exposes `ScrollContainerFrame` to the callers who might not needed, but almost
all of the callers in cpp files are already exposed to `nsIScrollableFrame`, as
demonstrated in this patch via replacing the #include from
"nsIScrollableFrame.h" to "ScrollContainerFrame.h", so this is OK.

Some callers can be simplified since we no longer need `do_QueryFrame` to
`nsIScrollableFrame`.

Differential Revision: https://phabricator.services.mozilla.com/D211488
2024-05-30 06:32:17 +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
6bd29e633d Bug 1896516 Part 11 - Remove nsIScrollableFrame usages under layout/, widget/, and toolkit/. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D211498
2024-05-28 04:46:20 +00:00
Ting-Yu Lin
9a9b18c0b6 Bug 1896516 Part 3 - Change GetScrollTargetFrame() to return ScrollContainerFrame. r=layout-reviewers,emilio
Also, simplify some callers of `GetScrollTargetFrame()` to drop
`nsIScrollableFrame*` and unnecessary `do_QueryFrame`. We'll continue removing
more `nsIScrollableFrame*` in later parts.

Differential Revision: https://phabricator.services.mozilla.com/D211490
2024-05-28 04:46:17 +00:00
Ting-Yu Lin
8dc0807324 Bug 1896516 Part 1 - Rename PresShell::GetRootScrollFrame(), and make it return ScrollContainerFrame. r=layout-reviewers,emilio
In theory, changing the return type from `nsIFrame*` to `ScrollContainerFrame*`
exposes `ScrollContainerFrame` to the callers who might not needed, but almost
all of the callers in cpp files are already exposed to `nsIScrollableFrame`, as
demonstrated in this patch via replacing the #include from
"nsIScrollableFrame.h" to "ScrollContainerFrame.h", so this is OK.

Some callers can be simplified since we no longer need `do_QueryFrame` to
`nsIScrollableFrame`.

Differential Revision: https://phabricator.services.mozilla.com/D211488
2024-05-28 04:46:16 +00:00
Jan-Niklas Jaeschke
10cdb4892f Bug 1894666 - Custom Highlight API: Call NotifySelectionListener() for the correct selection type. r=masayuki,dom-core
Before this patch, the `AutoFrameSelectionBatcher` helper class would always call `NotifySelectionListeners()` for `SelectionType::eNormal`, even if the selection may have originated from Custom Highlight.

This patch moves the information that a change has occurred during batching from `nsFrameSelection` into the `Selection` instance, thus keeping the information per instance instead of globally.
When batching ends, `Selection::NotifySelectionListeners()` is called for all `Selection` instances depending on the flag.

Additionally, `Selection::NotifySelectionListeners()` is updated so that some Listeners (AutoCopyListener, SelectionChangeEvent, AccessibleCaret) are only notified for `SelectionType::eNormal`.

Differential Revision: https://phabricator.services.mozilla.com/D210130
2024-05-15 12:35:39 +00:00
Emilio Cobos Álvarez
f6f9f50178 Bug 1896051 - Notify selection listeners from TakeFocus even if batching. r=masayuki
Otherwise we don't note the selection change, and listeners like the
caret might remain in the wrong position.

NotifySelectionListeners deals itself with batching:

  https://searchfox.org/mozilla-central/rev/8e885f04a0a4ff6d64ea59741c10d9b8e45d9ff8/dom/base/Selection.cpp#3752-3754

This is ancient code from the netscape era:

  0e36c2f407
  24e9fbcab6

So my hope is that tests pass with this, otherwise there are lower risk
fixes that we could make like just calling
SetChangesDuringBatchingFlag(), but that seems sketchy at best.

So let's try to do the right thing...

Differential Revision: https://phabricator.services.mozilla.com/D210050
2024-05-14 07:46:41 +00:00
Jan-Niklas Jaeschke
81f5e14057 Bug 1867939, part 4: Implemented the ::target-text CSS Pseudo Element. r=emilio,devtools-reviewers,nchevobbe
This patch implements the `::target-text` pseudo element.
Similarly to the Custom Highlight API, this is done implementing
a new Selection type.

Differential Revision: https://phabricator.services.mozilla.com/D195687
2024-04-04 14:39:32 +00:00
Stanca Serban
c9bea63c35 Backed out 6 changesets (bug 1867939) for causing wpt failures in target-text-010.html. CLOSED TREE
Backed out changeset 44101c258e52 (bug 1867939)
Backed out changeset c53267e1b460 (bug 1867939)
Backed out changeset 0748839408e5 (bug 1867939)
Backed out changeset 38631fbd2f2f (bug 1867939)
Backed out changeset d77b9257c842 (bug 1867939)
Backed out changeset 0d269b891421 (bug 1867939)
2024-04-04 00:50:50 +03:00
Jan-Niklas Jaeschke
e58875610d Bug 1867939, part 4: Implemented the ::target-text CSS Pseudo Element. r=emilio,devtools-reviewers,nchevobbe
This patch implements the `::target-text` pseudo element.
Similarly to the Custom Highlight API, this is done implementing
a new Selection type.

Differential Revision: https://phabricator.services.mozilla.com/D195687
2024-04-03 15:23:02 +00:00
Sandor Molnar
8340afd1fb Backed out 6 changesets (bug 1867939) for causing a top crash in nightly Bug 1889393 CLOSED TREE
Backed out changeset 2110f57e928c (bug 1867939)
Backed out changeset 51890598ecb4 (bug 1867939)
Backed out changeset 839bc1b11a2c (bug 1867939)
Backed out changeset bb88c4d09e82 (bug 1867939)
Backed out changeset 27c76e65cf58 (bug 1867939)
Backed out changeset c3e3c81f9ceb (bug 1867939)
2024-04-03 17:31:56 +03:00
Jan-Niklas Jaeschke
2ec51d7c56 Bug 1867939, part 4: Implemented the ::target-text CSS Pseudo Element. r=emilio,devtools-reviewers,nchevobbe
This patch implements the `::target-text` pseudo element.
Similarly to the Custom Highlight API, this is done implementing
a new Selection type.

Differential Revision: https://phabricator.services.mozilla.com/D195687
2024-04-02 13:44:25 +00:00
Cristian Tuns
a1bb69acae Backed out 6 changesets (bug 1867939) for causing build bustages in Document.h CLOSED TREE
Backed out changeset 0853f9a7a06c (bug 1867939)
Backed out changeset 2279e6577c13 (bug 1867939)
Backed out changeset 1b3af4b6a27b (bug 1867939)
Backed out changeset 2fbe643ca483 (bug 1867939)
Backed out changeset 575873406614 (bug 1867939)
Backed out changeset 82f99c0210b0 (bug 1867939)
2024-04-02 09:15:46 -04:00
Jan-Niklas Jaeschke
b764eaf1f8 Bug 1867939, part 4: Implemented the ::target-text CSS Pseudo Element. r=emilio,devtools-reviewers,nchevobbe
This patch implements the `::target-text` pseudo element.
Similarly to the Custom Highlight API, this is done implementing
a new Selection type.

Differential Revision: https://phabricator.services.mozilla.com/D195687
2024-04-02 11:43:21 +00:00
Sean Feng
2026f2e0ce Bug 1867058 - Part 8: Update Selection to support across shadow dom selection r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D195310
2024-03-25 13:40:59 +00:00
Sean Feng
76908bb481 Bug 1867058 - Part 1: Implement Selection.direction r=jjaschke,dom-core
This patch implements the .direction attribute

Spec: https://www.w3.org/TR/selection-api/#dom-selection-direction

Differential Revision: https://phabricator.services.mozilla.com/D195301
2024-03-25 13:40:56 +00:00
pstanciu
715a8e1d09 Backed out 12 changesets (bug 1867058) for causing bustages on AbstractRange.cpp
Backed out changeset 6254c9c51033 (bug 1867058)
Backed out changeset 2ad556d56736 (bug 1867058)
Backed out changeset a8bc41291ab3 (bug 1867058)
Backed out changeset c30869c03a70 (bug 1867058)
Backed out changeset 39c5816dff6b (bug 1867058)
Backed out changeset 42e226158dc9 (bug 1867058)
Backed out changeset 67bb7158a09f (bug 1867058)
Backed out changeset 7b5a689dc7fd (bug 1867058)
Backed out changeset 3cf108eb13a6 (bug 1867058)
Backed out changeset 8efda4cce80c (bug 1867058)
Backed out changeset 0837e15babab (bug 1867058)
Backed out changeset 8ce7972ea4df (bug 1867058)
2024-03-23 02:24:26 +02:00
Sean Feng
05056421c1 Bug 1867058 - Part 8: Update Selection to support across shadow dom selection r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D195310
2024-03-22 17:05:51 +00:00
Sean Feng
dd9904e006 Bug 1867058 - Part 1: Implement Selection.direction r=jjaschke,dom-core
This patch implements the .direction attribute

Spec: https://www.w3.org/TR/selection-api/#dom-selection-direction

Differential Revision: https://phabricator.services.mozilla.com/D195301
2024-03-22 17:05:48 +00:00
Gregory Pappas
3ea20569e6 Bug 1881845 - Remove nsContentCID.h r=smaug,media-playback-reviewers,karlt
All of these components have been converted to static registration, making this
file unneeded.

Differential Revision: https://phabricator.services.mozilla.com/D202633
2024-03-04 23:41:05 +00:00
Gregory Pappas
153106ad94 Bug 1881188 - Remove nsLayoutCID.h r=emilio
All of this stuff has been converted to static registration, making this file
unneeded.

Differential Revision: https://phabricator.services.mozilla.com/D202291
2024-02-21 13:04:30 +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
20faadc9da Bug 1816581 - part 5: Make nsFrameSelection::PeekOffsetForCaretMove implement without members r=emilio
A caller of it should be independent from `nsFrameSelection` instance.
Therefore, I'd like to separate it to static method part and instance method
part.

Differential Revision: https://phabricator.services.mozilla.com/D197287
2023-12-27 04:42:11 +00:00
Masayuki Nakano
bc8a395afe Bug 1816581 - part 4: Make Selection::GetPrimaryFrameForFocusNode stop updating the caret association hint of nsFrameSelection r=emilio
Its name sounds a getter, but it updates the caret association hint of
`nsFrameSelection`, but at least, one of its callers,
`nsFrameSelection::PeekOffsetForCaretMove` shouldn't update it because it
just scans the previous or next position for caret.

Then, `Selection::GetPrimaryFrameForFocusNode` can be implemented with a
new static method which is useful for `PeekOffsetForCaretMove` when it becomes
a static method.

Differential Revision: https://phabricator.services.mozilla.com/D197286
2023-12-27 04:42:11 +00:00
Masayuki Nakano
ac6767faae Bug 1816581 - part 2: Make nsCaret::GetCaretFrameForNodeOffset static r=emilio
Oddly, it updates `nsFrameSelection` instance and some root callers may depend
on that. Therefore, this patch keep updating `nsFrameSelection` in the callers.

Differential Revision: https://phabricator.services.mozilla.com/D197284
2023-12-27 04:42:10 +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
a558378375 Bug 779684 - part 3: Make nsFrameIterator non-refcountable r=emilio
Nobody shares an instance of `nsFrameIterator`.  Therefore, we can make it
non-refcountable.  Additionally, `nsVisualIterator` is not required because
it overrides only 4 methods which are really simple.  So, once we merge it
into `nsFrameIterator`, we can allocate it in the stack.

Differential Revision: https://phabricator.services.mozilla.com/D197144
2023-12-24 06:01:19 +00:00
Masayuki Nakano
76826c766a Bug 779684 - part 2: Get rid of nsFrameTraversal and nsIFrameTraversal r=emilio
The class is used only for creating `nsFrameIterator`, but it's unnecessary
so that we can get rid of it and its interface.

Differential Revision: https://phabricator.services.mozilla.com/D197143
2023-12-24 06:01:19 +00:00
Masayuki Nakano
32c9d4f8e7 Bug 779684 - part 1: Get rid of nsIFrameEnumerator interface r=emilio
It's inherited only by `nsFrameIterator`, and `nsFrameIterator` can be declared
in a header file. So, the interface is not required and removing it can avoid
virtual calls.

Differential Revision: https://phabricator.services.mozilla.com/D197142
2023-12-24 06:01:19 +00:00
Stanca Serban
e07cea7e9d Backed out 3 changesets (bug 779684) for causing nsFrameIterator related mochitests failures.
Backed out changeset 8b92fb4e3f41 (bug 779684)
Backed out changeset f357b2287591 (bug 779684)
Backed out changeset 738fe6bbf913 (bug 779684)
2023-12-23 10:32:48 +02:00
Masayuki Nakano
5518ab835e Bug 779684 - part 3: Make nsFrameIterator non-refcountable r=emilio
Nobody shares an instance of `nsFrameIterator`.  Therefore, we can make it
non-refcountable.  Additionally, `nsVisualIterator` is not required because
it overrides only 4 methods which are really simple.  So, once we merge it
into `nsFrameIterator`, we can allocate it in the stack.

Differential Revision: https://phabricator.services.mozilla.com/D197144
2023-12-23 05:39:39 +00:00
Masayuki Nakano
c889543d50 Bug 779684 - part 2: Get rid of nsFrameTraversal and nsIFrameTraversal r=emilio
The class is used only for creating `nsFrameIterator`, but it's unnecessary
so that we can get rid of it and its interface.

Differential Revision: https://phabricator.services.mozilla.com/D197143
2023-12-23 05:39:38 +00:00
Masayuki Nakano
d04f4666eb Bug 779684 - part 1: Get rid of nsIFrameEnumerator interface r=emilio
It's inherited only by `nsFrameIterator`, and `nsFrameIterator` can be declared
in a header file. So, the interface is not required and removing it can avoid
virtual calls.

Differential Revision: https://phabricator.services.mozilla.com/D197142
2023-12-23 05:39:38 +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
Masayuki Nakano
3e86e21ebe Bug 1855345 - Make AutoCopyListener ignore any selection changes caused by Selection API r=karlt,smaug
Even though there is a reasonable usabe like bug 1567160, we should
ensure that `AutoCopyListener` never update clipboard when the selection
change is caused by a Selection API call.

Differential Revision: https://phabricator.services.mozilla.com/D191585
2023-10-26 04:05:02 +00:00
Sylvestre Ledru
d0f6c7fc66 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-15 15:29:02 +00:00
Cristina Horotan
6a90f5eded Backed out 2 changesets (bug 1856795) for causing build bustage at BasicEvents.h CLOSED TREE
Backed out changeset 1d98b028923a (bug 1856795)
Backed out changeset eae2ac93e17c (bug 1856795)
2023-10-14 21:42:14 +03:00
Sylvestre Ledru
cc8a0ee742 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-14 17:34:26 +00:00
Jan-Niklas Jaeschke
12f5099c54 Bug 1838262, part 3: Removed ServoStyleSet::ProbeHighlightPseudoElementStyle(). r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D184709
2023-07-31 13:47:55 +00:00
Jan-Niklas Jaeschke
a4a9d51c57 Bug 1811823, part 1: Added HighlightSelectionData struct. r=emilio
The idea of this struct is to allow live data of a highlight selection to be passed into layout.
Layout needs highlight properties such as priority or type to resolve combinations of highlights correctly.

Differential Revision: https://phabricator.services.mozilla.com/D181142
2023-06-23 15:22:43 +00:00
Jan-Niklas Jaeschke
1817114384 Bug 1836013: Order highlight selections by insertion order. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D174480
2023-05-31 10:07:51 +00:00
Kagami Sascha Rosylight
89172dc9c2 Bug 1831065 - Part 2: Remove unused ErrorResult parameters in highlight and selection r=webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D177008
2023-05-03 13:24:53 +00:00
Masayuki Nakano
5b59e4aeae Bug 1384606 - part 4: Make nsIFrame::GetFrameFromDirection allow to return content in different native anonymous subtree if the caller wants r=emilio
The a11y module wants to traverse frames in native anonymous subtrees.
Therefore, this patch adds new option for allowing it, makes
`nsIFrame::GetFrameFromDirection` check it before comparing native anonymous
subtree root nodes, and makes `HyperTextAccessible::FindOffset` use the
option.

Differential Revision: https://phabricator.services.mozilla.com/D172759
2023-03-18 04:18:53 +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
25e942f2a0 Bug 1384606 - part 4: Make nsIFrame::GetFrameFromDirection allow to return content in different native anonymous subtree if the caller wants r=emilio
The a11y module wants to traverse frames in native anonymous subtrees.
Therefore, this patch adds new option for allowing it, makes
`nsIFrame::GetFrameFromDirection` check it before comparing native anonymous
subtree root nodes, and makes `HyperTextAccessible::FindOffset` use the
option.

Differential Revision: https://phabricator.services.mozilla.com/D172759
2023-03-17 06:26:03 +00: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