Commit Graph
504 Commits
Author SHA1 Message Date
Cosmin Sabou 1890f2de9f Revert "Bug 2035573 - Start focus navigation from selection if it is a descendant of focused element. r=vhilla,edgar" for mochitest failures @ test_dialogfocus.
This reverts commit baa46d0833.
2026-06-11 15:22:43 +00:00
Leo Tenenbaum baa46d0833 Bug 2035573 - Start focus navigation from selection if it is a descendant of focused element. r=vhilla,edgar
Differential Revision: https://phabricator.services.mozilla.com/D303899
2026-06-11 13:33:50 +00:00
Masayuki Nakano 821c05533a Bug 2045219 - Improve the debug print of nsINode r=smaug,dom-core-reviewers
Currently, `operator<<(std::ostram&, const nsINode&)` prints the path
of the node with some attribute information of each node. However, there
are some issues:

1. It's unclear if the reached root is a `DocumentFragment` or
`ShadowRoot` due to the same node name, `#document-fragment`.
2. Do not print the host's path.
3. Cannot print only in a specific node such as a `contenteditable`.
4. It's hard to consider which `Text` if a node has multiple `Text`
nodes.
5. No information about the assigned `<slot>`.
6. No information about `EditContext`.

This patch appends these information to each node. Additionally, adding
`format_as()` for avoiding to use `mozilla::ToString` for `fmt::format`
and `MOZ_LOG_FMT`.

Finally, to test the new data, this makes `Selection` and `SelectionAPI`
log use `MOZ_LOG_FMT`.

Differential Revision: https://phabricator.services.mozilla.com/D304964
2026-06-08 01:00:49 +00:00
agoloman 861a985a35 Revert "Bug 2035573 - Start focus navigation from selection if it is a descendant of focused element. r=vhilla,edgar" for causing wpt failures @sequential-focus-navigation-starting-point.tentative.html.
This reverts commit 15f3930b2c.
2026-06-04 22:12:33 +00:00
Leo Tenenbaum 15f3930b2c Bug 2035573 - Start focus navigation from selection if it is a descendant of focused element. r=vhilla,edgar
Differential Revision: https://phabricator.services.mozilla.com/D303899
2026-06-04 21:17:44 +00:00
Masayuki Nakano d7faad651b Bug 2041140 - AutoBlockElementsJoiner::ComputeRangeToDeleteAtOtherBlockBoundary should stop calling HTMLEditor::CollapseSelectionTo r=m_kato,jjaschke
Previously, `Compute*()` methods temporarily updated `Selection` for
emulating the corresponding `Handle*()` method behavior. However,
they have already been fixed as not using `Selection`. Therefore,
we can make
`AutoBlockElementsJoiner::ComputeRangeToDeleteAtOtherBlockBoundary` stop
updating `Selection` only for
initializing `AutoClonedSelectionRangeArray` instance.

Differential Revision: https://phabricator.services.mozilla.com/D301693
2026-05-24 08:47:22 +00:00
Leo Tenenbaum 2f3b6a3baa Bug 2041087 - Check for null document when setting focus navigation starting point in NotifySelectionListeners. r=dom-core,smaug
Differential Revision: https://phabricator.services.mozilla.com/D301834
2026-05-21 19:26:42 +00:00
Leo Tenenbaum 9e978fd6da Bug 2034851 - Separate sequential focus navigation starting point from selection. r=dom-core,smaug
Differential Revision: https://phabricator.services.mozilla.com/D298958
2026-05-15 17:53:05 +00:00
Jonathan Watt 017557984b Bug 2030928. Rename mozilla::ScrollAxis to mozilla::AxisScrollParams. r=credential-management-reviewers,layout-reviewers,emilio,dimi
The current mozilla::ScrollAxis struct in PresShellForwards.h isn't a simple
axis enum. It carries information about where to scroll to along a specific
axis, and under what conditions that should happen. So 'ScrollAxis' isn't the
best name.

Now we're introducing WebIDL 'ScrollAxis' in bug 1350457:

https://drafts.csswg.org/scroll-animations-1/#scrolltimeline-interface

The extensive use of PresShellForwards.h's ScrollAxis in DOM code makes it
conflict with this new DOM enum. Rather than try to fix this through lots of
explitic namespacing, this patch renames PresShellForwards.h's ScrollAxis.

Differential Revision: https://phabricator.services.mozilla.com/D293485
2026-04-14 12:59:21 +00:00
Jan-Niklas Jaeschke 0b2d030087 Bug 2030660 - Remove dom.shadowdom.selection_across_boundary.enabled pref. r=masayuki,webidl
Differential Revision: https://phabricator.services.mozilla.com/D293086
2026-04-10 08:02:43 +00:00
Emilio Cobos Álvarez 5016086e1a Bug 2025089 - Remove some includes from nsINode.h and Element.h. r=dom-core,dom-storage-reviewers,firefox-svg-reviewers,janv,smaug
Differential Revision: https://phabricator.services.mozilla.com/D289049
2026-03-22 23:45:55 +00:00
Sylvestre Ledru 9eb1a31a98 Bug 2023419 - Remove Emacs/Vim modelines from dom/ r=emilio,media-playback-reviewers,webidl,padenot
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287843
2026-03-16 21:02:32 +00:00
Norisz Fay a86d829321 Revert "Bug 2012637 - part 9: Add a Firefox Source Docs documentation page for TreeKind and notable issues r=smaug,dom-core" as requested by dev
This reverts commit 88008cd8ca.

Revert "Bug 2012637 - part 8: Make `nsContentUtils::ComparePoints` handle `TreeKind::Flat` and `TreeKind::FlatForSelection` correctly r=smaug,dom-core"

This reverts commit 73e6f6587b.

Revert "Bug 2012637 - part 7: Make `RangeUtils::CompareNodeToRangeBoundaries()` use `nsContentUtils::ComparePoints` with valid point in the tree r=smaug"

This reverts commit 6985d5e80f.

Revert "Bug 2012637 - part 6: Make `nsRange::CutContents()` convert the range boundaries to the ones in the DOM before comparing r=smaug"

This reverts commit 73b585af3d.

Revert "Bug 2012637 - part 5: Delete the default template parameter of `nsContentUtils::ComparePoints` and relatives r=smaug,dom-core"

This reverts commit 1a7f24e5b5.

Revert "Bug 2012637 - part 4: Make `nsContentUtils` use `nsIContent` for taking a child node as a parameter r=smaug"

This reverts commit a6ea8d6824.

Revert "Bug 2012637 - part 3: Add template `nsINode` API which can switch to call API from `TreeKind` r=smaug,dom-core,webidl"

This reverts commit a4211e9df0.

Revert "Bug 2012637 - part 2: Add `TreeKind::FlatForSelection` and change the template parameter of `ChildIteratorBase` to `TreeKind` r=smaug,dom-core"

This reverts commit 0241749ee7.

Revert "Bug 2012637 - part 1: Make `ChildIterBase` template class to re-implement `FlattenedChildIterator` for DOM, Flat and FlatForSelection TreeKind r=smaug,dom-core,layout-reviewers,emilio"

This reverts commit 9e71cb77fb.
2026-03-13 02:52:45 +00:00
Norisz Fay 4e52a01bd2 Revert "Bug 2012797 - Make CompareToRangeStart() and CompareToRangeEnd() use nsContentUtils::ComparePoints with corresponding type boundaries r=jjaschke,dom-core"
This reverts commit 0603e4d25d.
2026-03-13 02:52:44 +00:00
Norisz Fay 7b16c5f4cd Revert "Bug 2009328 - Make Selection::ExtendInternal() compare in the non-flattened tree r=jjaschke,dom-core" requested for causing crashes in Bug 2023029
This reverts commit 048a5fe45b.
2026-03-13 02:52:38 +00:00
Masayuki Nakano 048a5fe45b Bug 2009328 - Make Selection::ExtendInternal() compare in the non-flattened tree r=jjaschke,dom-core
I believe that the method does wrong things. The method's parameter
should be a boundary in the non-flattened tree. Additionally, it
needs to compare the anchor-focus range in the non-flattened tree
because the DOM API does not support cross shadow range.

In other words, the method should work with range boundaries in the
non-flattened tree and the result may cross the shadow DOM boundaries
if the boundaries in the flattened tree are in different shadow DOM.

Differential Revision: https://phabricator.services.mozilla.com/D282107
2026-03-12 06:23:51 +00:00
Masayuki Nakano 0603e4d25d Bug 2012797 - Make CompareToRangeStart() and CompareToRangeEnd() use nsContentUtils::ComparePoints with corresponding type boundaries r=jjaschke,dom-core
They compare the given range boundary and given range start/end
boundary.  At this time, it creates `ConstRawRangeBoundary` instance
with the container and the offset of the range boundary whose `TreeKind`
may be `FlatForSelection`.  In this case, the offset may be invalid in
the shadow including DOM.  Therefore, they need to convert the
boundaries to the points for the comparing `TreeKind`.

Oddly, this causes hitting the assertion in
`RangeBoundaryBase::AsRangeBoundaryInFlatTree()` because the range
boundary has wrong offset and do not have the `Ref()`. According to
the stack trace, the wrong offset comes from
`nsTextFrame::GetSelectionDetails()` during reflow. Therefore, I don't
want to investigate the layout code's bug in this bug. Thus, this patch
changes the `MOZ_ASSERT` to `NS_ASSERTION` instead.

Differential Revision: https://phabricator.services.mozilla.com/D281313
2026-03-12 04:09:46 +00:00
Masayuki Nakano 6985d5e80f Bug 2012637 - part 7: Make RangeUtils::CompareNodeToRangeBoundaries() use nsContentUtils::ComparePoints with valid point in the tree r=smaug
It may call `nsContentUtils::ComparePoints_AllowNegativeOffsets()` and
`nsContentUtils::ComparePointsWithIndices()` within points in different
kind of tree. Therefore, it should use `ConstRawRangeBoundary` and
convert the points to the one in the expected tree.

Differential Revision: https://phabricator.services.mozilla.com/D281310
2026-03-12 03:01:59 +00:00
Masayuki Nakano 1a7f24e5b5 Bug 2012637 - part 5: Delete the default template parameter of nsContentUtils::ComparePoints and relatives r=smaug,dom-core
They accept any kind of points even if it does not match with the
template parameter's `TreeKind` because the caller wants to check the
relation in different kind of tree.  Therefore, any callers need to
consider the `TreeKind` more carefully and clarify the `TreeKind` makes
developers easier to find a bug.

Differential Revision: https://phabricator.services.mozilla.com/D281308
2026-03-12 03:01:54 +00:00
Masayuki Nakano 0241749ee7 Bug 2012637 - part 2: Add TreeKind::FlatForSelection and change the template parameter of ChildIteratorBase to TreeKind r=smaug,dom-core
This add `TreeKind::FlatForSelection` which should ignore the UA shadow
trees which are created in `<details>`, `<video>`, SVG `<use>`, etc
because their children are not selectable or slotted and reordered by
the shadow tree so that `Selection` and `AbstractRange` need to work
with their children in the non-flattened tree.

This patch does not change the behavior. It'll be done by a following
patch.

Differential Revision: https://phabricator.services.mozilla.com/D281304
2026-03-12 03:01:48 +00:00
Masayuki Nakano 9e71cb77fb Bug 2012637 - part 1: Make ChildIterBase template class to re-implement FlattenedChildIterator for DOM, Flat and FlatForSelection TreeKind r=smaug,dom-core,layout-reviewers,emilio
`FlattenedChildIterator` is a non-template class and work only for the
flattened tree (i.e., in the `TreeKind::Flat` mode).

To centralize the implementation to access children from a parent node
in the various kinds of tree except `ShadowIncludingDOM`, this patch
makes it a template class and support the simple DOM (for
`TreeKind::DOM`), the flattened tree (for`TreeKind::Flat`) and also the
flattened tree for selection whose `TreeKind` will be added by the next
patch.

The reason why this patch does not support
`TreeKind::ShadowIncludingDOM` is, it is not clear that which children
should be handled when the parent is a shadow host, i.e., whether the
children of the host or the `ShadowRoot`. Therefore, the caller should
use `ShadowRoot` if the users want to list up the the children from a
host. Then, the code is really clear about what it does.

Differential Revision: https://phabricator.services.mozilla.com/D281303
2026-03-12 03:01:45 +00:00
Emilio Cobos Álvarez 5624defbfd Bug 2016280 - Use shadow DOM for editor. r=masayuki,dom-core,smaug,Jamie
There's still a ton of things that can be cleaned up after this, but
this setup is nicer.

For now, editor keeps getting set-up / torn down on BindToFrame. Seems
all that could be untangled, but step by step.

The preview stuff and placeholder can just be created on demand now,
rather than requiring frame reconstruction.

Also, nsSearchControlFrame and co no longer do anything of interest, so
move the still relevant bits elsewhere and remove them.

test_bug1248459.html is removed because it messes with the editor
selection using SpecialPowers, in a way such that it crosses shadow
boundaries, and messes up the selected state triggering debug asserts.

test_focus_docnav.xhtml now triggers a different code-path because of
the shadow root (rather than the frame tree traversal). Keep it working
for now by replacing it with something that isn't a shadow root.

Differential Revision: https://phabricator.services.mozilla.com/D282953
2026-02-17 09:53:01 +00:00
Jan-Niklas Jaeschke 9448bbd1ea Bug 2013526 - Only store TextRangeStyle for ranges in selection if they are not default. r=smaug
Also drive-by-ed a few things that can be `const` but weren't.

Differential Revision: https://phabricator.services.mozilla.com/D281227
2026-02-01 13:51:32 +00:00
agoloman 031c614e00 Revert "Bug 2013526 - Only store TextRangeStyle for ranges in selection if they are not default. r=smaug" for causing mochitest failures @Selection.cpp.
This reverts commit c925a519a4.
2026-01-31 05:51:47 +00:00
Jan-Niklas Jaeschke c925a519a4 Bug 2013526 - Only store TextRangeStyle for ranges in selection if they are not default. r=smaug
Also drive-by-ed a few things that can be `const` but weren't.

Differential Revision: https://phabricator.services.mozilla.com/D281227
2026-01-31 05:16:27 +00:00
Masayuki Nakano f880cd0ef8 Bug 2010730 - Rewrite RangeBoundaryBase::AsRangeBoundaryInFlatTree() r=jjaschke,smaug,dom-core
Currently, the method may return unset boundary.  However, we need to
map a DOM tree point to a flat tree point.

The wrong point of current implementation is, the method respect the
container and offset. However, that may be wrong if the pointing child
node is moved into a `<slot>` or a `ShadowRoot`. Instead, this patch
computes proper parent from pointing child node if there is.

(I think there should be `nsINode::ComputeFlatTreeIndexOfForSelection`
or something, but I'd like to put off doing that later because it'd
affect to wider scope of our code.)

Differential Revision: https://phabricator.services.mozilla.com/D279308
2026-01-25 23:20:58 +00:00
Masayuki Nakano 7cec6d9c1c Bug 2009323 - part 2: Make RangeBoundaryBase disallow invalid DOM point at creation when pointing to a child node r=jjaschke,dom-core
If it points to a child node, it may be created for an `nsRange` and
even for creating a temporary instance with it, it is for validating
the point.  Therefore, if there are factory methods which return unset
instance when the given point is invalid, the constructors can assert
valid point.

However, `StaticRange` can be created with invalid points.  Therefore,
they should keep allowing to be initialized with an invalid point when
it'll point to an offset.

Note that this does NOT mean `RangeBoundaryBase` won't have invalid
point because it can be modified intentionally or mutations may
invalidate the point but nobody may not update the instance.

And also not that this accepts new regressions of `<use>` cases in the
WPT. This will be fixed in bug 2010730.

