Bug 1386411 - Part 6: Add a more efficient nsISelectionController::GetSelection() API for retrieving native Selection objects; r=bzbarsky

This API avoids needless refcounting and QueryInterface overhead.
This commit is contained in:
Ehsan Akhgari
2017-08-01 19:50:50 -04:00
parent 13246923da
commit d09b186e51
4 changed files with 35 additions and 0 deletions

View File

@@ -296,6 +296,7 @@ public:
NS_IMETHOD GetSelectionFlags(int16_t *aOutEnable) override;
NS_IMETHOD GetSelection(RawSelectionType aRawSelectionType,
nsISelection** aSelection) override;
NS_IMETHODIMP_(Selection*) GetSelection(RawSelectionType aRawSelectionType) override;
NS_IMETHOD ScrollSelectionIntoView(RawSelectionType aRawSelectionType,
int16_t aRegion, int16_t aFlags) override;
NS_IMETHOD RepaintSelection(RawSelectionType aRawSelectionType) override;
@@ -432,6 +433,12 @@ nsTextInputSelectionImpl::GetSelection(RawSelectionType aRawSelectionType,
return NS_OK;
}
NS_IMETHODIMP_(Selection*)
nsTextInputSelectionImpl::GetSelection(RawSelectionType aRawSelectionType)
{
return GetSelection(ToSelectionType(aRawSelectionType));
}
NS_IMETHODIMP
nsTextInputSelectionImpl::ScrollSelectionIntoView(
RawSelectionType aRawSelectionType,