Closed
Bug 150606
Opened 22 years ago
Closed 22 years ago
Implementation of nsIAccessibleValue
Categories
(Core :: Disability Access APIs, defect)
Core
Disability Access APIs
Tracking
()
RESOLVED
FIXED
People
(Reporter: gilbert.fang, Assigned: gilbert.fang)
References
Details
Attachments
(2 files, 3 obsolete files)
2.62 KB,
application/octet-stream
|
Details | |
3.57 KB,
patch
|
jag+mozilla
:
review+
jag+mozilla
:
superreview+
asa
:
approval+
|
Details | Diff | Splinter Review |
see also bugsceri 34
Jessie will be in charge of this bug.
QA Contact: dsirnapalli → jessie.li
Assignee | ||
Comment 2•22 years ago
|
||
See mozilla/ layout/ xul/ base/ src/ nsProgressMeterFrame.cpp 132 nsAutoString value; 133 mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::value, value); 134 135 PRInt32 error; 136 PRInt32 flex = value.ToInteger(&error); 137 if (flex < 0) flex = 0; 138 if (flex > 100) flex = 100; Oh, this would mean that ProgressMeter's min/max are sure 0/100. And it really makes things easy.:-)
Assignee | ||
Comment 3•22 years ago
|
||
Extend class nsXULProgressMeterAccessible to support the nsIAccessibleValue. Is there any other xul control which needs to support the nsIAccessibleValue, I will file a new bug for that. This one is only for nsXULProgressMeterAccessible.
Assignee | ||
Comment 4•22 years ago
|
||
See mozilla/ accessible/ src/ xul/ nsXULFormControlAccessible.cpp 458 NS_IMETHODIMP nsXULProgressMeterAccessible::GetAccValue(nsAString& _retval) 459 { 460 nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode)); 461 NS_ASSERTION(element, "No element for DOM node!"); 462 element->GetAttribute(NS_LITERAL_STRING("value"), _retval); 463 if (!_retval.IsEmpty() && _retval.Last() != '%') 464 _retval.Append(NS_LITERAL_STRING("%")); 465 return NS_OK; 466 } aha, it is also easy to get the current value. :-)
Assignee | ||
Comment 5•22 years ago
|
||
#include "nsISupports.idl" [scriptable, uuid(F4ABBC2F-0F28-47DC-A9E9-F7A1719AB2BE)] interface nsIAccessibleValue : nsISupports { readonly attribute double maximumValue; readonly attribute double minimumValue; readonly attribute double currentValue; /** * We want to be able to return a success condition of the value * getting set. ie if the value is not within the interval of * minimumValue-maximumValue */ boolean setCurrentValue (in double value); }; For progressmeter, I suggest that the maximum is 100% =1. Let the ATs to do the translation to the percentage. The reason is this interface may be supported by other controls, and we should keep the meaning of numbers consistent.
Assignee | ||
Comment 6•22 years ago
|
||
If I write the code like this: nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode)); NS_ASSERTION(element, "No element for DOM node!"); nsPrintfCString currentValue("%.0f%",aValue); if (NS_SUCCEEDED(element->SetAttribute(NS_LITERAL_STRING("value"), currentValue))) { *_retval = PR_TRUE; return NS_OK; } Then the vc will complain: e:\cmtrunksb\mozilla\accessible\src\xul\nsXULFormControlAccessible.cpp(511) : error C2664: 'SetAttribute' : cannot convert parameter 2 from 'class nsPrintfCString' to 'const class nsAString &' Reason: cannot convert from 'class nsPrintfCString' to 'const class nsAString' No constructor could take the source type, or constructor overload resolution was ambiguous Why nsPrintfCString can not convert automatically, should we file a bug to improve it?
Assignee | ||
Comment 7•22 years ago
|
||
oh, I should use NS_ConvertUTF8toUCS2 to convert it. Thanks ot beisi and sirLuxalot.
Assignee | ||
Comment 8•22 years ago
|
||
This patch extends nsXULProgressMeterAccessible to support the nsIAccessibleValue. need r=?
Comment 9•22 years ago
|
||
Comment on attachment 90203 [details] [diff] [review] extending the nsXULProgressMeterAccessible (patch_bz150606_20020704_d) In GetCurrentValue() why are you using a variable called "error"? It doesn't sound much like an error at all -- perhaps you should call it currentValue or something? + PRInt32 error; + *aCurrentValue = currentValue.ToFloat(&error) / 100; In SetCurrentValue(), why not consolodate into double min, max; + double min; + GetMinimumValue(&min); + double max; + GetMaximumValue(&max); r=aaronl
Attachment #90203 -
Flags: review+
Assignee | ||
Comment 10•22 years ago
|
||
Hi, aaronl, thank u for review. here is my replay: 1) For ToFloat, Please see mozilla/ string/ obsolete/ nsString.cpp 460 /** 461 * Perform string to float conversion. 462 * @update gess 01/04/99 463 * @param aErrorCode will contain error if one occurs 464 * @return float rep of string value 465 */ 466 float nsCString::ToFloat(PRInt32* aErrorCode) So the variable error is for that error code. 2)Okay. That is because by now, I never found in mozilla, there exists that defining two variable in ONE line. I am not sure whether it is a convention. If u think they should be in one line, that is all right.
Assignee | ||
Comment 11•22 years ago
|
||
Extending the nsXULProgressMeterAccessible to support nsIAccessibleValue. This patch modifys one line of ( 90203: extending the nsXULProgressMeterAccessible (patch_bz150606_20020704_d) following the arronls' review. Please super-revies this patch.
Attachment #90203 -
Attachment is obsolete: true
Comment 12•22 years ago
|
||
Comment 13•22 years ago
|
||
Comment on attachment 90268 [details] [diff] [review] new patch after aaronl's review (patch_bz150606_20020705_a) r=aaronl
Attachment #90268 -
Flags: review+
Comment 14•22 years ago
|
||
Comment on attachment 90268 [details] [diff] [review] new patch after aaronl's review (patch_bz150606_20020705_a) You could use this: PRUint32 value = PRUint32(aValue * 100.0 + 0.5); nsAutoString valueString; valueString.AppendInt(value);
Assignee | ||
Comment 15•22 years ago
|
||
need r= and sr= ?
Attachment #90268 -
Attachment is obsolete: true
Comment 16•22 years ago
|
||
Comment on attachment 90578 [details] [diff] [review] new patch following jag's sr(patch_bz150606_20020708_b) r=kyle
Attachment #90578 -
Flags: review+
Updated•22 years ago
|
Attachment #90578 -
Flags: superreview+
Comment 17•22 years ago
|
||
Comment on attachment 90578 [details] [diff] [review] new patch following jag's sr(patch_bz150606_20020708_b) + if (aValue >= max && aValue <= min) + return NS_ERROR_INVALID_ARG; So if the min is 0.0 and the max is 1.0 this means that your value can't be 0.0 or 1.0 itself. Is this what you want?
Updated•22 years ago
|
Attachment #90578 -
Flags: superreview+
Assignee | ||
Comment 18•22 years ago
|
||
oh, my god, jag. you r really cute. I do not want to mean that actually. :-( I think I really should do is if (aValue > max || aValue < min) return NS_ERROR_INVALID_ARG; I am so embarrassed by this careless mistakes. Could u please kindly give me a super-review again?
Assignee | ||
Comment 19•22 years ago
|
||
could jag spend some time to see it again? :-)
Assignee | ||
Updated•22 years ago
|
Attachment #90578 -
Attachment is obsolete: true
Comment 20•22 years ago
|
||
Comment on attachment 90723 [details] [diff] [review] second patch after jag's review(patch_bz150606_20020710_b) sr=jag, carrying over r=
Attachment #90723 -
Flags: superreview+
Attachment #90723 -
Flags: review+
Comment 21•22 years ago
|
||
Comment on attachment 90723 [details] [diff] [review] second patch after jag's review(patch_bz150606_20020710_b) a=asa (on behalf of drivers) for checkin to the 1.1 trunk.
Attachment #90723 -
Flags: approval+
Comment 22•22 years ago
|
||
checked in
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•