Closed
Bug 442419
Opened 16 years ago
Closed 16 years ago
allow custom max for progressmeter
Categories
(Toolkit :: UI Widgets, enhancement)
Tracking
()
RESOLVED
FIXED
mozilla1.9.1b2
People
(Reporter: mook, Assigned: mook)
References
()
Details
Attachments
(2 files, 2 obsolete files)
7.44 KB,
patch
|
enndeakin
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
7.71 KB,
patch
|
Details | Diff | Splinter Review |
<progressmeter> currently (when determined) has possible values of 0 to 100 in increments of 1. For a very wide progressmeter, this means the value can be coarse. I think it would be useful to add a max= attribute (a positive integer) that can be used to determine the total possible value, defaulting to 100 (so there is no behaviour change). I was thinking of having a custom min= as well, but that gets complicated (needing to bound both values correctly, needing to shift values) when the (XUL widget) user can do that easily.
Assignee | ||
Comment 1•16 years ago
|
||
Patch for Mac (it just has to be special!) and everybody-else. Includes reftest, but I'm not sure if I did that part right. (It compares 50/100 against 99/198)
Attachment #327920 -
Flags: review?
Assignee | ||
Updated•16 years ago
|
Attachment #327920 -
Flags: review? → review?(enndeakin)
Comment 2•16 years ago
|
||
Comment on attachment 327920 [details] [diff] [review] add max= attribute to <xul:progressbar> >diff --git a/layout/xul/base/src/nsProgressMeterFrame.cpp b/layout/xul/base/src/nsProgressMeterFrame.cpp >- if (flex < 0) flex = 0; >- if (flex > 100) flex = 100; >+ PRInt32 maxFlex = maxValue.ToInteger(&error); >+ if (maxValue.IsEmpty()) { >+ maxFlex = 100; Seems like this should default to 100 if there was an error parsing. >+ <property name="max" >+ onget="return this.getAttribute('max') || '100';" >+ onset="this.setAttribute('max', Math.max(val, 1));"/> Similarly here. Ideally, setting the max to something will also adjust the value to the maximum if it is higher.
Attachment #327920 -
Flags: review?(enndeakin) → review+
Comment 3•16 years ago
|
||
Hi Neil - I've updated Mook's patch so it applies against mozilla-central tip, and tried to take into account your comments for defaulting to 100 in the event of a parse error. Mind reviewing this again?
Attachment #340452 -
Flags: review?(enndeakin)
Comment 4•16 years ago
|
||
Comment on attachment 340452 [details] [diff] [review] Updated patch for tip & for enndeakin's comments >+ <property name="max" >+ onget="return this.getAttribute('max') || '100';" >+ onset="if (isNaN(val)) this.setAttribute('max', 100); else this.setAttribute('max', Math.max(val, 1)); if (this.getAttribute('value') > val) this.setAttribute('value', Math.max(val, 1));"/> This is quite complicated. It should go in a <setter> block, or at least be better spaced out. Also, a setter needs to return 'val' as well. Updating the value should be a matter of just setting this.value = this.value i would think. Something like the following perhaps? onset="this.setAttribute("max", isNaN(val) ? 100 : Math.max(val, 1); this.value = this.value; return val;"
Comment 5•16 years ago
|
||
Thanks, I've updated to continue using the onset with your cleaner suggestion. (Didn't occur to me that simply doing this.value = this.value would invoke the getter's logic for capping it at the max)
Attachment #340452 -
Attachment is obsolete: true
Attachment #344702 -
Flags: review?(enndeakin)
Attachment #340452 -
Flags: review?(enndeakin)
Updated•16 years ago
|
Attachment #344702 -
Flags: review?(enndeakin) → review+
Attachment #344702 -
Flags: superreview+
Updated•16 years ago
|
Keywords: checkin-needed
Updated•16 years ago
|
Attachment #327920 -
Attachment is obsolete: true
Comment 6•16 years ago
|
||
Comment on attachment 344702 [details] [diff] [review] updated patch with better onset >--- a/layout/xul/base/src/nsProgressMeterFrame.cpp >+++ b/layout/xul/base/src/nsProgressMeterFrame.cpp >@@ -129,15 +129,27 @@ nsProgressMeterFrame::AttributeChanged(P >+ if (!NS_SUCCEEDED(error) || maxValue.IsEmpty()) { s/!NS_SUCCEEDED/NS_FAILED/ !?
Updated•16 years ago
|
Status: NEW → ASSIGNED
Whiteboard: [c-n: wait for comment 6, or not ?]
Comment 7•16 years ago
|
||
Good idea Serge, here's a new patch that uses NS_FAILED instead of NS_SUCCEEDED. I assume this doesn't need new r/sr since it's so trivial.
Comment 8•16 years ago
|
||
Pushed to mozilla-central: <http://hg.mozilla.org/mozilla-central/rev/0c2c2c895e5d>
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: [c-n: wait for comment 6, or not ?]
Target Milestone: --- → mozilla1.9.1b2
Comment 9•16 years ago
|
||
Pushed a bustage fix for this: http://hg.mozilla.org/mozilla-central/rev/b9dd40cbf22d
Comment 10•16 years ago
|
||
Oops, missed a bit: http://hg.mozilla.org/mozilla-central/rev/5fdc78311d6b
Comment 11•16 years ago
|
||
augh, sorry bout that. Thanks Mossop!
Comment 12•15 years ago
|
||
It looks like the added reftest hasn't ever been run because toolkit/content/tests/reftests/reftest.list isn't included in layout/reftests/reftest.list.
(In reply to Markus Stange [:mstange] from comment #12) > It looks like the added reftest hasn't ever been run because > toolkit/content/tests/reftests/reftest.list isn't included in > layout/reftests/reftest.list. I'll fix that in bug 989688.
You need to log in
before you can comment on or make changes to this bug.
Description
•