зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1423097 - part 3: Fix new orange caused by an existing bug of EditorBase::DeleteSelectionAndCreateElement() r=m_kato
Even after EditorBase::DeleteSelectionAndCreateElement() creates a new element, it tries to collapse selection with |pointToInsert| which is outdated after inserting new element. So, it should recompute the caret position with new DOM tree. MozReview-Commit-ID: DKh2uhItIol --HG-- extra : rebase_source : c0c30e1c809784af64e87596b471c472350857a8
This commit is contained in:
Родитель
bab72d08e8
Коммит
ed66480149
|
@ -4490,11 +4490,13 @@ EditorBase::DeleteSelectionAndCreateElement(nsAtom& aTag)
|
|||
RefPtr<Element> newElement = CreateNode(&aTag, pointToInsert);
|
||||
|
||||
// We want the selection to be just after the new node
|
||||
DebugOnly<bool> advanced = pointToInsert.AdvanceOffset();
|
||||
EditorRawDOMPoint afterNewElement(newElement);
|
||||
MOZ_ASSERT(afterNewElement.IsSetAndValid());
|
||||
DebugOnly<bool> advanced = afterNewElement.AdvanceOffset();
|
||||
NS_WARNING_ASSERTION(advanced,
|
||||
"Failed to move offset next to the new element");
|
||||
ErrorResult error;
|
||||
selection->Collapse(pointToInsert, error);
|
||||
selection->Collapse(afterNewElement, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
// XXX Even if it succeeded to create new element, this returns error
|
||||
// when Selection.Collapse() fails something. This could occur with
|
||||
|
|
Загрузка…
Ссылка в новой задаче