Loading layout/base/nsCaret.cpp +16 −11 Original line number Diff line number Diff line Loading @@ -182,11 +182,11 @@ NS_METHOD nsCaret::NotifySelectionChanged() #pragma mark - //----------------------------------------------------------------------------- nsresult nsCaret::StartBlinking() nsresult nsCaret::PrimeTimer() { NS_IF_RELEASE(mBlinkTimer); mBlinkTimer = nsnull; // set up the blink timer if (mBlinkRate > 0) Loading @@ -199,6 +199,15 @@ nsresult nsCaret::StartBlinking() mBlinkTimer->Init(CaretBlinkCallback, this, mBlinkRate); } return NS_OK; } //----------------------------------------------------------------------------- nsresult nsCaret::StartBlinking() { PrimeTimer(); NS_ASSERTION(!mDrawn, "Caret should not be drawn here"); DrawCaret(); // draw it right away Loading @@ -214,7 +223,6 @@ nsresult nsCaret::StopBlinking() DrawCaret(); NS_IF_RELEASE(mBlinkTimer); mBlinkTimer = nsnull; return NS_OK; } Loading @@ -237,11 +245,11 @@ void nsCaret::DrawCaret() // from the selection, and store the rect. If we are drawn, we _have_ to erase, // which why the rect is stored, and the stored rect used to erase. if (PR_TRUE || !mDrawn) if (!mDrawn) { nsCOMPtr<nsIDOMSelection> domSelection; nsresult err = mPresShell->GetSelection(getter_AddRefs(domSelection)); if (!NS_SUCCEEDED(err) || (nsnull == domSelection)) if (!NS_SUCCEEDED(err) || !domSelection) return; PRBool isCollapsed; Loading @@ -252,7 +260,7 @@ void nsCaret::DrawCaret() nsCOMPtr<nsIDOMNode> focusNode; PRInt32 focusOffset; domSelection->GetFocusNodeAndOffset(getter_doesnt_AddRef(focusNode), &focusOffset); domSelection->GetFocusNodeAndOffset(getter_AddRefs(focusNode), &focusOffset); // is this a text node? nsCOMPtr<nsIDOMCharacterData> nodeAsText(do_QueryInterface(focusNode)); Loading Loading @@ -330,10 +338,7 @@ void nsCaret::DrawCaret() mDrawn = !mDrawn; } // prime the timer again if (mBlinkTimer) mBlinkTimer->Init(CaretBlinkCallback, this, mBlinkRate); PrimeTimer(); } Loading layout/base/nsCaret.h +2 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,8 @@ class nsCaret : public nsICaret, protected: nsresult PrimeTimer(); nsresult StartBlinking(); nsresult StopBlinking(); Loading layout/base/src/nsCaret.cpp +16 −11 Original line number Diff line number Diff line Loading @@ -182,11 +182,11 @@ NS_METHOD nsCaret::NotifySelectionChanged() #pragma mark - //----------------------------------------------------------------------------- nsresult nsCaret::StartBlinking() nsresult nsCaret::PrimeTimer() { NS_IF_RELEASE(mBlinkTimer); mBlinkTimer = nsnull; // set up the blink timer if (mBlinkRate > 0) Loading @@ -199,6 +199,15 @@ nsresult nsCaret::StartBlinking() mBlinkTimer->Init(CaretBlinkCallback, this, mBlinkRate); } return NS_OK; } //----------------------------------------------------------------------------- nsresult nsCaret::StartBlinking() { PrimeTimer(); NS_ASSERTION(!mDrawn, "Caret should not be drawn here"); DrawCaret(); // draw it right away Loading @@ -214,7 +223,6 @@ nsresult nsCaret::StopBlinking() DrawCaret(); NS_IF_RELEASE(mBlinkTimer); mBlinkTimer = nsnull; return NS_OK; } Loading @@ -237,11 +245,11 @@ void nsCaret::DrawCaret() // from the selection, and store the rect. If we are drawn, we _have_ to erase, // which why the rect is stored, and the stored rect used to erase. if (PR_TRUE || !mDrawn) if (!mDrawn) { nsCOMPtr<nsIDOMSelection> domSelection; nsresult err = mPresShell->GetSelection(getter_AddRefs(domSelection)); if (!NS_SUCCEEDED(err) || (nsnull == domSelection)) if (!NS_SUCCEEDED(err) || !domSelection) return; PRBool isCollapsed; Loading @@ -252,7 +260,7 @@ void nsCaret::DrawCaret() nsCOMPtr<nsIDOMNode> focusNode; PRInt32 focusOffset; domSelection->GetFocusNodeAndOffset(getter_doesnt_AddRef(focusNode), &focusOffset); domSelection->GetFocusNodeAndOffset(getter_AddRefs(focusNode), &focusOffset); // is this a text node? nsCOMPtr<nsIDOMCharacterData> nodeAsText(do_QueryInterface(focusNode)); Loading Loading @@ -330,10 +338,7 @@ void nsCaret::DrawCaret() mDrawn = !mDrawn; } // prime the timer again if (mBlinkTimer) mBlinkTimer->Init(CaretBlinkCallback, this, mBlinkRate); PrimeTimer(); } Loading layout/base/src/nsCaret.h +2 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,8 @@ class nsCaret : public nsICaret, protected: nsresult PrimeTimer(); nsresult StartBlinking(); nsresult StopBlinking(); Loading layout/base/src/nsRangeList.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -1264,6 +1264,10 @@ nsRangeList::DeleteFromDocument() NS_IMETHODIMP nsRangeList::GetAnchorNodeAndOffset(nsIDOMNode** outAnchorNode, PRInt32 *outAnchorOffset) { if (!outAnchorNode || !outAnchorOffset) return NS_ERROR_NULL_POINTER; NS_IF_ADDREF((nsIDOMNode *)mAnchorNode); *outAnchorNode = mAnchorNode; *outAnchorOffset = mAnchorOffset; return NS_OK; Loading @@ -1276,6 +1280,10 @@ nsRangeList::GetAnchorNodeAndOffset(nsIDOMNode** outAnchorNode, PRInt32 *outAnch NS_IMETHODIMP nsRangeList::GetFocusNodeAndOffset(nsIDOMNode** outFocusNode, PRInt32 *outFocusOffset) { if (!outFocusNode || !outFocusOffset) return NS_ERROR_NULL_POINTER; NS_IF_ADDREF((nsIDOMNode *)mFocusNode); *outFocusNode = mFocusNode; *outFocusOffset = mFocusOffset; return NS_OK; Loading Loading
layout/base/nsCaret.cpp +16 −11 Original line number Diff line number Diff line Loading @@ -182,11 +182,11 @@ NS_METHOD nsCaret::NotifySelectionChanged() #pragma mark - //----------------------------------------------------------------------------- nsresult nsCaret::StartBlinking() nsresult nsCaret::PrimeTimer() { NS_IF_RELEASE(mBlinkTimer); mBlinkTimer = nsnull; // set up the blink timer if (mBlinkRate > 0) Loading @@ -199,6 +199,15 @@ nsresult nsCaret::StartBlinking() mBlinkTimer->Init(CaretBlinkCallback, this, mBlinkRate); } return NS_OK; } //----------------------------------------------------------------------------- nsresult nsCaret::StartBlinking() { PrimeTimer(); NS_ASSERTION(!mDrawn, "Caret should not be drawn here"); DrawCaret(); // draw it right away Loading @@ -214,7 +223,6 @@ nsresult nsCaret::StopBlinking() DrawCaret(); NS_IF_RELEASE(mBlinkTimer); mBlinkTimer = nsnull; return NS_OK; } Loading @@ -237,11 +245,11 @@ void nsCaret::DrawCaret() // from the selection, and store the rect. If we are drawn, we _have_ to erase, // which why the rect is stored, and the stored rect used to erase. if (PR_TRUE || !mDrawn) if (!mDrawn) { nsCOMPtr<nsIDOMSelection> domSelection; nsresult err = mPresShell->GetSelection(getter_AddRefs(domSelection)); if (!NS_SUCCEEDED(err) || (nsnull == domSelection)) if (!NS_SUCCEEDED(err) || !domSelection) return; PRBool isCollapsed; Loading @@ -252,7 +260,7 @@ void nsCaret::DrawCaret() nsCOMPtr<nsIDOMNode> focusNode; PRInt32 focusOffset; domSelection->GetFocusNodeAndOffset(getter_doesnt_AddRef(focusNode), &focusOffset); domSelection->GetFocusNodeAndOffset(getter_AddRefs(focusNode), &focusOffset); // is this a text node? nsCOMPtr<nsIDOMCharacterData> nodeAsText(do_QueryInterface(focusNode)); Loading Loading @@ -330,10 +338,7 @@ void nsCaret::DrawCaret() mDrawn = !mDrawn; } // prime the timer again if (mBlinkTimer) mBlinkTimer->Init(CaretBlinkCallback, this, mBlinkRate); PrimeTimer(); } Loading
layout/base/nsCaret.h +2 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,8 @@ class nsCaret : public nsICaret, protected: nsresult PrimeTimer(); nsresult StartBlinking(); nsresult StopBlinking(); Loading
layout/base/src/nsCaret.cpp +16 −11 Original line number Diff line number Diff line Loading @@ -182,11 +182,11 @@ NS_METHOD nsCaret::NotifySelectionChanged() #pragma mark - //----------------------------------------------------------------------------- nsresult nsCaret::StartBlinking() nsresult nsCaret::PrimeTimer() { NS_IF_RELEASE(mBlinkTimer); mBlinkTimer = nsnull; // set up the blink timer if (mBlinkRate > 0) Loading @@ -199,6 +199,15 @@ nsresult nsCaret::StartBlinking() mBlinkTimer->Init(CaretBlinkCallback, this, mBlinkRate); } return NS_OK; } //----------------------------------------------------------------------------- nsresult nsCaret::StartBlinking() { PrimeTimer(); NS_ASSERTION(!mDrawn, "Caret should not be drawn here"); DrawCaret(); // draw it right away Loading @@ -214,7 +223,6 @@ nsresult nsCaret::StopBlinking() DrawCaret(); NS_IF_RELEASE(mBlinkTimer); mBlinkTimer = nsnull; return NS_OK; } Loading @@ -237,11 +245,11 @@ void nsCaret::DrawCaret() // from the selection, and store the rect. If we are drawn, we _have_ to erase, // which why the rect is stored, and the stored rect used to erase. if (PR_TRUE || !mDrawn) if (!mDrawn) { nsCOMPtr<nsIDOMSelection> domSelection; nsresult err = mPresShell->GetSelection(getter_AddRefs(domSelection)); if (!NS_SUCCEEDED(err) || (nsnull == domSelection)) if (!NS_SUCCEEDED(err) || !domSelection) return; PRBool isCollapsed; Loading @@ -252,7 +260,7 @@ void nsCaret::DrawCaret() nsCOMPtr<nsIDOMNode> focusNode; PRInt32 focusOffset; domSelection->GetFocusNodeAndOffset(getter_doesnt_AddRef(focusNode), &focusOffset); domSelection->GetFocusNodeAndOffset(getter_AddRefs(focusNode), &focusOffset); // is this a text node? nsCOMPtr<nsIDOMCharacterData> nodeAsText(do_QueryInterface(focusNode)); Loading Loading @@ -330,10 +338,7 @@ void nsCaret::DrawCaret() mDrawn = !mDrawn; } // prime the timer again if (mBlinkTimer) mBlinkTimer->Init(CaretBlinkCallback, this, mBlinkRate); PrimeTimer(); } Loading
layout/base/src/nsCaret.h +2 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,8 @@ class nsCaret : public nsICaret, protected: nsresult PrimeTimer(); nsresult StartBlinking(); nsresult StopBlinking(); Loading
layout/base/src/nsRangeList.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -1264,6 +1264,10 @@ nsRangeList::DeleteFromDocument() NS_IMETHODIMP nsRangeList::GetAnchorNodeAndOffset(nsIDOMNode** outAnchorNode, PRInt32 *outAnchorOffset) { if (!outAnchorNode || !outAnchorOffset) return NS_ERROR_NULL_POINTER; NS_IF_ADDREF((nsIDOMNode *)mAnchorNode); *outAnchorNode = mAnchorNode; *outAnchorOffset = mAnchorOffset; return NS_OK; Loading @@ -1276,6 +1280,10 @@ nsRangeList::GetAnchorNodeAndOffset(nsIDOMNode** outAnchorNode, PRInt32 *outAnch NS_IMETHODIMP nsRangeList::GetFocusNodeAndOffset(nsIDOMNode** outFocusNode, PRInt32 *outFocusOffset) { if (!outFocusNode || !outFocusOffset) return NS_ERROR_NULL_POINTER; NS_IF_ADDREF((nsIDOMNode *)mFocusNode); *outFocusNode = mFocusNode; *outFocusOffset = mFocusOffset; return NS_OK; Loading