Closed
Bug 123836
Opened 23 years ago
Closed 16 years ago
Implement .indeterminate property on checkboxes
Categories
(Core :: Layout: Form Controls, enhancement)
Core
Layout: Form Controls
Tracking
()
RESOLVED
FIXED
mozilla1.9.2a1
People
(Reporter: ian, Assigned: ventnor.bugzilla)
References
Details
(Keywords: dev-doc-complete)
Attachments
(2 files, 4 obsolete files)
11.71 KB,
patch
|
Details | Diff | Splinter Review | |
1.95 KB,
text/html
|
Details |
It would be rather useful if <input type="checkbox"> and <input type="radio">
controls could support tri-state mode, triggered by the "indeterminate" DOM
property as defined by Microsoft:
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/indeterminate.asp
http://msdn.microsoft.com/workshop/browser/mshtml/reference/ifaces/inputelement/indeterminate.asp
Comment 1•23 years ago
|
||
DOM WG doesn't want this, so we'll have to put it in nsIDOMNSHTMLInputElement.
When XBL form controls are turned on, this will be just as easy as setting the
:checked property will. Setting to 1.1 since that's the milestone-after-XBL.
Target Milestone: --- → mozilla1.1
Updated•23 years ago
|
QA Contact: madhur → tpreston
Updated•23 years ago
|
Status: NEW → ASSIGNED
Comment 2•21 years ago
|
||
What's the status on this ... would it have to be done using XBL?
Comment 3•18 years ago
|
||
"The official feedback on DOM Level 2 HTML is a request to add an 'indeterminate' property to Interface HTMLInputElement."
"In November 2000, DOM Level 2 HTML was delayed for backward compatibility reasons and our intent is to capture the current practice in several implementation, which is not the case for indeterminate. Only IE implementations are supporting this indeterminate feature for the moment. The TriState implementation does support indeterminate property but it is not equivalent to the one in IEs. So, even if other implementation are going to implement indeterminate in the future, we prefer not to add this new feature for the moment. This certainly needs to be on the list for an XForms API at some point."
<http://www.w3.org/2001/12/DOM-Level-2-issues>
Assignee | ||
Comment 4•16 years ago
|
||
HTML 5 got this property newly added to it. We might as well try it out, it seems like it could add nice polish to web apps that use treefuls of checkboxes.
Assignee: john → ventnor.bugzilla
QA Contact: tpreston → layout.form-controls
Assignee | ||
Updated•16 years ago
|
Target Milestone: mozilla1.1alpha → ---
Assignee | ||
Comment 5•16 years ago
|
||
This adds backend support for the property, plus adds drawing support for generic widgets and GTK widgets. Mac and Windows can be done later.
Attachment #355652 -
Flags: superreview?(roc)
Attachment #355652 -
Flags: review?(roc)
+[scriptable, uuid(b92b725e-b75a-49a0-b6f9-e16bc4bfa3de)]
interface nsIDOMHTMLInputElement : nsIDOMHTMLElement
nsIDOMHTMLInputElement is frozen so you can't do this. Add to nsIDOMNSHTMLInputElement instead.
+PaintIndeterminateMark(nsIRenderingContext& aRenderingContext,
+ const nsRect& aRect)
+{
+ // Drawing a thin horizontal line in the middle of the rect.
Why is this the right thing to do?
+ nsCOMPtr<nsIDOMHTMLInputElement> elem(do_QueryInterface(mContent));
+ PRBool retval = PR_FALSE;
+ elem->GetIndeterminate(&retval);
Probably best to do a null check here in case our content is an unexpected type.
Otherwise looks good. When you post a new patch, ask jst for review on the content part.
Comment 7•16 years ago
|
||
Are we out of bits in the bitfield? If not, why are we adding a new member?
I'd really like to see a diff with more context and -p here. In fact, it might be worth setting your mq to always do that...
Assignee | ||
Comment 8•16 years ago
|
||
We discussed these IRL :) but I'll put them in a comment anyway.
(In reply to comment #6)
> +PaintIndeterminateMark(nsIRenderingContext& aRenderingContext,
> + const nsRect& aRect)
> +{
> + // Drawing a thin horizontal line in the middle of the rect.
>
> Why is this the right thing to do?
This is what Mac and most GTK themes do. Windows seems to change their appearance of tristate checkboxes in each version. Plus its easy to do.
> + nsCOMPtr<nsIDOMHTMLInputElement> elem(do_QueryInterface(mContent));
> + PRBool retval = PR_FALSE;
> + elem->GetIndeterminate(&retval);
>
> Probably best to do a null check here in case our content is an unexpected
> type.
The other existing function GetChecked() doesn't do that. I don't think the content will ever be an unexpected type.
Reporter | ||
Comment 9•16 years ago
|
||
Oops, in HTML5 I only made it apply to checkboxes. Does it apply to radio buttons too?
Assignee | ||
Comment 10•16 years ago
|
||
No.
Assignee | ||
Comment 11•16 years ago
|
||
Fixes comments.
Attachment #355652 -
Attachment is obsolete: true
Attachment #355667 -
Flags: superreview?(roc)
Attachment #355667 -
Flags: review?(roc)
Attachment #355652 -
Flags: superreview?(roc)
Attachment #355652 -
Flags: review?(roc)
Attachment #355667 -
Flags: superreview?(roc)
Attachment #355667 -
Flags: superreview+
Attachment #355667 -
Flags: review?(roc)
Attachment #355667 -
Flags: review?(jst)
Attachment #355667 -
Flags: review+
Comment on attachment 355667 [details] [diff] [review]
Patch 2
nsRefPtr<nsDOMFileList> mFileList;
+
};
Lose the blank line
Comment 13•16 years ago
|
||
So the indeterminate state doesn't affect :checked matching on checkboxes/radios? That is, they match based on their checked state no matter what the indeterminate state is?
Assignee | ||
Comment 14•16 years ago
|
||
Correct. According to HTML5 (and MSDN, God help it), indeterminate only affects the appearance of the control and the checked state is toggled independently.
Comment 15•16 years ago
|
||
I'm not talking about the "checked state" in terms of DOM state but in terms of CSS style matching. Should the CSS :checked selector match indeterminate controls?
Assignee | ||
Comment 16•16 years ago
|
||
I don't think so. The way the spec reads, it says the indeterminate attribute should not affect anything other than just the appearance of the control.
Comment 17•16 years ago
|
||
I'm not sure that makes sense to me, especially since the whole point of styling _is_ appearance.
Reporter | ||
Comment 18•16 years ago
|
||
We can say that :checked doesn't apply if :indeterminate applies. I haven't defined how the pseudos match HTML5 stuff yet.
Assignee | ||
Comment 19•16 years ago
|
||
Remove that space.
Attachment #355667 -
Attachment is obsolete: true
Attachment #355703 -
Flags: review?(jst)
Attachment #355667 -
Flags: review?(jst)
Comment 20•16 years ago
|
||
Comment on attachment 355703 [details] [diff] [review]
Patch 3
r=jst.
Are there bugs filed on doing the Mac and Windows drawing part of this changed?
Attachment #355703 -
Flags: review?(jst) → review+
Assignee | ||
Comment 21•16 years ago
|
||
Not that I'm aware of. I might file them later.
Attachment #355703 -
Attachment is obsolete: true
Assignee | ||
Comment 22•16 years ago
|
||
Oops, that patch got the tests dropped from it.
Whiteboard: [needs landing]
Assignee | ||
Updated•16 years ago
|
Whiteboard: [needs landing]
Assignee | ||
Comment 23•16 years ago
|
||
Attachment #358069 -
Attachment is obsolete: true
Assignee | ||
Updated•16 years ago
|
Keywords: checkin-needed
Whiteboard: [needs landing]
Comment 24•16 years ago
|
||
Pushed to mozilla-central:
http://hg.mozilla.org/mozilla-central/rev/41d6bf675366
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: [needs landing]
Updated•16 years ago
|
Summary: Implement .indeterminate property on checkboxes and radio buttons → Implement .indeterminate property on checkboxes
Target Milestone: --- → mozilla1.9.2a1
Comment 25•16 years ago
|
||
Just curious, why do the test pass on Windows and Mac if that's not implemented there yet and the manifest does not exclude these platforms?
Comment 26•16 years ago
|
||
The test turns off native theming using -moz-appearance: none, so it falls back to the cross-platform rendering.
Comment 27•16 years ago
|
||
ok, makes sense now. Thanks for the explanations.
Comment 28•16 years ago
|
||
Testcase showing various checked/indeterminate/enabled variations on checkboxes and radios.
Firefox/IE/Safari Mac seem to agree on the rendering here, except Safari on Windows which renders a checkbox with checked+indeterminate the same way as a non-indeterminate checked checkbox (looks like a bug).
Assignee | ||
Updated•15 years ago
|
Keywords: dev-doc-needed
Updated•15 years ago
|
Keywords: dev-doc-needed → dev-doc-complete
Comment 29•15 years ago
|
||
Is this only a DOM attribute (settable in Javascript) or a content attribute (settable in the HTML tag)?
The original IE implementation has it as a content attribute with the nonstandard indeterminate="true"/"false" syntax.
HTML5 only defines it as a DOM attribute, not as a content attribute:
http://www.w3.org/TR/html5/forms.html#the-input-element
http://www.w3.org/TR/html5/forms.html#dom-input-indeterminate
Assignee | ||
Comment 30•15 years ago
|
||
DOM only.
Comment 31•15 years ago
|
||
While the CSS :indeterminate is documented, we need to document the input element's support for this too.
Keywords: dev-doc-complete → dev-doc-needed
Comment 32•15 years ago
|
||
Do we handle the indeterminate state on checkboxes inside a tree/listbox differently? When I try to get the value of the restore column of the listbox in the about:sessionrestore page, I get true, false, and 0.
Here an example:
var elem = document.getElementById("tabList");
var restore = elem.view.getCellValue(0, tree.columns.getColumnAt(0))
If any tab under a window should not be restored, 'restore' will be 0.
Updated•14 years ago
|
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•