Closed
Bug 302051
Opened 19 years ago
Closed 18 years ago
Bidi: "Home" on line containing only text in reverse direction causes caret to be displayed on different line
Categories
(Core :: Layout: Text and Fonts, defect)
Core
Layout: Text and Fonts
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha1
People
(Reporter: uriber, Assigned: uriber)
References
Details
Attachments
(5 files, 1 obsolete file)
|
488 bytes,
text/html
|
Details | |
|
4.03 KB,
patch
|
Details | Diff | Splinter Review | |
|
252 bytes,
text/html
|
Details | |
|
10.11 KB,
patch
|
smontagu
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
|
10.56 KB,
patch
|
Details | Diff | Splinter Review |
This was originally described in the second part of bug 207186, comment #2. If in an RTL textbox, a line contains only LTR text, (or in an LTR textbox, a line contains only RTL text) pressing the HOME key (cmd+left-arrow on Mac) on that line causes the caret to be displayed at the beginning of the next line containing RTL (LTR) text, or, if there is no such line, at the beginning of the last line. The insertion point is actually placed at the correct position (logical start of the line), it's just the caret which is displayed in the wrong place.
| Assignee | ||
Comment 1•19 years ago
|
||
Place the caret in the first or second line of either textbox and press "Home" (cmd+left-arrow on Mac). The caret will appear at the beginning of the third line.
| Assignee | ||
Comment 2•19 years ago
|
||
This patch just removes some code which is responsible for the bug. I'm not even requesting official review on this, since I assume that code is actually useful in some situations. However, I can't say what these situations are. Simon - could you please give an example of when that code is (or was) actually useful? Thanks.
Comment 3•19 years ago
|
||
The code is designed for a case where there is some content on the line in the paragraph direction, and in that case it seems to work well. I think that the problem here is actually that nsSelection::GetFrameFromLevel() can modify the value of the aFrameOut argument on failure. Can you try moving the line *aFrameOut = foundFrame; at http://lxr.mozilla.org/seamonkey/source/layout/generic/nsSelection.cpp#2175 outside the do {} loop and see if this helps?
Summary: Bidi: "Home" on line containing only text in reverse direction causes caret to be displayed on different line → Bidi: "Home" on line containing only text in reverse direction causes caret to be displayed on different line
Comment 4•19 years ago
|
||
I'm not able to reproduce the bug with Win XP using the testcase, build 2005-07-01 05.
| Assignee | ||
Comment 5•19 years ago
|
||
Eyal: This is because of the original patch to bug 254278, which caused this bug (302051) as well as others to be not reproducable between 2004-08-04 and 2005-07-14, when the second patch for 254278 was checked in. See bug 207186 comment #54. Simon: Sorry, I got a bit busy with bug 277553. I hope to get back to this bug (and try your suggestion) soon.
Comment 6•19 years ago
|
||
(In reply to comment #3) > I think that the > problem here is actually that nsSelection::GetFrameFromLevel() can modify the > value of the aFrameOut argument on failure. That may be a problem, but it's not *the* problem, because GetFrameFromLevel() is not actually failing. It may need to be changed to make sure we don't leave the current line.
Comment 7•19 years ago
|
||
... like this, but I don't feel I know the frame traversal code well enough to be sure.
| Assignee | ||
Updated•19 years ago
|
Attachment #190430 -
Attachment is obsolete: true
Updated•19 years ago
|
Flags: blocking1.9a1?
| Assignee | ||
Comment 8•19 years ago
|
||
This testcase demonstrates a different problem with caret positioning after pressing "Home" in bidi text, but I'm posting it here rather than opening a new bug because I think it should affect the way this bug is fixed. Load the testcase in Composer, and press "Home". The caret is positioned visually between "123" and "456", instead of to the left of "123" as expected. The fault here, I think, is with the logic for finding the visually first frame on the line. The current logic is: "find the first frame whose level is the same as the paragraph level, and put the caret at the end of the frame before that". This startegy doesn't work in this case. Instead, perhaps we should use a more standard method for finding the first (last) visual frame on the line, namely nsLineIterator::CheckLineOrder(), followed by drilling down to the first/last descendant.
| Assignee | ||
Comment 9•18 years ago
|
||
This attempts to accomplish what I suggested in comment #8, by introducing a "visual" mode to the eSelect[Begin|End]Line case of PeekOffset, and using it for positioning the caret in this specific situation. Notice that MoveCaret() still always uses the logical mode. I'm not sure I really like this... Simon - comments?
Attachment #229877 -
Flags: review?(smontagu)
Comment 10•18 years ago
|
||
Comment on attachment 229877 [details] [diff] [review] patch?! >+ { > it->GetLine(thisLine, &firstFrame, &lineFrameCount, usedRect, &lineFlags); ... > } >+ } nit: clean up the indentation of this block. r=me with that.
Attachment #229877 -
Flags: review?(smontagu) → review+
| Assignee | ||
Updated•18 years ago
|
Attachment #229877 -
Flags: superreview?(roc)
Comment on attachment 229877 [details] [diff] [review] patch?! + if ((embeddingLevel & 1) && !lineIsRTL || !(embeddingLevel & 1) && lineIsRTL) How about if ((embeddingLevel & 1) == !lineIsRTL)
Attachment #229877 -
Flags: superreview?(roc) → superreview+
Comment 12•18 years ago
|
||
(In reply to comment #11) How about some in-code comments explaining what's being done and what endOfLine signifies exactly? :-(
| Assignee | ||
Comment 13•18 years ago
|
||
This is what I checked in: - Fixed indentation per comment #10 - Used roc's suggestion from comment #11 - Added a comment which hopefully clarifies the usage of endOfLine
| Assignee | ||
Comment 14•18 years ago
|
||
Checked in: Checking in layout/generic/nsFrameSelection.h; /cvsroot/mozilla/layout/generic/nsFrameSelection.h,v <-- nsFrameSelection.h new revision: 1.7; previous revision: 1.6 done Checking in layout/generic/nsFrame.cpp; /cvsroot/mozilla/layout/generic/nsFrame.cpp,v <-- nsFrame.cpp new revision: 3.661; previous revision: 3.660 done Checking in layout/generic/nsSelection.cpp; /cvsroot/mozilla/layout/generic/nsSelection.cpp,v <-- nsSelection.cpp new revision: 3.254; previous revision: 3.253 done Checking in layout/base/nsCaret.cpp; /cvsroot/mozilla/layout/base/nsCaret.cpp,v <-- nsCaret.cpp new revision: 1.162; previous revision: 1.161 done
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
| Assignee | ||
Comment 15•18 years ago
|
||
Reopening to assign to myself. Sorry for this and the following bugspam.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
| Assignee | ||
Updated•18 years ago
|
Assignee: mozilla → uriber
Status: REOPENED → NEW
| Assignee | ||
Updated•18 years ago
|
Status: NEW → RESOLVED
Closed: 18 years ago → 18 years ago
Flags: blocking1.9a1?
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9alpha
Component: Layout: BiDi Hebrew & Arabic → Layout: Text
QA Contact: zach → layout.fonts-and-text
You need to log in
before you can comment on or make changes to this bug.
Description
•