Skip to content

Commit

Permalink
Bug 1048752. Part 27: Remove obsolete caret state logic and just Sche…
Browse files Browse the repository at this point in the history
…dulePaint as needed. r=tn

This is the core of the whole patch set.

Now GetPaintGeometry/PaintCaret figure out on their own almost all the state
they need every time we paint. So when caret flags change, all we need
to do is SchedulePaint. We don't need to fiddle with mDrawn and most of the
logic in DrawCaret is obsolete. (In fact, it was duplicated by GetGeometry
and friends, and we're removing that duplication.) EraseCaret, CheckCaretState
and UpdateCaretPosition are also obsolete.

We need to have GetPaintGeometry/PaintCaret choose the correct content node
and offset, either getting them from the Selection or using specific data set by
DrawAtPosition. This logic, plus a bit of other code shared between them, is
put into the helper GetFrameAndOffset.

--HG--
extra : rebase_source : e777605dd2507ae043e9f82d0a30e23aa06e0c12
  • Loading branch information
rocallahan committed Aug 6, 2014
1 parent eee12a2 commit 2730385
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 325 deletions.
9 changes: 2 additions & 7 deletions editor/libeditor/nsEditorEventListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,11 +695,7 @@ nsEditorEventListener::DragOver(nsIDOMDragEvent* aDragEvent)
nsresult rv = aDragEvent->GetRangeOffset(&offset);
NS_ENSURE_SUCCESS(rv, rv);

// to avoid flicker, we could track the node and offset to see if we moved
if (mCaret)
mCaret->EraseCaret();

//mCaret->SetCaretVisible(true); // make sure it's visible
mCaret->SetVisible(true);
mCaret->DrawAtPosition(parent, offset);
}
}
Expand All @@ -713,7 +709,7 @@ nsEditorEventListener::DragOver(nsIDOMDragEvent* aDragEvent)

if (mCaret)
{
mCaret->EraseCaret();
mCaret->SetVisible(false);
}
}

Expand All @@ -725,7 +721,6 @@ nsEditorEventListener::CleanupDragDropCaret()
{
if (mCaret)
{
mCaret->EraseCaret();
mCaret->SetVisible(false); // hide it, so that it turns off its timer

nsCOMPtr<nsIPresShell> presShell = GetPresShell();
Expand Down
Loading

0 comments on commit 2730385

Please sign in to comment.