Make edit sub action handlers stop retrieving selection by themselves #1
Categories
(Core :: DOM: Editor, enhancement, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox102 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
(Blocks 1 open bug)
Details
(Keywords: perf-alert)
Attachments
(15 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
Bug 1762115 - part 4: Make `SplitNodeTransaction::DoTransaction()` stop touching selection r=m_kato!
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Currently, a lot of edit sub-action handlers retrieve selection by themselves. This means that doing something depends on that the previously running code changed selection. So this long standing issue makes me investigating where need do change for fixing bug 1735608.
Assignee | ||
Comment 1•3 years ago
|
||
I think that I should land the patches (currently I have 15 patches) before the holiday week in Japan. Their performance improvement must make everybody happy. However, the changes may be risky. Therefore, it's fine to back them out even in the holiday week.
Assignee | ||
Comment 2•3 years ago
|
||
The strategy of this patch and most following patches is, returning candidate
caret position with CreateNodeResultBase
, and make each caller choose whether
it updates Selection
immediately, put it off until exiting from a loop, or
just ignore.
This patch makes HTMLEditor::HandleInsertBRElement
return
CreateElementResult
and makes its callers handle selection as same as the
method does.
And note that I've not realized that NS_FAILED
and NS_SUCCEEDED
include
MOZ_(UN)LIKELY
. Therefore, they don't need to be wrapped with them. And
also NS_WARN_IF
has it too (but it's not in opt build, see bug 1765909).
On the other hand, neither Result::isErr
nor Result::isOk
has them
(bug 1765916). Therefore, except in the case of Result
, this and following
patches will remove unnecessary MOZ_(UN)LIKELY
from editor.
Assignee | ||
Comment 3•3 years ago
|
||
Unfortunately, we need to keep InsertNodeTransaction::RedoTransaction()
touching Selection
for now because redoing Selection
management is out
of scope of this bug (it's probably require big changes, but no benefits for
now).
Depends on D144644
Assignee | ||
Comment 4•3 years ago
|
||
Depends on D144645
Assignee | ||
Comment 5•3 years ago
|
||
Depends on D144646
Assignee | ||
Comment 6•3 years ago
|
||
This patch allows methods which split some nodes to return new candidate
caret position and makes callers of them consider whether applying it to
the selection immediately or not.
Depends on D144647
Assignee | ||
Comment 7•3 years ago
|
||
Depends on D144648
Assignee | ||
Comment 8•3 years ago
|
||
Now, it does not require to update selection, and its result may have a point
to put caret it is used to doing. This patch makes it stop collapsing selection
after each split, and instead, makes all callers of it collapse selection if
it's (probably) necessary.
Note that the method may not split any nodes but return it as "handled".
Therefore, the callers do not check whether a splitting node occurred but
suggesting point to put caret is invalid or the other cases. Therefore, in
strictly speaking, this patch changes the existing behavior, but it should not
affects web apps in the wild because of the low usage of the legacy mutation
event listeners.
Depends on D144649
Assignee | ||
Comment 9•3 years ago
|
||
Depends on D144650
Assignee | ||
Comment 10•3 years ago
|
||
Depends on D144651
Assignee | ||
Comment 11•3 years ago
|
||
Depends on D144652
Assignee | ||
Comment 12•3 years ago
|
||
It's called only by HTMLEditor::HandleInsertParagraphInListItemElement
and
it also just returns a point to put caret computed from the result of
CopyLastEditableChildStylesWithTransaction
and its caller changes the
selection. Therefore, it's enough to make it return a recommend point to
put caret.
Depends on D144653
Assignee | ||
Comment 13•3 years ago
|
||
Its callers will touch Selection
or just returns a recommend point to put
caret.
Depends on D144654
Assignee | ||
Comment 14•3 years ago
|
||
For avoiding duplicated forward declarations, this patch also creates
EditorForwards.h
which is exposed under mozilla
. And then, for the future
changes, this makes the method templated to the callers do not require to
convert the result if the caller wants to return CreateElementResult
etc.
Depends on D144655
Assignee | ||
Comment 15•3 years ago
|
||
Depends on D144656
Assignee | ||
Comment 16•3 years ago
|
||
This patch also makes that HTMLWithContextInserter::InsertContents
collect moving children first. Then, move each one with a transaction.
This is standard manner in these days to avoid infinite loop caused by
moving the removed child back by a mutation event listener.
Depends on D144657
Assignee | ||
Comment 17•3 years ago
|
||
I think that I should land the patches (currently I have 15 patches) before the holiday week in Japan. Their performance improvement must make everybody happy. However, the changes may be risky. Therefore, it's fine to back them out even in the holiday week.
Comment 18•3 years ago
|
||
Comment 19•3 years ago
|
||
Comment 20•3 years ago
|
||
Comment 21•3 years ago
|
||
Comment 22•3 years ago
|
||
Comment 23•3 years ago
|
||
Comment 24•3 years ago
|
||
Comment 25•3 years ago
|
||
Comment 26•3 years ago
|
||
Comment 27•3 years ago
|
||
Comment 28•3 years ago
|
||
Comment 29•3 years ago
|
||
Comment 30•3 years ago
|
||
Comment 31•3 years ago
|
||
Comment 32•3 years ago
|
||
Comment 33•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c60b2478b2f2
https://hg.mozilla.org/mozilla-central/rev/d50ee2ce9eaa
https://hg.mozilla.org/mozilla-central/rev/8a1b659f4092
https://hg.mozilla.org/mozilla-central/rev/88a64ff079e1
https://hg.mozilla.org/mozilla-central/rev/c5cbd7d6343f
https://hg.mozilla.org/mozilla-central/rev/498113b89022
https://hg.mozilla.org/mozilla-central/rev/4a5c8b9e6f29
https://hg.mozilla.org/mozilla-central/rev/f5426e3f86ba
https://hg.mozilla.org/mozilla-central/rev/8f8a187b3446
https://hg.mozilla.org/mozilla-central/rev/d79abc3fb657
https://hg.mozilla.org/mozilla-central/rev/cf4b29edd52f
https://hg.mozilla.org/mozilla-central/rev/d0a43b0f26fc
https://hg.mozilla.org/mozilla-central/rev/07ef1afedce6
https://hg.mozilla.org/mozilla-central/rev/5cb08d1cbdd8
https://hg.mozilla.org/mozilla-central/rev/40b512ed4dbf
Comment 34•3 years ago
|
||
(In reply to Pulsebot from comment #29)
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/d0a43b0f26fc
part 12: MakeWhiteSpaceVisibilityKeeper::InsertBRElement
stop touching
Selection
directly r=m_kato
== Change summary for alert #34093 (as of Tue, 10 May 2022 06:19:37 GMT) ==
Improvements:
Ratio | Test | Platform | Options | Absolute values (old vs new) |
---|---|---|---|---|
4% | facebook loadtime | android-hw-p2-8-0-android-aarch64-shippable-qr | warm webrender | 681.19 -> 651.33 |
For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=34093
Updated•3 years ago
|
Description
•