зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1420415 - TextEditor::CreateBRImpl() needs to make pointToInsertBrNode store mOffset before calling EditorBase::CreateNode() r=m_kato
When TextEditor::CreateBRImpl() splits a text node before inserting new <br> element, it initializes pointToInsertBrNode only with the right text node. Then, it refers its Offset() after inserting new <br> node before the point. Therefore, the offset is computed with the new DOM tree. So, adding 1 to the offset is redundant only in this case. So, before calling CreateNode(), it needs to make pointToInsertBrNode store offset with calling its Offset(). Note that this ugly code will be replaced with patches for bug 1408227. Additionally, this doesn't use AutoEditorDOMPointChildInvalidator because it's not available in 58 but we need to uplift this patch. Finally, I'm not sure how to check this in automated tests. Therefore, this patch doesn't include automated tests. MozReview-Commit-ID: IaQBonoGawR --HG-- extra : rebase_source : a89559932f27d98a02baf3e207c6be3c2a545aad
This commit is contained in:
Родитель
8f5385f702
Коммит
32d89118c3
|
@ -466,6 +466,9 @@ TextEditor::CreateBRImpl(nsCOMPtr<nsIDOMNode>* aInOutParent,
|
|||
pointToInsertBrNode.Set(node);
|
||||
Unused << newLeftNode;
|
||||
}
|
||||
// Lock the offset of pointToInsertBrNode because it'll be referred after
|
||||
// inserting a new <br> node before it.
|
||||
Unused << pointToInsertBrNode.Offset();
|
||||
// create br
|
||||
brNode = CreateNode(nsGkAtoms::br, pointToInsertBrNode);
|
||||
if (NS_WARN_IF(!brNode)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче