Bidirectional source text with right-to-left characters is displayed garbled

NEW
Assigned to

Status

()

defect
--
major
14 years ago
11 years ago

People

(Reporter: andreasprilopwww, Assigned: mcsmurf)

Tracking

({helpwanted, testcase})

Trunk
mozilla1.9.1
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [Waiting for tree to reopen after FFv3.0 release], URL)

Attachments

(1 attachment)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.7.3) Gecko/20040919
Build Identifier: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.7.3) Gecko/20040919

Mozilla applies the bidirectional algorithm to display the source text
resulting in garbled (messed up) source when the text contains
actual right-to-left characters such as Arabic or Hebrew.


Reproducible: Always

Steps to Reproduce:
1. Go to http://www.unics.uni-hannover.de/nhtcapri/temp/messy.html
2. View page source

Actual Results:  
The lines containing Hebrew characters are displayed garbled.


Expected Results:  
Apply the bidi algorithm only to *segments* of the source
as explained in
http://www.unicode.org/reports/tr9/#HL4

Comment 1

14 years ago
Also seen on Win98:
Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.9a1) Gecko/20060107 SeaMonkey/1.5a

<p title="&#1489;&#1497;&#1514;<"&#1488;&#1500;&#1507;</p> is displayed correctly, but line-breaking it in the source, it is shown wrong: try to line-break between '"' and'>', and it wraps like this:

<p title="&#1489;&#1497;&#1514;<
"&#1488;&#1500;&#1507;</p>

testcase:
view-source:http://www.unics.uni-hannover.de/nhtcapri/temp/messy.html
http://www.unics.uni-hannover.de/nhtcapri/temp/messy.html
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: testcase

Comment 2

14 years ago
<p title="&#1489;&#1497;&#1514;">&#1488;&#1500;&#1507;</p> wraps <p title="&#1489;&#1497;&#1514;"
>&#1488;&#1500;&#1507;</p>

As this textarea also shows problems, here latin characters used instead of RTL characters, but testcase seen only on RTL characters:
<p title="RTL">RTL</p>
<p title=""RTL
RTL<</p>
adding 
.attribute-value {unicode-bidi: embed;}
to viewSource.css would solve this.

Comment 4

14 years ago
(In reply to comment #3)
> adding 
> .attribute-value {unicode-bidi: embed;}
> to viewSource.css would solve this.

I added this line to viewsource.css in 
C:\Programme\Gemeinsame Dateien\mozilla.org\GRE\1.8_2006010700\res

reloaded the source view and it was fixed.

Bug also seen in
Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8) Gecko/20051224 Firefox/1.5
Severity: normal → major
Keywords: helpwanted
OS: Solaris → Other
Hardware: Sun → All
(Reporter)

Comment 6

14 years ago
> adding 
> .attribute-value {unicode-bidi: embed;}
> to viewSource.css would solve this.

Where is the file "viewSource.css" located under Solaris?
(For user - not admin)
(Reporter)

Comment 7

14 years ago
> adding 
> .attribute-value {unicode-bidi: embed;}
> to viewSource.css would solve this.

I found that I can add this line also to the file userContent.css
and the page source view is now okay.
Thank you!

Comment 8

14 years ago
(In reply to comment #3)
> adding 
> .attribute-value {unicode-bidi: embed;}
to viewSource.css would solve this problem in view-source of navigator.

It doesn't solve the problem in view-source of composer:
in the middle, <" is wrong, should be ">
 
<p title="&#1489;&#1497;&#1514;">&#1488;&#1500;&#1507;</p>

Should another bug filed for this?

Selection is also funny, start at end or start of line and slowly select towards other end. When the first RTL Letter is reached, selection jumps right to the last one, so all of them are selected. Going on, the first is unselected, the next etc. When the last one is unselected, they all get selected again, and selection proceeds normally in the rest of the line.

Comment 9

14 years ago
(In reply to comment #7)
> > adding 
> > .attribute-value {unicode-bidi: embed;}
> > to viewSource.css would solve this.
> 
> I found that I can add this line also to the file userContent.css

Does this also fix the problem seen in Composer?
Ctrl+E opens testcase in Composer, click on <HTML> Source in the footer, or from the View menu -> HTML Source.
(Reporter)

Comment 10

14 years ago
>> I found that I can add this line also to the file userContent.css
> 
> Does this also fix the problem seen in Composer?

No. The problem (messy/garbled source) is still present
in Composer.
Composer doesn't use any kind of styling for the source text view. If this bug is fixed, fixing bug 58730 (or its blocker, bug 47040) will automatically make the fix apply to composer.
(In reply to comment #8)
> Selection is also funny, start at end or start of line and slowly select
> towards other end. When the first RTL Letter is reached, selection jumps right
> to the last one, so all of them are selected. Going on, the first is
> unselected, the next etc. When the last one is unselected, they all get
> selected again, and selection proceeds normally in the rest of the line.

This is normal behaviour for selecting bidirectional text. See http://blogs.msdn.com/michkap/archive/2006/01/10/511194.aspx
(Assignee)

Comment 13

14 years ago
Posted patch PatchSplinter Review
Well, who can review this change then?
Comment on attachment 208500 [details] [diff] [review]
Patch

Thank you for the patch. I guess you should also patch toolkit/components/viewsource/content/viewSource.css
(Assignee)

Comment 15

14 years ago
Hm, i thought the one in toolkit/ is just a addition to the one in layout?
Sorry, my bad.
(Assignee)

Updated

13 years ago
Attachment #208500 - Flags: review?(dbaron)
(Assignee)

Updated

13 years ago
Assignee: mrbkap → smontagu
Comment on attachment 208500 [details] [diff] [review]
Patch

r=dbaron, although you probably want the same thing on a whole bunch of other things as well -- I imagine things could get pretty messy with RTL tag names, attribute values, and entity names in XML.
Attachment #208500 - Flags: review?(dbaron) → review+
(Assignee)

Updated

13 years ago
Attachment #208500 - Flags: superreview?(smontagu)
Comment on attachment 208500 [details] [diff] [review]
Patch

sorry, I'm not a super-reviewer
Attachment #208500 - Flags: superreview?(smontagu)
Assignee: smontagu → mrbkap
OS: Other → All
Version: unspecified → Trunk
Comment on attachment 208500 [details] [diff] [review]
Patch

See your previous comment 17...
Attachment #208500 - Flags: superreview?(dbaron)
Attachment #208500 - Flags: superreview?(dbaron) → superreview+
Assignee: mrbkap → nobody
Component: ViewSource → View Source
Product: Mozilla Application Suite → Firefox
QA Contact: doronr → view.source
Whiteboard: [Waiting for tree to reopen after FFv3.0 release]
Target Milestone: --- → Firefox 3.1
Assignee: nobody → bugzilla
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.