Closed
Bug 162081
Opened 23 years ago
Closed 20 years ago
Wrong letter is underlined as accesskey / mnemonic when widget direction is RTL
Categories
(Core :: Layout: Text and Fonts, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: tsahi_75, Assigned: smontagu)
References
(Blocks 1 open bug)
Details
(Keywords: helpwanted, intl, rtl)
Attachments
(12 files, 9 obsolete files)
|
947 bytes,
application/vnd.mozilla.xul+xml
|
Details | |
|
982 bytes,
application/vnd.mozilla.xul+xml
|
Details | |
|
7.06 KB,
image/png
|
Details | |
|
982 bytes,
application/vnd.mozilla.xul+xml
|
Details | |
|
1.77 KB,
image/png
|
Details | |
|
1.40 KB,
patch
|
Details | Diff | Splinter Review | |
|
1.64 KB,
application/vnd.mozilla.xul+xml
|
Details | |
|
1.64 KB,
application/vnd.mozilla.xul+xml
|
Details | |
|
37.91 KB,
image/png
|
Details | |
|
3.03 KB,
image/png
|
Details | |
|
19.05 KB,
image/png
|
Details | |
|
17.43 KB,
patch
|
asa
:
approval-aviary-
|
Details | Diff | Splinter Review |
Description: when the interface is aligned to the right, e.g. when using a RTL
language (like hebrew or arabic), the wrong letter in menues, buttons etc. is
underlined instead of the the real access key. e.g. if F is the access key for
File, then e is underlined. this happens only with an RTL language (i tested it
on hebrew), and it looks like Mozilla is counting the letters starting from the
left in order to find the letter to be underlined, instead of from the beginning
of the string.
Steps to reproduce:
1. aligning the interface to the right: add these lines to the file intl.css, in
the locale\en-US\global, in the en-US.jar file (the language pack file, in the
chrome folder):
window,dialog,wizard,page {
direction: rtl;
}
menu { direction: rtl; }
outliner { direction: rtl; }
2. localize a menu item, like the word "File" in the main navigator menu (you
will probably need a hebrew/arabic/other RTL enabled OS for that). this item is
in locale/en-US/communicator/utilityOverlay.dtd.
3. start mozilla
4. look at localized UI element
Actual Results: underlined letter is at the opposite side of the string to the
access key.
Expected results: well, the access key should be underlined of course.
Comment 1•23 years ago
|
||
Comment 2•23 years ago
|
||
WORKSFORME Mozilla 2002081508, Classic Theme, Windows 98
Comment 3•23 years ago
|
||
> XP Toolkit/Widgets: Menus
Component: BiDi Hebrew & Arabic → XP Toolkit/Widgets: Menus
Comment 4•23 years ago
|
||
> XP Toolkit/Widgets: Menus
Assignee: mkaply → hyatt
QA Contact: zach → shrir
The code that finds the accesskey is here.
http://lxr.mozilla.org/mozilla/source/layout/xul/base/src/nsTextBoxFrame.cpp#759
So we probably need to do different searches depending on what the direction is.
So something like:
PRBool found;
if (!AlwaysAppendAccessKey()) {
if Direction == LTR then
found = FindInReadable;
else
found = RFindInReadable;
if (!found)
if Direction == LTR then
found = FindInReadable(caseinsensitive);
else
found = RFindInReadable(caseinsensitive);
} else {
if Direction == LTR then
found = RFindInReadable(caseinsensitive);
else
found = FindInReadable(caseinsensitive);
}
The last chunk there, where AlwaysAppendAccessKey is true, raises the point that
nsTextBoxFrame::UpdateAccessTitle() doesn't respect RTL direction when appending
the accesskey, it always throws it at the end. Should it put it at the start if
RTL?
| Reporter | ||
Comment 7•23 years ago
|
||
per comment 2, it works if you use english, but if you use the hebrew word for
"File", and make it's first letter the access key, you would still have the
left-most letter underlined, although in hebrew (and arabic etc.) the first
letter is the right-most letter. i can't put a screenshot now, but maybe tomorrow.
| Reporter | ||
Comment 8•23 years ago
|
||
this is the testcase Daniel attached, only localised to hebrew. you can see how
the left-most letter is underlined, although the right-most letter is the
accesskey.
if you want to view the code of this testcase, be sure to use a viewer that
supports RTL.
| Reporter | ||
Comment 9•22 years ago
|
||
any work done here? this is a major issue for RTL localizers, and been lying
around for too long.
Comment 10•22 years ago
|
||
I've tested this bug under WinXP with 1.1 he-IL (20020826) and the problem
seems more severe than the summary suggests. As long as Hebrew input is used,
mnemonics are completely broken. The fact that they are also misaligned is
indeed a major problem, but is secondary.
I suggest to change the summary of this bug accordingly.
Prog.
| Reporter | ||
Comment 11•22 years ago
|
||
i think there's no point to fix the hebrew input problem before we get the
correct access key underlined. you can open a seperate bug for it, depending on
this one (or have this one depend on the new one).
Comment 12•21 years ago
|
||
This bug in all OS, please change the OS box
Comment 13•21 years ago
|
||
Ahmad, can you verify this on operating systems other than Windows?
Prog.
| Reporter | ||
Comment 14•21 years ago
|
||
see screenshots from debian linux at
http://www.mozilla.org.il/board/viewtopic.php?t=481. mac doesn't have any
accesskeys.
since i reported this, i changed to WinXP, and i get it there too. changing.
OS: Windows 98 → All
Comment 15•21 years ago
|
||
Yes , I am using Linux and I have this problem
Comment 17•21 years ago
|
||
question: do hebrew/arabic mnemonic work in Mozilla? I mean, even if
Tsadik-Sofit is marked as the mnemonic, does alt+Kuf opens the File menu?
another one: do we have the same problem for other widgets (buttons, links. etc.)?
Keywords: helpwanted,
intl
QA Contact: shrir → xslf
Summary: wrong letter is underlined as accesskey when UI is aligned to the right → wrong letter is underlined as accesskey / mnemonic when UI is aligned to the right
Comment 18•21 years ago
|
||
In answer to my first question: they do.
Comment 19•21 years ago
|
||
First of all, not as I said in my last comment, i see some problems using the
mnemonics, sometimes - at least when i test the localized testcase. When a menu
is opened, the mnemonics (for the opened menu of course) work fine, but: the
top level mnemonics haven't worked-for-me in the suite, but they did work in
firefox, maybe there is a problem in the testcase...
The attached patch fixes the mnemonic placement for RTL text rects (which is
the only case that is going to be tested...). It doesn't fix cases where you
have LTR gui in a RTL langauge (see XXX: comment).
Assignee: nobody → bugs.mano
Status: NEW → ASSIGNED
Updated•21 years ago
|
Attachment #154896 -
Flags: review?(mkaply)
Comment 20•21 years ago
|
||
(...and i checked, and there is no problem with not-first-letter mnemonic
:-)...)
Attachment #95799 -
Attachment is obsolete: true
Attachment #120970 -
Attachment is obsolete: true
Updated•21 years ago
|
Attachment #154896 -
Flags: superreview?(roc)
Updated•21 years ago
|
Component: XP Toolkit/Widgets: Menus → Layout: BiDi Hebrew & Arabic
Summary: wrong letter is underlined as accesskey / mnemonic when UI is aligned to the right → Wrong letter is underlined as accesskey / mnemonic when widget direction is RTL
| Reporter | ||
Comment 21•21 years ago
|
||
(In reply to comment #17)
> question: do hebrew/arabic mnemonic work in Mozilla? I mean, even if
> Tsadik-Sofit is marked as the mnemonic, does alt+Kuf opens the File menu?
>
to put things strait, if Kuf is maked in the XUL code as the access key, it will
open the Kovets menu, even if the actual letter underlined is the Tsadik, due to
this bug.
> another one: do we have the same problem for other widgets (buttons, links. etc.)?
it happenes on buttons too. by links, do you mean links in the content area (web
pages)?
(In reply to comment #20)
> (...and i checked, and there is no problem with not-first-letter mnemonic
> :-)...)
are you sure about this? from what i've seen, the underline is simply counted
from the left, regardless of the direction. if the second letter is the access
key, then the second letter from the left is underlined, even if the word starts
at the right (as it is the case in RTL).
i'll upload a testcase in a minute.
| Reporter | ||
Comment 22•21 years ago
|
||
this test case shows that even when the access key is not the first letter, the
problem persists. the access key for the first menu is Vav, the second letter.
however, the underlined letter is the Beit, which is second from left. the line
itself is narrow, to accomodate the thin Vav.
Comment 23•21 years ago
|
||
Comment 24•21 years ago
|
||
(In reply to comment #21)
> (In reply to comment #17)
> > question: do hebrew/arabic mnemonic work in Mozilla? I mean, even if
> > Tsadik-Sofit is marked as the mnemonic, does alt+Kuf opens the File menu?
> >
>
> to put things strait, if Kuf is maked in the XUL code as the access key, it will
> open the Kovets menu, even if the actual letter underlined is the Tsadik, due to
> this bug.
Anyway, i didn't change the reg. code of the accesskeys. If there is a problem
(And for me: there is, at least with the testcase), we'll file another bug...
> > another one: do we have the same problem for other widgets (buttons, links.
etc.)?
>
> it happenes on buttons too. by links, do you mean links in the content area (web
> pages)?
>
Yep
> (In reply to comment #20)
> > (...and i checked, and there is no problem with not-first-letter mnemonic
> > :-)...)
>
> are you sure about this? from what i've seen, the underline is simply counted
> from the left, regardless of the direction. if the second letter is the access
> key, then the second letter from the left is underlined, even if the word starts
> at the right (as it is the case in RTL).
>
> i'll upload a testcase in a minute.
I meant *after* patching (see last screenshot)
| Reporter | ||
Comment 25•21 years ago
|
||
(In reply to comment #24)
> (In reply to comment #21)
> >
> > it happenes on buttons too. by links, do you mean links in the content area (web
> > pages)?
> >
>
> Yep
>
well, accesskeys in web pages are not underlined by default, unless you
explicitly use the <u> tag, so it's not a problem there.
| Assignee | ||
Comment 26•21 years ago
|
||
(In reply to comment #19)
> First of all, not as I said in my last comment, i see some problems using the
> mnemonics, sometimes - at least when i test the localized testcase. When a menu
> is opened, the mnemonics (for the opened menu of course) work fine, but: the
> top level mnemonics haven't worked-for-me in the suite, but they did work in
> firefox, maybe there is a problem in the testcase...
You might have been seeing bug 177508 some of the time...
> The attached patch fixes the mnemonic placement for RTL text rects (which is
> the only case that is going to be tested...). It doesn't fix cases where you
> have LTR gui in a RTL langauge (see XXX: comment).
Does RTL gui in a LTR language work correctly? This is important because the
Hebrew localization has menu items in English (Chatzilla, DOM Inspector, etc.)
Comment 27•21 years ago
|
||
Good point Simon....
I shoould also check if we deal with a BiDi char (the accesskey)... Do we have
any method for checking this in bidiutils? or should I check the unicode values?
Updated•21 years ago
|
Attachment #154896 -
Flags: superreview?(roc)
Attachment #154896 -
Flags: review?(mkaply)
Comment 28•21 years ago
|
||
This macro?
http://lxr.mozilla.org/seamonkey/source/content/shared/public/nsBidiUtils.h#209
Expect a patch tonight :-)
Comment 29•21 years ago
|
||
In my las(In reply to comment #28)
I meant thos 4 macros:
http://lxr.mozilla.org/seamonkey/source/content/shared/public/nsBidiUtils.h#217
Comment 30•21 years ago
|
||
This fixes rtl accesskeys for the following cases:
* RTL l10n in RTL GUI
* LTR l10n in RTL GUI
* RTL l10n in LTR GUI
..and in a better way (we already store if-frame-is-bidi).
Updated•21 years ago
|
Attachment #154896 -
Attachment is obsolete: true
Updated•21 years ago
|
Attachment #154950 -
Flags: superreview?(roc)
Attachment #154950 -
Flags: review?(smontagu)
Comment 31•21 years ago
|
||
| Assignee | ||
Comment 32•21 years ago
|
||
Comment on attachment 154950 [details] [diff] [review]
workaround
This is still only going to work for text in a single direction. Tsahi, do you
think we can assume that individual menu item labels will always be either RTL
or LTR but never mixed[1]? If not, we will need a Bidi-aware version of
nsTextBoxFrame::CalculateUnderline(); if so, that would be overkill and I think
this will be the best solution.
[1] One obvious case where we get mixed-directional text is where the access
key is not localized and we get something like
(F) קובץ
but an isolated LTR character doesn't break this patch.
Comment 33•21 years ago
|
||
(In reply to comment #32)
> Tsahi, do you think we can assume that individual menu item labels will
> always be either RTL or LTR but never mixed[1]?
to put things strait, even if it we have something like "חלון Window קטן", and
the mnemonic will be "ל" for example, it will still work, it should also work
for "ק" , "ט" or "ן" , the problematic case is likely to be mixed-direction
string with a LTR mnemonic (only when it is *exist* in the string).
| Reporter | ||
Comment 34•21 years ago
|
||
we have mixed direction text in file > new > Navigator Window/Navigator
Tab/Composer Page. i left Navigator and Composer in english, because they are
component names that don't have much meaning in english too, in the sense that
they are like brand names. i did translate Address Book and Mail & Newsgroups.
the current access keys for them are english - e.g. P for Composer. i suppose i
could choose hebrew access keys for them to workaroud this problem. are there
any rules on how to select access keys? i think it would be easier to remember
the N in Navigator than the Lamed in Halon.
Comment 35•21 years ago
|
||
Correct me if i'm wrong, the strings yoyu mentioned are not mixed with two
directions (you don't have any bidi charcter there).
we mean smoething like "חלון Composer חדש". "Composer" itself (even if the box
is RTLed) is not broken.
| Reporter | ||
Comment 36•21 years ago
|
||
the string is "חלון Navigator" or "דף Composer", if that's mixed enough for you.
please stick to unicode when writing hebrew here. we started with it, and i hate
swiching encodings all the time.
Comment 37•21 years ago
|
||
You won't have a problem with "[hebrew]+ [english]+", because you are still
counting only in one direction... the problem can come for strings like
"[hebrew]+ [english]+ [hebrew]+" where the accesskey is on "[english]+"
As far as i know, we don't have any string in this form.
| Assignee | ||
Comment 38•21 years ago
|
||
This sacrifices elegance for performance: the logical place to do this would be
in nsTextBoxFrame::CalculateUnderline() but that would mean duplicating all the
calls to the Bidi engine. It would also be cleaner to pass mAccessKeyInfo
instead of individual members, but the class isn't defined in any public
header, and I'm not sure if there is an appropriate one to move it into.
| Assignee | ||
Updated•21 years ago
|
Attachment #154950 -
Attachment is obsolete: true
| Assignee | ||
Comment 39•21 years ago
|
||
Attachment #154954 -
Attachment is obsolete: true
| Assignee | ||
Comment 40•21 years ago
|
||
Updated•21 years ago
|
Attachment #154950 -
Flags: superreview?(roc)
Attachment #154950 -
Flags: review?(smontagu)
| Assignee | ||
Comment 41•21 years ago
|
||
(In reply to comment #37)
> You won't have a problem with "[hebrew]+ [english]+", because you are still
> counting only in one direction...
I don't think this is correct. In the case of "חלון Navigator", with access key
"N", the accesskeyIndex will be 5, but the N is visually at the far left if
direction is rtl. I've included this case in the "חדש" submenu in the rightmost
menu in attachment 155036 [details].
| Assignee | ||
Comment 42•21 years ago
|
||
Comment on attachment 155034 [details] [diff] [review]
Patch for multi-directional texts
My debug tree is a little out of date. I'll request reviews as soon as I'm sure
that the whole tree builds OK with this patch.
Comment 43•21 years ago
|
||
(In reply to comment #42)
> (From update of attachment 155034 [details] [diff] [review])
> My debug tree is a little out of date. I'll request reviews as soon as I'm sure
> that the whole tree builds OK with this patch.
>
I have up-to-dat tree... I will check it soon...
Comment 44•21 years ago
|
||
Comment on attachment 155034 [details] [diff] [review]
Patch for multi-directional texts
No hunks on patching:
patching file layout/base/public/nsBidiPresUtils.h
patching file layout/base/src/nsBidiPresUtils.cpp
patching file layout/html/base/src/nsPageFrame.cpp
patching file layout/xul/base/src/nsTextBoxFrame.cpp
patching file layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
Comment 45•21 years ago
|
||
I'm afraid to say, but the patch doesn't work for me. The status is just like it
was before patching, maybae you patched another file(s) and missed him on "diffing"?
| Assignee | ||
Comment 46•21 years ago
|
||
The patch works for me on a clean tree. Maybe there was a problem with your build?
Comment 47•21 years ago
|
||
Well, on My WinXP Box, i "make"ed with a clean build, on both "mozilla/layout" and even just "mozilla/"
In both cases, no change :-/
| Assignee | ||
Comment 48•21 years ago
|
||
Thanks to bz for this screenshot. More investigation is needed.
| Assignee | ||
Comment 49•21 years ago
|
||
Updated•21 years ago
|
Assignee: bugs.mano → smontagu
Status: ASSIGNED → NEW
| Reporter | ||
Comment 50•21 years ago
|
||
what's up with this bug? we will need this to create good looking official
localized builds, starting Firefox 1.0.
| Assignee | ||
Comment 51•21 years ago
|
||
(In reply to comment #50)
> what's up with this bug? we will need this to create good looking official
> localized builds, starting Firefox 1.0.
We need help from someone with a debug build on a system where the patch doesn't
work.
Comment 52•21 years ago
|
||
(In reply to comment #51)
> We need help from someone with a debug build on a system where the patch doesn't
> work.
...building now.
Comment 53•21 years ago
|
||
I dunno what was the problem in previous attempts.
Comment 54•21 years ago
|
||
Looks like the problem might be linux-only.
Comment 55•21 years ago
|
||
Comment on attachment 154950 [details] [diff] [review]
workaround
if this one does work as expected on linux, we may want it as a workaround for
ff/tb 1.0.
Attachment #154950 -
Attachment description: better patch → workaround
Updated•21 years ago
|
Attachment #154950 -
Attachment is obsolete: false
Comment 56•21 years ago
|
||
Indeed broken on X (exactly the same problem as in the screenshot).
The only point to blame is nsBidiPresUtils::RenderText calling
aRenderingContext.GetWidth, since this eventually goes to per-platform Gfx code.
The Gtk gfx code returns oversized font metrics, it seems.
It gets even more complicated, since Gtk's has different font metrics
implementations: core X, Xft and Pango. Go figure which one works well and which
one we need to fix.
Comment 57•21 years ago
|
||
gfx/gtk isn't broken. The bug was in the patch. In the RTL case, gfx/gtk was
receiving a "left" string with incorrect width, and starting on the incorrect
start offset. No wonder it miscalculated the width; it was calculating the width
of a NUL terminator!
The fix:
if (level & 1) {
aRenderingContext.GetWidth(aText + start,
(subRunLength - (aAccessKeyIndex - start + 1)),
subWidth, nsnull);
}
Explanation:
1st argument: aText is in visual order, so we shall begin the string from the
start (e.g. <*start*><TZADI><BET><VAV><KUF> -- where <KUF> is the mnemonic).
2nd argument: aAccessKeyIndex is a logical position within the entire string;
1. We subtract the start of our run from it (aAccessKeyIndex - start)
2. We add +1 to it, since aAccessKeyIndex is zero-based.
3. We subtract the resulting logical position from the start of the run, from
the run's length, to get the visual position within the run.
ie. <TZADI><BET><VAV><*end*><KUF>
Result:
We get the metrics for [<TZADI><BET><VAV>]<KUF>.
Comment 58•21 years ago
|
||
Few more comments about the RenderText function:
1. I wrote that "aText is in visual order". Well, it's passed in logical order
(the function's documentation could as well say so), but the function has a
side-effect of log2vis-ing the string its passed *for input*. We should either
not have this (non-trivial) side-effect, or document it.
2. The two arguments (related to mnemonics) you've added seem a bit ad-hoc here.
Aren't we better off adding something more generic to such a function?
Resolving of logical positions is not a "natural" use of a RenderText function
either, but for sake of optimization (since we do BiDi at this point anyway), we
can offer this functionality in this function.
I propose something like (very similar to the addition parameters to fribidi's
log2vis function):
struct nsBidiPositionResolve
{
// [in] Logical position within string
PRInt32 logicalPosition;
// [out] Visual position within string
PRInt32 visualPosition;
// [out] Visual metric in twips
PRInt32 visualMetricTwips;
};
/*
* @param aPosResolve array of logical positions to resolve into visual
positions; can be nsnull if this functionality is not required
* @param aPosResolveCount number of items in the aPosResolve array
*/
nsresult RenderText(PRUnichar* aText,
PRInt32 aLength,
nsBidiDirection aBaseDirection,
nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
nscoord aX,
nscoord aY,
nsBidiPositionResolve* aPosResolve,
PRInt32 aPosResolveCount);
Comment 59•21 years ago
|
||
This patch implements 3 changes on top of smontagu's work:
1. A more generic form of RenderText (as I've described in my previous
comment). Resolves an arbitrary number of logical indexes into visual indexes +
left width metric.
2. A minor change in the length passed to GetWidth.
3. RenderText no longer has side-effect on the aText. This forces me to keep a
copy of each run, so I hope it won't affect performance considerably.
Attachment #155034 -
Attachment is obsolete: true
| Assignee | ||
Comment 60•21 years ago
|
||
(In reply to comment #59)
> 3. RenderText no longer has side-effect on the aText. This forces me to keep a
> copy of each run, so I hope it won't affect performance considerably.
Currently nsTextBoxFrame creates a temporary copy |buffer| to pass to RenderText
to avoid the side effect. You could eliminate that.
Other than that I like the patch, and I can confirm that it works correctly on
Win32.
| Assignee | ||
Updated•21 years ago
|
Attachment #162316 -
Flags: superreview?(bzbarsky)
Attachment #162316 -
Flags: review?(bzbarsky)
| Assignee | ||
Comment 61•21 years ago
|
||
Comment on attachment 162316 [details] [diff] [review]
Patch (for both reordering and non-reordering gfx-s)
>Index: xul/base/src/nsTextBoxFrame.cpp
>+ posResolve.logicalIndex = mAccessKeyInfo->mAccesskeyIndex;
I'm crashing on this line when entering hebrew in the URI bar. You probably
need to null-check mAccessKeyInfo.
Comment 62•21 years ago
|
||
Changes from previous patch:
1. Don't keep unnecessary copy, since RenderText no longer modifies the input
string.
2. Check for null mAccessKeyInfo
Attachment #162316 -
Attachment is obsolete: true
Updated•21 years ago
|
Attachment #162925 -
Flags: superreview?(bzbarsky)
Attachment #162925 -
Flags: review?(bzbarsky)
Comment 63•21 years ago
|
||
It's quite likely I'll need someone on irc to talk me through this patch in
order to review it properly... I don't really know this code, and more
importantly don't really know what it does. In any case, I'm not going to be
able to look until at least tuesday.
Updated•20 years ago
|
Attachment #162316 -
Flags: superreview?(bzbarsky)
Attachment #162316 -
Flags: review?(bzbarsky)
Comment 64•20 years ago
|
||
Comment on attachment 162925 [details] [diff] [review]
Patch with smontagu's comment #60 and #61
>Index: base/public/nsBidiPresUtils.h
>+ nsresult RenderText(const PRUnichar* aText,
Check whether there are other callers who no longer have to allocate and fix
them?
>Index: base/src/nsBidiPresUtils.cpp
>+ for(int nPosResolve=0; nPosResolve<aPosResolveCount; ++nPosResolve)
Space around the '<' please.
>-
>+
Don't make random whitespace changes?
>+ * If aAccessKeyLeftWidth is not null, we return the width
of the string
....
Remove this comment, as discussed.
>+ /*
>+ * If this run is only one character long, the width is the x-coord
What width? You mean the visual position? May be better to call it that.
>+ /*
>+ * Otherwise, we need to calculate the width of the part of the run to
>+ * the left of the mnemnonic.
"visually to the left of the character whose logical position is
posResolve->logicalIndex" perhaps?
If the run is right-to-left, this will be
>+ * the substring from the character after the mnemonic up to the end of
"the width of the substring from the character after ..."
>+ * the run; if it is left-to-right it will be the substring from the
Again, "the width of the substring".
>+ * start of the run up to the character before the mnemonic.
Again, we don't really have a mnemonic in sight.... Rephrase the comment
accordingly?
>+ aRenderingContext.GetWidth(aText + posResolve->logicalIndex + 1,
>+ start + subRunLength - (posResolve->logicalIndex + 1),
I think the second arg would be clearer as |posResolve->visualIndex -
visualStart|.
>+ posResolve->logicalIndex - start,
Same here. That makes it clearer that we really are looking at the same thing
in both cases...
For that matter, it may be a good idea to put the first arg of the GetWidth()
call in a suitably named local in each branch of that if, and only make one
GetWidth() call. It would help in two ways: probably smaller code, and more
clarity as to what this magic "aText + posResolve->logicalIndex + 1" quantity
is (the logical start of the string we're measuring).
>Index: xul/base/src/nsTextBoxFrame.cpp
>+ mAccessKeyInfo->mBeforeWidth = posResolve.visualLeftTwips;
Given this, the code in nsTextBoxFrame::CalculateUnderline is somewhat
redundant. Can part of it be skipped for the case when this code calculates an
mBeforeWidth?
Comment 65•20 years ago
|
||
Implements suggestions by comment #62.
I didn't find any more places where the string passed to RenderText is
duplicated to avoid the "side effect" which RenderText used to have. I only
changed all functions which used RenderText to pass a const PRUnichar*, since
the function now accepts a const string.
Attachment #162925 -
Attachment is obsolete: true
Updated•20 years ago
|
Attachment #163634 -
Flags: superreview?(bzbarsky)
Attachment #163634 -
Flags: review?(bzbarsky)
Updated•20 years ago
|
Attachment #162925 -
Flags: superreview?(bzbarsky)
Attachment #162925 -
Flags: review?(bzbarsky)
Comment 66•20 years ago
|
||
Comment on attachment 163634 [details] [diff] [review]
Patch with bzbarsky's comment #62
>Index: base/src/nsBidiPresUtils.cpp
>+ nscoord subWidth;
>+ if (level & 1) {
...
>+ // The delta between the end of the run and the left part's beginning.
>+ PRInt32 visualLeftLength = posResolve->visualIndex - visualStart;
>+ aRenderingContext.GetWidth(visualLeftPart,
>+ visualLeftLength,
>+ subWidth, nsnull);
>+ }
>+ else {
....
>+ // The delta between the start of the run and the left part's end.
>+ PRInt32 visualLeftLength = posResolve->visualIndex - visualStart;
>+ aRenderingContext.GetWidth(visualLeftPart,
>+ visualLeftLength,
>+ subWidth, nsnull);
>+ }
The point was that the visuaLeftLength setting and the GetWidth() call are now
identical between the two branches and can be hoisted out of the if/else
entirely. So you set the visualIndex and visualLeftPart differently (declare
before the if, set in the two branches), then use them.
>Index: xul/base/src/nsTextBoxFrame.cpp
>+ nsBidiDirection direction =
>+ (NS_STYLE_DIRECTION_RTL ==
No need for the linebreak after the '=' sign, methinks. If the line is too
long, you need to outdent more on the line following the equals....
>+ aRenderingContext.GetWidth(mCroppedTitle.get(), mAccessKeyInfo->mAccesskeyIndex,
>+ mAccessKeyInfo->mBeforeWidth);
Fix the indent here.
r+sr=bzbarsky with those changes.
Attachment #163634 -
Flags: superreview?(bzbarsky)
Attachment #163634 -
Flags: superreview+
Attachment #163634 -
Flags: review?(bzbarsky)
Attachment #163634 -
Flags: review+
Comment 67•20 years ago
|
||
Attachment #163634 -
Attachment is obsolete: true
Comment 68•20 years ago
|
||
Attachment #163812 -
Attachment is obsolete: true
Comment 69•20 years ago
|
||
Comment on attachment 163816 [details] [diff] [review]
Better patch with bzbarsky's comment #66
Checking in base/public/nsBidiPresUtils.h;
/cvsroot/mozilla/layout/base/public/nsBidiPresUtils.h,v <-- nsBidiPresUtils.h
new revision: 1.15; previous revision: 1.14
done
Checking in base/src/nsBidiPresUtils.cpp;
/cvsroot/mozilla/layout/base/src/nsBidiPresUtils.cpp,v <--
nsBidiPresUtils.cpp
new revision: 1.56; previous revision: 1.55
done
Checking in html/base/src/nsPageFrame.cpp;
/cvsroot/mozilla/layout/html/base/src/nsPageFrame.cpp,v <-- nsPageFrame.cpp
new revision: 3.141; previous revision: 3.140
done
Checking in xul/base/src/nsTextBoxFrame.cpp;
/cvsroot/mozilla/layout/xul/base/src/nsTextBoxFrame.cpp,v <--
nsTextBoxFrame.c
pp
new revision: 1.76; previous revision: 1.75
done
Checking in xul/base/src/tree/src/nsTreeBodyFrame.cpp;
/cvsroot/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp,v <--
nsTree
BodyFrame.cpp
new revision: 1.234; previous revision: 1.233
done
Comment 70•20 years ago
|
||
Forgive me if this is a stupid question (I'm not a developer), but is it
possible to apply this patch to the aviary1.0 branch? It seems like this would
be a major usability enhancement.
Comment 71•20 years ago
|
||
Comment on attachment 163816 [details] [diff] [review]
Better patch with bzbarsky's comment #66
Judging from the he-IL nightly builds of Firefox (in which the mnemonics bug is
clearly visible), this fix would be desired for the upcoming Firefox 1.0. Can
it be approved?
Attachment #163816 -
Flags: approval-aviary?
Comment 72•20 years ago
|
||
Comment on attachment 163816 [details] [diff] [review]
Better patch with bzbarsky's comment #66
too late for 1.0
Attachment #163816 -
Flags: approval-aviary? → approval-aviary-
Updated•20 years ago
|
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment 73•20 years ago
|
||
*** Bug 291453 has been marked as a duplicate of this bug. ***
| Assignee | ||
Comment 74•19 years ago
|
||
Comment on attachment 163816 [details] [diff] [review]
Better patch with bzbarsky's comment #66
Requesting branch approval. This is important for all localizations in right-to-left languages
Attachment #163816 -
Flags: approval-branch-1.8.1?(roc)
| Assignee | ||
Comment 75•19 years ago
|
||
Comment on attachment 163816 [details] [diff] [review]
Better patch with bzbarsky's comment #66
Sorry, this is already in the 1.8 branch
Attachment #163816 -
Flags: approval-branch-1.8.1?(roc)
Comment 76•17 years ago
|
||
Mass-assigning the new rtl keyword to RTL-related (see bug 349193).
Keywords: rtl
Component: Layout: BiDi Hebrew & Arabic → Layout: Text
QA Contact: xslf → layout.fonts-and-text
You need to log in
before you can comment on or make changes to this bug.
Description
•