Commit Graph

376 Commits

Author SHA1 Message Date
Jan-Niklas Jaeschke
5917881724 Bug 1968981 - CSS Highlight API: Repaint Highlight selections after changing its priority or type. a=dmeehan DONTBUILD
Original Revision: https://phabricator.services.mozilla.com/D251615

Differential Revision: https://phabricator.services.mozilla.com/D252472
2025-06-05 13:30:02 +00:00
Florian Quèze
9885783942 Bug 1956726 - remove leftover Telemetry.h includes in .cpp files, r=chutten,geckoview-reviewers,cookie-reviewers,win-reviewers,dom-storage-reviewers,gstoll,valentin,m_kato,janv.
Differential Revision: https://phabricator.services.mozilla.com/D244351
2025-04-08 13:03:02 +00:00
Sean Feng
d8b23c28fb Bug 1954735 - Remove the assertion in PresShell::UpdateLastSelectionForToString r=masayuki
This assertion can be hit when the pref was on and then got
flipped to off. I think this is a legit usecase to set it to null
even if the pref is off. So this assertion doesn't really make sense.

All the callers that set this to non-null have the pref check that
should be enough.

Differential Revision: https://phabricator.services.mozilla.com/D241996
2025-03-19 13:28:04 +00:00
Sean Feng
e46b69d89c Bug 85686 - Mimic Chromium's getSelection().toString() behaviour r=masayuki,dom-core,webidl,smaug
Basically when getSelection().toString() is called, Chromium may
return an serialization on a different content than Firefox.
This patch tries to address this webcompat issue by mimicing
the same behaviour.

We should still address the spec issues, but this seems to be
an acceptable compromise.

Differential Revision: https://phabricator.services.mozilla.com/D239657
2025-03-17 13:36:16 +00:00
Masayuki Nakano
d74b5eae46 Bug 1954394 - Mark some nsFrameSelection methods which change selection r=jjaschke
Even in these days, we notify selection listeners of selection changes
**synchronously**.  Thus, we need to mark all selection change methods as
`MOZ_CAN_RUN_SCRIPT` even though they are safe in the most cases.

Depends on D241776

Differential Revision: https://phabricator.services.mozilla.com/D241778
2025-03-17 12:49:59 +00:00
Masayuki Nakano
0ef5624d51 Bug 1954020 - Rename "limiter" of nsFrameSelection to "independent selection root element" r=emilio
It's currently always set to the native anonymous `<div>` for editable content
of text control element.  So, it means that it's an independent selection root.

Depends on D241587

Differential Revision: https://phabricator.services.mozilla.com/D241775
2025-03-17 12:49:58 +00:00
Masayuki Nakano
a5637890c7 Bug 1946001 - Fix some points which may cross independent selection boundary r=emilio,jjaschke
This patch fixes multiple points which may cross independent selection
boundaries which is element boundary of the native anonymous `<div>` for
editable content in text controls.  The reason why I don't split this patch is,
fixing one of them leads another assertion failure.  So, I couldn't pass all
tests with separated patches.

1. `nsFrameTraversal` should take `Element` instead of `nsIFrame` for the
limiter because e.g., inline editing host like `<span contenteditable>` may
have multiple frames if it's wrapped.  Therefore, we should make it take
an element as the ancestor limiter, and check it when getting parent frame
or after getting previous or next frame.
2. `nsIFrame::PeekBackwardAndForward` may cross the boundary because it does not
take the anonymous `<div>` element as ancestor limiter of the selection.  It's
currently used only for extending selection.  Therefore, I rename it to make
it clearer.
3. `SelectionMovementUtils::GetPrevNextBidiLevel` to take the ancestor limiter
for calling `nsIFrame::GetFrameFromDirection()`.
4. `nsINode` should have a method to return the `nsFrameSelection` instance
which manages the selection in the node.  This makes the check simpler, and
this is not expensive.  Then, for making it clearer, I rename
`TextControlElement::GetConstFrameSelection()` to
`GetIndependentFrameSelection()`.
5. `nsINode::GetSelectionRootContent()` should have an option to return
independent selection root when the node is its host for
`nsFrameSelection::ConstrainFrameAndPointToAnchorSubtree()`
6. `nsFrameSelection::ConstrainFrameAndPointToAnchorSubtree()` should not
retrieve independent selection root when the given frame is a text control
frame.
7. `RangeUtils` should get parent with checking the independent selection
boundaries.
8. `Selection::Extend` should assert if the destination is managed by its
frame selection to detect a bug.

Differential Revision: https://phabricator.services.mozilla.com/D241587
2025-03-17 12:49:57 +00:00
Alexandru Marc
2e0051d757 Backed out 2 changesets (bug 85686, bug 1954244) for causing mass failures a=backout
Backed out changeset 702bc8ef655a (bug 1954244)
Backed out changeset a3cd9e425585 (bug 85686)
2025-03-15 04:22:27 +02:00
Sean Feng
d9af41ffc2 Bug 85686 - Mimic Chromium's getSelection().toString() behaviour r=masayuki,dom-core,webidl,smaug
Basically when getSelection().toString() is called, Chromium may
return an serialization on a different content than Firefox.
This patch tries to address this webcompat issue by mimicing
the same behaviour.

We should still address the spec issues, but this seems to be
an acceptable compromise.

Differential Revision: https://phabricator.services.mozilla.com/D239657
2025-03-13 17:31:54 +00:00
Cristina Horotan
a755f2ab17 Backed out changeset c354639dff24 (bug 85686) for causing multiple dt failures. CLOSED TREE 2025-03-12 22:13:59 +02:00
Sean Feng
afba09df01 Bug 85686 - Mimic Chromium's getSelection().toString() behaviour r=masayuki,dom-core,webidl,smaug
Basically when getSelection().toString() is called, Chromium may
return an serialization on a different content than Firefox.
This patch tries to address this webcompat issue by mimicing
the same behaviour.

We should still address the spec issues, but this seems to be
an acceptable compromise.

Differential Revision: https://phabricator.services.mozilla.com/D239657
2025-03-12 15:50:43 +00:00
Masayuki Nakano
e595f1e9aa Bug 1945711 - part 3: Make some callers of nsContentUtils::ComparePoints use the RangeBoundaryBase version r=jjaschke,dom-core
There are some callers of parent/offset version which computes offset before.
However, the offset may not be used.  Therefore, the callers should use
`RangeBoundaryBase` version.

Additionally, if only one of the pairs is computed from `RangeBoundaryBase`,
such callers should use the `RangeBoundaryBase` version too because the offset
computation may be skipped.  In this case, temporary `RangeBoundaryBase` should
be a `RawRangeBoundary` and whose `aRangeIsMutationObserver` should be set to
`RangeBoundaryIsMutationObserved::No` to avoid immediately to compute the child
node from `aOffset`.  I think that this should be default to
`RangeBoundaryIsMutationObserved::No` in the future, but for now, we should just
make the users explicitly set it to `RangeBoundaryIsMutationObserved::No` for
avoiding regressions.

Differential Revision: https://phabricator.services.mozilla.com/D236793
2025-02-10 01:29:39 +00:00
Masayuki Nakano
2b503ca56d Bug 1943226 - Make nsFrameSelection treat limiters are elements r=jjaschke,dom-core
`nsFrameSelection::GetLimiter()` is not `nullptr` only when it's an instance for
an independent selection of a text control.  In the case, it's set to the editor
root anonymous `<div>` of the text control.  Despite the name, this is already
optimized only for this purpose in `nsFrameSelection::NodeIsInLimiters()`.
Thus, we don't have any problems to make this clearer for the other developers
with renaming some parameter names.

`nsFrameSelection::GetAncestorLimiter()` is also always an `Element`.  So,
we can change this to `Element` too.

Differential Revision: https://phabricator.services.mozilla.com/D235254
2025-01-24 02:53:07 +00:00
Masayuki Nakano
9fd27e7690 Bug 1937289 - Make AutoRangeArray::ExtendAnchorFocusRangeFor stop using nsFrameSelection r=m_kato,jjaschke,dom-core
`AutoRangeArray` is created for making some handlers of the editor classes free
from `Selection` and `nsFrameSelection` while handling the edit actions.
However, the method still depends on `nsFrameSelection` instance since its
callees are instance methods of `nsFrameSelection`.

However, `EditContext` requires completely free methods to compute target
ranges of `beforeinput`.  Therefore, we need to make it not depend on
`Selection` nor `nsFrameSelection`.

The common method, `nsFrameSelection::CreateRangeExtendedToSomewhere`, requires
`PresShell`, selection limiter which is set only when the selection is an
independent selection like in a selection for a text control, selection
ancestor limiter which is set only when an editing host has focus, caret
association hint to put caret to end of preceding line or start of following
line if selection range is collapsed at a line break and caret bidi level for
considering caret position around line break in bidi text.  They are now stored
by `nsFrameSelection` and modified when selection range is changed in some
cases.  Basically, the method is called without updating its ranges and if and
only if it's initialized with `Selection`.  So, simply caching the
`nsFrameSelection`'s values solves the issues in the most cases, but this
patch makes `AutoRangeArray` adjust the value only when its `Collapse` is
called because `Selection` automatically updates it and we can compute the
value without `Selection` nor `nsFrameSelection`.

