Split `WhiteSpaceVisibilityKeeper::MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange()` to computation part and modifying DOM part
Categories
(Core :: DOM: Editor, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox80 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
Details
Attachments
(10 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
WhiteSpaceVisibilityKeeper::MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange()
(formerly WSRunObject::PrepareToDeleteRangePriv()
) computes everything before modifying the DOM tree, and then, may touch the DOM tree at most twice. This is wrong design. Each computation should be done immediately before touching the DOM tree.
Assignee | ||
Comment 1•5 years ago
|
||
So, this fix will change editor behavior, but only in edge cases (e.g., mutation event listener changed target text node at first modification).
Assignee | ||
Comment 2•5 years ago
|
||
This patch is preparation for easier to review.
This patch duplicates the body of
MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange()
and calls the
copies from new MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange()
.
The one is for handling start of deleting range, and the other is for handling
end of deleting range.
As you see, this patch and the following patches do not work because of the
duplicated code. Perhaps, part 2 works if there is no mutation event listeners.
Part 9 works even if there is mutation event listeners which touch the DOM
tree in the worst case (when it touches both end of delete range and start of
delete range, and around the start of deleting range is modified by JS).
Finally, part 9 takes back the original performance.
Depends on D82715
Assignee | ||
Comment 3•5 years ago
|
||
Depends on D83217
Assignee | ||
Comment 4•5 years ago
|
||
Depends on D83218
Assignee | ||
Comment 5•5 years ago
|
||
Depends on D83219
Assignee | ||
Comment 6•5 years ago
|
||
Depends on D83220
Assignee | ||
Comment 7•5 years ago
|
||
Depends on D83221
Assignee | ||
Comment 8•5 years ago
|
||
Depends on D83223
Assignee | ||
Comment 9•5 years ago
|
||
For representing delete or replace data which have the range and replace string,
this patch creates ReplaceRangeDataBase
class which is stack-only, has
EditorDOMRange
or EditorDOMRangeInTexts
as the range and has replace string
which can be empty string.
Then, MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange()
should
modify the DOM tree by itself. With the following patch, the behavior is
corrected for multiple DOM tree changes.
Depends on D83224
Assignee | ||
Comment 10•5 years ago
|
||
This is what the original method should've done. Mutation event listeners may
change the DOM tree at the first modification, but it hasn't checked whether
the range to delete or replace around start of deleting range is still valid
or not.
Depends on D83226
Assignee | ||
Comment 11•5 years ago
|
||
With this patch, the creation cost of TextFragmentData
is minimized, but
MakeSureToKeepVisibleStateOfWhiteSpacesAroundDeletingRange()
can work
with the latest DOM tree information at touching start of the deleting range
even after touching end of the range.
Depends on D83228
Comment 12•5 years ago
|
||
Comment 13•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/0de6c5accfb2
https://hg.mozilla.org/mozilla-central/rev/526b2c243a61
https://hg.mozilla.org/mozilla-central/rev/5f92809ee7e7
https://hg.mozilla.org/mozilla-central/rev/cd11ae9b62b4
https://hg.mozilla.org/mozilla-central/rev/f1d32700df16
https://hg.mozilla.org/mozilla-central/rev/91a43ab116a8
https://hg.mozilla.org/mozilla-central/rev/f2f1d527be0e
https://hg.mozilla.org/mozilla-central/rev/9862b5b2184c
https://hg.mozilla.org/mozilla-central/rev/76330247b90c
https://hg.mozilla.org/mozilla-central/rev/b1f1014ba56d
Description
•