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
I was inspired by the previous patch to remove FrameLayerBuilder.h from
nsDisplayList.h too.
--HG--
extra : rebase_source : b34a01bea5865da4737817e2396b98d54cc6d1bf
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
Fixes the assertion failure with text:
"###!!! ASSERTION: Wrong line container
hint: '!aForFrame || (aLineContainer == FindLineContainer(aForFrame) ||
aLineContainer->GetType() == nsGkAtoms::rubyTextContainerFrame ||
(aLineContainer->GetType() == nsGkAtoms::letterFrame &&
aLineContainer->IsFloating()))', file
/home/sgbowen/builds/mozilla-central/layout/generic/nsTextFrame.cpp, line 1259"
which occasionally appears when opening pages with ruby or when running ruby
reftests.
Updates the manifest for ruby reftests to the current expectations (adjust
assertion counts, etc.)
To account for spacing between bases or text boxes during reflow, the line
layout which manages the bases updates its inline direction coordinate based on
the preferred inline size for the corresponding text boxes. Next, the base is
reflowed at the correct inline coordinate. Each paired text box is then also
reflowed at the proper inline position determined by (1) the current position of
its corresponding base and (2) its own preferred width.
In computing intrinsic widths, accounting for spacing is less complicated. The
minimum intrinsic width is the width of the widest ruby column, and the
preferred intrinsic width is the sum of all the ruby column widths. Each ruby
column width is the maximum width of its base box and text boxes. These
individual widths are determined using GetPrefISize on the base and text boxes.
Ruby base container frames store a list of pointers to the ruby text container
frames in the segment they denote. This list of pointers is created in the ruby
frame reflow method before calling the reflow method for the ruby base
container. The list exists and is used only during reflow of the main ruby frame
and is cleared before returning from reflow.
* * *
The current reference frame is still the same as our reference frame because we set and restore it in nsFrame::BuildDisplayListForChild before this. So we need to actually compute it.
The offsetToReferenceFrame is to the reference frame for this, since we are transformed we are the reference frame, so the offset was 0,0. So the computation still produced correct results.
The offsetToReferenceFrame is to the reference frame for this, since we are transformed we are the reference frame, so the offset was 0,0. So the computation still produced correct results.