forked from mirrors/gecko-dev
Bug 253889: DeCOMtaminate nsIPresShell - GetCaret(). r=roc
--HG-- extra : rebase_source : 2a05050d8cbb10dd3bb763d5d5a158cc5f3dd814
This commit is contained in:
parent
3b3307f212
commit
c82a6bc194
12 changed files with 45 additions and 77 deletions
|
|
@ -322,8 +322,7 @@ nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget)
|
||||||
nsCoreUtils::GetPresShellFor(lastNodeWithCaret);
|
nsCoreUtils::GetPresShellFor(lastNodeWithCaret);
|
||||||
NS_ENSURE_TRUE(presShell, caretRect);
|
NS_ENSURE_TRUE(presShell, caretRect);
|
||||||
|
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = presShell->GetCaret();
|
||||||
presShell->GetCaret(getter_AddRefs(caret));
|
|
||||||
NS_ENSURE_TRUE(caret, caretRect);
|
NS_ENSURE_TRUE(caret, caretRect);
|
||||||
|
|
||||||
nsCOMPtr<nsISelection> caretSelection(do_QueryReferent(mLastUsedSelection));
|
nsCOMPtr<nsISelection> caretSelection(do_QueryReferent(mLastUsedSelection));
|
||||||
|
|
|
||||||
|
|
@ -135,10 +135,8 @@ nsContentEventHandler::Init(nsQueryContentEvent* aEvent)
|
||||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_NOT_AVAILABLE);
|
NS_ENSURE_SUCCESS(rv, NS_ERROR_NOT_AVAILABLE);
|
||||||
aEvent->mReply.mHasSelection = !isCollapsed;
|
aEvent->mReply.mHasSelection = !isCollapsed;
|
||||||
|
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = mPresShell->GetCaret();
|
||||||
rv = mPresShell->GetCaret(getter_AddRefs(caret));
|
NS_ASSERTION(caret, "GetCaret returned null");
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
NS_ASSERTION(caret, "GetCaret succeeded, but the result is null");
|
|
||||||
|
|
||||||
nsRect r;
|
nsRect r;
|
||||||
nsIFrame* frame = caret->GetGeometry(mSelection, &r);
|
nsIFrame* frame = caret->GetGeometry(mSelection, &r);
|
||||||
|
|
@ -663,10 +661,8 @@ nsContentEventHandler::OnQueryCaretRect(nsQueryContentEvent* aEvent)
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = mPresShell->GetCaret();
|
||||||
rv = mPresShell->GetCaret(getter_AddRefs(caret));
|
NS_ASSERTION(caret, "GetCaret returned null");
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
NS_ASSERTION(caret, "GetCaret succeeded, but the result is null");
|
|
||||||
|
|
||||||
// When the selection is collapsed and the queried offset is current caret
|
// When the selection is collapsed and the queried offset is current caret
|
||||||
// position, we should return the "real" caret rect.
|
// position, we should return the "real" caret rect.
|
||||||
|
|
|
||||||
|
|
@ -1899,8 +1899,7 @@ nsFocusManager::SetCaretVisible(nsIPresShell* aPresShell,
|
||||||
// When browsing with caret, make sure caret is visible after new focus
|
// When browsing with caret, make sure caret is visible after new focus
|
||||||
// Return early if there is no caret. This can happen for the testcase
|
// Return early if there is no caret. This can happen for the testcase
|
||||||
// for bug 308025 where a window is closed in a blur handler.
|
// for bug 308025 where a window is closed in a blur handler.
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = aPresShell->GetCaret();
|
||||||
aPresShell->GetCaret(getter_AddRefs(caret));
|
|
||||||
if (!caret)
|
if (!caret)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
|
|
@ -2054,8 +2053,7 @@ nsFocusManager::GetSelectionLocation(nsIDocument* aDocument,
|
||||||
if (newCaretFrame && newCaretContent) {
|
if (newCaretFrame && newCaretContent) {
|
||||||
// If the caret is exactly at the same position of the new frame,
|
// If the caret is exactly at the same position of the new frame,
|
||||||
// then we can use the newCaretFrame and newCaretContent for our position
|
// then we can use the newCaretFrame and newCaretContent for our position
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = aPresShell->GetCaret();
|
||||||
aPresShell->GetCaret(getter_AddRefs(caret));
|
|
||||||
nsRect caretRect;
|
nsRect caretRect;
|
||||||
nsIFrame *frame = caret->GetGeometry(domSelection, &caretRect);
|
nsIFrame *frame = caret->GetGeometry(domSelection, &caretRect);
|
||||||
if (frame) {
|
if (frame) {
|
||||||
|
|
|
||||||
|
|
@ -1981,10 +1981,9 @@ nsEditor::QueryComposition(nsTextEventReply* aReply)
|
||||||
if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
|
if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
|
||||||
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
|
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
|
||||||
if (!ps) return NS_ERROR_NOT_INITIALIZED;
|
if (!ps) return NS_ERROR_NOT_INITIALIZED;
|
||||||
nsRefPtr<nsCaret> caretP;
|
nsRefPtr<nsCaret> caretP = ps->GetCaret();
|
||||||
result = ps->GetCaret(getter_AddRefs(caretP));
|
|
||||||
|
if (caretP) {
|
||||||
if (NS_SUCCEEDED(result) && caretP) {
|
|
||||||
if (aReply) {
|
if (aReply) {
|
||||||
caretP->SetCaretDOMSelection(selection);
|
caretP->SetCaretDOMSelection(selection);
|
||||||
|
|
||||||
|
|
@ -4363,10 +4362,10 @@ nsresult nsEditor::EndUpdateViewBatch()
|
||||||
GetPresShell(getter_AddRefs(presShell));
|
GetPresShell(getter_AddRefs(presShell));
|
||||||
|
|
||||||
if (presShell)
|
if (presShell)
|
||||||
presShell->GetCaret(getter_AddRefs(caret));
|
caret = presShell->GetCaret();
|
||||||
|
|
||||||
StCaretHider caretHider(caret);
|
StCaretHider caretHider(caret);
|
||||||
|
|
||||||
PRUint32 flags = 0;
|
PRUint32 flags = 0;
|
||||||
|
|
||||||
GetFlags(&flags);
|
GetFlags(&flags);
|
||||||
|
|
|
||||||
|
|
@ -870,8 +870,7 @@ nsEditorEventListener::Focus(nsIDOMEvent* aEvent)
|
||||||
|
|
||||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||||
if (presShell) {
|
if (presShell) {
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = presShell->GetCaret();
|
||||||
presShell->GetCaret(getter_AddRefs(caret));
|
|
||||||
if (caret) {
|
if (caret) {
|
||||||
caret->SetIgnoreUserModify(PR_FALSE);
|
caret->SetIgnoreUserModify(PR_FALSE);
|
||||||
if (selection) {
|
if (selection) {
|
||||||
|
|
@ -942,8 +941,7 @@ nsEditorEventListener::Blur(nsIDOMEvent* aEvent)
|
||||||
|
|
||||||
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
|
||||||
if (presShell) {
|
if (presShell) {
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = presShell->GetCaret();
|
||||||
presShell->GetCaret(getter_AddRefs(caret));
|
|
||||||
if (caret) {
|
if (caret) {
|
||||||
caret->SetIgnoreUserModify(PR_TRUE);
|
caret->SetIgnoreUserModify(PR_TRUE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1576,8 +1576,7 @@ nsPlaintextEditor::SetCompositionString(const nsAString& aCompositionString, nsI
|
||||||
nsresult result = GetSelection(getter_AddRefs(selection));
|
nsresult result = GetSelection(getter_AddRefs(selection));
|
||||||
if (NS_FAILED(result)) return result;
|
if (NS_FAILED(result)) return result;
|
||||||
|
|
||||||
nsRefPtr<nsCaret> caretP;
|
nsRefPtr<nsCaret> caretP = ps->GetCaret();
|
||||||
ps->GetCaret(getter_AddRefs(caretP));
|
|
||||||
|
|
||||||
// We should return caret position if it is possible. Because this event
|
// We should return caret position if it is possible. Because this event
|
||||||
// dispatcher always expects to be returned the correct caret position.
|
// dispatcher always expects to be returned the correct caret position.
|
||||||
|
|
|
||||||
|
|
@ -182,8 +182,7 @@ nsDisplayListBuilder::IsMovingFrame(nsIFrame* aFrame)
|
||||||
|
|
||||||
nsCaret *
|
nsCaret *
|
||||||
nsDisplayListBuilder::GetCaret() {
|
nsDisplayListBuilder::GetCaret() {
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = CurrentPresShellState()->mPresShell->GetCaret();
|
||||||
CurrentPresShellState()->mPresShell->GetCaret(getter_AddRefs(caret));
|
|
||||||
return caret;
|
return caret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,8 +201,7 @@ nsDisplayListBuilder::EnterPresShell(nsIFrame* aReferenceFrame,
|
||||||
if (!mBuildCaret)
|
if (!mBuildCaret)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = state->mPresShell->GetCaret();
|
||||||
state->mPresShell->GetCaret(getter_AddRefs(caret));
|
|
||||||
state->mCaretFrame = caret->GetCaretFrame();
|
state->mCaretFrame = caret->GetCaretFrame();
|
||||||
|
|
||||||
if (state->mCaretFrame) {
|
if (state->mCaretFrame) {
|
||||||
|
|
|
||||||
|
|
@ -585,14 +585,14 @@ public:
|
||||||
/**
|
/**
|
||||||
* Get the caret, if it exists. AddRefs it.
|
* Get the caret, if it exists. AddRefs it.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetCaret(nsCaret **aOutCaret) = 0;
|
virtual NS_HIDDEN_(already_AddRefed<nsCaret>) GetCaret() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invalidate the caret's current position if it's outside of its frame's
|
* Invalidate the caret's current position if it's outside of its frame's
|
||||||
* boundaries. This function is useful if you're batching selection
|
* boundaries. This function is useful if you're batching selection
|
||||||
* notifications and might remove the caret's frame out from under it.
|
* notifications and might remove the caret's frame out from under it.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD_(void) MaybeInvalidateCaretPosition() = 0;
|
virtual NS_HIDDEN_(void) MaybeInvalidateCaretPosition() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current caret to a new caret. To undo this, call RestoreCaret.
|
* Set the current caret to a new caret. To undo this, call RestoreCaret.
|
||||||
|
|
|
||||||
|
|
@ -811,8 +811,8 @@ public:
|
||||||
NS_IMETHOD_(void) ClearMouseCapture(nsIView* aView);
|
NS_IMETHOD_(void) ClearMouseCapture(nsIView* aView);
|
||||||
|
|
||||||
// caret handling
|
// caret handling
|
||||||
NS_IMETHOD GetCaret(nsCaret **aOutCaret);
|
virtual NS_HIDDEN_(already_AddRefed<nsCaret>) GetCaret();
|
||||||
NS_IMETHOD_(void) MaybeInvalidateCaretPosition();
|
virtual NS_HIDDEN_(void) MaybeInvalidateCaretPosition();
|
||||||
NS_IMETHOD SetCaretEnabled(PRBool aInEnable);
|
NS_IMETHOD SetCaretEnabled(PRBool aInEnable);
|
||||||
NS_IMETHOD SetCaretReadOnly(PRBool aReadOnly);
|
NS_IMETHOD SetCaretReadOnly(PRBool aReadOnly);
|
||||||
NS_IMETHOD GetCaretEnabled(PRBool *aOutEnabled);
|
NS_IMETHOD GetCaretEnabled(PRBool *aOutEnabled);
|
||||||
|
|
@ -2784,17 +2784,14 @@ PresShell::NotifyDestroyingFrame(nsIFrame* aFrame)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// note that this can return a null caret, but NS_OK
|
already_AddRefed<nsCaret> PresShell::GetCaret()
|
||||||
NS_IMETHODIMP PresShell::GetCaret(nsCaret **outCaret)
|
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(outCaret);
|
nsCaret* caret = mCaret;
|
||||||
|
NS_IF_ADDREF(caret);
|
||||||
*outCaret = mCaret;
|
return caret;
|
||||||
NS_IF_ADDREF(*outCaret);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(void) PresShell::MaybeInvalidateCaretPosition()
|
void PresShell::MaybeInvalidateCaretPosition()
|
||||||
{
|
{
|
||||||
if (mCaret) {
|
if (mCaret) {
|
||||||
mCaret->InvalidateOutsideCaret();
|
mCaret->InvalidateOutsideCaret();
|
||||||
|
|
@ -6635,9 +6632,7 @@ PresShell::PrepareToUseCaretPosition(nsIWidget* aEventWidget, nsIntPoint& aTarge
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
// check caret visibility
|
// check caret visibility
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = GetCaret();
|
||||||
rv = GetCaret(getter_AddRefs(caret));
|
|
||||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
|
||||||
NS_ENSURE_TRUE(caret, PR_FALSE);
|
NS_ENSURE_TRUE(caret, PR_FALSE);
|
||||||
|
|
||||||
PRBool caretVisible = PR_FALSE;
|
PRBool caretVisible = PR_FALSE;
|
||||||
|
|
|
||||||
|
|
@ -689,9 +689,8 @@ nsTextInputSelectionImpl::SetCaretReadOnly(PRBool aReadOnly)
|
||||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShellWeak, &result);
|
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShellWeak, &result);
|
||||||
if (shell)
|
if (shell)
|
||||||
{
|
{
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = shell->GetCaret();
|
||||||
if (NS_SUCCEEDED(shell->GetCaret(getter_AddRefs(caret))))
|
if (caret) {
|
||||||
{
|
|
||||||
nsISelection* domSel = mFrameSelection->
|
nsISelection* domSel = mFrameSelection->
|
||||||
GetSelection(nsISelectionController::SELECTION_NORMAL);
|
GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||||
if (domSel)
|
if (domSel)
|
||||||
|
|
@ -716,9 +715,8 @@ nsTextInputSelectionImpl::GetCaretVisible(PRBool *_retval)
|
||||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShellWeak, &result);
|
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShellWeak, &result);
|
||||||
if (shell)
|
if (shell)
|
||||||
{
|
{
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = shell->GetCaret();
|
||||||
if (NS_SUCCEEDED(shell->GetCaret(getter_AddRefs(caret))))
|
if (caret) {
|
||||||
{
|
|
||||||
nsISelection* domSel = mFrameSelection->
|
nsISelection* domSel = mFrameSelection->
|
||||||
GetSelection(nsISelectionController::SELECTION_NORMAL);
|
GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||||
if (domSel)
|
if (domSel)
|
||||||
|
|
@ -736,9 +734,8 @@ nsTextInputSelectionImpl::SetCaretVisibilityDuringSelection(PRBool aVisibility)
|
||||||
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShellWeak, &result);
|
nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShellWeak, &result);
|
||||||
if (shell)
|
if (shell)
|
||||||
{
|
{
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = shell->GetCaret();
|
||||||
if (NS_SUCCEEDED(shell->GetCaret(getter_AddRefs(caret))))
|
if (caret) {
|
||||||
{
|
|
||||||
nsISelection* domSel = mFrameSelection->
|
nsISelection* domSel = mFrameSelection->
|
||||||
GetSelection(nsISelectionController::SELECTION_NORMAL);
|
GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||||
if (domSel)
|
if (domSel)
|
||||||
|
|
@ -1649,9 +1646,9 @@ nsTextControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
|
||||||
getter_AddRefs(domSelection))) &&
|
getter_AddRefs(domSelection))) &&
|
||||||
domSelection) {
|
domSelection) {
|
||||||
nsCOMPtr<nsISelectionPrivate> selPriv(do_QueryInterface(domSelection));
|
nsCOMPtr<nsISelectionPrivate> selPriv(do_QueryInterface(domSelection));
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = shell->GetCaret();
|
||||||
nsCOMPtr<nsISelectionListener> listener;
|
nsCOMPtr<nsISelectionListener> listener;
|
||||||
if (NS_SUCCEEDED(shell->GetCaret(getter_AddRefs(caret))) && caret) {
|
if (caret) {
|
||||||
listener = do_QueryInterface(caret);
|
listener = do_QueryInterface(caret);
|
||||||
if (listener) {
|
if (listener) {
|
||||||
selPriv->AddSelectionListener(listener);
|
selPriv->AddSelectionListener(listener);
|
||||||
|
|
@ -1883,8 +1880,7 @@ void nsTextControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
|
||||||
if (!ourSel) return;
|
if (!ourSel) return;
|
||||||
|
|
||||||
nsIPresShell* presShell = PresContext()->GetPresShell();
|
nsIPresShell* presShell = PresContext()->GetPresShell();
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = presShell->GetCaret();
|
||||||
presShell->GetCaret(getter_AddRefs(caret));
|
|
||||||
if (!caret) return;
|
if (!caret) return;
|
||||||
caret->SetCaretDOMSelection(ourSel);
|
caret->SetCaretDOMSelection(ourSel);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -788,15 +788,12 @@ nsFrameSelection::FetchDesiredX(nscoord &aDesiredX) //the x position requested b
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = mShell->GetCaret();
|
||||||
nsresult result = mShell->GetCaret(getter_AddRefs(caret));
|
|
||||||
if (NS_FAILED(result))
|
|
||||||
return result;
|
|
||||||
if (!caret)
|
if (!caret)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
PRInt8 index = GetIndexFromSelectionType(nsISelectionController::SELECTION_NORMAL);
|
PRInt8 index = GetIndexFromSelectionType(nsISelectionController::SELECTION_NORMAL);
|
||||||
result = caret->SetCaretDOMSelection(mDomSelections[index]);
|
nsresult result = caret->SetCaretDOMSelection(mDomSelections[index]);
|
||||||
if (NS_FAILED(result))
|
if (NS_FAILED(result))
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|
@ -2086,7 +2083,6 @@ nsFrameSelection::CommonPageMove(PRBool aForward,
|
||||||
// expected behavior for PageMove is to scroll AND move the caret
|
// expected behavior for PageMove is to scroll AND move the caret
|
||||||
// and remain relative position of the caret in view. see Bug 4302.
|
// and remain relative position of the caret in view. see Bug 4302.
|
||||||
|
|
||||||
nsresult result;
|
|
||||||
//get the frame from the scrollable view
|
//get the frame from the scrollable view
|
||||||
|
|
||||||
nsIFrame* scrolledFrame = aScrollableFrame->GetScrolledFrame();
|
nsIFrame* scrolledFrame = aScrollableFrame->GetScrolledFrame();
|
||||||
|
|
@ -2098,12 +2094,9 @@ nsFrameSelection::CommonPageMove(PRBool aForward,
|
||||||
nsISelection* domSel = GetSelection(nsISelectionController::SELECTION_NORMAL);
|
nsISelection* domSel = GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||||
if (!domSel)
|
if (!domSel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = mShell->GetCaret();
|
||||||
result = mShell->GetCaret(getter_AddRefs(caret));
|
|
||||||
if (NS_FAILED(result))
|
|
||||||
return;
|
|
||||||
|
|
||||||
nsRect caretPos;
|
nsRect caretPos;
|
||||||
nsIFrame* caretFrame = caret->GetGeometry(domSel, &caretPos);
|
nsIFrame* caretFrame = caret->GetGeometry(domSel, &caretPos);
|
||||||
if (!caretFrame)
|
if (!caretFrame)
|
||||||
|
|
@ -4195,9 +4188,8 @@ nsTypedSelection::GetPrimaryFrameForFocusNode(nsIFrame **aReturnFrame, PRInt32 *
|
||||||
nsFrameSelection::HINT hint = mFrameSelection->GetHint();
|
nsFrameSelection::HINT hint = mFrameSelection->GetHint();
|
||||||
|
|
||||||
if (aVisual) {
|
if (aVisual) {
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = presShell->GetCaret();
|
||||||
nsresult result = presShell->GetCaret(getter_AddRefs(caret));
|
if (!caret)
|
||||||
if (NS_FAILED(result) || !caret)
|
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
PRUint8 caretBidiLevel = mFrameSelection->GetCaretBidiLevel();
|
PRUint8 caretBidiLevel = mFrameSelection->GetCaretBidiLevel();
|
||||||
|
|
@ -5558,8 +5550,7 @@ nsTypedSelection::ScrollIntoView(SelectionRegion aRegion,
|
||||||
result = GetPresShell(getter_AddRefs(presShell));
|
result = GetPresShell(getter_AddRefs(presShell));
|
||||||
if (NS_FAILED(result) || !presShell)
|
if (NS_FAILED(result) || !presShell)
|
||||||
return result;
|
return result;
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = presShell->GetCaret();
|
||||||
presShell->GetCaret(getter_AddRefs(caret));
|
|
||||||
if (caret)
|
if (caret)
|
||||||
{
|
{
|
||||||
// Now that text frame character offsets are always valid (though not
|
// Now that text frame character offsets are always valid (though not
|
||||||
|
|
|
||||||
|
|
@ -552,8 +552,7 @@ CheckCaretDrawingState() {
|
||||||
if (!presShell)
|
if (!presShell)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nsRefPtr<nsCaret> caret;
|
nsRefPtr<nsCaret> caret = presShell->GetCaret();
|
||||||
presShell->GetCaret(getter_AddRefs(caret));
|
|
||||||
if (!caret)
|
if (!caret)
|
||||||
return;
|
return;
|
||||||
caret->CheckCaretDrawingState();
|
caret->CheckCaretDrawingState();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue