Closed Bug 394109 Opened 17 years ago Closed 17 years ago

Inconsistent text-decoration positioning

Categories

(Core :: Layout: Text and Fonts, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: roc, Assigned: masayuki)

References

Details

(Keywords: regression, testcase)

Attachments

(1 file, 1 obsolete file)

The testcases in bug 365336 no longer work correctly.
I don't know when this broke, but I think it was quite recently.
nsTextFrameThebes rounds |y + ascent| in |GetSnappedBaselineY|.

but nsCSSRenering does:

4440   gfxFloat y = NS_round(aPt.y + aAscent - offset);

Should we change it to |NS_round(aPt.y + aAscent) - NS_round(offset)|?
Related to bug 392425?
> Should we change it to |NS_round(aPt.y + aAscent) - NS_round(offset)|?

Yeah, I think so. Does that fix things?
I'm not in my home, I'll create the patch tonight or tomorrow.
Attached patch Patch rv1.0 (obsolete) — Splinter Review
right, this can fix.
Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Attachment #278994 - Flags: superreview?(roc)
Attachment #278994 - Flags: review?(roc)
The patch has gfx part. gfxRect::Round is called from nsTextFrameThebes, for snapping to dev units. But the rounding is wrong if the values are negative.
+    textRect.y = presContext->RoundAppUnitsToNearestDevPixels(textRect.y);

What's this for in nsTextBoxFrame? If we need to do something here, we should probably be computing the baseline (y + ascent), rounding it, and then recomputing y by subtracting the ascent.

 nsTextFrame::PaintTextDecorations(gfxContext* aCtx, const gfxRect& aDirtyRect,
                                   const gfxPoint& aFramePt,
+                                  const gfxPoint& aTextBaselinePt,
                                   nsTextPaintStyle& aTextPaintStyle,

Why not just take aTextBaselinePt only?
Attached patch Patch rv1.1Splinter Review
I changed only nsTextBoxFrame.

I think that I should not remove the |const gfxPoint& aFramePt| in nsTextFrameThebes. Because it needs x point of frame rect for drawing, but if it is removed, for RTL case, we need to recalculate the x point from baselinePt.
Attachment #278994 - Attachment is obsolete: true
Attachment #279063 - Flags: superreview?(roc)
Attachment #279063 - Flags: review?(roc)
Attachment #278994 - Flags: superreview?(roc)
Attachment #278994 - Flags: review?(roc)
Attachment #279063 - Flags: superreview?(roc)
Attachment #279063 - Flags: superreview+
Attachment #279063 - Flags: review?(roc)
Attachment #279063 - Flags: review+
Attachment #279063 - Flags: approval1.9?
Attachment #279063 - Flags: approval1.9? → approval1.9+
checked-in.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Flags: blocking1.9?
OS: Mac OS X → All
Hardware: PC → All
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: