Bug 1621592 Comment 2 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

[`atLeftBlockChild`](https://searchfox.org/mozilla-central/rev/278046367dab878316f60f0bd7f740cf73f3c447/editor/libeditor/HTMLEditSubActionHandler.cpp#3641) inside `TryToJoinBlocksWithTransaction` gets wrong value:

* The code tries merging the parent `<div>` of `<span>` with `<p>`, instead of just `<span>` with `<p>`
* The offset is computed against `<div>` and `<p>`, where `<p>` is in the first child of `<div>`.
* So the code moves `<p>` to the offset:
   * [`SplitInlinesAndCollectEditTargetNodesInOneHardLine`](https://searchfox.org/mozilla-central/rev/278046367dab878316f60f0bd7f740cf73f3c447/editor/libeditor/HTMLEditSubActionHandler.cpp#3850) splits `<span>` to make a new `<span>` that only includes `<p>`, and store it in `arrayOfContents`.
   * As [`HTMLEditor::NodeIsBlockStatic`](https://searchfox.org/mozilla-central/rev/278046367dab878316f60f0bd7f740cf73f3c447/editor/libeditor/HTMLEditSubActionHandler.cpp#3869) check fails, the code moves the new `<span>` without peeling any block.
[`atLeftBlockChild`](https://searchfox.org/mozilla-central/rev/278046367dab878316f60f0bd7f740cf73f3c447/editor/libeditor/HTMLEditSubActionHandler.cpp#3641) inside `TryToJoinBlocksWithTransaction` gets wrong value:

* The code tries merging the parent `<div>` of `<span>` with `<p>`, instead of just `<span>` with `<p>`
* The offset is computed against `<div>` and `<span>` using `atLeftBlockChild`, where `<span>` is in the parent of `<p>`.
* So the code moves `<p>` to the offset:
   * [`SplitInlinesAndCollectEditTargetNodesInOneHardLine`](https://searchfox.org/mozilla-central/rev/278046367dab878316f60f0bd7f740cf73f3c447/editor/libeditor/HTMLEditSubActionHandler.cpp#3850) splits `<span>` to make a new `<span>` that only includes `<p>`, and store it in `arrayOfContents`.
   * As [`HTMLEditor::NodeIsBlockStatic`](https://searchfox.org/mozilla-central/rev/278046367dab878316f60f0bd7f740cf73f3c447/editor/libeditor/HTMLEditSubActionHandler.cpp#3869) check fails, the code moves the new `<span>` without peeling any block.

Back to Bug 1621592 Comment 2