White-space disappears when you type `Enter` before ASCII white-space
Categories
(Core :: DOM: Editor, defect, P3)
Tracking
()
People
(Reporter: masayuki, Assigned: masayuki)
References
()
Details
Attachments
(1 file)
- Load
data:text/html,<div contenteditable><div>a b</div></div>
- Put caret before the white-space (i.e., after
a
) - Type
Enter
Expected Result:
<div>a b</div><div> b</div>
Actual Result:
<div>a b</div><div> b</div>
I.e., the white-space at start of the second paragraph is invisible due to start of a block.
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 1•3 years ago
|
||
It does the following things when caret is collapsed in a text node in a <p>
or <div>
element.
- Split the text node containing caret to insert
<br>
element - Insert
<br>
element after it - Split ancestor elements which inclusive descendants of the
<p>
or<div>
- Delete the
<br>
element if unnecessary from the left paragraph
#3 and #4 are performed by HTMLEditor::SplitParagraph()
and it calls
WhiteSpaceVisibilityKeeper::PrepareToSplitBlockElement()
correctly before
splitting the block. However, in the case (caret is at middle of a text node),
the text has already been split to 2 nodes because of #1. Therefore, it fails
to handle to keep the white-space visibility.
So that I believe that the root cause of this bug is, the method does much
complicated things which are required, and doing the redundant things will
eat memory space due to undo transactions. However, for now, I'd like to fix
this with a simple patch which just call the preparation method before splitting
the text node because I'd like to uplift this if it'd be approved (Note that
this is not a recent regression, the root cause was created by bug 92686 which
was fixed in 17 years ago:
https://searchfox.org/mozilla-central/commit/2e66280faef73e9be218e00758d4eb738395ac83,
but must be annoying bug for users who see this frequently).
The new WPTs are pass in Chrome.
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/73567f6c2bcf Make `HTMLEditor::HandleInsertParagraphInParagraph()` call `WhiteSpaceVisibilityKeeper::PrepareToSplitBlockElement()` before splitting a text node r=m_kato,smaug
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/31624 for changes under testing/web-platform/tests
Comment 4•3 years ago
|
||
bugherder |
Upstream PR merged by moz-wptsync-bot
Comment 6•3 years ago
|
||
The patch landed in nightly and beta is affected.
:masayuki, is this bug important enough to require an uplift?
If not please set status_beta
to wontfix
.
For more information, please visit auto_nag documentation.
Assignee | ||
Comment 7•3 years ago
|
||
We should wait more feedback for this change before requesting uplift.
Updated•2 years ago
|
Updated•2 years ago
|
Description
•