зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1407305 - Part 3: Avoid using GetChildAt() in EditorBase::GetPriorNode(); r=masayuki
This commit is contained in:
Родитель
85ece51460
Коммит
40afcd0316
|
@ -3278,6 +3278,7 @@ EditorBase::GetLengthOfDOMNode(nsIDOMNode* aNode,
|
|||
nsIContent*
|
||||
EditorBase::GetPriorNode(nsINode* aParentNode,
|
||||
int32_t aOffset,
|
||||
nsINode* aChildAtOffset,
|
||||
bool aEditableNode,
|
||||
bool aNoBlockCrossing)
|
||||
{
|
||||
|
@ -3294,8 +3295,8 @@ EditorBase::GetPriorNode(nsINode* aParentNode,
|
|||
}
|
||||
|
||||
// else look before the child at 'aOffset'
|
||||
if (nsIContent* child = aParentNode->GetChildAt(aOffset)) {
|
||||
return GetPriorNode(child, aEditableNode, aNoBlockCrossing);
|
||||
if (aChildAtOffset) {
|
||||
return GetPriorNode(aChildAtOffset, aEditableNode, aNoBlockCrossing);
|
||||
}
|
||||
|
||||
// unless there isn't one, in which case we are at the end of the node
|
||||
|
@ -4544,6 +4545,7 @@ EditorBase::CreateTxnForDeleteRange(nsRange* aRangeToDelete,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsIContent* child = aRangeToDelete->GetChildAtStartOffset();
|
||||
int32_t offset = aRangeToDelete->StartOffset();
|
||||
|
||||
// determine if the insertion point is at the beginning, middle, or end of
|
||||
|
@ -4656,7 +4658,7 @@ EditorBase::CreateTxnForDeleteRange(nsRange* aRangeToDelete,
|
|||
// node to find out
|
||||
nsCOMPtr<nsINode> selectedNode;
|
||||
if (aAction == ePrevious) {
|
||||
selectedNode = GetPriorNode(node, offset, true);
|
||||
selectedNode = GetPriorNode(node, offset, child, true);
|
||||
} else if (aAction == eNext) {
|
||||
selectedNode = GetNextNode(node, offset, true);
|
||||
}
|
||||
|
|
|
@ -708,6 +708,7 @@ public:
|
|||
*/
|
||||
nsIContent* GetPriorNode(nsINode* aParentNode,
|
||||
int32_t aOffset,
|
||||
nsINode* aChildAtOffset,
|
||||
bool aEditableNode,
|
||||
bool aNoBlockCrossing = false);
|
||||
|
||||
|
|
|
@ -5064,6 +5064,7 @@ HTMLEditRules::CheckForEmptyBlock(nsINode* aStartNode,
|
|||
// Move to the end of the previous node
|
||||
nsCOMPtr<nsIContent> priorNode = htmlEditor->GetPriorNode(blockParent,
|
||||
offset,
|
||||
emptyBlock,
|
||||
true);
|
||||
if (priorNode) {
|
||||
EditorDOMPoint pt = GetGoodSelPointForNode(*priorNode, aAction);
|
||||
|
|
|
@ -3901,7 +3901,7 @@ HTMLEditor::GetPriorHTMLNode(nsINode* aParent,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return GetPriorNode(aParent, aOffset, true, aNoBlockCrossing);
|
||||
return GetPriorNode(aParent, aOffset, aChildAtOffset, true, aNoBlockCrossing);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче