Closed
Bug 187208
Opened 23 years ago
Closed 23 years ago
give more information for menu
Categories
(Core :: Disability Access APIs, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: yinbolian, Assigned: browser-china-atf)
References
Details
(Keywords: access)
Attachments
(1 file, 3 obsolete files)
8.07 KB,
patch
|
Details | Diff | Splinter Review |
Give information such as:
1. Is it submenu
2. It shortcut
3. It is AccessKey
mass changing QA contact to Jessie Li.
Status: NEW → ASSIGNED
QA Contact: dsirnapalli → jessie.li
Attachment #110576 -
Flags: review?(kyle.yuan)
Comment on attachment 110576 [details] [diff] [review]
patch
>+NS_IMETHODIMP nsXULMenuitemAccessible::GetAccKeybinding(nsAString& _retval)
>+{
>+ nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
>+ if (elt) {
>+ nsAutoString accesskey;
>+ elt->GetAttribute(NS_LITERAL_STRING("acceltext"), accesskey);
>+ if (accesskey.IsEmpty())
>+ return NS_OK;
>+
>+ nsAutoString Shortcut;
>+ PRInt32 oldpos, pos=0;
Please use interCap variable name here, and make the first letter lower-case.
Same with the rest part.
>+
>+ while ( (pos != -1) && (pos < (PRInt32)accesskey.Length()) ) {
You don't need the space between the parentheses.
>+ oldpos = pos;
>+ nsAutoString subString;
>+ pos = accesskey.FindChar('+', oldpos);
>+ if (pos == -1) {
>+ accesskey.Mid(subString, oldpos, accesskey.Length() - oldpos);
>+ Shortcut += subString;
>+ }
>+ else {
>+ accesskey.Mid(subString, oldpos, pos - oldpos);
>+ Shortcut += NS_LITERAL_STRING("<") + subString + NS_LITERAL_STRING(">");
>+ pos++;
>+ }
>+ }
I'd like to see this transformation takes place in thr mai code, it's platform
specific.
> const gchar *
> MaiInterfaceAction::GetKeybinding(gint aActionIndex)
> {
>+ //return all Keybindings including accesskey and shortcut
>+ //
Don't need the empty comment line
>+ nsAutoString autoStr;
I prefer a better name for this, such as keyShortcut.
>+ nsresult rv = accessible->GetAccKeyboardShortcut(autoStr);
>+ if (NS_FAILED(rv))
>+ return NULL;
>+
Here you should check whether the |autoStr| is empty, as well as
|grandparentKey|.
>+
>+ nsAutoString keyBinding, shortCut;
>+ accessible->GetAccKeybinding(keyBinding);
Need a null checking.
>+ shortCut = autoStr + NS_LITERAL_STRING(";") + keyBinding;
>+
Attachment #110576 -
Flags: review?(kyle.yuan) → review-
new patch due to comment #3
Attachment #110576 -
Attachment is obsolete: true
Attachment #110748 -
Flags: superreview?(aaronl)
Attachment #110748 -
Flags: review?(kyle.yuan)
Comment on attachment 110748 [details] [diff] [review]
patch 2
>+ //get accesskey
>+ nsAutoString accessKey;
>+ nsresult rv = accessible->GetAccKeyboardShortcut(accessKey);
>+ if (NS_FAILED(rv) || accessKey.IsEmpty())
>+ return NULL;
You shouldn't return here, in case of some menu items have a shortcut key, but
no accesskey.
>+ allKeybinding = allKeybinding + NS_LITERAL_STRING(";") + subShortcut;
allKeybinding += NS_LITERAL_STRING(";") + subShortcut; is better
other part looks good to me.
BTW, currently, Aaron is not the right person to ask sr= (I hope he will be
soon :), please choose a sr from http://www.mozilla.org/hacking/reviewers.html
Attachment #110748 -
Flags: review?(kyle.yuan) → review-
Comment on attachment 110748 [details] [diff] [review]
patch 2
aaronl is not a super reviewer.
Attachment #110748 -
Flags: superreview?(aaronl)
new patch due to comment #5
Attachment #110759 -
Flags: review?(kyle.yuan)
Attachment #110759 -
Flags: review?(kyle.yuan) → review+
Attachment #110759 -
Flags: superreview?(blizzard)
Attachment #110759 -
Flags: superreview?(blizzard) → superreview?(bryner)
Comment 8•23 years ago
|
||
Comment on attachment 110759 [details] [diff] [review]
patch 3
>+ //get accesskey
>+ nsAutoString accessKey;
>+ nsresult rv = accessible->GetAccKeyboardShortcut(accessKey);
>+
>+ if (!NS_FAILED(rv) && !accessKey.IsEmpty()) {
Use NS_SUCCEEDED(rv) instead of !NS_FAILED(rv) here, and also later in the
patch.
sr=bryner with those changes.
Attachment #110759 -
Flags: superreview?(bryner) → superreview+
Comment 10•23 years ago
|
||
checked in!
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•