Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1101364 - Part 1: Apply AutoApplyUserSelectStyle to nsHTMLEditor:…
Browse files Browse the repository at this point in the history
…:SelectAll(). r=mats
  • Loading branch information
mephisto41 committed Dec 12, 2014
1 parent 82666af commit 024fa8d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions editor/libeditor/nsHTMLEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3540,24 +3540,26 @@ nsHTMLEditor::SelectAll()

nsCOMPtr<nsIContent> anchorContent = do_QueryInterface(anchorNode, &rv);
NS_ENSURE_SUCCESS(rv, rv);

// If the anchor content has independent selection, we never need to explicitly
// select its children.

nsIContent *rootContent;
if (anchorContent->HasIndependentSelection()) {
rv = selection->SetAncestorLimiter(nullptr);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMNode> rootElement = do_QueryInterface(mRootElement, &rv);
NS_ENSURE_SUCCESS(rv, rv);
return selection->SelectAllChildren(rootElement);
rootContent = mRootElement;
} else {
nsCOMPtr<nsIPresShell> ps = GetPresShell();
rootContent = anchorContent->GetSelectionRootContent(ps);
}

nsCOMPtr<nsIPresShell> ps = GetPresShell();
nsIContent *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::AutoApplyUserSelectStyle> userSelection;
if (!rootContent->IsEditable()) {
userSelection.emplace(selection);
}
return selection->SelectAllChildren(rootElement);
}

Expand Down

0 comments on commit 024fa8d

Please sign in to comment.