Bug 1101364 - Part 1: Apply AutoApplyUserSelectStyle to nsHTMLEditor::SelectAll(). r=mats

This commit is contained in:
Morris Tseng 2014-12-12 01:15:00 -05:00
Родитель 50d890e0f7
Коммит 8ef3486369
1 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -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);
}