Differential Revision: https://phabricator.services.mozilla.com/D279307
2026-01-25 23:20:55 +00:00
Masayuki Nakano 4fa12d7518 Bug 2009323 - part 1: Make RangeBoundaryBase have some factory methods which take only a child node r=jjaschke,dom-core
`RangeBoundaryBase` allows to be initialized with invalid data for
allowing the users to use it as a validator.  However, this is bad,
and now it supports 2 tree kinds.  So, the users need to be familiar
with the relation of a child node and its parent and its offset when
they use `TreeKind::Flat`.  For making it easier to use, this patch
adds some new factory methods which automatically computes proper
parent/offset for a node with the `TreeKind`.

Differential Revision: https://phabricator.services.mozilla.com/D279306
2026-01-25 23:20:51 +00:00
agoloman 83e701e107 Revert "Bug 2009323 - part 2: Make RangeBoundaryBase disallow invalid DOM point at creation when pointing to a child node r=jjaschke,dom-core" for causing conflicts when backing out Bug 2009323.
This reverts commit 5728aae19d.

Revert "Bug 2009323 - part 1: Make `RangeBoundaryBase` have some factory methods which take only a child node r=jjaschke,dom-core"

This reverts commit 41c5bea4d5.
2026-01-23 14:51:12 +00:00
agoloman 96800d940e Revert "Bug 2010730 - Rewrite RangeBoundaryBase::AsRangeBoundaryInFlatTree() r=jjaschke,smaug,dom-core" for causing wpt failures @setBaseAndExtent-start-or-end-in-anonymous-shadow-container.html.
This reverts commit 34e2538a71.
2026-01-23 06:51:38 +00:00
Masayuki Nakano 34e2538a71 Bug 2010730 - Rewrite RangeBoundaryBase::AsRangeBoundaryInFlatTree() r=jjaschke,smaug,dom-core
Currently, the method may return unset boundary.  However, we need to
map a DOM tree point to a flat tree point.

The wrong point of current implementation is, the method respect the
container and offset. However, that may be wrong if the pointing child
node is moved into a `<slot>` or a `ShadowRoot`. Instead, this patch
computes proper parent from pointing child node if there is.

(I think there should be `nsINode::ComputeFlatTreeIndexOfForSelection`
or something, but I'd like to put off doing that later because it'd
affect to wider scope of our code.)

Differential Revision: https://phabricator.services.mozilla.com/D279308
2026-01-23 05:21:05 +00:00
Masayuki Nakano 5728aae19d Bug 2009323 - part 2: Make RangeBoundaryBase disallow invalid DOM point at creation when pointing to a child node r=jjaschke,dom-core
If it points to a child node, it may be created for an `nsRange` and
even for creating a temporary instance with it, it is for validating
the point.  Therefore, if there are factory methods which return unset
instance when the given point is invalid, the constructors can assert
valid point.

However, `StaticRange` can be created with invalid points.  Therefore,
they should keep allowing to be initialized with an invalid point when
it'll point to an offset.

Note that this does NOT mean `RangeBoundaryBase` won't have invalid
point because it can be modified intentionally or mutations may
invalidate the point but nobody may not update the instance.

And also not that this accepts new regressions of `<use>` cases in the
WPT. This will be fixed in bug 2010730.

Differential Revision: https://phabricator.services.mozilla.com/D279307
2026-01-23 05:14:52 +00:00
Masayuki Nakano 41c5bea4d5 Bug 2009323 - part 1: Make RangeBoundaryBase have some factory methods which take only a child node r=jjaschke,dom-core
`RangeBoundaryBase` allows to be initialized with invalid data for
allowing the users to use it as a validator.  However, this is bad,
and now it supports 2 tree kinds.  So, the users need to be familiar
with the relation of a child node and its parent and its offset when
they use `TreeKind::Flat`.  For making it easier to use, this patch
adds some new factory methods which automatically computes proper
parent/offset for a node with the `TreeKind`.

Differential Revision: https://phabricator.services.mozilla.com/D279306
2026-01-23 05:14:49 +00:00
Masayuki Nakano 5c705dd826 Bug 2009095 - Make RangeBoundaryBase store whether it points to child node or offset instead of whether the owner observes mutations r=jjaschke,dom-core
I'm often confused at `RangeBoundaryIsMutationObserved` and
`RangeBoundaryBase::mIsMutationObserved` due to their names. They are
default to `Yes` or `true`. However, `RangeBoundaryBase` may be used for
temporary objects too without mutation observer. Therefore, they may
lie.

