Closed Bug 349352 Opened 19 years ago Closed 19 years ago

Underline shifts when clicking the spacebar after an unrecognized Hebrew word on RTL textarea

Categories

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

defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla1.8.1

People

(Reporter: nir123, Assigned: smontagu)

References

Details

(Keywords: fixed1.8.1, rtl, testcase)

Attachments

(3 files, 4 obsolete files)

Grr. forgot the description :) On RTL textarea, try to write a misspelled Hebrew word and then click the spacebar. result: the red underline shifts to the the left after any spacebar clicking.
Summary: Underline shifts when click the spacebar after an unrecognized Hebrew word on RTL textarea → Underline shifts when clicking the spacebar after an unrecognized Hebrew word on RTL textarea
Flags: blocking1.8.1?
Same bug on Linux, but only with --enable-pango. Setting All | All
Assignee: mscott → nobody
Component: Spelling checker → Layout: BiDi Hebrew & Arabic
OS: Windows XP → All
QA Contact: spelling-checker → layout.bidi
Hardware: PC → All
Flags: blocking1.8.1? → blocking1.8.1+
Target Milestone: --- → mozilla1.8.1
Can you please post a testcase? I don't know hebrew at all, or any good sites. If possible, can you also post some text I can paste in with exact steps to reproduce?
Assignee: nobody → smontagu
Awesome, I would have never figured that out.
Attached file testcase (obsolete) —
the red underline should be under the word.
Keywords: testcase
Attached file testcase
I added charset=windows-1255 to this testcase.
Attachment #234747 - Attachment is obsolete: true
Attached patch Patch (obsolete) — Splinter Review
Attachment #234811 - Flags: review?(uriber)
Comment on attachment 234811 [details] [diff] [review] Patch Looks good. r=me. You might want to fix the annoying indentation problem (starting with |if (!hideStandardSelection || displaySelection)|) while you're there.
Attachment #234811 - Flags: review?(uriber) → review+
Attachment #234811 - Flags: superreview?(bzbarsky)
I'd like to see some documentation for the new args before I can reasonably sr this...
Attachment #234811 - Attachment is obsolete: true
Attachment #235197 - Flags: superreview?(bzbarsky)
Attachment #234811 - Flags: superreview?(bzbarsky)
Attached patch Same, with diff -w (obsolete) — Splinter Review
Comment on attachment 235197 [details] [diff] [review] Indentation fixed and documentation added Removing review request for now. I had an idea to simplify this and other things.
Attachment #235197 - Flags: superreview?(bzbarsky)
Comment on attachment 235197 [details] [diff] [review] Indentation fixed and documentation added re-requesting sr. I will do the simplification later after the TextFrame rewrite.
Attachment #235197 - Flags: superreview?(bzbarsky)
Attachment #235197 - Flags: review+
Comment on attachment 235197 [details] [diff] [review] Indentation fixed and documentation added >Index: layout/generic/nsTextFrame.cpp >+ * @param aSelectionIsMirrored whether the offsets of the selection have been So wouldn't it make more sense to call this aSelectionPointsReversed or even aSelectionCoordsReversed? At least those names seem to make more sense to me... If you're ok with that, make that change throught the patch? If not, catch me and let's talk about naming this stuff? I'm not familiar with standard bidi terms, so maybe "mirrored" is a technical term here? > void RenderString(nsIRenderingContext& aRenderingContext, Same here, and this probably wants a cop of the comment on PaintTextDecorations. >+ /** >+ * @return whether the selection points were mirrored And here, "reversed". > nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext, >+ * XXX In theory this should use the same logic as >+ * SELECTION_SPELLCHECK for right-to-left frames, but I don't >+ * know of any right-to-left language that uses an IME Would handling this really make the code that much more complex? If so, can we at least assert that whatever situation we're not handling is not happening? If not, can we do the right thing here? >@@ -3003,128 +3038,147 @@ nsTextFrame::PaintUnicodeText(nsPresCont >+ selectionIsMirrored = AdjustSelectionPointsForBidi(sdptr, textLength, >+ CHARTYPE_IS_RTL(charType), >+ isOddLevel, isBidiSystem); I'd prefer a linebreak after the '=' sign and more natural indenting of the arguments (lining up with the arguments right after the '(' ). >+ PRBool isSelection = iter.GetSelectionColors( >+ &currentFGColor, >+ &currentBKColor, >+ &isCurrentBKColorTransparent); How about nixing the extra spaces after the "PRBool" instead? If things still don't fit in 80 chars, please put the linebreak after the '='. By the way, check with roc before landing this reindentation? If it's going to make life hell for him, please don't do it.... >@@ -3684,35 +3741,36 @@ nsTextFrame::PaintTextSlowly(nsPresConte >+ selectionIsMirrored = AdjustSelectionPointsForBidi(sdptr, textLength, Again, linebreak after the '='.
Attached patch Simpler patchSplinter Review
I apologize for wasting reviewers' time. I was looking for a scenario where I could test IMEs, and I realized with Uri's help that the patch went through some unnecessary hoops. The condition if ((NS_GET_EMBEDDING_LEVEL(this) & 1) != aSelectionIsMirrored) is equivalent to if ((NS_GET_EMBEDDING_LEVEL(this) & 1) != (isOddLevel ^ (isRTLChars && isBidiSystem)) but (NS_GET_EMBEDDING_LEVEL(this) & 1) and (isOddLevel) are the same thing, so it reduces to just if (isRTLChars && isBidiSystem) and we already have a boolean for that, isRTLOnBidiPlatform.
Attachment #235197 - Attachment is obsolete: true
Attachment #235198 - Attachment is obsolete: true
Attachment #237956 - Flags: superreview?(bzbarsky)
Attachment #237956 - Flags: review?(uriber)
Attachment #235197 - Flags: superreview?(bzbarsky)
Comment on attachment 237956 [details] [diff] [review] Simpler patch Seems fine.
Attachment #237956 - Flags: review?(uriber) → review+
Comment on attachment 237956 [details] [diff] [review] Simpler patch >Index: layout/generic/nsTextFrame.cpp > void PaintTextDecorations(nsIRenderingContext& aRenderingContext, So... I should have caught this before, but could we make this arg NOT have a default value? Put it before aText or something? That way we can be sure we got all the callers, etc... > void RenderString(nsIRenderingContext& aRenderingContext, Same here. >@@ -2560,33 +2571,53 @@ nsTextFrame::PaintTextDecorations(nsIRen >+ * If the rendering context is drawing text from right-to-left, "from right to left" (no dashes). sr=bzbarsky with those nits.
Attachment #237956 - Flags: superreview?(bzbarsky) → superreview+
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Attached patch Branch patchSplinter Review
Requesting 1.8.1 approval. This bug makes spellchecking almost unusable for right-to-left languages. The fix is very low risk, and only changes behaviour for the underline marking for right-to-left text. (To make assurance doubly sure, when backporting to the branch I removed the code for IME selection, since it would need to be rewritten for the branch and I have no way of testing it anyway, and replaced it by an assertion as bz suggested)
Attachment #238195 - Flags: approval1.8.1?
Comment on attachment 238195 [details] [diff] [review] Branch patch a=schrep
Attachment #238195 - Flags: approval1.8.1? → approval1.8.1+
Keywords: fixed1.8.1
Attachment #234753 - Attachment mime type: text/html → text/html; charset=windows-1255
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: