mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1101364
- Part 1: Apply AutoApplyUserSelectStyle to nsHTMLEditor::SelectAll(). r=mats
This commit is contained in:
parent
50d890e0f7
commit
8ef3486369
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user