Closed Bug 1766956 Opened 3 years ago Closed 3 years ago

WARNING: nsRange::CompareBoundaryPoints(Range_Binding::START_TO_START) failed: file /builds/worker/checkouts/gecko/editor/libeditor/SelectionState.cpp:141

Categories

(Core :: DOM: Editor, defect, P3)

defect

Tracking

()

RESOLVED FIXED
102 Branch
Tracking Status
firefox102 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

Details

Attachments

(3 files)

This warning appears too much in mochitest log and WPT log.

Severity: -- → S3
Priority: -- → P3

The warnings are caused by comparing a range with non-positioned range, or
comparing non-positioned ranges. And SelectionState::IsCollapsed() may
return true when it has and only has a non-positioned range.

Therefore, this patch adds new method which checks whether the selection cache
points a caret position or not instead of the "collapsed" state, and make
PlaceholderTransaction::StartSelectionEquals check is result before calling
SelectionState::Equals.

Assignee: nobody → masayuki
Status: NEW → ASSIGNED

This is the most cases of the warnings. If previous transactions occurred in
now disconnected subtree, e.g., they are replaced by setting innerHTML to
check different scenarios, nsRange::CompareBoundaryPoints return error.
Therefore, this case should be handled before comparing the range boundaries
and logged for making easier to debug.

Depends on D145225

The creation and initialization cost of nsRange is expensive. And just
comparing DOM points does not require the checks of ancestors which are
required by nsRange to observe DOM mutations. Therefore, although the
logic is not exactly same, we can skip the additional unnecessary cost.
Note that the Editor module checks without nsRange's strict initialization
in most places so that it must not be required to do the strict check only in
SelectionState.

Additionally, this moves some definitions of SelectionState methods to
its header for making them inlined since the dependency is now reduced.

Finally, some methods are renamed to align to Selection API.

Depends on D145226

Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/7f222a317c1a part 1: Make `PlaceholderTransaction::StartSelectionEquals` call `SelectionState::Equals` only when both selection caches store caret positions r=m_kato https://hg.mozilla.org/integration/autoland/rev/6f9a9774db23 part 2: Make `PlaceholderTransaction::Merge` return `false` if the caret points of merging transactions are in different root nodes r=m_kato
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/377f41f6d339 part 3: Make `SelectionState` stop using `nsRange` to compare DOM points r=m_kato
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: