Make `AutoRangeArray::ExtendAnchorFocusRangeFor` stop using `nsFrameSelection`
Categories
(Core :: DOM: Editor, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox136 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
(Blocks 1 open bug, Regressed 1 open bug)
Details
Attachments
(1 file)
Assignee | ||
Comment 1•2 months ago
|
||
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 no 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 to 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. Therefore, this patch adds some
MOZ_ASSERT
into some delete handlers of HTMLEditor
to make it sure that
the specified instance is initialized with Selection
.
Depends on D232173
Comment 3•1 month ago
|
||
bugherder |
Description
•