Closed Bug 1655706 Opened 7 months ago Closed 7 months ago

Clean up `HTMLEditor::TryToJoinBlocksWithTransaction()`

Categories

(Core :: DOM: Editor, task, P2)

task

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(7 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

It's made from 4 block, one is preparation, the others join 2 blocks, one of them is for the case when left block is a descendant of right block, next one is for the case when right block is a descendant of left block, the last one is for the case when they are siblings or similar. The last 3 blocks extend deletion range to delete invisible white-spaces. For understanding them deeper, I wrote patches to split these blocks.

Severity: -- → S3
Priority: -- → P2

And the name is wrong. It depends on aPoint whether the <br> element is
visible or invisible because it just scans preceding <br> element but
stop doing it when it meets a visible content. Therefore, this patch renames
it to explain what it does.

Now, the new method,
WhiteSpaceVisibilityKeeper::MergeFirstLineOfRightBlockElementIntoLeftBlockElement()
is the only user of the method so that we can get rid of it since it does enough
simple thing.

Depends on D85529

rightListElement is not used, so, we can put it into smaller scope.

leftListElement is used for storing original leftBlockElement when
newListElementTagNameOfRightListElement is some. Therefore, we can
stop using it with caching the original leftBlockElement before
maybe modified its value.

Depends on D85530

Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/e6609ce56edc
part 1-1: Move `HTMLEditor::GetInvisibleBRElementAt()` to `WSRunScanner` r=m_kato
https://hg.mozilla.org/integration/autoland/rev/578e7eee6309
part 1-2: Move last part of `HTMLEditor::TryToJoinBlocksWithTransaction()` to `WhiteSpaceVisibilityKeeper` r=m_kato
https://hg.mozilla.org/integration/autoland/rev/aca4cf510bef
part 1-3: Get rid of `WhiteSpaceVisibilityKeeper::PrepareToJoinNodes()` r=m_kato
https://hg.mozilla.org/integration/autoland/rev/d7da635ceb47
part 2-1: Make `HTMLEditor::TryToJoinBlocksWithTransaction()` stop using `leftListElement` and `rightListElement` after initializing `newListElementTagNameOfRightListElement` r=m_kato
https://hg.mozilla.org/integration/autoland/rev/c46442c200e9
part 2-2: Move 2nd block of `HTMLEditor::TryToJoinBlocksWithTransaction()` into `WhiteSpaceVisibilityKeeper` r=m_kato
https://hg.mozilla.org/integration/autoland/rev/7118f540a471
part 3-1: Move the last block of `HTMLEditor::TryToJoinBlocksWithTransaction()` into `WhiteSpaceVisibilityKeeper` r=m_kato
https://hg.mozilla.org/integration/autoland/rev/7dd2d86abbe3
part 3-2: Move `AutoTransactionsConserveSelection` in `HTMLEditor::TryToJoinBlocksWithTransaction()` into each `WhiteSpaceVisibilityKeeper` method r=m_kato
You need to log in before you can comment on or make changes to this bug.