Closed
Bug 108307
Opened 23 years ago
Closed 23 years ago
Checkbox initial value is not set when display: none
Categories
(Core :: Layout: Form Controls, defect)
Tracking
()
RESOLVED
FIXED
mozilla0.9.9
People
(Reporter: john, Assigned: john)
References
Details
Attachments
(3 files, 2 obsolete files)
1.07 KB,
text/html
|
Details | |
1.12 KB,
text/html
|
Details | |
35.79 KB,
patch
|
jst
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
<FORM NAME=mainform> <INPUT NAME=chk TYPE=checkbox CHECKED STYLE="display: none"> <SCRIPT>alert(document.mainform.chk.checked)</SCRIPT> </FORM> should show true. Currently it shows false. This affects its ability to be properly submitted and manipulated with Java1
Is there anything I can do to help with this bug? I'd like to be able to recommend a browser other than IE for use with my site, and this bug currently prevents that. I don't have a lot of time, and I know essentially nothing of Mozilla's code, but I'd like to move this along if I can. I'm reluctant to take on anything complex (this is quite tangential to what I'm paid to do), but I suppose if it were straightforward jkeiser or someone else would have taken care of it already.
Assignee | ||
Comment 2•23 years ago
|
||
I will have gobs more time for Mozilla starting next week, and this is near the top of my list (after radio buttons). Still, if you have enough time and you want to work on it, I'd be happy to point you in the right direction. This is one of the easier fixes I have on my plate, though it's by no means trivial. It involves is moving the "checked" state over from one class to another. Essentially, the problem is the state is stored in the frame class, which only exists when the element is being displayed. Thus this is where the initialization happens as well. It needs to be moved to content. Frame: http://lxr.mozilla.org/seamonkey/source/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp http://lxr.mozilla.org/seamonkey/source/layout/html/forms/src/nsGfxCheckboxControlFrame.h (See the mChecked member variable in the .h file, that's the one to remove) Content: http://lxr.mozilla.org/seamonkey/source/content/html/content/src/nsHTMLInputElement.cpp (mChecked needs to be moved to the class definition here and any calls to the frame to determine the value need to be changed to use the local ver.)
It's unlikely that I'd get to it before next week. If I find I have the time, I'll check in with you before I dive in.
Comment 4•23 years ago
|
||
Could we get this targetted for early in 0.99? If it really blocks 112716, then we need it soon.
Assignee | ||
Comment 5•23 years ago
|
||
This is the whole thing, completely and utterly untested. Will test and debug tomorrow.
Assignee | ||
Updated•23 years ago
|
Target Milestone: --- → mozilla0.9.9
Assignee | ||
Comment 6•23 years ago
|
||
That patch is nearly working. .defaultChecked needs to be hooked up to setAttribute("checked"), and the .defaultChecked <-> .checked relationship is a little off (though only in its more obscure points)--attaching testcase.
Assignee | ||
Comment 7•23 years ago
|
||
Note to self: test and make sure radio buttons and onChange work properly (this patch intersects there and fixes some onChange bugs).
Assignee | ||
Comment 8•23 years ago
|
||
Attachment #65313 -
Attachment is obsolete: true
Assignee | ||
Comment 9•23 years ago
|
||
This shows that in the forthcoming patch, radios are still working. defaultChecked <-> checked interaction is a little screwy, but then, it always has been. (Just compare behaviors. We do about the same as before, except now .defaultChecked doesn't change the value of .checked after you have been clicking around on the buttons a lot.)
Assignee | ||
Comment 10•23 years ago
|
||
All is working here, and it passes jst-review.cgi.
Attachment #65200 -
Attachment is obsolete: true
Assignee | ||
Updated•23 years ago
|
Status: NEW → ASSIGNED
Comment 11•23 years ago
|
||
r=rods
Comment 12•23 years ago
|
||
- In nsHTMLInputElement.cpp: @@ -223,6 +232,8 @@ PRPackedBool mHandlingClick; PRPackedBool mValueChanged; char* mValue; + PRPackedBool mCheckedChanged; + PRPackedBool mChecked; We now have 5 PRPackedBool's (and one PRInt8), which will eat up at least 16 bytes, should we combine the 5 PRPackedBool's into bitfields to save space here? Or should we file a new bug on that? - In nsGfxCheckboxControlFrame::GetCheckboxState(): + nsIDOMHTMLInputElement* elem = nsnull; + CallQueryInterface(mContent, &elem); + PRBool retval = PR_FALSE; + elem->GetChecked(&retval); + return retval; That leaks, nsCOMPtr! Same thing in nsGfxCheckboxControlFrame::SetCheckboxState() - In nsGfxCheckboxControlFrame::StringToCheckState(): + if ( !aStateAsString.Equals(NS_STRING_TRUE) ) { + return PR_FALSE; + } else { + return PR_TRUE; + } else-after-return, and why not simply: + return aStateAsString.Equals(NS_STRING_TRUE); sr=jst with the above fixed.
Updated•23 years ago
|
Attachment #65495 -
Flags: superreview+
Attachment #65495 -
Flags: review+
Comment 13•23 years ago
|
||
s/16 bytes/8 bytes/
Assignee | ||
Comment 14•23 years ago
|
||
OK, changes made and working, except PRPackedBool fix. That is bug 121317. Will check in when tree opens.
Assignee | ||
Comment 15•23 years ago
|
||
checked in, tested, happy.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 16•23 years ago
|
||
Thanks, John. Now that this is fixed, I no longer have to tell users that our site can't be safely viewed in Mozilla!
Assignee | ||
Comment 17•23 years ago
|
||
Better check that you're not running afoul of its companion bug, bug 108308 :)
Comment 18•23 years ago
|
||
Thanks; I know about that bug. My site doesn't happen to hide radio controls. Of course, I can't recommend Mozilla-based browsers unreservedly until 108308 is fixed.
Updated•22 years ago
|
QA Contact: madhur → tpreston
You need to log in
before you can comment on or make changes to this bug.
Description
•