On the other hand, the most usage of
`RangeBoundaryBase::mIsMutationObserved` is, to check whether the
instance points to child node or offset. So, I think they can be changed
to `enum class RangeBoundaryPointsTo { Offset, ChildNode }` and
`mPointingToChildNode`.

Differential Revision: https://phabricator.services.mozilla.com/D279300
2026-01-23 04:46:00 +00:00
Jan-Niklas Jaeschke 39176767d1 Bug 2011011, part 2: Small refactorings around the changed StyledRangeCollection data structure. r=dom-core,smaug
This patch does small refactorings like modernizing loops.
In addition, the `StyledRange` struct is moved into the `mozilla::dom`
namespace.

There are no functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D279475
2026-01-21 08:02:43 +00:00
Jan-Niklas Jaeschke cfdc5c4ec3 Bug 2011011, part 1: Implement fast lookup for styled range data in Selection. r=dom-core,smaug
The `StyledRange`s in `Selection` need to be stored sorted by start
position in the DOM. At the same time, the style data needs to be
queried during paint, using a range pointer as key.

Before this patch, the data was stored in an `nsTArray`, which led to
linear lookup times during paint. This could lead to noticeable jank
in situations with many ranges (e.g. CSS Highlight API).

Since the data is key-value-ish, the data structure is changed
to use a sorted array of `AbstractRange`s in addition to a lookup table
for the `TextRangeStyle`s.

This patch tries to keep refactorings to a minimum
and should not change any behavior.

Differential Revision: https://phabricator.services.mozilla.com/D279474
2026-01-21 08:02:40 +00:00
Emilio Cobos Álvarez 077d88e977 Bug 2011213 - Remove FMT_STRING() usage. r=padenot
Should not be needed now that we build with C++20.

Differential Revision: https://phabricator.services.mozilla.com/D279521
2026-01-19 15:12:33 +00:00
Masayuki Nakano 6eed70821e Bug 2000978 - Make SelectionMovementUtils::GetFrameForNodeOffset() return FrameAndOffset instead of using aReturnOffset r=emilio,layout-reviewers
Additionally, this adds some shortcut operators to `FrameAndOffset`.
Therefore, some users of derived structs of `FrameAndOffset` become
simpler.

Differential Revision: https://phabricator.services.mozilla.com/D273716
2025-12-15 07:53:05 +00:00
Hiroyuki Ikezoe a99f99fe91 Bug 2002407 - Drop mOnlyIfPerceivedScrollableDirection. r=layout-reviewers,dholbert
mOnlyIfPerceivedScrollableDirection flag was introduced in bug 791616 to fix
an issue that while moving the caret the box having the caret was
slightly scrolled. There's a mochitest named test_bug791616.html [1] in
our tree for bug 791616, now the mochitest gets passed without the flag.
So it isn't necessary now.

helper_scrollIntoView_bug2002407 is a test case for bug 1999977 which
should be fixed by this change.

[1] https://searchfox.org/firefox-main/rev/7032b912c282da6b9b8219e779b2a441a27aaec9/layout/generic/test/test_bug791616.html

Differential Revision: https://phabricator.services.mozilla.com/D275903
2025-12-12 03:11:47 +00:00
Jan-Niklas Jaeschke ee56bb8110 Bug 2004005 - CSS Highlight API: Don't add invalid static ranges to Selection. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D275360
2025-12-07 12:15:13 +00:00
Cosmin Sabou afbde9b7af Revert "Bug 2004005 - CSS Highlight API: Don't add invalid static ranges to Selection. r=smaug" for causing build bustages on Selection.cpp
This reverts commit 15ee536019.
2025-12-06 20:04:23 +00:00
Jan-Niklas Jaeschke 15ee536019 Bug 2004005 - CSS Highlight API: Don't add invalid static ranges to Selection. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D275360
2025-12-06 19:46:48 +00:00
Emilio Cobos Álvarez ba0e228d4f Bug 2000639 - Remove nsViewManager. r=jwatt
After the previous patches, nsViewManager is basically a backpointer to
its pres shell.

Remove it and just make PresShell manage the root view directly. After
this is done, we can decide what to do about nsView (which is itself
little more than a widget listener that forwards to pres shell right
now).

This technically starts listening to mParentWidget slightly later (on
pres shell creation), but I think that's ok.

Differential Revision: https://phabricator.services.mozilla.com/D272890
2025-11-28 10:48:18 +00:00
Masayuki Nakano 82a139a8f0 Bug 1998858 - part 2: Make Selection stop splitting user selected range to exclude non-selectable nodes r=smaug,emilio,edgar,TYLin,layout-reviewers
The other browsers do not support multiple selection ranges.  Therefore,
they never split selection ranges to exclude non-selectable nodes.
To align the behavior, we should do so.  However, to keep current
look of `Selection` which is similar to Chrome's behavior, we should
make the selection painters ignore normal selections if their content
is not selectable.

Note that this patch allows painting selected text when there are some
IME selections even if `user-select` is `none` because the normal
selection is also a part of IME selections.  Although our widget
currently do not use non-collapsed normal selection during a
composition, it may be changed to support new IME in the future.

Differential Revision: https://phabricator.services.mozilla.com/D272187
2025-11-21 00:16:55 +00:00
Jonathan Kew 0612ab4067 Bug 1987419 - Use const references for CharacterDataBuffer in textframe code. r=layout-reviewers,firefox-svg-reviewers,emilio,longsonr
Differential Revision: https://phabricator.services.mozilla.com/D264083
2025-09-09 10:05:38 +00:00
Jan-Niklas Jaeschke adc52807be Bug 1949053, part 5 - Rename nsTextFrame::TextFragment to `CharacterDataBuffer. r=masayuki,layout-reviewers,emilio
This patch removes the term "text fragment" from `nsTextFrame`,
and replaces it with `character data buffer`. There are no changes in logic.

Differential Revision: https://phabricator.services.mozilla.com/D259936
2025-08-06 08:48:12 +00:00
Jan-Niklas Jaeschke 0151e67615 Bug 1949053, part 2 - Rename nsTextFragment to mozilla::dom::CharacterDataBuffer. r=masayuki
This patch updates all occurrences of the type `nsTextFragment` into its new name, `mozilla::dom::CharacterDataBuffer`.
It also updates the includes, including sorting.

Differential Revision: https://phabricator.services.mozilla.com/D259867
2025-08-06 08:48:01 +00:00
Emilio Cobos Álvarez 791917d8af Bug 1976665 - Sort headers in dom/. r=dom-core,media-playback-reviewers,webrtc-reviewers,dom-storage-reviewers,padenot,janv,smaug,jesup,jib
Most changes are automated. Relevant bit is dom/.clang-format. I had to
manually disable clang-format in a few places where importing external
files and so on that aren't self-contained, and fix a couple includes /
forward declarations.

Differential Revision: https://phabricator.services.mozilla.com/D256800
2025-08-05 11:47:34 +00:00
Sean Feng bb9ad7f346 Bug 1965846 - Make CrossShadowBoundaryRange utilizes RangeBoundary(TreeKind::Flat) r=smaug
https://phabricator.services.mozilla.com/D251609 introduces a new type
to `RangeBoundary` so that it has different behaviours for
`TreeKind::DOM` and `TreeKind::Flat`. There was a concern about
mix-using the boundaries that had different types, it would be
error-prone.

The idea to address that concern is we always keep nsRange::mStart
and nsRange::mEnd to use `TreeKind::DOM`, and make
CrossShadowBoundaryRange to always use `TreeKind::Flat`. This also means
that we need to create CrossShadowBoundaryRange more often.

Differential Revision: https://phabricator.services.mozilla.com/D254081
2025-07-03 13:25:18 +00:00
Sean Feng 6e6993a09a Bug 1972095 - Update selection.getComposedRanges to the latest syntax r=smaug
while still having the old syntax supported.

Differential Revision: https://phabricator.services.mozilla.com/D253715
2025-06-17 18:27:02 +00:00