Closed
Bug 58384
Opened 24 years ago
Closed 23 years ago
letter-spacing causes walking when text is aligned
Categories
(Core :: Layout, defect, P3)
Tracking
()
RESOLVED
FIXED
mozilla0.9.5
People
(Reporter: ian, Assigned: waterson)
References
Details
(Keywords: css1, testcase, Whiteboard: [Hixie-P3])
Attachments
(3 files, 3 obsolete files)
291 bytes,
text/html
|
Details | |
1.17 KB,
text/html
|
Details | |
4.21 KB,
patch
|
attinasi
:
superreview+
|
Details | Diff | Splinter Review |
STEPS TO REPRODUCE 1. Right-align some text. 2. Set the letter-spacing to some non-zero value. 3. Resize the window. ACTUAL RESULTS Text walks left and is no longer right aligned. Reproduced on a Win2K Netscape commercial branch build.
Reporter | ||
Comment 1•24 years ago
|
||
Reporter | ||
Updated•24 years ago
|
QA Contact: petersen → ian
Comment 2•24 years ago
|
||
It works for me on Mac-MN6-2000-10-17. What build are you using?
Assignee | ||
Comment 3•23 years ago
|
||
Weird. It definitely does *not* work for me on Win32, either in mozilla or viewer.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
Assignee | ||
Updated•23 years ago
|
Target Milestone: mozilla0.9 → mozilla0.9.1
Comment 4•23 years ago
|
||
Yea, I see this too (Win2K and Linux)
Assignee | ||
Updated•23 years ago
|
Target Milestone: mozilla0.9.1 → mozilla0.9.2
Assignee | ||
Updated•23 years ago
|
Target Milestone: mozilla0.9.2 → mozilla0.9.3
Reporter | ||
Comment 6•23 years ago
|
||
See also bug 86279, which is almost certainly related.
Whiteboard: [Hixie-P3]
Assignee | ||
Updated•23 years ago
|
Target Milestone: mozilla0.9.3 → mozilla0.9.4
Assignee | ||
Updated•23 years ago
|
Target Milestone: mozilla0.9.4 → mozilla0.9.5
Assignee | ||
Comment 7•23 years ago
|
||
Assignee | ||
Comment 8•23 years ago
|
||
The problem is that we include the letter spacing implicitly in the word spacing when we set up the TextStyle struct (around nsTextFrame.cpp:577), however, we back out only the word spacing in nsTextFrame::TrimTrailingWhiteSpace(). The fix is to back out the letter spacing, as well. This should fix bug 86279, also.
Blocks: 86279
Comment 9•23 years ago
|
||
The inconsistency in using mWordSpacing is very confusing. To include TextStyle::mLetterSpacing implicitly inside TextStyle::mWordSpacing might not be a good idea. But either way, your fix is necessary. r=shanjian
Assignee | ||
Comment 10•23 years ago
|
||
Yeah, it might be easier on the brain-print to explicitly add the letter-spacing where appropriate instead of building it in to the word spacing, but I could go either way. pierre did this in r1.277 of the file to fix bug 1046: perhaps to make it through the PDT's ``smaller must be safer'' gauntlet? ;-) If we decide to leave the letter-spacing munged in with the word-spacing, we probably ought to remove some of the redundant tests that check both values to see if they're non-zero: we can simply check the word-spacing.
Assignee | ||
Comment 11•23 years ago
|
||
Comment 12•23 years ago
|
||
The spec is a little bit ambiguous. Please make sure that the results are similar to what we get with IE5 on Mac and Windows for left-aligned, right- aligned and centered text. Setting a large value for letter-spacing may help you to see the problems, if any.
Comment 13•23 years ago
|
||
I find the alternative patch nicer.
Comment 14•23 years ago
|
||
(to pierre) Because the spec is ambiguous, we are allowed to choose either way. I believe there is strong reasons to include letter-spacing inside word-spacing when doing layout. A obvious one is that if use specify a larger letter-spacing and a very small word-spacing, the space between letters inside a word might be larger than word-spacing. That is unacceptable. The problem that this bug targets is the inconsistency in such usage. (to waterson) The alternative patch does not seem to consume significant extra CPU cycles. I prefer it too. (r=shanjian)
Updated•23 years ago
|
Attachment #51028 -
Flags: review+
Comment 15•23 years ago
|
||
Shanjian: It is precisely because we are allowed to choose either way that I recommended we choose the way that is compatible with competitors. I also recommended we use a testcase that sets a relatively large value for letter-spacing because the problems, if any, will be more easily noticeable (we seem to be on an agreement here). The problems I was thinking of were not about whether we should add letter-spacing when we calculate the spacing between words (the issue was settled in bug 1046) but to a possible spurious spacing on the right-hand side of a right-aligned text with an 'ltr' direction (or the left-hand side of a left-aligned text with a 'rtl' direction) or even with centered text. I think we originally had a bug like this and I would like it to come back.
Assignee | ||
Comment 16•23 years ago
|
||
The code in TrimTrailingWhiteSpace() is what ensures we don't leave the word and letter spacing at the end of the line. I haven't tried it on left-aligned RTL text though.
Assignee | ||
Comment 17•23 years ago
|
||
Assignee | ||
Comment 18•23 years ago
|
||
Comment on attachment 51097 [details]
test case illustrating rtl & ltr text left-aligned, right-aligned, centered, justified
Boioioing! Wrong MIME type.
Attachment #51097 -
Attachment is obsolete: true
Assignee | ||
Comment 19•23 years ago
|
||
Assignee | ||
Comment 20•23 years ago
|
||
Attachment 51099 [details] illustrates three bugs, which I'll file separately.
1. Right-aligned and justified text are not flush with the right edge
of the div.
2. At certain widths, right-aligned text is incorrectly measured, and spills
over the boundary of the div. (Possibly poor accounting for a space
at the end of a line?)
3. Justified RTL text that has only a single word on a line ends up aligning
the word with the left edge of the div, not the right.
These problems exists regardless of whether the patch is applied.
Comment 21•23 years ago
|
||
Some related bugs: bug 18160 and bug 92671
Assignee | ||
Comment 22•23 years ago
|
||
Looks like bug 18160 corresponds to problem (2), above. It looks like (1) likely has to do with the letter-spacing: altering that value in the test case above shows that the space between the right edge of the div and the right edge of the text differs by the letter spacing. I've filed bug 102016 on that issue. I've filed bug 102019 on issue (3).
Assignee | ||
Comment 23•23 years ago
|
||
Assignee | ||
Updated•23 years ago
|
Attachment #51013 -
Attachment is obsolete: true
Assignee | ||
Updated•23 years ago
|
Attachment #51028 -
Attachment is obsolete: true
Updated•23 years ago
|
Attachment #51130 -
Flags: superreview+
Comment 24•23 years ago
|
||
Comment on attachment 51130 [details] [diff] [review] as above, with merge conflicts fixed after rbs's landing sr=attinasi - glad to see wh have a new TextFrame expert ;)
Assignee | ||
Comment 25•23 years ago
|
||
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•