Closed
Bug 345954
Opened 19 years ago
Closed 19 years ago
RTL alt-image-text displayed incorrectly
Categories
(Core :: Layout: Text and Fonts, defect)
Core
Layout: Text and Fonts
Tracking
()
RESOLVED
FIXED
People
(Reporter: nir123, Assigned: smontagu)
Details
(Keywords: rtl, testcase)
Attachments
(3 files)
|
258 bytes,
text/html
|
Details | |
|
8.20 KB,
patch
|
smontagu
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
|
1.12 KB,
patch
|
uriber
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060724 Minefield/3.0a1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060724 Minefield/3.0a1
On Windows, RTL alt text with punctuation is displayed incorrectly.
for details, see the upcoming testcase.
Thanks to Uri Bernstein I could figure out the whole issue.
Reproducible: Always
Comment 2•19 years ago
|
||
On Mac the problem appears worse: the entire text is laid out left-to-right, letter by letter.
Confirming, changing to All/All, and moving to BiDi.
Assignee: jdunn → nobody
Status: UNCONFIRMED → NEW
Component: Layout: Images → Layout: BiDi Hebrew & Arabic
Ever confirmed: true
OS: Windows XP → All
QA Contact: layout.images → layout.bidi
Hardware: PC → All
| Assignee | ||
Comment 3•19 years ago
|
||
On Linux (at least without pango) this is similar to what Uri describes on Mac. This is a regression, but it may be a very old one (i.e. the last time I remember testing this was several years ago)
Status: NEW → ASSIGNED
Component: Layout: BiDi Hebrew & Arabic → Layout: Images
| Assignee | ||
Updated•19 years ago
|
Component: Layout: Images → Layout: BiDi Hebrew & Arabic
| Assignee | ||
Comment 4•19 years ago
|
||
From discussion on IRC about the exact scope of the bug, it doesn't seem to be a regression. Pure right-to-left text on Windows with no punctuation displays correctly.
Taking bug.
Assignee: nobody → smontagu
Status: ASSIGNED → NEW
| Assignee | ||
Comment 5•19 years ago
|
||
Just making the text rendered correctly is fairly trivial, but there are other cans of worms that this opens:
If the image has right-to-left direction (specified or inherited) should the text be displayed with right-to-left base direction?
If the image has right-to-left direction, when the image is replaced by a place holder box with an icon in quirks mode, should the text and the icon be aligned right within the box?
In strict mode, when the image is replaced by inline text, should the text participate in continuous Bidi reordering of the line in which it appears, or should it open a Bidi embedding?
I think the answers to those questions should be "yes", "yes" and "embedding", but no specification seems to address them. I haven't yet tested strict mode in other browsers, but Safari, IE6 on Windows and Opera on Windows all completely ignore the direction in quirks mode. Gecko in strict mode treats the alt text as if it were within <span dir="rtl">, without embedding.
Comment 6•19 years ago
|
||
To summarize my opinion as I expressed it on IRC:
I agree on "yes" and "yes" for the first two questions, but (weakly) disagree with "embedding" on the third, that is, I think the text should participate in continuous Bidi reordering.
| Assignee | ||
Comment 7•19 years ago
|
||
OK, this patch handles the bidi reordering, alignment within the placeholder frame and alignment of the icon in the RTL (quirks-mode) case, and doesn't attempt to create embeddings in the standards-mode case.
- aRenderingContext.DrawRect(aPt.x, aPt.y,size,size);
+ nscoord iconXPos = (vis->mDirection == NS_STYLE_DIRECTION_RTL) ?
+ inner.XMost() - size : inner.x;
+ aRenderingContext.DrawRect(iconXPos, inner.y,size,size);
The change from aPt.x/y to inner.x/y is actually a fix for a different bug: when the icon is not available we only display the bottom right quadrant of the rectangle drawn here - the rest is outside the clip area set at the top of this hunk. The result looks like a small square with a red circle in the centre, not (what I assume was intended) a rectangle of the same dimensions as the icon, with a red circle in the bottom right corner.
Attachment #230990 -
Flags: review?(uriber)
Comment 8•19 years ago
|
||
Comment on attachment 230990 [details] [diff] [review]
patch
It took me a while to understand the red circle stuff, but I think I did eventually.
Looks good to me.
Attachment #230990 -
Flags: review?(uriber) → review+
| Assignee | ||
Comment 9•19 years ago
|
||
from IRC:
<Hixie> we should stop the bidi algorithm from "leaking" out of alt text
<Hixie> the same applies to generated content and :before, maybe
| Reporter | ||
Comment 10•19 years ago
|
||
I've just noticed that on windows the bug regressed.
On Firefox 1.5 I can see the alt text in the testcase correctly.
| Reporter | ||
Comment 11•19 years ago
|
||
(In reply to comment #10)
> I've just noticed that on windows the bug regressed.
> On Firefox 1.5 I can see the alt text in the testcase correctly.
>
On windows, It's probably cairo-related due to the regression range:
20060222 - 20060226
(I can't narrow the range)
So maybe on Mac and Linux it's a separate bug and the correct component for windows is GFX: Thebes (?)
| Assignee | ||
Comment 12•19 years ago
|
||
It's possible that Cairo (or rather Uniscribe script and font selection) causes the exact form that the bug takes on Windows trunk builds, but I still think it's fundamentally the same bug on all platforms. I will make sure to test the fix on Cairo and non-Cairo builds though.
| Assignee | ||
Comment 13•19 years ago
|
||
Attachment #231299 -
Flags: review?(uriber)
Comment 14•19 years ago
|
||
Comment on attachment 231299 [details] [diff] [review]
patch to html.css to make a bidi embedding for the alt text
If Hixie says so...
Attachment #231299 -
Flags: review?(uriber) → review+
| Assignee | ||
Updated•19 years ago
|
Attachment #230990 -
Flags: review+ → review?(bzbarsky)
| Assignee | ||
Updated•19 years ago
|
Attachment #231299 -
Flags: superreview?(bzbarsky)
| Assignee | ||
Updated•19 years ago
|
Attachment #230990 -
Flags: superreview?(bzbarsky)
Attachment #230990 -
Flags: review?(bzbarsky)
Attachment #230990 -
Flags: review+
Comment 15•19 years ago
|
||
Comment on attachment 230990 [details] [diff] [review]
patch
>Index: layout/generic/nsImageFrame.cpp
>+ nsRect dest((vis->mDirection == NS_STYLE_DIRECTION_RTL) ?
>+ inner.XMost() - size : inner.x,inner.y,size,size);
This could really use better formatting. For example, put the inner.y part on a new line, spaces after commas, maybe indent the inner.XMost() part so it's clear what it belongs with...
>Index: layout/generic/nsImageFrame.h
>+ nscoord MeasureString(const PRUnichar* aString,
Document the return value, please.
sr=bzbarsky with the nits picked.
Attachment #230990 -
Flags: superreview?(bzbarsky) → superreview+
Updated•19 years ago
|
Attachment #231299 -
Flags: superreview?(bzbarsky) → superreview+
| Assignee | ||
Comment 16•19 years ago
|
||
Fix checked in.
Status: NEW → RESOLVED
Closed: 19 years ago → 19 years ago
Resolution: --- → FIXED
Comment 17•18 years ago
|
||
Mass-assigning the new rtl keyword to RTL-related (see bug 349193).
Keywords: rtl
Component: Layout: BiDi Hebrew & Arabic → Layout: Text
QA Contact: layout.bidi → layout.fonts-and-text
You need to log in
before you can comment on or make changes to this bug.
Description
•