Bug 1391978 - Part 2. Replace nsISelection::SelectAllChildren with Selection::SelectAllChildren. r?masayuki
MozReview-Commit-ID: m9bLHIIfy9
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -2637,22 +2637,24 @@ EditorBase::InsertTextIntoTextNodeImpl(c
nsresult
EditorBase::SelectEntireDocument(Selection* aSelection)
{
if (!aSelection) {
return NS_ERROR_NULL_POINTER;
}
- nsCOMPtr<nsIDOMElement> rootElement = do_QueryInterface(GetRoot());
+ Element* rootElement = GetRoot();
if (!rootElement) {
return NS_ERROR_NOT_INITIALIZED;
}
- return aSelection->SelectAllChildren(rootElement);
+ ErrorResult errorResult;
+ aSelection->SelectAllChildren(*rootElement, errorResult);
+ return errorResult.StealNSResult();
}
nsINode*
EditorBase::GetFirstEditableNode(nsINode* aRoot)
{
MOZ_ASSERT(aRoot);
nsIContent* node = GetLeftmostChild(aRoot);
--- a/editor/libeditor/HTMLEditor.cpp
+++ b/editor/libeditor/HTMLEditor.cpp
@@ -3609,24 +3609,23 @@ HTMLEditor::SelectAll()
rootContent = mRootElement;
} else {
nsCOMPtr<nsIPresShell> ps = GetPresShell();
rootContent = anchorContent->GetSelectionRootContent(ps);
}
NS_ENSURE_TRUE(rootContent, NS_ERROR_UNEXPECTED);
- nsCOMPtr<nsIDOMNode> rootElement = do_QueryInterface(rootContent, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
Maybe<mozilla::dom::Selection::AutoUserInitiated> userSelection;
if (!rootContent->IsEditable()) {
userSelection.emplace(selection);
}
- return selection->SelectAllChildren(rootElement);
+ ErrorResult errorResult;
+ selection->SelectAllChildren(*rootContent, errorResult);
+ return errorResult.StealNSResult();
}
// this will NOT find aAttribute unless aAttribute has a non-null value
// so singleton attributes like <Table border> will not be matched!
bool
HTMLEditor::IsTextPropertySetByContent(nsINode* aNode,
nsIAtom* aProperty,
const nsAString* aAttribute,