Closed
Bug 734319
Opened 13 years ago
Closed 13 years ago
nsTextFrame::DrawTextRunAndDecorations should limit decoration to the offset/length given
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: heycam, Assigned: heycam)
References
Details
Attachments
(1 file)
nsTextFrame::DrawTextRunAndDecorations currently restricts any line decorations that it draws to aClipEdges but not to aOffset/aLength. I am calling into the nsTextFrame::PaintText with specific offset/lengths to paint substrings of a text frame and this is currently painting the decoration for the entire width of the frame.
Assignee | ||
Comment 1•13 years ago
|
||
Measure the substring of the text run to determine how much decoration to paint.
Attachment #604302 -
Flags: review?(dbaron)
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → cam
Status: NEW → ASSIGNED
Whiteboard: [autoland]
Assignee | ||
Updated•13 years ago
|
Whiteboard: [autoland] → [autoland-try]
Updated•13 years ago
|
Whiteboard: [autoland-try] → [autoland-in-queue]
Comment 2•13 years ago
|
||
Autoland Patchset:
Patches: 604302
Branch: mozilla-central => try
Destination: http://hg.mozilla.org/try/pushloghtml?changeset=5d90a5a2a32d
Try run started, revision 5d90a5a2a32d. To cancel or monitor the job, see: https://tbpl.mozilla.org/?tree=Try&rev=5d90a5a2a32d
Assignee | ||
Comment 3•13 years ago
|
||
Forgot to #include <limits>...
Comment on attachment 604302 [details] [diff] [review]
Limit line decorations to the given offset/length when painting a text frame.
>+ nscoord width;
>+ if (aOffset == 0 && aLength == std::numeric_limits<PRUint32>::max()) {
>+ width = GetRect().width;
Is that really the normal-case value of aLength?
(And if it is, can you just write it as PR_UINT32_MAX ?)
Assignee | ||
Comment 5•13 years ago
|
||
Comment on attachment 604302 [details] [diff] [review]
Limit line decorations to the given offset/length when painting a text frame.
(In reply to David Baron [:dbaron] from comment #4)
> Is that really the normal-case value of aLength?
Hmm, I got confused with other local changes I've got in my tree. Will check and revise.
Attachment #604302 -
Flags: review?(dbaron)
Comment 6•13 years ago
|
||
Try run for 5d90a5a2a32d is complete.
Detailed breakdown of the results available here:
https://tbpl.mozilla.org/?tree=Try&rev=5d90a5a2a32d
Results (out of 14 total builds):
success: 2
failure: 12
Builds (or logs if builds failed) available at:
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/autolanduser@mozilla.com-5d90a5a2a32d
Updated•13 years ago
|
Whiteboard: [autoland-in-queue]
Comment 7•13 years ago
|
||
Sorry for the drive-by review, but I don't think this is the right place
to do this. If aOffset/aLength is a sub-range of the frame's text then
aClipEdges is expected to clip to that range. It is the *caller's*
responsibility calculate this (if clipping text-decorations is desired).
Assignee | ||
Comment 8•13 years ago
|
||
Mats, I guess I could compute the points for aClipEdges so that it clips to the characters that I want, but I already have a content offset/length. Is it worth it to turn these into nscoords just so that they can be converted back to the offset/length pair to restrict the decoration rendering to?
Assignee | ||
Comment 9•13 years ago
|
||
Or are there currently situations where we do need to render a substring of the frame's glyphs but say all of the decoration?
Comment 10•13 years ago
|
||
> Is it worth it to turn these into nscoords just so that they can be converted
> back to the offset/length pair to restrict the decoration rendering to?
What do you mean? there's no "converting back" going on in this method.
Drawing the text use aOffset/aLength, drawing the decorations use
nscoord that comes from GetRect().width, clipped to aClipEdges.
On the contrary, the suggested patch would slow down existing callers
that already provides a correct aOffset/aLength/aClipEdges by doing a
redundant mTextRun->GetAdvanceWidth().
Currently we calculate aClipEdges *once* and then pass that around to
a bunch of helper methods that does the drawing. Calculating the clip
in each of the leaf methods would be much more expensive.
Consider for example:
PaintTextWithSelectionColors
for (PRUint32 i = textStyle->mTextShadow->Length(); i > 0; --i) {
PaintOneShadow
DrawText
DrawTextRunAndDecorations
> Or are there currently situations where we do need to render a substring of
> the frame's glyphs but say all of the decoration?
No, I don't think so.
Assignee | ||
Comment 11•13 years ago
|
||
OK, fair enough, thanks.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•