Closed
Bug 290255
Opened 19 years ago
Closed 18 years ago
Slider Tag, <scale>
Categories
(Core :: XUL, defect)
Core
XUL
Tracking
()
RESOLVED
FIXED
People
(Reporter: enndeakin, Assigned: enndeakin)
References
()
Details
(Keywords: dev-doc-complete)
Attachments
(5 files, 5 obsolete files)
47.65 KB,
patch
|
mconnor
:
review+
|
Details | Diff | Splinter Review |
11.85 KB,
patch
|
Details | Diff | Splinter Review | |
43.36 KB,
patch
|
neil
:
superreview+
|
Details | Diff | Splinter Review |
2.38 KB,
image/gif
|
Details | |
77.96 KB,
patch
|
roc
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
XUL should have a <slider> tag for selecting from a range. I implemented a simple one a while ago, but never added it. There's still things that could be added in the future, like a numeric label, but this is a good start.
Assignee | ||
Comment 1•19 years ago
|
||
Attachment #180660 -
Flags: review?(neil.parkwaycc.co.uk)
Assignee | ||
Comment 2•19 years ago
|
||
GTK-only theme changes for now. Don't have a Mac to build with and the Windows theme API is non-cooperative.
Assignee | ||
Comment 3•19 years ago
|
||
Maybe we should try the jar.mn relative path magic here?
Comment 4•19 years ago
|
||
Comment on attachment 180660 [details] [diff] [review] xpfe and layout changes I can't really comment on the native theme stuff. >+:not(scrollbar) > slider { >+ -moz-binding: url(chrome://global/content/bindings/slider.xml#slider); >+} You don't actually have to call your new widget a slider to make it use nsSliderFrame.cpp - the binding already extends xul:slider - this will save on all the various :not(scrollbar)-type rules (which I must say I'm not keen on). >+ <children/> I don't see the point of this. >+ var value = this.getAttribute(attr); >+ if (value){ You didn't do an if (value) check in _setIntegerAttribute and I don't see why you need it here either. >+ event.preventBubble(); This is probably not very useful. What may be useful is event.preventDefault(); to stop the arrow keys scrolling a containing scrollbox. >+ <handler event="keypress" keycode="VK_LEFT" phase="target"> At some point this will need to be fixed to work in RTL... >+slider[orient="vertical"] sliderthumb { You need to make sliderthumb inherit the orient too, so that you can write a simpler CSS rule. (This one is particularly bad, because it checks the ancestor hierarchy in case it finds a vertical slider).
Assignee | ||
Comment 5•18 years ago
|
||
- add support for scale in windows and gtk native theme code - add minpos for slider so that scales can set a minimum value
Attachment #180660 -
Attachment is obsolete: true
Attachment #180661 -
Attachment is obsolete: true
Attachment #180662 -
Attachment is obsolete: true
Attachment #198095 -
Flags: review?(bryner)
Assignee | ||
Comment 6•18 years ago
|
||
Attachment #198098 -
Flags: review?(neil.parkwaycc.co.uk)
Assignee | ||
Comment 7•18 years ago
|
||
Attachment #198099 -
Flags: review?(aaronleventhal)
Assignee | ||
Updated•18 years ago
|
Status: NEW → ASSIGNED
Comment 8•18 years ago
|
||
Comment on attachment 198098 [details] [diff] [review] xpfe and toolkit changes to add a <scale> tag >+ <![CDATA[ >+ var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService); please split this line so it doesn't overflow quite so much >+ <method name="_getIntegerAttribute"> >+ <parameter name="attr"/> >+ <parameter name="defaultvalue"/> general: we try to follow the style guide so that args/param names are prefaced with a/an (anAttr, aDefaultValue). Yes, there's stuff that doesn't do this, but new code should enforce this. >+ <handlers> >+ <handler event="DOMAttrModified"> >+ if (event.originalTarget != this._slider) return; general: always put a return statement on a new line. >+ var attrname = event.attrName; >+ if (attrname == "curpos") { >+ this.setAttribute("value", event.newValue); >+ >+ var event = document.createEvent("Events"); >+ event.initEvent("change", false, true); >+ this.dispatchEvent(event); >+ } >+ else if (attrname == "minpos") { >+ this.setAttribute("min", event.newValue); >+ } >+ else if (attrname == "maxpos") { >+ this.setAttribute("max", event.newValue); >+ } typically we'd use a switch statment once we get to three, and brackets around single lines are bad too. >+ <handler event="keypress" keycode="VK_UP"> >+ this.decrease(); >+ event.preventDefault(); >+ </handler> general: instead of event.preventDefault() please use preventdefault="true" on these handlers. This ensures that it'll work in content when JS is disabled, etc. >Index: toolkit/themes/pinstripe/global/scale.css >=================================================================== >RCS file: toolkit/themes/pinstripe/global/scale.css >diff -N toolkit/themes/pinstripe/global/scale.css >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ toolkit/themes/pinstripe/global/scale.css 18 Sep 2005 20:32:30 -0000 >@@ -0,0 +1,89 @@ >+/* ***** BEGIN LICENSE BLOCK ***** <snip> >+ * ***** END LICENSE BLOCK ***** */ we're starting to preprocess CSS to cut down disk size even further. Since this is trunk, you can use the following style to cut out all of the text from the jarred chrome. Then add * to the jar.mn line to call the PP. >+/* ***** BEGIN LICENSE BLOCK ***** %if 0 (license text) %endif >+ * ***** END LICENSE BLOCK ***** */ anyway, looks pretty good, with those bits addressed, r=me for the toolkit bits (and I'd like to see the xpfe/toolkit impls stay in sync)
Attachment #198098 -
Flags: review+
Comment 9•18 years ago
|
||
// If the platform supports it, the left/right chunks // of the slider thumb -#define NS_THEME_SLIDER_THUMB_START 113 -#define NS_THEME_SLIDER_THUMB_END 114 +#define NS_THEME_SCALE_THUMB_START 115 +#define NS_THEME_SCALE_THUMB_END 116 // The ticks for a slider. -#define NS_THEME_SLIDER_TICK 115 +#define NS_THEME_SCALE_TICK 117 Doesn't these need to have both horizontal and vertical rendering?
Comment 10•18 years ago
|
||
Comment on attachment 198098 [details] [diff] [review] xpfe and toolkit changes to add a <scale> tag Sorry for the delay; this is just a skim through, I'll try it out later. >+thumb.scale-thumb { I would have thought .scale-thumb should suffice here. >+scale[disabled] .scale-slider { >+ -moz-user-focus: ignore; >+} This doesn't work automatically? Perhaps you need to implement nsIDOMXULControlElement. >+ <property name="pageIncrement" onget="return this._getIntegerAttribute('pagencrement', 10);" Typo in attribute name. >+ if (attrname == "curpos") { >+ this.setAttribute("value", event.newValue); Hmm... scrollbars automatically get their curpos synchronized to the slider. Maybe it would be easier if you could hook in to that mechanism. You'd also be able to use phase="target" on your DOMAttrChanged handler that fires the change event. You'd also be able to set your other attributes and let XBL copy them to the slider. >+ <handler event="focus" phase="capturing"> >+ <![CDATA[ >+ if (!this.hasAttribute('focused')) >+ this.setAttribute('focused','true'); >+ ]]> >+ </handler> >+ >+ <handler event="blur" phase="capturing"> >+ <![CDATA[ >+ this.removeAttribute('focused'); >+ ]]> >+ </handler> I don't see any focus rules at all, either using the attribute or :focus. >+ skin/classic/global/scale.css (global/mac/scale.css) >+ skin/classic/global/scale.css (global/win/scale.css) The files appear to be identical? >+ cursor: default; What's this overriding? >+ min-height: 18px; >+ min-width: auto; >+ min-height: auto; Typo?
Comment 11•18 years ago
|
||
I get this warning when I move the slider. Warning: variable event hides argument Source file: chrome://global/content/bindings/scale.xml Line: 103, Column: 14 Source code: var event = document.createEvent("Events");
Updated•18 years ago
|
OS: Linux → All
Assignee | ||
Comment 12•18 years ago
|
||
> Hmm... scrollbars automatically get their curpos synchronized to the slider.
> Maybe it would be easier if you could hook in to that mechanism. You'd also be
> able to use phase="target" on your DOMAttrChanged handler that fires the change
> event. You'd also be able to set your other attributes and let XBL copy them to
> the slider.
I tried that method originally, but for some reason I didn't like it, a reason I don't remember now. I could revisit it if desired.
Attachment #216014 -
Flags: superreview?(neil)
Attachment #216014 -
Flags: review?(neil)
Comment 13•18 years ago
|
||
Comment on attachment 216014 [details] [diff] [review] Address review comments >+ this.dispatchEvent(changeEvent); >+ >+ break; >+ case "minpos": Nit: The blank line is in the wrong place. >+.scale-thumb { >+ border: 3px solid; >+ -moz-border-top-colors: #000000 #E4EBF2 #C3CAD2; >+ -moz-border-right-colors: #000000 #8F9DAD #A4AFBB; >+ -moz-border-bottom-colors: #000000 #8F9DAD #A4AFBB; >+ -moz-border-left-colors: #000000 #E4EBF2 #C3CAD2; >+ background-image: url("chrome://global/skin/scrollbar/thumb-vrt-grip.gif"); >+ min-width: 18px; >+} >+ >+.scale-thumb[orient="vertical"] { >+ background-image: url("chrome://global/skin/scrollbar/thumb-hrz-grip.gif"); >+ min-height: 18px; >+ min-width: auto; >+} It looks like you've got the two images swapped by mistake. Do you have the Classic images (or alternatively a Classic screenshot)? Also, min-width: auto; is invalid CSS. IIRC sliders always layout their thumbs to fit their minor dimension so you probably don't need to override it here.
Attachment #216014 -
Flags: superreview?(neil) → superreview+
Assignee | ||
Comment 14•18 years ago
|
||
Don't know who best reviews native theme changes.
Attachment #198095 -
Attachment is obsolete: true
Attachment #216137 -
Flags: review?(roc)
Attachment #198095 -
Flags: review?(bryner)
Comment 15•18 years ago
|
||
Comment on attachment 198099 [details] [diff] [review] accessibility changes Mark, if this looks reasonable on your first pass you can hit me up for 2nd review.
Attachment #198099 -
Flags: review?(aaronleventhal) → review?(pilgrim)
Comment 16•18 years ago
|
||
Comment on attachment 198099 [details] [diff] [review] accessibility changes Aaron, my understanding of the DHTML Accessibility code is that xhtml2:role="wairole:slider" is already being exposed properly, so this patch does not need to change any of the DHTML Accessibility code. If that's correct, r=me.
Attachment #198099 -
Flags: review?(pilgrim) → review+
// Draw focus rectangles for XP HTML checkboxes and radio buttons // XXX it'd be nice to draw these outside of the frame Hmm, the latter is possible now (by overriding GetWidgetOverflow).
nsNativeThemeWin::DrawWidgetBackground
+ contentRect.left += adjustment - 1;
Why is this different from the horizontal case? At least explain why in a comment.
Why doesn't ClassicDrawWidget have code for drawing scales?
+ if ((pageIncrement + maxpospx - minpospx) != 0)
> 0
+ nsAutoString snap;
+ scrollbar->GetAttr(kNameSpaceID_None, nsXULAtoms::snap, snap);
+ if (snap.EqualsLiteral("true")) {
+ nsAutoString disabled;
+ mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled);
+ if (disabled.EqualsLiteral("true"))
+ return NS_OK;
AttrValueIs?
What happens if minpos > maxpos?
Comment 19•18 years ago
|
||
Comment on attachment 198099 [details] [diff] [review] accessibility changes Yes but this isn't using the DHTML slider -- this implements accessible slider support via C++.
Attachment #198099 -
Flags: review+
Comment on attachment 216137 [details] [diff] [review] Add Mac native theme code, update windows code minusing until questions are addressed
Attachment #216137 -
Flags: review?(roc) → review-
Assignee | ||
Comment 21•18 years ago
|
||
(In reply to comment #18) > Why doesn't ClassicDrawWidget have code for drawing scales? > I don't know what a classic scale looks like. But in this case, it should fall back to the styles defined in css, which draw a scale which looks somewhat like a scrollbar. > What happens if minpos > maxpos? I will fix it such that maxpos will be considered to have the value minpos in that case. It won't make the scale useful for anything but at least it will be intentionaly so.
Comment 22•18 years ago
|
||
The top horizontal slider demonstrates optional pointing and end and page tick marks. The middle vertical slider only demonstrates end and page tick marks.
Assignee | ||
Comment 23•18 years ago
|
||
- adds Windows Classic theme support - makes nsSliderFrame handle the case when minpos > maxpos. I'll file a follow up bug to make the binding do some better bounds checking
Attachment #216137 -
Attachment is obsolete: true
Attachment #220649 -
Flags: superreview?(roc)
Attachment #220649 -
Flags: review?(roc)
Attachment #220649 -
Flags: superreview?(roc)
Attachment #220649 -
Flags: superreview+
Attachment #220649 -
Flags: review?(roc)
Attachment #220649 -
Flags: review+
Assignee | ||
Comment 24•18 years ago
|
||
Comment on attachment 216014 [details] [diff] [review] Address review comments This has been reviewed already
Attachment #216014 -
Flags: review?(neil)
Assignee | ||
Comment 25•18 years ago
|
||
<scale> has been checked in. See http://wiki.mozilla.org/XUL:Slider_Tag for info about how it is used
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Updated•18 years ago
|
Summary: Slider Tag → Slider Tag, <scale>
Comment 26•18 years ago
|
||
What is the status of rtl support in <scale>? It looks like left and right arrow keys aren't bidi-aware. Is the visual representation reversed when chrome is right-to-left?
Assignee | ||
Comment 27•18 years ago
|
||
There isn't any rtl support for scale currently, but it wouldn't be too hard to add.
Assignee | ||
Updated•18 years ago
|
Attachment #180660 -
Flags: review?(neil)
Assignee | ||
Updated•18 years ago
|
Attachment #198098 -
Flags: review?(neil)
Comment 28•17 years ago
|
||
Is anyone currently working on the RTL support? The wiki says there is the need.
Comment 29•17 years ago
|
||
dev-doc is at http://developer.mozilla.org/en/docs/XUL:scale.
Comment 30•17 years ago
|
||
Neil, would you consider something like this https://bugzilla.mozilla.org/show_bug.cgi?id=391655 for the benefit of custom themes?
Updated•17 years ago
|
Keywords: dev-doc-complete
Hardware: PC → All
Assignee | ||
Updated•17 years ago
|
Flags: in-testsuite+
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.widgets
You need to log in
before you can comment on or make changes to this bug.
Description
•