Closed Bug 333433 Opened 18 years ago Closed 18 years ago

Typing an RTL character on the third line (and onwards) of an LTR textarea, on a pure LTR page, causes text duplication

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: uriber, Assigned: uriber)

References

Details

(Keywords: regression, rtl, testcase)

Attachments

(2 files, 1 obsolete file)

In a LTR textarea containing LTR text, on a page which has no RTL text at all on it, typing an RTL letter on the third line (and onwards) of the textarea, causes text duplication.

I'll attach a testcase soon.

This is a regression from bug 329878 (although I don't yet understand why).
Attached file testcase
Instructions included.

I should have said that this requires the line to be the third line of wrapping text, with no linebreaks.
Keywords: testcase
I reoroduced it on Windows XP.
Please change OS and Hardware values to "All"
Thanks, Nir.
OS: MacOS X → All
Hardware: Macintosh → All
Attached patch patch (obsolete) — Splinter Review
Set the NS_FRAME_IS_BIDI flag on existing fluid continuations being "left alone" for reuse by the line breaking code. Apparently that code needs to know it's dealing with bidi stuff.

On a side note, I question the usefulness of the NS_FRAME_IS_BIDI flag, as in all cases I know of, it seems to be set for all the frames on a page which contains any RTL at all. This is why adding any RTL anywhere on the testcase would cause the bug to disappear - it would make all frames have the flag set anyway.
Assignee: nobody → uriber
Status: NEW → ASSIGNED
Attachment #217857 - Flags: superreview?(bzbarsky)
Attachment #217857 - Flags: review?(smontagu)
Attached patch patch v2Splinter Review
Actually, I should probably do this for RemoveBidiContinuation as well. Sorry for the spam.
Attachment #217857 - Attachment is obsolete: true
Attachment #217860 - Flags: superreview?(bzbarsky)
Attachment #217860 - Flags: review?(smontagu)
Attachment #217857 - Flags: superreview?(bzbarsky)
Attachment #217857 - Flags: review?(smontagu)
Comment on attachment 217860 [details] [diff] [review]
patch v2

Looks ok, but if we can get rid of this state bit, we should!
Attachment #217860 - Flags: superreview?(bzbarsky) → superreview+
Attachment #217860 - Flags: review?(smontagu) → review+
(In reply to comment #4)
> On a side note, I question the usefulness of the NS_FRAME_IS_BIDI flag, as in
> all cases I know of, it seems to be set for all the frames on a page which
> contains any RTL at all.

It shouldn't be being set on frames in an LTR-only paragraph even if other paragraphs contain RTL. Is it?
(In reply to comment #7)
> 
> It shouldn't be being set on frames in an LTR-only paragraph even if other
> paragraphs contain RTL. Is it?
> 

I double-checked, and it is. Resolve() is called on the LTR-only paragraph (should it be?), and it calls AdjustOffsetsForBidi(), which sets the flag.
> I double-checked, and it is. Resolve() is called on the LTR-only paragraph
> (should it be?)

If we don't call Resolve() we won't know whether it's an LTR-only paragraph.

> and it calls AdjustOffsetsForBidi(), which sets the flag.

That seems wrong to me. I think EnsureBidiContinuation() should be setting it.

Checked in:

Checking in layout/base/nsBidiPresUtils.cpp;
/cvsroot/mozilla/layout/base/nsBidiPresUtils.cpp,v  <--  nsBidiPresUtils.cpp
new revision: 1.76; previous revision: 1.75
done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9alpha
(In reply to comment #9)
>
> That seems wrong to me. I think EnsureBidiContinuation() should be setting it.
> 

I tracked this back to the patch on bug 74946, which added setting the flag on both branches of the |if ( (runLength > 0) && (runLength < fragmentLength) )|.
As far as I can tell, the behaviour didn't change ever since that patch was landed.
I still think it's wrong :) The bit was originally supposed to mean "this frame either is a nextBidi or has a nextBidi"[1], though it is overloaded for TextBoxFrames to mean "this frame has some RTL content". Let's continue this discussion in a new bug.

[1]http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/layout/generic/nsIFrame.h&rev=3.316&mark=213-214#211
The new bug is bug 333500
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.

Attachment

General

Creator:
Created:
Updated:
Size: