Closed Bug 582181 Opened 14 years ago Closed 13 years ago

Incorrect rendering of directionality in mixed LTR and RTL texts

Categories

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

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: huji.huji, Assigned: smontagu)

References

Details

Attachments

(3 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6

If you have a textarea which is in RTL layout, and you put in a piece of text which is a mixture of RTL and LTR content, if the LTR content starts with specific characters (like braces, curly braces or < or >), the directionality of the character is affected by the text "before" it, not the text on the same line. This causes confusion.

Reproducible: Always

Steps to Reproduce:
1. Create a page in RTL layout nd put a textarea in it which also flows from right to left. As a shortcut, you can use Persian Wikipedia's Edit Box ( http://fa.wikipedia.org/w/index.php?title=testpage&action=edit&section=new )
2. Inside the text area, paste this sample text:

Blah blah
فلان فلان
<ref>ooo</ref>
<references />


Actual Results:  
The opening < for the REF tag and the REFERENCES tag is not shown in the desired place.


See this screenshot please: http://upload.wikimedia.org/wikipedia/test/e/ed/Rtlproblem2.png

The top two windows belong to IE and Google Chrome (latest versions), and the bottom box belongs to Firefox. You can clearly get the difference in the rendering of the text.

This bug has been present in Firefox at least since version 2.5 (IIRC), and apparently no one has bothered to report it.
Version: unspecified → 3.6 Branch
i know this was related to Bug 263359 that today fixed :)
Reporter, are you still seeing this issue with Firefox 4.0.1 or later in safe mode or a fresh profile? If not, please close. These links can help you in your testing.
http://support.mozilla.com/kb/Safe+Mode
http://support.mozilla.com/kb/Managing+profiles
Sadly, bug 263359 is backed out so this can be seen again, (in versions this was committed you couldn't find that, same "Gecko/20110413 Firefox/6.0a1")
Attached image Correct rendering
about above comment
Depends on: 263359
Version: 3.6 Branch → Trunk
(In reply to comment #3)
> Reporter, are you still seeing this issue with Firefox 4.0.1 or later in
> safe mode or a fresh profile? If not, please close. These links can help you
> in your testing.
> http://support.mozilla.com/kb/Safe+Mode
> http://support.mozilla.com/kb/Managing+profiles

Yes, the bug is still present in Firefox 4.0.1 in safe mode and using a fresh profile.
Version: Trunk → 4.0 Branch
This bug was reported using a pre-release version of Firefox 4. Now that Firefox 4.0.1 final has been released, can you please update and retest your bug? A fresh profile would be a good starting place to test, 
http://support.mozilla.com/kb/Managing+profiles. If you continue to see the issue, can you please update this bug with your results?

Filter: firefox4prebugsunco
Tested with a clean profile on Firefox 4.0.1 in Ubuntu and in Win, and the bug still persists.
OS: Windows XP → All
Can you please try it in the latest nightly now that bug 263359 is fixed?
Ehsan, I downloaded last nightly, it is generally fixed but in this testcase:
data:text/html;charset=utf-8,<textarea style="direction:rtl">فارسی%0A[[en:Farsi]]%0A</textarea>
please do a backspace in last line of textarea (remove last enter of textarea), something going wrong I thing. it is too much better from previous Firefox, but i think this little problem can be fixed also
I also see another problem. Using the original example:

Blah blah
فلان فلان
<ref>ooo</ref>
<references />

If you put the cursor at the end of the last line, hit BACKSPACE once (so the > will be removed) and then type ">" again, it will not be shown correctly.
I can reproduce both comment 10 and 11.  Simon, I think that dynamic changes somehow screw up the bidi calculations here...
Status: UNCONFIRMED → NEW
Component: General → Layout: Text
Ever confirmed: true
Product: Firefox → Core
QA Contact: general → layout.fonts-and-text
Version: 4.0 Branch → Trunk
Assignee: nobody → smontagu
Attached patch Patch (obsolete) — Splinter Review
Attachment #539146 - Flags: review?(roc)
Attached patch MochitestsSplinter Review
Attachment #539147 - Flags: review?(roc)
Comment on attachment 539146 [details] [diff] [review]
Patch

Review of attachment 539146 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/base/nsBidiPresUtils.cpp
@@ +650,5 @@
>      || !aFrame->IsFrameOfType(nsIFrame::eBidiInlineContainer);
>  }
>  
>  void
> +nsBidiPresUtils::AppendFrameAndAdvance(nsIFrame*& aFrame,

Shouldn't this be called AdvanceAndAppendFrame?

I think aFrame and aNextSibling should be nsIFrame** so that it's clear in the callers that the frame references are modified.
Comment on attachment 539147 [details] [diff] [review]
Mochitests

Review of attachment 539147 [details] [diff] [review]:
-----------------------------------------------------------------
Attachment #539147 - Flags: review?(roc) → review+
http://hg.mozilla.org/mozilla-central/rev/ec3718e17035
http://hg.mozilla.org/mozilla-central/rev/dcc03e00b32a
Status: NEW → RESOLVED
Closed: 13 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Oops, I thought you had marked this as r+ with comments, and I checked it in already. Can you r+ it retroactively (or not, and I'll back out)?
Attachment #539146 - Attachment is obsolete: true
Attachment #539803 - Flags: review?(roc)
Attachment #539146 - Flags: review?(roc)
Comment on attachment 539803 [details] [diff] [review]
Patch with comments addressed

Review of attachment 539803 [details] [diff] [review]:
-----------------------------------------------------------------
Attachment #539803 - Flags: review?(roc) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: