mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-07 11:56:51 +00:00
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:
parent
9ebd4efff6
commit
b32c372b3d
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user