After applying this patch, `AutoRangeArray` has two meanings, one is the
instance is a proxy for `Selection`.  The other is a container for a range to
call methods which take pointer or reference to it.  To make this differences
checked at build time, this patch creates a new subclass of it, and renamed to
`AutoClonedRangeArray` to make it clearer that what are stored in the array.

Oddly, `AutoRangeArray(nsRange&)` constructor has not been cloned.  Therefore,
I make it and its subclass version clone before storing into the array.  Then,
one caller needs to change which range should be tracked.

Differential Revision: https://phabricator.services.mozilla.com/D232174
2025-01-07 01:56:52 +00:00
Jan-Niklas Jaeschke
5b73e583c8 Bug 1933738, part 1 - Always use nsFrameSelection::GetSelection() to access a Selection and assert it's non-null. r=emilio
The `nsFrameSelection` class guarantees that all `mDomSelections` are
non-null between creating and unlinking the instance.
Therefore, a nullptr check is typically not necessary when accessing a `Selection` instance.
This patch removes null-checks and instead asserts that a Selection is non-null.
This is done by adding a `MOZ_ASSERT`  to `nsFrameSelection::GetSelection()` and
by removing all direct access to `mDomSelections` and
instead routing through `GetSelection()` (or, by adding asserts).
As a side effect, this removes quite a bit of duplicate code.

Note that `nsFrameSelection::GetSelection()` might still return `nullptr`
if being called with an invalid selection type (`eInvalid`, `eNone`, `eHighlight`).
This means that if the selection type is not hard-coded, a nullptr check is still necessary.

Differential Revision: https://phabricator.services.mozilla.com/D230410
2024-11-29 07:31:57 +00:00
Jonathan Watt
7532be254f Bug 1931736. Add missing braces around if/loop statements in layout/generic/. r=layout-reviewers,emilio
Depends on D229247

Differential Revision: https://phabricator.services.mozilla.com/D229248
2024-11-17 05:03:58 +00:00
Stanca Serban
487746bf1b Backed out 2 changesets (bug 1862256) for causing mochitests failures in test_native_key_bindings_mac.html. CLOSED TREE
Backed out changeset b23e836dc19b (bug 1862256)
Backed out changeset ccb29705b1d5 (bug 1862256)
2024-11-07 14:31:58 +02:00
Laura Hausmann
a52d3dad74 Bug 1862256 - Fix textarea home/end behavior r=saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D192724
2024-11-07 10:30:46 +00:00
Otto Länd
e17cef5494 Bug 1927549: apply code formatting via Lando
# ignore-this-changeset
2024-10-29 09:28:05 +00:00
Jan-Niklas Jaeschke
0957666706 Bug 1927549, part 5: Moved content of nsFrameSelection::PeekOffsetForCaretMove() into nsFrameSelection::MoveCaret(). r=masayuki
The logic of this method was moved into helper methods in part 2 of this patchset.
Now, there was only one caller left.
So, we can easily move the code into the one call site and get rid of the method.

Differential Revision: https://phabricator.services.mozilla.com/D227159
2024-10-29 09:25:09 +00:00
Jan-Niklas Jaeschke
14280f1925 Bug 1927549, part 4: Renamed aContinueSelection to aExtendSelection to align with the enum name. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D227158
2024-10-29 09:25:09 +00:00
Jan-Niklas Jaeschke
74f09765cc Bug 1927549, part 3: Introduced SelectionMovementUtils::MoveRangeBoundaryToSomewhere(). r=masayuki
This new helper function can create a range boundary which is moved
by `aAmount` into `aDirection` without requiring to be in a selection.

Differential Revision: https://phabricator.services.mozilla.com/D227146
2024-10-29 09:25:08 +00:00
Jan-Niklas Jaeschke
72922d7915 Bug 1927549, part 2: Moved logic of nsFrameSelection::PeekOffsetForCaretMove() into helper methods. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D227145
2024-10-29 09:25:08 +00:00
Jan-Niklas Jaeschke
c0e1ec05ea Bug 1927549, part 1: Introduce enum ExtendSelection in nsFrameSelection. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D227144
2024-10-29 09:25:07 +00:00
serge-sans-paille
262f78c07f Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-28 08:21:19 +00:00
Alexandru Marc
a5eb905bf4 Backed out changeset d92f391b3b0c (bug 1922838) for backing out bug 1915351 2024-10-25 16:42:33 +03:00
serge-sans-paille
07101ac24d Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 09:06:01 +00:00
Alexandru Marc
004e704b22 Backed out changeset 448597bce69d (bug 1922838) for causing build bustages. CLOSED TREE 2024-10-24 11:37:49 +03:00
serge-sans-paille
2c916d4973 Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 07:38:30 +00:00
Emilio Cobos Álvarez
1123d2e75f Bug 1926031 - Make Selection::ScrollIntoView take ScrollFlags. r=jjaschke,masayuki
Differential Revision: https://phabricator.services.mozilla.com/D226389
2024-10-22 09:58:02 +00:00
Otto Länd
e9bedf0154 Bug 1926031: apply code formatting via Lando
# ignore-this-changeset
2024-10-22 09:37:12 +00:00
Emilio Cobos Álvarez
6a6f7270d4 Bug 1926031 - Remove unused SCROLL_FOR_CARET_MOVE. r=jjaschke,masayuki
No point in keeping the code around.

Differential Revision: https://phabricator.services.mozilla.com/D226387
2024-10-22 09:34:28 +00:00
Masayuki Nakano
1f32758228 Bug 1921705 - Make nsIFrame::PeekOffsetForCharacter treat non-editable frames as non-selectable r=emilio
When `PeekOffsetForCharacter` find a non-editable content, it should never
return the frame because user must want to move caret only in editable content
when the previous position is editable.  Additionally, when a non-selectable
frame is skipped, caret will be moved enough, so it should not skip any editable
content.  Finally, the found frame may cause a line break.  Therefore, this
patch overwrites the result of `SelectablePeekReport::PeekOffsetForCharacter`
from `FOUND` to `CONTINUE_UNSELECTABLE` when non-editable content is found.

The remaining failures of the new WPT should be handled in bug 449685 because
they are caused by no frame for invisible preceding/trailing white spaces around
the block element boundary.

Depends on D223909

Differential Revision: https://phabricator.services.mozilla.com/D224183
2024-10-03 02:39:21 +00:00
Sean Feng
318fb07f2b Bug 1455893 - Fix a bug where incorrect frame is used for shadow-crossing selection r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D221707
2024-09-11 14:13:30 +00:00
Emilio Cobos Álvarez
bc37920bdb Bug 1908552 - Remove unused ChromeOnly Selection.scrollIntoView. r=jjaschke,masayuki
There are no callers from JS (looked at the selection region constant
usage in idl and those use nsISelectionController, not this).

If we were to provide this API in the future, it would probably use
ScrollIntoViewOptions or so instead (plus something extra perhaps).

I wanted to remove the weird WehreToScroll percentage impl, but actually
some C++ accessibility code still uses it.

Differential Revision: https://phabricator.services.mozilla.com/D216872
2024-07-26 11:29:56 +00:00
Masayuki Nakano
6822b4fba8 Bug 1897255 - Make nsIFrame::PeekOffsetForLine won't cross editing host boundary unless the callers allows that r=emilio
The problems in the testcase are, `nsIFrame::PeekOffsetForLine` returns a frame
for any content node outside the editing host and `nsIFrame::GetLastLeaf`
returns a native anonymous subtree node if the frame is for the native
anonymous subtree root like `<input>` or `<textarea>`.

For fixing the former, the methods need to check whether found frame's editable
state **and** whether the editable node is an inclusive descendant of the
editing host.  However, there are complicated cases with inline editing hosts
and elements whose `contenteditable` is set to `false` and this is a new
regression for ESR 128.  Therefore, we need to fix this without any behavior
changes as far as possible.  Therefore, this patch basically checks only whether
the editing state of found one is editable and/or whether the one is an
inclusive descendant of the editing host to avoid `Selection` moves outside the
editing host.  The reaming complicated cases should be handled in new bugs which
blocks bug 1873155.

For fixing the latter, `nsIFrame::GetLastLeaf` needs to check the given frame's
content is a native anonymous subtree root or not.

Differential Revision: https://phabricator.services.mozilla.com/D216371
2024-07-19 08:13:10 +00:00
Edgar Chen
93cc222620 Bug 1906187 - Stop initializing the static member of AutoCopyListener; r=masayuki
So the sClipbaordID can not be an invalid clipboard type then.

Differential Revision: https://phabricator.services.mozilla.com/D215703
2024-07-04 05:01:32 +00:00
Sean Feng
8b5fa3ca09 Bug 1881095 - Add the copy paste support for ShadowDOM selection r=jjaschke,smaug,dom-core
This patch allows nsDocumentEncoder to serialize contents
in shadow trees when those contents are selected.

Differential Revision: https://phabricator.services.mozilla.com/D211577
2024-06-10 18:59:50 +00:00
Ting-Yu Lin
5cdee429ce 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
19542ed32d 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
14aebc5bf9 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
bf4dfe53f8 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
37e9b779f9 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
7e7ff289d4 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
6f6e711315 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
af935609c3 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
bf9b8d9763 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
dbaf47b1f4 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
ce5dc60809 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
3f695f17a9 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