зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1549268
- Mark EditorBase::JoinNodesWithTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D30041 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
0ab96c1983
Коммит
48d2fce863
|
@ -1085,6 +1085,7 @@ class EditorBase : public nsIEditor,
|
|||
* @param aRightNode The node which will be new container of the content of
|
||||
* aLeftNode.
|
||||
*/
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
nsresult JoinNodesWithTransaction(nsINode& aLeftNode, nsINode& aRightNode);
|
||||
|
||||
/**
|
||||
|
@ -1403,6 +1404,7 @@ class EditorBase : public nsIEditor,
|
|||
* aLeftNode.
|
||||
* @return The point of the first child of the last right node.
|
||||
*/
|
||||
MOZ_CAN_RUN_SCRIPT
|
||||
EditorDOMPoint JoinNodesDeepWithTransaction(nsIContent& aLeftNode,
|
||||
nsIContent& aRightNode);
|
||||
|
||||
|
|
|
@ -512,7 +512,9 @@ nsresult HTMLEditRules::AfterEditInner(EditSubAction aEditSubAction,
|
|||
// merge any adjacent text nodes
|
||||
if (aEditSubAction != EditSubAction::eInsertText &&
|
||||
aEditSubAction != EditSubAction::eInsertTextComingFromIME) {
|
||||
nsresult rv = HTMLEditorRef().CollapseAdjacentTextNodes(mDocChangeRange);
|
||||
RefPtr<nsRange> docChangeRange = mDocChangeRange;
|
||||
nsresult rv = MOZ_KnownLive(HTMLEditorRef())
|
||||
.CollapseAdjacentTextNodes(docChangeRange);
|
||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||
return NS_ERROR_EDITOR_DESTROYED;
|
||||
}
|
||||
|
@ -2974,8 +2976,9 @@ nsresult HTMLEditRules::WillDeleteSelection(
|
|||
return rv;
|
||||
}
|
||||
// Join blocks
|
||||
EditorDOMPoint pt = HTMLEditorRef().JoinNodesDeepWithTransaction(
|
||||
*leftParent, *rightParent);
|
||||
EditorDOMPoint pt =
|
||||
MOZ_KnownLive(HTMLEditorRef())
|
||||
.JoinNodesDeepWithTransaction(*leftParent, *rightParent);
|
||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||
return NS_ERROR_EDITOR_DESTROYED;
|
||||
}
|
||||
|
@ -8883,8 +8886,8 @@ nsresult HTMLEditRules::JoinNearestEditableNodesWithTransaction(
|
|||
// Separate join rules for differing blocks
|
||||
if (HTMLEditUtils::IsList(&aNodeLeft) || aNodeLeft.GetAsText()) {
|
||||
// For lists, merge shallow (wouldn't want to combine list items)
|
||||
nsresult rv =
|
||||
HTMLEditorRef().JoinNodesWithTransaction(aNodeLeft, aNodeRight);
|
||||
nsresult rv = MOZ_KnownLive(HTMLEditorRef())
|
||||
.JoinNodesWithTransaction(aNodeLeft, aNodeRight);
|
||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||
return NS_ERROR_EDITOR_DESTROYED;
|
||||
}
|
||||
|
@ -8909,7 +8912,8 @@ nsresult HTMLEditRules::JoinNearestEditableNodesWithTransaction(
|
|||
}
|
||||
|
||||
// For list items, divs, etc., merge smart
|
||||
nsresult rv = HTMLEditorRef().JoinNodesWithTransaction(aNodeLeft, aNodeRight);
|
||||
nsresult rv = MOZ_KnownLive(HTMLEditorRef())
|
||||
.JoinNodesWithTransaction(aNodeLeft, aNodeRight);
|
||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||
return NS_ERROR_EDITOR_DESTROYED;
|
||||
}
|
||||
|
|
|
@ -3778,7 +3778,8 @@ nsresult HTMLEditor::CollapseAdjacentTextNodes(nsRange* aInRange) {
|
|||
// get the prev sibling of the right node, and see if its leftTextNode
|
||||
nsCOMPtr<nsINode> prevSibOfRightNode = rightTextNode->GetPreviousSibling();
|
||||
if (prevSibOfRightNode && prevSibOfRightNode == leftTextNode) {
|
||||
nsresult rv = JoinNodesWithTransaction(*leftTextNode, *rightTextNode);
|
||||
nsresult rv = JoinNodesWithTransaction(MOZ_KnownLive(*leftTextNode),
|
||||
MOZ_KnownLive(*rightTextNode));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -711,7 +711,7 @@ class HTMLEditor final : public TextEditor,
|
|||
/**
|
||||
* Join together any adjacent editable text nodes in the range.
|
||||
*/
|
||||
nsresult CollapseAdjacentTextNodes(nsRange* aRange);
|
||||
MOZ_CAN_RUN_SCRIPT nsresult CollapseAdjacentTextNodes(nsRange* aRange);
|
||||
|
||||
/**
|
||||
* IsInVisibleTextFrames() returns true if all text in aText is in visible
|
||||
|
|
|
@ -434,6 +434,7 @@ interface nsIEditor : nsISupports
|
|||
* of the same type. However, a text node can be
|
||||
* merged only with another text node.
|
||||
*/
|
||||
[can_run_script]
|
||||
void joinNodes(in Node leftNode,
|
||||
in Node rightNode,
|
||||
in Node parent);
|
||||
|
|
Загрузка…
Ссылка в новой задаче