зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1392867 - Part 2: Avoid calling GetChildAt() in HTMLEditRules::TryToJoinBlocks(); r=masayuki
This commit is contained in:
Родитель
07f926500c
Коммит
e7f2972a7f
|
@ -2735,15 +2735,15 @@ HTMLEditRules::TryToJoinBlocks(nsIContent& aLeftNode,
|
|||
// different lists, join the lists instead.
|
||||
bool mergeLists = false;
|
||||
nsIAtom* existingList = nsGkAtoms::_empty;
|
||||
int32_t offset;
|
||||
nsIContent* childInBlock = nullptr;
|
||||
nsCOMPtr<Element> leftList, rightList;
|
||||
if (HTMLEditUtils::IsListItem(leftBlock) &&
|
||||
HTMLEditUtils::IsListItem(rightBlock)) {
|
||||
leftList = leftBlock->GetParentElement();
|
||||
rightList = rightBlock->GetParentElement();
|
||||
if (leftList && rightList && leftList != rightList &&
|
||||
!EditorUtils::IsDescendantOf(leftList, rightBlock, &offset) &&
|
||||
!EditorUtils::IsDescendantOf(rightList, leftBlock, &offset)) {
|
||||
!EditorUtils::IsDescendantOf(leftList, rightBlock, &childInBlock) &&
|
||||
!EditorUtils::IsDescendantOf(rightList, leftBlock, &childInBlock)) {
|
||||
// There are some special complications if the lists are descendants of
|
||||
// the other lists' items. Note that it is okay for them to be
|
||||
// descendants of the other lists themselves, which is the usual case for
|
||||
|
@ -2801,7 +2801,7 @@ HTMLEditRules::TryToJoinBlocks(nsIContent& aLeftNode,
|
|||
if (mergeLists) {
|
||||
// The idea here is to take all children in rightList that are past
|
||||
// offset, and pull them into leftlist.
|
||||
for (nsCOMPtr<nsIContent> child = rightList->GetChildAt(offset);
|
||||
for (nsCOMPtr<nsIContent> child = childInBlock;
|
||||
child; child = rightList->GetChildAt(rightOffset)) {
|
||||
rv = htmlEditor->MoveNode(child, leftList, -1);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче