mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 15:58:39 +09:00
Bug 1371170 - Add non-virtual EditorBase::GetSelectionController
Tag #1375
This commit is contained in:
parent
32e4ad01e3
commit
8e7852efa2
2 changed files with 14 additions and 7 deletions
|
|
@ -629,6 +629,17 @@ EditorBase::GetSelectionController(nsISelectionController** aSel)
|
|||
{
|
||||
NS_ENSURE_TRUE(aSel, NS_ERROR_NULL_POINTER);
|
||||
*aSel = nullptr; // init out param
|
||||
nsCOMPtr<nsISelectionController> selCon = GetSelectionController();
|
||||
if (NS_WARN_IF(!selCon)) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
selCon.forget(aSel);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsISelectionController>
|
||||
EditorBase::GetSelectionController()
|
||||
{
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
if (mSelConWeak) {
|
||||
selCon = do_QueryReferent(mSelConWeak);
|
||||
|
|
@ -636,11 +647,7 @@ EditorBase::GetSelectionController(nsISelectionController** aSel)
|
|||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||
selCon = do_QueryInterface(presShell);
|
||||
}
|
||||
if (!selCon) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
NS_ADDREF(*aSel = selCon);
|
||||
return NS_OK;
|
||||
return selCon.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
@ -663,8 +670,7 @@ EditorBase::GetSelection(SelectionType aSelectionType,
|
|||
{
|
||||
NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
|
||||
*aSelection = nullptr;
|
||||
nsCOMPtr<nsISelectionController> selcon;
|
||||
GetSelectionController(getter_AddRefs(selcon));
|
||||
nsCOMPtr<nsISelectionController> selcon = GetSelectionController();
|
||||
if (!selcon) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue