Closed
Bug 412251
Opened 18 years ago
Closed 18 years ago
Text selection background rect always contains first font height
Categories
(Core :: Layout: Text and Fonts, defect)
Core
Layout: Text and Fonts
Tracking
()
RESOLVED
FIXED
People
(Reporter: masayuki, Assigned: masayuki)
References
()
Details
(Keywords: intl, regression)
Attachments
(1 file, 3 obsolete files)
|
18.19 KB,
image/png
|
Details |
The current implementation decides the selection background rect from actual used fonts for the text. However, Gecko1.8 is not so. I think that we should always include the first font metrics for it.
In Japan, many (major) sites using following style:
font-family: "Western font", "Japanese font", sans-serif;
Because ASCII characters often used in Japanese text, but the glyphs in Japanese fonts are not beautiful. So, many web designers like the style.
And the major Western fonts have larger ascent and descent than Japanese fonts. Therefore, in many sites, we can look the ugly Japanese text selection on current trunk. (See the screenshot)
Flags: blocking1.9?
| Assignee | ||
Comment 1•18 years ago
|
||
fix.
Attachment #296932 -
Flags: superreview?(roc)
Attachment #296932 -
Flags: review?(roc)
| Assignee | ||
Comment 2•18 years ago
|
||
Oops, sorry for the spam.
Attachment #296932 -
Attachment is obsolete: true
Attachment #296933 -
Flags: superreview?(roc)
Attachment #296933 -
Flags: review?(roc)
Attachment #296932 -
Flags: superreview?(roc)
Attachment #296932 -
Flags: review?(roc)
+ gfxTextRun::Metrics minimumMetrics =
+ font->Measure(mTextRun, 0, 0, aTightBoundingBox, aContext, nsnull);
Instead of doing this, why not just get the font metrics and apply its ascent and descent manually? Using Measure does extra work and doesn't really make sense; we're only supposed to use Measure to measure parts of a textrun that actually use that font.
Why are you changing nsTextFrame::ComputeTightBounds? I understand why your change make sense for Reflow(), but ComputeTightBounds is supposed to compute a tight rectangle around the inked glyphs and the metrics for the first font shouldn't affect that.
| Assignee | ||
Comment 4•18 years ago
|
||
(In reply to comment #3)
> Why are you changing nsTextFrame::ComputeTightBounds? I understand why your
> change make sense for Reflow(), but ComputeTightBounds is supposed to compute a
> tight rectangle around the inked glyphs and the metrics for the first font
> shouldn't affect that.
Because nsIFrame comment said:
> Compute a tight bounding rectangle for the frame. This is a rectangle that encloses the pixels that are actually drawn.
Shouldn't include the ComputeTightBounds the selection background rect?
Good point, but I don't think it should include selection drawing actually. ComputeTightBounds is used by MathML layout and we don't want selection to affect the layout. So let's change the nsIFrame comment to reflect that.
| Assignee | ||
Comment 6•18 years ago
|
||
Attachment #296933 -
Attachment is obsolete: true
Attachment #297344 -
Flags: superreview?(roc)
Attachment #297344 -
Flags: review?(roc)
Attachment #296933 -
Flags: superreview?(roc)
Attachment #296933 -
Flags: review?(roc)
Why change
+ aTextMetrics.mAscent = PR_MAX(aTextMetrics.mAscent, firstFontAscent);
+ aTextMetrics.mDescent = PR_MAX(aTextMetrics.mDescent, firstFontDescent);
?
Seems to me it should be enough to a) include first-font ascent/descent in the overflow area during reflow and b) include them in the rectangle we paint when we're painting selection decoration backgrounds.
| Assignee | ||
Comment 8•18 years ago
|
||
Isn't the way enough for mouse operathion? I.e., I'm worry about mismaching between painting rect and mouse events acceptable rect. (I'm not in my home, so, I didn't check the actual behavior, sorry.)
I'm not really worried about that. If the user clicks above the text, they might miss the text frame, yes, but that can already happen. If this is a problem we can modify the nsDisplayText display item to allow a larger hit area.
| Assignee | ||
Comment 10•18 years ago
|
||
O.K. However, the way needs to checking-in the patch for bug 392785 before, but it is blocked by bug 402524 :-( I posted the patch for bug 402524, but it is not reviewed 2 months.
Attachment #297344 -
Flags: superreview?(roc)
Attachment #297344 -
Flags: review?(roc)
Flags: wanted1.9+
Flags: blocking1.9?
Flags: blocking1.9-
| Assignee | ||
Comment 11•18 years ago
|
||
fixed by bug 421353.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
| Assignee | ||
Updated•18 years ago
|
Attachment #297344 -
Attachment is obsolete: true
You need to log in
before you can comment on or make changes to this bug.
Description
•