mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Redragging over empty text field doesn't show drag caret, except for the last text field. bug 390228, r+sr=roc a=dbaron
This commit is contained in:
parent
e8ef7a1329
commit
f055907b89
@ -523,9 +523,9 @@ nsTextEditorDragListener::DragGesture(nsIDOMEvent* aDragEvent)
|
||||
nsresult
|
||||
nsTextEditorDragListener::DragEnter(nsIDOMEvent* aDragEvent)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShell);
|
||||
if (!mCaret)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShell);
|
||||
if (presShell)
|
||||
{
|
||||
mCaret = do_CreateInstance("@mozilla.org/layout/caret;1");
|
||||
@ -539,7 +539,11 @@ nsTextEditorDragListener::DragEnter(nsIDOMEvent* aDragEvent)
|
||||
mCaretDrawn = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
else if (presShell)
|
||||
{
|
||||
presShell->SetCaret(mCaret);
|
||||
}
|
||||
|
||||
return DragOver(aDragEvent);
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ NS_IMETHODIMP nsCaret::EraseCaret()
|
||||
{
|
||||
if (mDrawn) {
|
||||
DrawCaret(PR_TRUE);
|
||||
if (mReadOnly) {
|
||||
if (mReadOnly && mBlinkRate) {
|
||||
// If readonly we don't have a blink timer set, so caret won't
|
||||
// be redrawn automatically. We need to force the caret to get
|
||||
// redrawn right after the paint
|
||||
@ -399,7 +399,12 @@ NS_IMETHODIMP nsCaret::DrawAtPosition(nsIDOMNode* aNode, PRInt32 aOffset)
|
||||
if (!frameSelection)
|
||||
return NS_ERROR_FAILURE;
|
||||
bidiLevel = frameSelection->GetCaretBidiLevel();
|
||||
|
||||
|
||||
// DrawAtPosition is used by consumers who want us to stay drawn where they
|
||||
// tell us. Setting mBlinkRate to 0 tells us to not set a timer to erase
|
||||
// ourselves, our consumer will take care of that.
|
||||
mBlinkRate = 0;
|
||||
|
||||
// XXX we need to do more work here to get the correct hint.
|
||||
nsresult rv = DrawAtPositionWithHint(aNode, aOffset,
|
||||
nsFrameSelection::HINTLEFT,
|
||||
|
@ -124,6 +124,7 @@ public:
|
||||
* To avoid drawing glitches, you should call EraseCaret()
|
||||
* after each call to DrawAtPosition().
|
||||
*
|
||||
* Note: This call breaks the caret's ability to blink at all.
|
||||
**/
|
||||
NS_IMETHOD DrawAtPosition(nsIDOMNode* aNode, PRInt32 aOffset) = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user