This duplicates some code, but later patches will modify the callers and then
eventually we'll re-share common code.
--HG--
extra : rebase_source : 53f4756e87aadf22046972ef9102c190fbb35132
This is the start of the changes to caret-drawing proper.
The idea is to combine GetCaretFrame and GetCaretRect into a method
GetPaintGeometry which looks like GetGeometry but returns values
needed for painting (i.e. including bidi decorations, and returning
a null frame if we're not supposed to paint due to specific caret
state, e.g. in the "off" phase of the blink cycle).
Mostly a straightforward refactoring but there are a few interesting changes:
-- nsDisplayCaret stores its bounds instead of getting them from nsCaret on
demand. Eventually those bounds will not be stored in nsCaret at all.
-- nsDisplayCaret::GetBounds returns true for aSnap. nsCaret draws snapped
rects, so why not.
-- I removed "if (caretRect.Intersects(aDirtyRect))" in EnterPresShell.
As far as I can tell, this check is incorrect because it doesn't take
transforms into account. Since there's at most one drawn caret per window,
hence we do this at most once per paint, I don't think there's any real
performance advantage to having this check.
--HG--
extra : rebase_source : c98d3a5994478b482d19cc2e2ac83ab51bd17e00
The forward declaration of Selection in nsCaret.h will be used in later patches.
--HG--
extra : rebase_source : d1b749adac983c04d3365bb6bfb76a50101beeb5
This patch started an attempt to remove nsFrameSelection.h from nsCaret.h
and metastasized into a rather large refactoring patch that removed it
from some other header files as well, and changed nsFrameSelection::HINT
into a global-scope enum with better names. I also converted bools
into CaretAssociationHint in a few places where that was appropriate,
but there are still some more places (GetChildFrameContainingOffset)
where bools need to be converted. I figured this patch was big enough already.
--HG--
extra : rebase_source : cc618ef60e707e1360644340a2648de389383da0
GetGeometry is used in two different ways. Sometimes it's used to get
information about a particular caret. Sometimes it's used to get
information about a particular selection that's not associated with
a caret. Splitting GetGeometry into a non-static version for the former
and a static version for the latter makes this more clear. Also it saves
code since for the latter version we don't have to get an nsCaret first.
--HG--
extra : rebase_source : b7730dac56b308a82b79b175749234c9a92b6f59
We don't need to store the blink rate. Instead we can just fetch it whenever
we need it. However we do need a flag to handle the case where
nsCaret::DrawAtPosition disables blinking.
--HG--
extra : rebase_source : 4f36825a8e22edd3a2e37edb1fae5675c85adadd
mCaretAspectRatio doesn't need to be stored. We can recompute it
whenever we need it.
--HG--
extra : rebase_source : 065a6996e920800edf5cbcc7f072f0439ef84553
mCaretWidthCSSPx doesn't need to be stored. We can just recompute it
whenever we need it.
--HG--
extra : rebase_source : 850b556651afade0da543e281e5fa54235969ab4
These used to be needed for linking with non-libxul builds, but are no
longer needed. The obsolete comment is fixed in a later patch.
--HG--
extra : rebase_source : 034f69b647bd64d4353e51a15e166094b7b2e638
To make it more clear what's going on, make CaretBlinkCallback protected
and reorder the public methods to put the state-changing "API" methods first.
--HG--
extra : rebase_source : fddf0ea4b9269b2d431d0b75c40f99a9140138a1
GetCaretFrameForNodeOffset only uses the nsFrameSelection and mBidiUI
from its nsCaret. For mBidiUI we can just get the pref directly whenever
we need it. By modifying GetCaretFrameForNodeOffset to take nsFrameSelection
as a parameter, we can make it static to make it clear it isn't really
related to the state of the nsCaret.
This may also fix a bug in Selection::GetPrimaryFrameForFocusNode where
things would go unexpectedly wrong if mCaret is temporarily observing
a different selection to the Selection.
--HG--
extra : rebase_source : cdd59f6e20cd1060bc5d2325cb3adb5e5c4a1d2c