Optimize DOM mutation caused by `HTMLEditor::DoSplitNode` and `HTMLEditor::DoJoinNodes`
Categories
(Core :: DOM: Editor, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox136 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
Details
Attachments
(1 file)
HTMLEditor::DoSplitNode
does:
- Insert a new right node
- Move content in left node into the right node
HTMLEditor::DoJoinNodes
does:
- Move content of the right node to the left node
- Delete the left node
So, all things are done when connected. Therefore IMEContentObserver
uses its cache and it's harder to debug. Additionally, temporarily the touching range becomes wider then the result at joining nodes. That could cause IME gets received longer text change range. Therefore, they should do:
HTMLEditor::DoSplitNode
:
- Move content in left node to the orphan new right node (then, only removing content is handled by
IMEContentObserver
) - Insert the right node (then,
IMEContentObserver
can compute the offset and length only once)
HTMLEditor::DoJoinNodes
:
- Delete the right node (then, all moving content is treated as removed by
IMEContentObserver
, i.e., it needs to compute offset/length once) - Move the non-connected right node children into the left node (then,
IMEContentObserver
can cache all moving nodes and compute offset/length once)
Assignee | ||
Comment 1•1 month ago
|
||
HTMLEditor::DoSplitNode
does:
- Insert a new right node
- Move content in left node into the right node
HTMLEditor::DoJoinNodes
does:
- Move content of the right node to the left node
- Delete the left node
So, all things are done when connected. Therefore IMEContentObserver
uses its
cache and it's harder to debug. Additionally, temporarily the touching range
becomes wider then the result at joining nodes. That could cause IME gets
received longer text change range. Therefore, they should do:
HTMLEditor::DoSplitNode
:
- Move content in left node to the orphan new right node (then, only removing
content is handled byIMEContentObserver
) - Insert the right node (then,
IMEContentObserver
can compute the offset and
length only once)
HTMLEditor::DoJoinNodes
:
- Delete the right node (then, all moving content is treated as removed by
IMEContentObserver
, i.e., it needs to compute offset/length once) - Move the non-connected right node children into the left node (then,
IMEContentObserver
can cache all moving nodes and compute offset/length once)
Comment 3•29 days ago
|
||
Backed out for causing mochitests failures in test_composition_text_querycontent.xhtml.
- Backout link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | widget/tests/test_composition_text_querycontent.xhtml | runIMEContentObserverTest with contenteditable (defaultParagraphSeparator is br): deleting child nodes (partially #2) with pressing Delete key should cause text change notification whose offset is 1 - got 2, expected 1
Assignee | ||
Comment 4•29 days ago
|
||
Hmm, odd. I didn't see the failure when I was working on this bug...
Assignee | ||
Comment 5•28 days ago
|
||
The patch also fails in test_text_change_notifications_when_inserting_text_containing_line_breaks.html
which will be updated in bug 1940653 which needs to be fixed in the beta channel. Therefore, I'll update the patch again after landing the patch for bug 1940653.
Comment 7•21 days ago
|
||
bugherder |
Description
•