Bug 1361008 - Part 1. Don't select invisible text node on makeBasicBlock. r=masayuki

GetNodesForOperation(..., makeBasicBlock) will get all nodes of promoted range.  But it includes invisible text node after <br> element.  So HTMLEditRules::MakeBasicBlock will creates block for invisible text node.

So we should remove invisible text node from nodes of formatBlock.

MozReview-Commit-ID: L1bsPAYcwx3

--HG--
extra : rebase_source : d9e4e3ff3eef41fb7a4b4c88d73d000b2e53806f
This commit is contained in:
Makoto Kato 2017-06-12 15:28:54 +09:00
parent 9ebd4efff6
commit b32c372b3d

View File

@ -5856,6 +5856,18 @@ HTMLEditRules::GetNodesForOperation(
GetInnerContent(*node, aOutArrayOfNodes, &j);
}
}
// Empty text node shouldn't be selected if unnecessary
for (int32_t i = aOutArrayOfNodes.Length() - 1; i >= 0; i--) {
OwningNonNull<nsINode> node = aOutArrayOfNodes[i];
if (EditorBase::IsTextNode(node)) {
// Don't select empty text except to empty block
bool isEmpty = false;
htmlEditor->IsVisTextNode(node->AsContent(), &isEmpty, false);
if (isEmpty) {
aOutArrayOfNodes.RemoveElementAt(i);
}
}
}
}
// Indent/outdent already do something special for list items, but we still
// need to make sure we don't act on table elements