зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1549264 - Mark EditorBase::SplitNodeWithTransaction() as MOZ_CAN_RUN_SCRIPT r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D30039 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
0925cb9a70
Коммит
f440ac739a
|
@ -1072,7 +1072,7 @@ class EditorBase : public nsIEditor,
|
||||||
* error.
|
* error.
|
||||||
*/
|
*/
|
||||||
template <typename PT, typename CT>
|
template <typename PT, typename CT>
|
||||||
already_AddRefed<nsIContent> SplitNodeWithTransaction(
|
MOZ_CAN_RUN_SCRIPT already_AddRefed<nsIContent> SplitNodeWithTransaction(
|
||||||
const EditorDOMPointBase<PT, CT>& aStartOfRightNode,
|
const EditorDOMPointBase<PT, CT>& aStartOfRightNode,
|
||||||
ErrorResult& aResult);
|
ErrorResult& aResult);
|
||||||
|
|
||||||
|
@ -1386,7 +1386,7 @@ class EditorBase : public nsIEditor,
|
||||||
* caller want to do it.
|
* caller want to do it.
|
||||||
*/
|
*/
|
||||||
template <typename PT, typename CT>
|
template <typename PT, typename CT>
|
||||||
SplitNodeResult SplitNodeDeepWithTransaction(
|
MOZ_CAN_RUN_SCRIPT SplitNodeResult SplitNodeDeepWithTransaction(
|
||||||
nsIContent& aMostAncestorToSplit,
|
nsIContent& aMostAncestorToSplit,
|
||||||
const EditorDOMPointBase<PT, CT>& aDeepestStartOfRightNode,
|
const EditorDOMPointBase<PT, CT>& aDeepestStartOfRightNode,
|
||||||
SplitAtEdges aSplitAtEdges);
|
SplitAtEdges aSplitAtEdges);
|
||||||
|
|
|
@ -1462,9 +1462,9 @@ nsresult HTMLEditRules::WillInsertText(EditSubAction aEditSubAction,
|
||||||
|
|
||||||
// is it a return?
|
// is it a return?
|
||||||
if (subStr.Equals(newlineStr)) {
|
if (subStr.Equals(newlineStr)) {
|
||||||
RefPtr<Element> brElement =
|
RefPtr<Element> brElement = MOZ_KnownLive(HTMLEditorRef())
|
||||||
HTMLEditorRef().InsertBrElementWithTransaction(currentPoint,
|
.InsertBrElementWithTransaction(
|
||||||
nsIEditor::eNone);
|
currentPoint, nsIEditor::eNone);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -1834,7 +1834,8 @@ EditActionResult HTMLEditRules::WillInsertParagraphSeparator() {
|
||||||
EditorRawDOMPoint endOfBlockParent;
|
EditorRawDOMPoint endOfBlockParent;
|
||||||
endOfBlockParent.SetToEndOf(blockParent);
|
endOfBlockParent.SetToEndOf(blockParent);
|
||||||
RefPtr<Element> brElement =
|
RefPtr<Element> brElement =
|
||||||
HTMLEditorRef().InsertBrElementWithTransaction(endOfBlockParent);
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
|
.InsertBrElementWithTransaction(endOfBlockParent);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return EditActionIgnored(NS_ERROR_EDITOR_DESTROYED);
|
return EditActionIgnored(NS_ERROR_EDITOR_DESTROYED);
|
||||||
}
|
}
|
||||||
|
@ -1921,7 +1922,8 @@ nsresult HTMLEditRules::InsertBRElement(const EditorDOMPoint& aPointToBreak) {
|
||||||
// First, insert a <br> element.
|
// First, insert a <br> element.
|
||||||
RefPtr<Element> brElement;
|
RefPtr<Element> brElement;
|
||||||
if (IsPlaintextEditor()) {
|
if (IsPlaintextEditor()) {
|
||||||
brElement = HTMLEditorRef().InsertBrElementWithTransaction(aPointToBreak);
|
brElement = MOZ_KnownLive(HTMLEditorRef())
|
||||||
|
.InsertBrElementWithTransaction(aPointToBreak);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -1946,9 +1948,10 @@ nsresult HTMLEditRules::InsertBRElement(const EditorDOMPoint& aPointToBreak) {
|
||||||
HTMLEditor::GetLinkElement(pointToBreak.GetContainer());
|
HTMLEditor::GetLinkElement(pointToBreak.GetContainer());
|
||||||
if (linkNode) {
|
if (linkNode) {
|
||||||
SplitNodeResult splitLinkNodeResult =
|
SplitNodeResult splitLinkNodeResult =
|
||||||
HTMLEditorRef().SplitNodeDeepWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
*linkNode, pointToBreak,
|
.SplitNodeDeepWithTransaction(
|
||||||
SplitAtEdges::eDoNotCreateEmptyContainer);
|
*linkNode, pointToBreak,
|
||||||
|
SplitAtEdges::eDoNotCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -2094,8 +2097,10 @@ EditActionResult HTMLEditRules::SplitMailCites() {
|
||||||
}
|
}
|
||||||
|
|
||||||
SplitNodeResult splitCiteNodeResult =
|
SplitNodeResult splitCiteNodeResult =
|
||||||
HTMLEditorRef().SplitNodeDeepWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
*citeNode, pointToSplit, SplitAtEdges::eDoNotCreateEmptyContainer);
|
.SplitNodeDeepWithTransaction(
|
||||||
|
*citeNode, pointToSplit,
|
||||||
|
SplitAtEdges::eDoNotCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return EditActionIgnored(NS_ERROR_EDITOR_DESTROYED);
|
return EditActionIgnored(NS_ERROR_EDITOR_DESTROYED);
|
||||||
}
|
}
|
||||||
|
@ -2124,8 +2129,8 @@ EditActionResult HTMLEditRules::SplitMailCites() {
|
||||||
EditorRawDOMPoint endOfPreviousNodeOfSplitPoint;
|
EditorRawDOMPoint endOfPreviousNodeOfSplitPoint;
|
||||||
endOfPreviousNodeOfSplitPoint.SetToEndOf(previousNodeOfSplitPoint);
|
endOfPreviousNodeOfSplitPoint.SetToEndOf(previousNodeOfSplitPoint);
|
||||||
RefPtr<Element> invisibleBrElement =
|
RefPtr<Element> invisibleBrElement =
|
||||||
HTMLEditorRef().InsertBrElementWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
endOfPreviousNodeOfSplitPoint);
|
.InsertBrElementWithTransaction(endOfPreviousNodeOfSplitPoint);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return EditActionIgnored(NS_ERROR_EDITOR_DESTROYED);
|
return EditActionIgnored(NS_ERROR_EDITOR_DESTROYED);
|
||||||
}
|
}
|
||||||
|
@ -2139,7 +2144,8 @@ EditActionResult HTMLEditRules::SplitMailCites() {
|
||||||
// cite node, <br> should be inserted before the current cite.
|
// cite node, <br> should be inserted before the current cite.
|
||||||
EditorRawDOMPoint pointToInsertBrNode(splitCiteNodeResult.SplitPoint());
|
EditorRawDOMPoint pointToInsertBrNode(splitCiteNodeResult.SplitPoint());
|
||||||
RefPtr<Element> brElement =
|
RefPtr<Element> brElement =
|
||||||
HTMLEditorRef().InsertBrElementWithTransaction(pointToInsertBrNode);
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
|
.InsertBrElementWithTransaction(pointToInsertBrNode);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return EditActionIgnored(NS_ERROR_EDITOR_DESTROYED);
|
return EditActionIgnored(NS_ERROR_EDITOR_DESTROYED);
|
||||||
}
|
}
|
||||||
|
@ -2189,8 +2195,8 @@ EditActionResult HTMLEditRules::SplitMailCites() {
|
||||||
wsType == WSType::special ||
|
wsType == WSType::special ||
|
||||||
// In case we're at the very end.
|
// In case we're at the very end.
|
||||||
wsType == WSType::thisBlock) {
|
wsType == WSType::thisBlock) {
|
||||||
brElement = HTMLEditorRef().InsertBrElementWithTransaction(
|
brElement = MOZ_KnownLive(HTMLEditorRef())
|
||||||
pointToCreateNewBrNode);
|
.InsertBrElementWithTransaction(pointToCreateNewBrNode);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return EditActionIgnored(NS_ERROR_EDITOR_DESTROYED);
|
return EditActionIgnored(NS_ERROR_EDITOR_DESTROYED);
|
||||||
}
|
}
|
||||||
|
@ -3177,8 +3183,9 @@ nsresult HTMLEditRules::InsertBRIfNeeded() {
|
||||||
if (HTMLEditorRef().CanContainTag(*atStartOfSelection.GetContainer(),
|
if (HTMLEditorRef().CanContainTag(*atStartOfSelection.GetContainer(),
|
||||||
*nsGkAtoms::br)) {
|
*nsGkAtoms::br)) {
|
||||||
RefPtr<Element> brElement =
|
RefPtr<Element> brElement =
|
||||||
HTMLEditorRef().InsertBrElementWithTransaction(atStartOfSelection,
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
nsIEditor::ePrevious);
|
.InsertBrElementWithTransaction(atStartOfSelection,
|
||||||
|
nsIEditor::ePrevious);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -3498,9 +3505,11 @@ EditActionResult HTMLEditRules::TryToJoinBlocksWithTransaction(
|
||||||
nsCOMPtr<nsINode> previousContentParent =
|
nsCOMPtr<nsINode> previousContentParent =
|
||||||
previousContent.GetContainer();
|
previousContent.GetContainer();
|
||||||
int32_t previousContentOffset = previousContent.Offset();
|
int32_t previousContentOffset = previousContent.Offset();
|
||||||
rv = HTMLEditorRef().SplitStyleAbovePoint(
|
rv = MOZ_KnownLive(HTMLEditorRef())
|
||||||
address_of(previousContentParent), &previousContentOffset, nullptr,
|
.SplitStyleAbovePoint(address_of(previousContentParent),
|
||||||
nullptr, nullptr, getter_AddRefs(splittedPreviousContent));
|
&previousContentOffset, nullptr, nullptr,
|
||||||
|
nullptr,
|
||||||
|
getter_AddRefs(splittedPreviousContent));
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return EditActionIgnored(NS_ERROR_EDITOR_DESTROYED);
|
return EditActionIgnored(NS_ERROR_EDITOR_DESTROYED);
|
||||||
}
|
}
|
||||||
|
@ -3797,7 +3806,8 @@ nsresult HTMLEditRules::DidDeleteSelection() {
|
||||||
}
|
}
|
||||||
if (atCiteNode.IsSet() && seenBR) {
|
if (atCiteNode.IsSet() && seenBR) {
|
||||||
RefPtr<Element> brElement =
|
RefPtr<Element> brElement =
|
||||||
HTMLEditorRef().InsertBrElementWithTransaction(atCiteNode);
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
|
.InsertBrElementWithTransaction(atCiteNode);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -4081,7 +4091,8 @@ nsresult HTMLEditRules::MakeList(nsAtom& aListType, bool aEntireList,
|
||||||
}
|
}
|
||||||
ErrorResult error;
|
ErrorResult error;
|
||||||
nsCOMPtr<nsIContent> newLeftNode =
|
nsCOMPtr<nsIContent> newLeftNode =
|
||||||
HTMLEditorRef().SplitNodeWithTransaction(atCurNode, error);
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
|
.SplitNodeWithTransaction(atCurNode, error);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
error.SuppressException();
|
error.SuppressException();
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
|
@ -4442,9 +4453,10 @@ nsresult HTMLEditRules::MakeBasicBlock(nsAtom& blockType) {
|
||||||
}
|
}
|
||||||
// Do the splits!
|
// Do the splits!
|
||||||
SplitNodeResult splitNodeResult =
|
SplitNodeResult splitNodeResult =
|
||||||
HTMLEditorRef().SplitNodeDeepWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
*curBlock, pointToInsertBlock,
|
.SplitNodeDeepWithTransaction(
|
||||||
SplitAtEdges::eDoNotCreateEmptyContainer);
|
*curBlock, pointToInsertBlock,
|
||||||
|
SplitAtEdges::eDoNotCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -4453,8 +4465,8 @@ nsresult HTMLEditRules::MakeBasicBlock(nsAtom& blockType) {
|
||||||
}
|
}
|
||||||
EditorRawDOMPoint pointToInsertBrNode(splitNodeResult.SplitPoint());
|
EditorRawDOMPoint pointToInsertBrNode(splitNodeResult.SplitPoint());
|
||||||
// Put a <br> element at the split point
|
// Put a <br> element at the split point
|
||||||
brContent =
|
brContent = MOZ_KnownLive(HTMLEditorRef())
|
||||||
HTMLEditorRef().InsertBrElementWithTransaction(pointToInsertBrNode);
|
.InsertBrElementWithTransaction(pointToInsertBrNode);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -4572,7 +4584,8 @@ nsresult HTMLEditRules::DidMakeBasicBlock() {
|
||||||
if (NS_WARN_IF(!atStartOfSelection.IsSet())) {
|
if (NS_WARN_IF(!atStartOfSelection.IsSet())) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
nsresult rv = InsertMozBRIfNeeded(*atStartOfSelection.Container());
|
nsresult rv =
|
||||||
|
InsertMozBRIfNeeded(MOZ_KnownLive(*atStartOfSelection.Container()));
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -4805,8 +4818,8 @@ nsresult HTMLEditRules::IndentAroundSelectionWithCSS() {
|
||||||
atCurNode.GetContainer()->NodeInfo()->NameAtom();
|
atCurNode.GetContainer()->NodeInfo()->NameAtom();
|
||||||
// Create a new nested list of correct type.
|
// Create a new nested list of correct type.
|
||||||
SplitNodeResult splitNodeResult =
|
SplitNodeResult splitNodeResult =
|
||||||
MaybeSplitAncestorsForInsertWithTransaction(*containerName,
|
MaybeSplitAncestorsForInsertWithTransaction(
|
||||||
atCurNode);
|
MOZ_KnownLive(*containerName), atCurNode);
|
||||||
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
||||||
return splitNodeResult.Rv();
|
return splitNodeResult.Rv();
|
||||||
}
|
}
|
||||||
|
@ -5077,8 +5090,8 @@ nsresult HTMLEditRules::IndentAroundSelectionWithHTML() {
|
||||||
atCurNode.GetContainer()->NodeInfo()->NameAtom();
|
atCurNode.GetContainer()->NodeInfo()->NameAtom();
|
||||||
// Create a new nested list of correct type.
|
// Create a new nested list of correct type.
|
||||||
SplitNodeResult splitNodeResult =
|
SplitNodeResult splitNodeResult =
|
||||||
MaybeSplitAncestorsForInsertWithTransaction(*containerName,
|
MaybeSplitAncestorsForInsertWithTransaction(
|
||||||
atCurNode);
|
MOZ_KnownLive(*containerName), atCurNode);
|
||||||
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
||||||
return splitNodeResult.Rv();
|
return splitNodeResult.Rv();
|
||||||
}
|
}
|
||||||
|
@ -5139,8 +5152,8 @@ nsresult HTMLEditRules::IndentAroundSelectionWithHTML() {
|
||||||
atListItem.GetContainer()->NodeInfo()->NameAtom();
|
atListItem.GetContainer()->NodeInfo()->NameAtom();
|
||||||
// Create a new nested list of correct type.
|
// Create a new nested list of correct type.
|
||||||
SplitNodeResult splitNodeResult =
|
SplitNodeResult splitNodeResult =
|
||||||
MaybeSplitAncestorsForInsertWithTransaction(*containerName,
|
MaybeSplitAncestorsForInsertWithTransaction(
|
||||||
atListItem);
|
MOZ_KnownLive(*containerName), atListItem);
|
||||||
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
||||||
return splitNodeResult.Rv();
|
return splitNodeResult.Rv();
|
||||||
}
|
}
|
||||||
|
@ -5637,9 +5650,10 @@ SplitRangeOffFromNodeResult HTMLEditRules::SplitRangeOffFromBlock(
|
||||||
|
|
||||||
// Split at the start.
|
// Split at the start.
|
||||||
SplitNodeResult splitAtStartResult =
|
SplitNodeResult splitAtStartResult =
|
||||||
HTMLEditorRef().SplitNodeDeepWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
aBlockElement, EditorRawDOMPoint(&aStartOfMiddleElement),
|
.SplitNodeDeepWithTransaction(
|
||||||
SplitAtEdges::eDoNotCreateEmptyContainer);
|
aBlockElement, EditorRawDOMPoint(&aStartOfMiddleElement),
|
||||||
|
SplitAtEdges::eDoNotCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return SplitRangeOffFromNodeResult(NS_ERROR_EDITOR_DESTROYED);
|
return SplitRangeOffFromNodeResult(NS_ERROR_EDITOR_DESTROYED);
|
||||||
}
|
}
|
||||||
|
@ -5651,8 +5665,10 @@ SplitRangeOffFromNodeResult HTMLEditRules::SplitRangeOffFromBlock(
|
||||||
DebugOnly<bool> advanced = atAfterEnd.AdvanceOffset();
|
DebugOnly<bool> advanced = atAfterEnd.AdvanceOffset();
|
||||||
NS_WARNING_ASSERTION(advanced, "Failed to advance offset after the end node");
|
NS_WARNING_ASSERTION(advanced, "Failed to advance offset after the end node");
|
||||||
SplitNodeResult splitAtEndResult =
|
SplitNodeResult splitAtEndResult =
|
||||||
HTMLEditorRef().SplitNodeDeepWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
aBlockElement, atAfterEnd, SplitAtEdges::eDoNotCreateEmptyContainer);
|
.SplitNodeDeepWithTransaction(
|
||||||
|
aBlockElement, atAfterEnd,
|
||||||
|
SplitAtEdges::eDoNotCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return SplitRangeOffFromNodeResult(NS_ERROR_EDITOR_DESTROYED);
|
return SplitRangeOffFromNodeResult(NS_ERROR_EDITOR_DESTROYED);
|
||||||
}
|
}
|
||||||
|
@ -5804,9 +5820,10 @@ nsresult HTMLEditRules::CreateStyleForInsertText(Document& aDocument) {
|
||||||
if (RefPtr<Text> text = node->GetAsText()) {
|
if (RefPtr<Text> text = node->GetAsText()) {
|
||||||
// if we are in a text node, split it
|
// if we are in a text node, split it
|
||||||
SplitNodeResult splitTextNodeResult =
|
SplitNodeResult splitTextNodeResult =
|
||||||
HTMLEditorRef().SplitNodeDeepWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
*text, EditorRawDOMPoint(text, offset),
|
.SplitNodeDeepWithTransaction(
|
||||||
SplitAtEdges::eAllowToCreateEmptyContainer);
|
*text, EditorRawDOMPoint(text, offset),
|
||||||
|
SplitAtEdges::eAllowToCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -6349,7 +6366,8 @@ nsresult HTMLEditRules::MaybeDeleteTopMostEmptyAncestor(
|
||||||
// AfterEdit().
|
// AfterEdit().
|
||||||
if (!HTMLEditUtils::IsList(atBlockParent.GetContainer())) {
|
if (!HTMLEditUtils::IsList(atBlockParent.GetContainer())) {
|
||||||
RefPtr<Element> brElement =
|
RefPtr<Element> brElement =
|
||||||
HTMLEditorRef().InsertBrElementWithTransaction(atBlockParent);
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
|
.InsertBrElementWithTransaction(atBlockParent);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -7115,7 +7133,8 @@ nsresult HTMLEditRules::GetNodesForOperation(
|
||||||
// Split the text node.
|
// Split the text node.
|
||||||
ErrorResult error;
|
ErrorResult error;
|
||||||
nsCOMPtr<nsIContent> newLeftNode =
|
nsCOMPtr<nsIContent> newLeftNode =
|
||||||
HTMLEditorRef().SplitNodeWithTransaction(atEnd, error);
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
|
.SplitNodeWithTransaction(atEnd, error);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
error.SuppressException();
|
error.SuppressException();
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
|
@ -7445,10 +7464,12 @@ nsresult HTMLEditRules::BustUpInlinesAtRangeEndpoints(RangeItem& aRangeItem) {
|
||||||
// GetHighestInlineParent(), isn't it?
|
// GetHighestInlineParent(), isn't it?
|
||||||
if (endInline && !isCollapsed) {
|
if (endInline && !isCollapsed) {
|
||||||
SplitNodeResult splitEndInlineResult =
|
SplitNodeResult splitEndInlineResult =
|
||||||
HTMLEditorRef().SplitNodeDeepWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
*endInline,
|
.SplitNodeDeepWithTransaction(
|
||||||
EditorRawDOMPoint(aRangeItem.mEndContainer, aRangeItem.mEndOffset),
|
*endInline,
|
||||||
SplitAtEdges::eDoNotCreateEmptyContainer);
|
EditorRawDOMPoint(aRangeItem.mEndContainer,
|
||||||
|
aRangeItem.mEndOffset),
|
||||||
|
SplitAtEdges::eDoNotCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -7468,11 +7489,12 @@ nsresult HTMLEditRules::BustUpInlinesAtRangeEndpoints(RangeItem& aRangeItem) {
|
||||||
|
|
||||||
if (startInline) {
|
if (startInline) {
|
||||||
SplitNodeResult splitStartInlineResult =
|
SplitNodeResult splitStartInlineResult =
|
||||||
HTMLEditorRef().SplitNodeDeepWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
*startInline,
|
.SplitNodeDeepWithTransaction(
|
||||||
EditorRawDOMPoint(aRangeItem.mStartContainer,
|
*startInline,
|
||||||
aRangeItem.mStartOffset),
|
EditorRawDOMPoint(aRangeItem.mStartContainer,
|
||||||
SplitAtEdges::eDoNotCreateEmptyContainer);
|
aRangeItem.mStartOffset),
|
||||||
|
SplitAtEdges::eDoNotCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -7517,8 +7539,10 @@ nsresult HTMLEditRules::BustUpInlinesAtBRs(
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
SplitNodeResult splitNodeResult =
|
SplitNodeResult splitNodeResult =
|
||||||
HTMLEditorRef().SplitNodeDeepWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
*nextNode, atBrNode, SplitAtEdges::eAllowToCreateEmptyContainer);
|
.SplitNodeDeepWithTransaction(
|
||||||
|
*nextNode, atBrNode,
|
||||||
|
SplitAtEdges::eAllowToCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -7711,9 +7735,10 @@ nsresult HTMLEditRules::ReturnInHeader(Element& aHeader, nsINode& aNode,
|
||||||
|
|
||||||
// Split the header
|
// Split the header
|
||||||
SplitNodeResult splitHeaderResult =
|
SplitNodeResult splitHeaderResult =
|
||||||
HTMLEditorRef().SplitNodeDeepWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
aHeader, EditorRawDOMPoint(node, aOffset),
|
.SplitNodeDeepWithTransaction(
|
||||||
SplitAtEdges::eAllowToCreateEmptyContainer);
|
aHeader, EditorRawDOMPoint(node, aOffset),
|
||||||
|
SplitAtEdges::eAllowToCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -7772,8 +7797,8 @@ nsresult HTMLEditRules::ReturnInHeader(Element& aHeader, nsINode& aNode,
|
||||||
|
|
||||||
// Append a <br> to it
|
// Append a <br> to it
|
||||||
RefPtr<Element> brElement =
|
RefPtr<Element> brElement =
|
||||||
HTMLEditorRef().InsertBrElementWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
EditorRawDOMPoint(pNode, 0));
|
.InsertBrElementWithTransaction(EditorRawDOMPoint(pNode, 0));
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -7942,8 +7967,8 @@ EditActionResult HTMLEditRules::ReturnInParagraph(Element& aParentDivOrP) {
|
||||||
if (doesCRCreateNewP) {
|
if (doesCRCreateNewP) {
|
||||||
ErrorResult error;
|
ErrorResult error;
|
||||||
nsCOMPtr<nsIContent> newLeftDivOrP =
|
nsCOMPtr<nsIContent> newLeftDivOrP =
|
||||||
HTMLEditorRef().SplitNodeWithTransaction(pointToSplitParentDivOrP,
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
error);
|
.SplitNodeWithTransaction(pointToSplitParentDivOrP, error);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
error.SuppressException();
|
error.SuppressException();
|
||||||
return EditActionResult(NS_ERROR_EDITOR_DESTROYED);
|
return EditActionResult(NS_ERROR_EDITOR_DESTROYED);
|
||||||
|
@ -7987,7 +8012,8 @@ EditActionResult HTMLEditRules::ReturnInParagraph(Element& aParentDivOrP) {
|
||||||
return EditActionResult(NS_OK);
|
return EditActionResult(NS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
brContent = HTMLEditorRef().InsertBrElementWithTransaction(pointToInsertBR);
|
brContent = MOZ_KnownLive(HTMLEditorRef())
|
||||||
|
.InsertBrElementWithTransaction(pointToInsertBR);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return EditActionResult(NS_ERROR_EDITOR_DESTROYED);
|
return EditActionResult(NS_ERROR_EDITOR_DESTROYED);
|
||||||
}
|
}
|
||||||
|
@ -8033,9 +8059,10 @@ nsresult HTMLEditRules::SplitParagraph(
|
||||||
|
|
||||||
// Split the paragraph.
|
// Split the paragraph.
|
||||||
SplitNodeResult splitDivOrPResult =
|
SplitNodeResult splitDivOrPResult =
|
||||||
HTMLEditorRef().SplitNodeDeepWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
aParentDivOrP, EditorRawDOMPoint(selNode, selOffset),
|
.SplitNodeDeepWithTransaction(
|
||||||
SplitAtEdges::eAllowToCreateEmptyContainer);
|
aParentDivOrP, EditorRawDOMPoint(selNode, selOffset),
|
||||||
|
SplitAtEdges::eAllowToCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -8074,11 +8101,11 @@ nsresult HTMLEditRules::SplitParagraph(
|
||||||
// moz-<br> will be exposed as <br> with Element.innerHTML. Therefore,
|
// moz-<br> will be exposed as <br> with Element.innerHTML. Therefore,
|
||||||
// we can use normal <br> elements for placeholder in this case.
|
// we can use normal <br> elements for placeholder in this case.
|
||||||
// Note that Chromium also behaves so.
|
// Note that Chromium also behaves so.
|
||||||
rv = InsertBRIfNeeded(*splitDivOrPResult.GetPreviousNode());
|
rv = InsertBRIfNeeded(MOZ_KnownLive(*splitDivOrPResult.GetPreviousNode()));
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
rv = InsertBRIfNeeded(*splitDivOrPResult.GetNextNode());
|
rv = InsertBRIfNeeded(MOZ_KnownLive(*splitDivOrPResult.GetNextNode()));
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -8128,8 +8155,8 @@ nsresult HTMLEditRules::ReturnInListItem(Element& aListItem, nsINode& aNode,
|
||||||
// We need to split the list!
|
// We need to split the list!
|
||||||
EditorRawDOMPoint atListItem(&aListItem);
|
EditorRawDOMPoint atListItem(&aListItem);
|
||||||
ErrorResult error;
|
ErrorResult error;
|
||||||
leftListNode =
|
leftListNode = MOZ_KnownLive(HTMLEditorRef())
|
||||||
HTMLEditorRef().SplitNodeWithTransaction(atListItem, error);
|
.SplitNodeWithTransaction(atListItem, error);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
error.SuppressException();
|
error.SuppressException();
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
|
@ -8190,8 +8217,8 @@ nsresult HTMLEditRules::ReturnInListItem(Element& aListItem, nsINode& aNode,
|
||||||
|
|
||||||
// Append a <br> to it
|
// Append a <br> to it
|
||||||
RefPtr<Element> brElement =
|
RefPtr<Element> brElement =
|
||||||
HTMLEditorRef().InsertBrElementWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
EditorRawDOMPoint(pNode, 0));
|
.InsertBrElementWithTransaction(EditorRawDOMPoint(pNode, 0));
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -8230,9 +8257,10 @@ nsresult HTMLEditRules::ReturnInListItem(Element& aListItem, nsINode& aNode,
|
||||||
|
|
||||||
// Now split the list item.
|
// Now split the list item.
|
||||||
SplitNodeResult splitListItemResult =
|
SplitNodeResult splitListItemResult =
|
||||||
HTMLEditorRef().SplitNodeDeepWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
aListItem, EditorRawDOMPoint(selNode, aOffset),
|
.SplitNodeDeepWithTransaction(
|
||||||
SplitAtEdges::eAllowToCreateEmptyContainer);
|
aListItem, EditorRawDOMPoint(selNode, aOffset),
|
||||||
|
SplitAtEdges::eAllowToCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -8784,7 +8812,7 @@ SplitNodeResult HTMLEditRules::MaybeSplitAncestorsForInsertWithTransaction(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for a node that can legally contain the tag.
|
// Look for a node that can legally contain the tag.
|
||||||
EditorRawDOMPoint pointToInsert(aStartOfDeepestRightNode);
|
EditorDOMPoint pointToInsert(aStartOfDeepestRightNode);
|
||||||
for (; pointToInsert.IsSet();
|
for (; pointToInsert.IsSet();
|
||||||
pointToInsert.Set(pointToInsert.GetContainer())) {
|
pointToInsert.Set(pointToInsert.GetContainer())) {
|
||||||
// We cannot split active editing host and its ancestor. So, there is
|
// We cannot split active editing host and its ancestor. So, there is
|
||||||
|
@ -8809,9 +8837,11 @@ SplitNodeResult HTMLEditRules::MaybeSplitAncestorsForInsertWithTransaction(
|
||||||
}
|
}
|
||||||
|
|
||||||
SplitNodeResult splitNodeResult =
|
SplitNodeResult splitNodeResult =
|
||||||
HTMLEditorRef().SplitNodeDeepWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
*pointToInsert.GetChild(), aStartOfDeepestRightNode,
|
.SplitNodeDeepWithTransaction(
|
||||||
SplitAtEdges::eAllowToCreateEmptyContainer);
|
MOZ_KnownLive(*pointToInsert.GetChild()),
|
||||||
|
aStartOfDeepestRightNode,
|
||||||
|
SplitAtEdges::eAllowToCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return SplitNodeResult(NS_ERROR_EDITOR_DESTROYED);
|
return SplitNodeResult(NS_ERROR_EDITOR_DESTROYED);
|
||||||
}
|
}
|
||||||
|
@ -9592,8 +9622,8 @@ nsresult HTMLEditRules::RemoveEmptyNodesInChangedRange() {
|
||||||
// We are deleting a cite that has just a br. We want to delete cite,
|
// We are deleting a cite that has just a br. We want to delete cite,
|
||||||
// but preserve br.
|
// but preserve br.
|
||||||
RefPtr<Element> brElement =
|
RefPtr<Element> brElement =
|
||||||
HTMLEditorRef().InsertBrElementWithTransaction(
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
EditorRawDOMPoint(delNode));
|
.InsertBrElementWithTransaction(EditorRawDOMPoint(delNode));
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -9724,7 +9754,8 @@ nsresult HTMLEditRules::PopListItem(nsIContent& aListItem, bool* aOutOfList) {
|
||||||
}
|
}
|
||||||
MOZ_ASSERT(atListItem.IsSetAndValid());
|
MOZ_ASSERT(atListItem.IsSetAndValid());
|
||||||
ErrorResult error;
|
ErrorResult error;
|
||||||
leftListNode = HTMLEditorRef().SplitNodeWithTransaction(atListItem, error);
|
leftListNode = MOZ_KnownLive(HTMLEditorRef())
|
||||||
|
.SplitNodeWithTransaction(atListItem, error);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
error.SuppressException();
|
error.SuppressException();
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
|
@ -10314,7 +10345,8 @@ nsresult HTMLEditRules::MakeSureElemStartsOrEndsOnCR(nsINode& aNode,
|
||||||
pointToInsert.Set(&aNode, 0);
|
pointToInsert.Set(&aNode, 0);
|
||||||
}
|
}
|
||||||
RefPtr<Element> brElement =
|
RefPtr<Element> brElement =
|
||||||
HTMLEditorRef().InsertBrElementWithTransaction(pointToInsert);
|
MOZ_KnownLive(HTMLEditorRef())
|
||||||
|
.InsertBrElementWithTransaction(pointToInsert);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return NS_ERROR_EDITOR_DESTROYED;
|
return NS_ERROR_EDITOR_DESTROYED;
|
||||||
}
|
}
|
||||||
|
@ -10620,8 +10652,8 @@ nsresult HTMLEditRules::PrepareToMakeElementAbsolutePosition(
|
||||||
atCurNode.GetContainer()->NodeInfo()->NameAtom();
|
atCurNode.GetContainer()->NodeInfo()->NameAtom();
|
||||||
// Create a new nested list of correct type.
|
// Create a new nested list of correct type.
|
||||||
SplitNodeResult splitNodeResult =
|
SplitNodeResult splitNodeResult =
|
||||||
MaybeSplitAncestorsForInsertWithTransaction(*containerName,
|
MaybeSplitAncestorsForInsertWithTransaction(
|
||||||
atCurNode);
|
MOZ_KnownLive(*containerName), atCurNode);
|
||||||
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
||||||
return splitNodeResult.Rv();
|
return splitNodeResult.Rv();
|
||||||
}
|
}
|
||||||
|
@ -10689,8 +10721,8 @@ nsresult HTMLEditRules::PrepareToMakeElementAbsolutePosition(
|
||||||
atListItem.GetContainer()->NodeInfo()->NameAtom();
|
atListItem.GetContainer()->NodeInfo()->NameAtom();
|
||||||
// Create a new nested list of correct type
|
// Create a new nested list of correct type
|
||||||
SplitNodeResult splitNodeResult =
|
SplitNodeResult splitNodeResult =
|
||||||
MaybeSplitAncestorsForInsertWithTransaction(*containerName,
|
MaybeSplitAncestorsForInsertWithTransaction(
|
||||||
atListItem);
|
MOZ_KnownLive(*containerName), atListItem);
|
||||||
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
||||||
return splitNodeResult.Rv();
|
return splitNodeResult.Rv();
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,7 @@ class HTMLEditRules : public TextEditRules {
|
||||||
*
|
*
|
||||||
* @param aNode The node which may be inserted <br> elements.
|
* @param aNode The node which may be inserted <br> elements.
|
||||||
*/
|
*/
|
||||||
|
MOZ_CAN_RUN_SCRIPT
|
||||||
MOZ_MUST_USE nsresult MakeSureElemStartsAndEndsOnCR(nsINode& aNode);
|
MOZ_MUST_USE nsresult MakeSureElemStartsAndEndsOnCR(nsINode& aNode);
|
||||||
|
|
||||||
void DidCreateNode(Element& aNewElement);
|
void DidCreateNode(Element& aNewElement);
|
||||||
|
@ -262,7 +263,7 @@ class HTMLEditRules : public TextEditRules {
|
||||||
* not be spastic. If so, it inserts one. Callers responsibility to only
|
* not be spastic. If so, it inserts one. Callers responsibility to only
|
||||||
* call with collapsed selection.
|
* call with collapsed selection.
|
||||||
*/
|
*/
|
||||||
MOZ_MUST_USE nsresult InsertBRIfNeeded();
|
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE nsresult InsertBRIfNeeded();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CanContainParagraph() returns true if aElement can have a <p> element as
|
* CanContainParagraph() returns true if aElement can have a <p> element as
|
||||||
|
@ -274,7 +275,7 @@ class HTMLEditRules : public TextEditRules {
|
||||||
* Insert normal <br> element into aNode when aNode is a block and it has
|
* Insert normal <br> element into aNode when aNode is a block and it has
|
||||||
* no children.
|
* no children.
|
||||||
*/
|
*/
|
||||||
MOZ_MUST_USE nsresult InsertBRIfNeeded(nsINode& aNode) {
|
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE nsresult InsertBRIfNeeded(nsINode& aNode) {
|
||||||
return InsertBRIfNeededInternal(aNode, false);
|
return InsertBRIfNeededInternal(aNode, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +283,7 @@ class HTMLEditRules : public TextEditRules {
|
||||||
* Insert moz-<br> element (<br type="_moz">) into aNode when aNode is a
|
* Insert moz-<br> element (<br type="_moz">) into aNode when aNode is a
|
||||||
* block and it has no children.
|
* block and it has no children.
|
||||||
*/
|
*/
|
||||||
MOZ_MUST_USE nsresult InsertMozBRIfNeeded(nsINode& aNode) {
|
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE nsresult InsertMozBRIfNeeded(nsINode& aNode) {
|
||||||
return InsertBRIfNeededInternal(aNode, true);
|
return InsertBRIfNeededInternal(aNode, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,6 +297,7 @@ class HTMLEditRules : public TextEditRules {
|
||||||
* Otherwise, i.e., this should insert a normal <br>
|
* Otherwise, i.e., this should insert a normal <br>
|
||||||
* element, false.
|
* element, false.
|
||||||
*/
|
*/
|
||||||
|
MOZ_CAN_RUN_SCRIPT
|
||||||
MOZ_MUST_USE nsresult InsertBRIfNeededInternal(nsINode& aNode,
|
MOZ_MUST_USE nsresult InsertBRIfNeededInternal(nsINode& aNode,
|
||||||
bool aInsertMozBR);
|
bool aInsertMozBR);
|
||||||
|
|
||||||
|
@ -540,7 +542,7 @@ class HTMLEditRules : public TextEditRules {
|
||||||
* contents. This method inserts moz-<br> element if start container of
|
* contents. This method inserts moz-<br> element if start container of
|
||||||
* Selection needs it.
|
* Selection needs it.
|
||||||
*/
|
*/
|
||||||
MOZ_MUST_USE nsresult DidMakeBasicBlock();
|
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE nsresult DidMakeBasicBlock();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called before changing an element to absolute positioned.
|
* Called before changing an element to absolute positioned.
|
||||||
|
@ -783,6 +785,7 @@ class HTMLEditRules : public TextEditRules {
|
||||||
* @param aStartOfMiddleElement Start node of middle block element.
|
* @param aStartOfMiddleElement Start node of middle block element.
|
||||||
* @param aEndOfMiddleElement End node of middle block element.
|
* @param aEndOfMiddleElement End node of middle block element.
|
||||||
*/
|
*/
|
||||||
|
MOZ_CAN_RUN_SCRIPT
|
||||||
MOZ_MUST_USE SplitRangeOffFromNodeResult SplitRangeOffFromBlock(
|
MOZ_MUST_USE SplitRangeOffFromNodeResult SplitRangeOffFromBlock(
|
||||||
Element& aBlockElement, nsIContent& aStartOfMiddleElement,
|
Element& aBlockElement, nsIContent& aStartOfMiddleElement,
|
||||||
nsIContent& aEndOfMiddleElement);
|
nsIContent& aEndOfMiddleElement);
|
||||||
|
@ -990,6 +993,7 @@ class HTMLEditRules : public TextEditRules {
|
||||||
* Will be modified to split point if they're
|
* Will be modified to split point if they're
|
||||||
* split.
|
* split.
|
||||||
*/
|
*/
|
||||||
|
MOZ_CAN_RUN_SCRIPT
|
||||||
MOZ_MUST_USE nsresult BustUpInlinesAtRangeEndpoints(RangeItem& aRangeItem);
|
MOZ_MUST_USE nsresult BustUpInlinesAtRangeEndpoints(RangeItem& aRangeItem);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1084,7 +1088,8 @@ class HTMLEditRules : public TextEditRules {
|
||||||
* the point to insert the element.
|
* the point to insert the element.
|
||||||
*/
|
*/
|
||||||
template <typename PT, typename CT>
|
template <typename PT, typename CT>
|
||||||
MOZ_MUST_USE SplitNodeResult MaybeSplitAncestorsForInsertWithTransaction(
|
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE SplitNodeResult
|
||||||
|
MaybeSplitAncestorsForInsertWithTransaction(
|
||||||
nsAtom& aTag, const EditorDOMPointBase<PT, CT>& aStartOfDeepestRightNode);
|
nsAtom& aTag, const EditorDOMPointBase<PT, CT>& aStartOfDeepestRightNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1169,7 +1174,7 @@ class HTMLEditRules : public TextEditRules {
|
||||||
* InsertBRElementToEmptyListItemsAndTableCellsInChangedRange() inserts
|
* InsertBRElementToEmptyListItemsAndTableCellsInChangedRange() inserts
|
||||||
* <br> element into empty list item or table cell elements.
|
* <br> element into empty list item or table cell elements.
|
||||||
*/
|
*/
|
||||||
MOZ_MUST_USE nsresult
|
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE nsresult
|
||||||
InsertBRElementToEmptyListItemsAndTableCellsInChangedRange();
|
InsertBRElementToEmptyListItemsAndTableCellsInChangedRange();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1187,7 +1192,8 @@ class HTMLEditRules : public TextEditRules {
|
||||||
*
|
*
|
||||||
* @param aAction Maybe used to look for a good point to put caret.
|
* @param aAction Maybe used to look for a good point to put caret.
|
||||||
*/
|
*/
|
||||||
MOZ_MUST_USE nsresult AdjustSelection(nsIEditor::EDirection aAction);
|
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE nsresult
|
||||||
|
AdjustSelection(nsIEditor::EDirection aAction);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FindNearEditableNode() tries to find an editable node near aPoint.
|
* FindNearEditableNode() tries to find an editable node near aPoint.
|
||||||
|
@ -1278,6 +1284,7 @@ class HTMLEditRules : public TextEditRules {
|
||||||
* @param aStarts true for trying to insert <br> to the start.
|
* @param aStarts true for trying to insert <br> to the start.
|
||||||
* false for trying to insert <br> to the end.
|
* false for trying to insert <br> to the end.
|
||||||
*/
|
*/
|
||||||
|
MOZ_CAN_RUN_SCRIPT
|
||||||
MOZ_MUST_USE nsresult MakeSureElemStartsOrEndsOnCR(nsINode& aNode,
|
MOZ_MUST_USE nsresult MakeSureElemStartsOrEndsOnCR(nsINode& aNode,
|
||||||
bool aStarts);
|
bool aStarts);
|
||||||
|
|
||||||
|
|
|
@ -1692,8 +1692,9 @@ EditorDOMPoint HTMLEditor::InsertNodeIntoProperAncestorWithTransaction(
|
||||||
if (pointToInsert != aPointToInsert) {
|
if (pointToInsert != aPointToInsert) {
|
||||||
// We need to split some levels above the original selection parent.
|
// We need to split some levels above the original selection parent.
|
||||||
MOZ_ASSERT(pointToInsert.GetChild());
|
MOZ_ASSERT(pointToInsert.GetChild());
|
||||||
SplitNodeResult splitNodeResult = SplitNodeDeepWithTransaction(
|
SplitNodeResult splitNodeResult =
|
||||||
*pointToInsert.GetChild(), aPointToInsert, aSplitAtEdges);
|
SplitNodeDeepWithTransaction(MOZ_KnownLive(*pointToInsert.GetChild()),
|
||||||
|
aPointToInsert, aSplitAtEdges);
|
||||||
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
||||||
return EditorDOMPoint();
|
return EditorDOMPoint();
|
||||||
}
|
}
|
||||||
|
@ -2139,7 +2140,7 @@ HTMLEditor::MakeOrChangeList(const nsAString& aListType, bool entireList,
|
||||||
if (pointToInsertList.GetContainer() != atStartOfSelection.GetContainer()) {
|
if (pointToInsertList.GetContainer() != atStartOfSelection.GetContainer()) {
|
||||||
// We need to split up to the child of parent.
|
// We need to split up to the child of parent.
|
||||||
SplitNodeResult splitNodeResult = SplitNodeDeepWithTransaction(
|
SplitNodeResult splitNodeResult = SplitNodeDeepWithTransaction(
|
||||||
*pointToInsertList.GetChild(), atStartOfSelection,
|
MOZ_KnownLive(*pointToInsertList.GetChild()), atStartOfSelection,
|
||||||
SplitAtEdges::eAllowToCreateEmptyContainer);
|
SplitAtEdges::eAllowToCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
||||||
return splitNodeResult.Rv();
|
return splitNodeResult.Rv();
|
||||||
|
@ -2316,7 +2317,7 @@ nsresult HTMLEditor::InsertBasicBlockWithTransaction(nsAtom& aTagName) {
|
||||||
atStartOfSelection.GetContainer()) {
|
atStartOfSelection.GetContainer()) {
|
||||||
// We need to split up to the child of the point to insert a block.
|
// We need to split up to the child of the point to insert a block.
|
||||||
SplitNodeResult splitBlockResult = SplitNodeDeepWithTransaction(
|
SplitNodeResult splitBlockResult = SplitNodeDeepWithTransaction(
|
||||||
*pointToInsertBlock.GetChild(), atStartOfSelection,
|
MOZ_KnownLive(*pointToInsertBlock.GetChild()), atStartOfSelection,
|
||||||
SplitAtEdges::eAllowToCreateEmptyContainer);
|
SplitAtEdges::eAllowToCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(splitBlockResult.Failed())) {
|
if (NS_WARN_IF(splitBlockResult.Failed())) {
|
||||||
return splitBlockResult.Rv();
|
return splitBlockResult.Rv();
|
||||||
|
@ -2457,8 +2458,8 @@ nsresult HTMLEditor::IndentOrOutdentAsSubAction(
|
||||||
atStartOfSelection.GetContainer()) {
|
atStartOfSelection.GetContainer()) {
|
||||||
// We need to split up to the child of parent.
|
// We need to split up to the child of parent.
|
||||||
SplitNodeResult splitBlockquoteResult = SplitNodeDeepWithTransaction(
|
SplitNodeResult splitBlockquoteResult = SplitNodeDeepWithTransaction(
|
||||||
*pointToInsertBlockquote.GetChild(), atStartOfSelection,
|
MOZ_KnownLive(*pointToInsertBlockquote.GetChild()),
|
||||||
SplitAtEdges::eAllowToCreateEmptyContainer);
|
atStartOfSelection, SplitAtEdges::eAllowToCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(splitBlockquoteResult.Failed())) {
|
if (NS_WARN_IF(splitBlockquoteResult.Failed())) {
|
||||||
return splitBlockquoteResult.Rv();
|
return splitBlockquoteResult.Rv();
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,8 +208,8 @@ class HTMLEditor final : public TextEditor,
|
||||||
/**
|
/**
|
||||||
* Indent or outdent content around Selection.
|
* Indent or outdent content around Selection.
|
||||||
*/
|
*/
|
||||||
nsresult IndentAsAction();
|
MOZ_CAN_RUN_SCRIPT nsresult IndentAsAction();
|
||||||
nsresult OutdentAsAction();
|
MOZ_CAN_RUN_SCRIPT nsresult OutdentAsAction();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* event callback when a mouse button is pressed
|
* event callback when a mouse button is pressed
|
||||||
|
@ -788,6 +788,7 @@ class HTMLEditor final : public TextEditor,
|
||||||
nsresult SetInlinePropertyOnNode(nsIContent& aNode, nsAtom& aProperty,
|
nsresult SetInlinePropertyOnNode(nsIContent& aNode, nsAtom& aProperty,
|
||||||
nsAtom* aAttribute, const nsAString& aValue);
|
nsAtom* aAttribute, const nsAString& aValue);
|
||||||
|
|
||||||
|
MOZ_CAN_RUN_SCRIPT
|
||||||
nsresult SplitStyleAbovePoint(nsCOMPtr<nsINode>* aNode, int32_t* aOffset,
|
nsresult SplitStyleAbovePoint(nsCOMPtr<nsINode>* aNode, int32_t* aOffset,
|
||||||
nsAtom* aProperty, nsAtom* aAttribute,
|
nsAtom* aProperty, nsAtom* aAttribute,
|
||||||
nsIContent** aOutLeftNode = nullptr,
|
nsIContent** aOutLeftNode = nullptr,
|
||||||
|
@ -951,9 +952,8 @@ class HTMLEditor final : public TextEditor,
|
||||||
nsresult ClearStyle(nsCOMPtr<nsINode>* aNode, int32_t* aOffset,
|
nsresult ClearStyle(nsCOMPtr<nsINode>* aNode, int32_t* aOffset,
|
||||||
nsAtom* aProperty, nsAtom* aAttribute);
|
nsAtom* aProperty, nsAtom* aAttribute);
|
||||||
|
|
||||||
nsresult SetPositionToAbsolute(Element& aElement);
|
MOZ_CAN_RUN_SCRIPT nsresult SetPositionToAbsolute(Element& aElement);
|
||||||
MOZ_CAN_RUN_SCRIPT
|
MOZ_CAN_RUN_SCRIPT nsresult SetPositionToStatic(Element& aElement);
|
||||||
nsresult SetPositionToStatic(Element& aElement);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OnModifyDocument() is called when the editor is changed. This should
|
* OnModifyDocument() is called when the editor is changed. This should
|
||||||
|
@ -1510,6 +1510,7 @@ class HTMLEditor final : public TextEditor,
|
||||||
* @param aEditSubAction Must be EditSubAction::eIndent or
|
* @param aEditSubAction Must be EditSubAction::eIndent or
|
||||||
* EditSubAction::eOutdent.
|
* EditSubAction::eOutdent.
|
||||||
*/
|
*/
|
||||||
|
MOZ_CAN_RUN_SCRIPT
|
||||||
nsresult IndentOrOutdentAsSubAction(EditSubAction aEditSubAction);
|
nsresult IndentOrOutdentAsSubAction(EditSubAction aEditSubAction);
|
||||||
|
|
||||||
MOZ_CAN_RUN_SCRIPT
|
MOZ_CAN_RUN_SCRIPT
|
||||||
|
@ -2085,6 +2086,7 @@ class HTMLEditor final : public TextEditor,
|
||||||
* @param aTagName A block level element name. Must NOT be
|
* @param aTagName A block level element name. Must NOT be
|
||||||
* nsGkAtoms::dt nor nsGkAtoms::dd.
|
* nsGkAtoms::dt nor nsGkAtoms::dd.
|
||||||
*/
|
*/
|
||||||
|
MOZ_CAN_RUN_SCRIPT
|
||||||
nsresult InsertBasicBlockWithTransaction(nsAtom& aTagName);
|
nsresult InsertBasicBlockWithTransaction(nsAtom& aTagName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2109,6 +2111,7 @@ class HTMLEditor final : public TextEditor,
|
||||||
|
|
||||||
nsresult PromoteInlineRange(nsRange& aRange);
|
nsresult PromoteInlineRange(nsRange& aRange);
|
||||||
nsresult PromoteRangeIfStartsOrEndsInNamedAnchor(nsRange& aRange);
|
nsresult PromoteRangeIfStartsOrEndsInNamedAnchor(nsRange& aRange);
|
||||||
|
MOZ_CAN_RUN_SCRIPT
|
||||||
nsresult SplitStyleAboveRange(nsRange* aRange, nsAtom* aProperty,
|
nsresult SplitStyleAboveRange(nsRange* aRange, nsAtom* aProperty,
|
||||||
nsAtom* aAttribute);
|
nsAtom* aAttribute);
|
||||||
MOZ_CAN_RUN_SCRIPT
|
MOZ_CAN_RUN_SCRIPT
|
||||||
|
|
|
@ -439,7 +439,7 @@ nsresult IndentCommand::DoCommand(Command aCommand,
|
||||||
if (NS_WARN_IF(!htmlEditor)) {
|
if (NS_WARN_IF(!htmlEditor)) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
nsresult rv = htmlEditor->IndentAsAction();
|
nsresult rv = MOZ_KnownLive(htmlEditor)->IndentAsAction();
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -483,7 +483,7 @@ nsresult OutdentCommand::DoCommand(Command aCommand,
|
||||||
if (NS_WARN_IF(!htmlEditor)) {
|
if (NS_WARN_IF(!htmlEditor)) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
nsresult rv = htmlEditor->OutdentAsAction();
|
nsresult rv = MOZ_KnownLive(htmlEditor)->OutdentAsAction();
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -350,7 +350,7 @@ nsresult HTMLEditor::DoInsertHTMLWithContext(
|
||||||
// Are we in a text node? If so, split it.
|
// Are we in a text node? If so, split it.
|
||||||
if (pointToInsert.IsInTextNode()) {
|
if (pointToInsert.IsInTextNode()) {
|
||||||
SplitNodeResult splitNodeResult = SplitNodeDeepWithTransaction(
|
SplitNodeResult splitNodeResult = SplitNodeDeepWithTransaction(
|
||||||
*pointToInsert.GetContainerAsContent(), pointToInsert,
|
MOZ_KnownLive(*pointToInsert.GetContainerAsContent()), pointToInsert,
|
||||||
SplitAtEdges::eAllowToCreateEmptyContainer);
|
SplitAtEdges::eAllowToCreateEmptyContainer);
|
||||||
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
if (NS_WARN_IF(splitNodeResult.Failed())) {
|
||||||
return splitNodeResult.Rv();
|
return splitNodeResult.Rv();
|
||||||
|
|
|
@ -1780,7 +1780,8 @@ CreateElementResult TextEditRules::CreateBRInternal(
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<Element> brElement =
|
RefPtr<Element> brElement =
|
||||||
TextEditorRef().InsertBrElementWithTransaction(aPointToInsert);
|
MOZ_KnownLive(TextEditorRef())
|
||||||
|
.InsertBrElementWithTransaction(aPointToInsert);
|
||||||
if (NS_WARN_IF(!CanHandleEditAction())) {
|
if (NS_WARN_IF(!CanHandleEditAction())) {
|
||||||
return CreateElementResult(NS_ERROR_EDITOR_DESTROYED);
|
return CreateElementResult(NS_ERROR_EDITOR_DESTROYED);
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,13 +284,12 @@ class TextEditRules : public nsITimerCallback, public nsINamed {
|
||||||
/**
|
/**
|
||||||
* Creates a trailing break in the text doc if there is not one already.
|
* Creates a trailing break in the text doc if there is not one already.
|
||||||
*/
|
*/
|
||||||
MOZ_MUST_USE nsresult CreateTrailingBRIfNeeded();
|
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE nsresult CreateTrailingBRIfNeeded();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a bogus <br> node if the root element has no editable content.
|
* Creates a bogus <br> node if the root element has no editable content.
|
||||||
*/
|
*/
|
||||||
MOZ_CAN_RUN_SCRIPT
|
MOZ_CAN_RUN_SCRIPT MOZ_MUST_USE nsresult CreateBogusNodeIfNeeded();
|
||||||
MOZ_MUST_USE nsresult CreateBogusNodeIfNeeded();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a truncated insertion string if insertion would place us over
|
* Returns a truncated insertion string if insertion would place us over
|
||||||
|
@ -314,8 +313,8 @@ class TextEditRules : public nsITimerCallback, public nsINamed {
|
||||||
* if couldn't create new <br> element.
|
* if couldn't create new <br> element.
|
||||||
*/
|
*/
|
||||||
template <typename PT, typename CT>
|
template <typename PT, typename CT>
|
||||||
CreateElementResult CreateBR(
|
MOZ_CAN_RUN_SCRIPT CreateElementResult
|
||||||
const EditorDOMPointBase<PT, CT>& aPointToInsert) {
|
CreateBR(const EditorDOMPointBase<PT, CT>& aPointToInsert) {
|
||||||
CreateElementResult ret = CreateBRInternal(aPointToInsert, false);
|
CreateElementResult ret = CreateBRInternal(aPointToInsert, false);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// If editor is destroyed, it must return NS_ERROR_EDITOR_DESTROYED.
|
// If editor is destroyed, it must return NS_ERROR_EDITOR_DESTROYED.
|
||||||
|
@ -335,8 +334,8 @@ class TextEditRules : public nsITimerCallback, public nsINamed {
|
||||||
* if couldn't create new <br> element.
|
* if couldn't create new <br> element.
|
||||||
*/
|
*/
|
||||||
template <typename PT, typename CT>
|
template <typename PT, typename CT>
|
||||||
CreateElementResult CreateMozBR(
|
MOZ_CAN_RUN_SCRIPT CreateElementResult
|
||||||
const EditorDOMPointBase<PT, CT>& aPointToInsert) {
|
CreateMozBR(const EditorDOMPointBase<PT, CT>& aPointToInsert) {
|
||||||
CreateElementResult ret = CreateBRInternal(aPointToInsert, true);
|
CreateElementResult ret = CreateBRInternal(aPointToInsert, true);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// If editor is destroyed, it must return NS_ERROR_EDITOR_DESTROYED.
|
// If editor is destroyed, it must return NS_ERROR_EDITOR_DESTROYED.
|
||||||
|
@ -393,7 +392,7 @@ class TextEditRules : public nsITimerCallback, public nsINamed {
|
||||||
* If it succeeded, never returns nullptr.
|
* If it succeeded, never returns nullptr.
|
||||||
*/
|
*/
|
||||||
template <typename PT, typename CT>
|
template <typename PT, typename CT>
|
||||||
CreateElementResult CreateBRInternal(
|
MOZ_CAN_RUN_SCRIPT CreateElementResult CreateBRInternal(
|
||||||
const EditorDOMPointBase<PT, CT>& aPointToInsert, bool aCreateMozBR);
|
const EditorDOMPointBase<PT, CT>& aPointToInsert, bool aCreateMozBR);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -354,7 +354,7 @@ class TextEditor : public EditorBase, public nsIPlaintextEditor {
|
||||||
* <br> node, returns nullptr.
|
* <br> node, returns nullptr.
|
||||||
*/
|
*/
|
||||||
template <typename PT, typename CT>
|
template <typename PT, typename CT>
|
||||||
already_AddRefed<Element> InsertBrElementWithTransaction(
|
MOZ_CAN_RUN_SCRIPT already_AddRefed<Element> InsertBrElementWithTransaction(
|
||||||
const EditorDOMPointBase<PT, CT>& aPointToInsert,
|
const EditorDOMPointBase<PT, CT>& aPointToInsert,
|
||||||
EDirection aSelect = eNone);
|
EDirection aSelect = eNone);
|
||||||
|
|
||||||
|
|
|
@ -240,7 +240,8 @@ already_AddRefed<Element> WSRunObject::InsertBreak(
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<Element> newBrElement =
|
RefPtr<Element> newBrElement =
|
||||||
mHTMLEditor->InsertBrElementWithTransaction(pointToInsert, aSelect);
|
MOZ_KnownLive(mHTMLEditor)
|
||||||
|
->InsertBrElementWithTransaction(pointToInsert, aSelect);
|
||||||
if (NS_WARN_IF(!newBrElement)) {
|
if (NS_WARN_IF(!newBrElement)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -419,6 +419,7 @@ interface nsIEditor : nsISupports
|
||||||
* @param aNewLeftNode [OUT] the new node resulting from the split,
|
* @param aNewLeftNode [OUT] the new node resulting from the split,
|
||||||
* becomes aExistingRightNode's previous sibling.
|
* becomes aExistingRightNode's previous sibling.
|
||||||
*/
|
*/
|
||||||
|
[can_run_script]
|
||||||
void splitNode(in Node existingRightNode,
|
void splitNode(in Node existingRightNode,
|
||||||
in long offset,
|
in long offset,
|
||||||
out Node newLeftNode);
|
out Node newLeftNode);
|
||||||
|
|
|
@ -211,6 +211,7 @@ interface nsIHTMLEditor : nsISupports
|
||||||
* SetParagraphFormat Insert a block paragraph tag around selection
|
* SetParagraphFormat Insert a block paragraph tag around selection
|
||||||
* @param aParagraphFormat "p", "h1" to "h6", "address", "pre", or "blockquote"
|
* @param aParagraphFormat "p", "h1" to "h6", "address", "pre", or "blockquote"
|
||||||
*/
|
*/
|
||||||
|
[can_run_script]
|
||||||
void setParagraphFormat(in AString aParagraphFormat);
|
void setParagraphFormat(in AString aParagraphFormat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -283,6 +284,7 @@ interface nsIHTMLEditor : nsISupports
|
||||||
* Document me!
|
* Document me!
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
[can_run_script]
|
||||||
void makeOrChangeList(in AString aListType, in boolean entireList,
|
void makeOrChangeList(in AString aListType, in boolean entireList,
|
||||||
in AString aBulletType);
|
in AString aBulletType);
|
||||||
|
|
||||||
|
@ -298,6 +300,7 @@ interface nsIHTMLEditor : nsISupports
|
||||||
* Document me!
|
* Document me!
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
[can_run_script]
|
||||||
void indent(in AString aIndent);
|
void indent(in AString aIndent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Загрузка…
Ссылка в новой задаче