mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 07:40:42 +00:00

When copying paragraphs in Gecko, some private type data is copied into the clipboard and our editor refers the private data at pasting such data. In this case, `text/_moz_htmlinfo` has 2 integers to specify the range at the copy. If selection range ends at end of text followed by an invisible `<br>` and a block boundary, this is set to the depth of the text node. Then, `HTMLWithContextInserter::CollectTopMostChildContentsCompletelyInRange` collects top most children of the last paragraph in `HTMLWithContextInserter::Run` [1]. Therefore, the last `<div>` in the clipboard is unwrapped at pasting in the test case. This patch makes `FragmentFromPasteCreator::MoveStartAndEndAccordingToHTMLInfo` re-climb up the tree under the common ancestor of found start/last nodes. 1. https://searchfox.org/mozilla-central/rev/6b1e306175c2284958fb185bab388021e2890ed0/editor/libeditor/HTMLEditorDataTransfer.cpp#646-651 Differential Revision: https://phabricator.services.mozilla.com/D203574