web-platform-tests / wpt

Test suites for Web platform specs — including WHATWG, W3C, and others
https://web-platform-tests.org/
Other
5.02k stars 3.12k forks source link

[Gecko Bug 1930277] Make `nsHTMLCopyEncoder::RangeNodeContext::IncludeInContext` not treat inline editing host as an contextual inline element #49287

Closed moz-wptsync-bot closed 2 days ago

moz-wptsync-bot commented 2 days ago

It treats some inline elements as contextual elements. Then, they will be preserved in copied HTML fragment. However, if an inline element is an editing host, we don't want to contain it to the copied fragment because pasting it causes duplicating same style into same editing host. So, if the style includes relative style like font-size: 2em, it will cause bigger text than the surrounding text. Additionally, the inline editing host usually has a border but we don't want to make it appear in editable text.

Unfortunately, with this change, we stop copying the text style specified to the inline editing host. However, this is same behavior as when the editing host is a block element like <div>. Note that pasted text will be merged into the inline editing host style. Therefore, if and only if the destination has different style from the editing host, the result might be different from the expected one by the user. However, this is a long standing issue, see bug 1428046, for example.

Differential Revision: https://phabricator.services.mozilla.com/D228623

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1930277 gecko-commit: 060a278ac9c9372f565183bbb337b03ffdff3d7e gecko-reviewers: edgar, dom-core