Bug 1387143 part 9. Remove nsISelectionPrivate::Get/SetAncestorLimiter. r=mats

This commit is contained in:
Boris Zbarsky 2018-05-08 13:52:37 -04:00
parent 2abc41a969
commit a36e7f946e
5 changed files with 13 additions and 18 deletions

View File

@ -2054,24 +2054,22 @@ Selection::GetCachedFrameOffset(nsIFrame* aFrame, int32_t inOffset,
return rv;
}
NS_IMETHODIMP
Selection::GetAncestorLimiter(nsIContent** aContent)
nsIContent*
Selection::GetAncestorLimiter() const
{
if (mFrameSelection) {
nsCOMPtr<nsIContent> c = mFrameSelection->GetAncestorLimiter();
c.forget(aContent);
return mFrameSelection->GetAncestorLimiter();
}
return NS_OK;
return nullptr;
}
NS_IMETHODIMP
Selection::SetAncestorLimiter(nsIContent* aContent)
void
Selection::SetAncestorLimiter(nsIContent* aLimiter)
{
if (mFrameSelection) {
RefPtr<nsFrameSelection> frameSelection = mFrameSelection;
frameSelection->SetAncestorLimiter(aContent);
frameSelection->SetAncestorLimiter(aLimiter);
}
return NS_OK;
}
RangeData*

View File

@ -362,6 +362,10 @@ public:
nsresult SetTextRangeStyle(nsRange* aRange,
const TextRangeStyle& aTextRangeStyle);
// Methods to manipulate our mFrameSelection's ancestor limiter.
nsIContent* GetAncestorLimiter() const;
void SetAncestorLimiter(nsIContent* aLimiter);
private:
friend class ::nsAutoScrollTimer;

View File

@ -31,8 +31,6 @@ native ScrollAxis(nsIPresShell::ScrollAxis);
[uuid(0c9f4f74-ee7e-4fe9-be6b-0ba856368178)]
interface nsISelectionPrivate : nsISupports
{
[noscript] attribute nsIContent ancestorLimiter;
DOMString toStringWithFormat(in string formatType, in unsigned long flags, in int32_t wrapColumn);
void addSelectionListener(in nsISelectionListener newListener);
void removeSelectionListener(in nsISelectionListener listenerToRemove);

View File

@ -270,11 +270,7 @@ ContentEventHandler::InitRootContent(Selection* aNormalSelection)
if (!aNormalSelection->RangeCount()) {
// If there is no selection range, we should compute the selection root
// from ancestor limiter or root content of the document.
nsresult rv =
aNormalSelection->GetAncestorLimiter(getter_AddRefs(mRootContent));
if (NS_WARN_IF(NS_FAILED(rv))) {
return NS_ERROR_FAILURE;
}
mRootContent = aNormalSelection->GetAncestorLimiter();
if (!mRootContent) {
mRootContent = mDocument->GetRootElement();
if (NS_WARN_IF(!mRootContent)) {

View File

@ -3542,8 +3542,7 @@ HTMLEditor::SelectAll()
nsIContent* anchorContent = anchorNode->AsContent();
nsIContent* rootContent;
if (anchorContent->HasIndependentSelection()) {
nsresult rv = selection->SetAncestorLimiter(nullptr);
NS_ENSURE_SUCCESS(rv, rv);
selection->SetAncestorLimiter(nullptr);
rootContent = mRootElement;
} else {
nsCOMPtr<nsIPresShell> ps = GetPresShell();