Loading
Bug 1658702 - part 14: Implement a path to compute target ranges of...
Bug 1658702 - part 14: Implement a path to compute target ranges of `EditorBase::DeleteRangesWithTransaction()` r=m_kato `HTMLEditor` falls back to `EditorBase::DeleteRangesWithTransaction()` in some cases, especially when handling non-collapsed ranges. Therefore, we need to implement it for the following patches. The code corresponds to: * https://searchfox.org/mozilla-central/rev/62c443a7c801ba9672de34c2867ec1665a4bbe67/editor/libeditor/EditorBase.cpp#3848-3862 * https://searchfox.org/mozilla-central/rev/62c443a7c801ba9672de34c2867ec1665a4bbe67/editor/libeditor/EditorBase.cpp#3355,3371,3374,3376,3386-3387,3392 * https://searchfox.org/mozilla-central/rev/62c443a7c801ba9672de34c2867ec1665a4bbe67/editor/libeditor/EditorBase.cpp#3421,3431-3432,3435-3436,3444,3453-3455,3464-3465,3473-3474,3477-3478,3486,3495-3497,3506-3507,3515-3520,3526-3528,3535-3538,3543-3544,3546-3549,3558-3562,3570-3572,3579-3580 * https://searchfox.org/mozilla-central/rev/62c443a7c801ba9672de34c2867ec1665a4bbe67/editor/libeditor/DeleteTextTransaction.cpp#34,49-51,59,69-71 Basically, we don't need to touch the ranges, but if `aDirectionAndAmount` is `nsIEditor::eNext` or `nsIEditor::ePrevious`, each collapsed range is extened for: * previous character (treating only surrogate pair) * next character (treating only surrogate pair) * selecting another content node This logic is much rougher than what `AutoDeleteRangesHandler` and its nested classes do. So, `HTMLEditor` should stop using it in the future, but we need to keep using it for now. Depends on D90210 Differential Revision: https://phabricator.services.mozilla.com/D90211