Closed
Bug 596088
Opened 14 years ago
Closed 14 years ago
<input type='file'> doesn't look disabled when inside a disabled fieldest but is disabled
Categories
(Core :: Layout: Form Controls, defect)
Core
Layout: Form Controls
Tracking
()
RESOLVED
FIXED
mozilla2.0b9
Tracking | Status | |
---|---|---|
blocking2.0 | --- | final+ |
People
(Reporter: mounir, Assigned: mounir)
References
Details
Attachments
(2 files, 1 obsolete file)
381 bytes,
text/html
|
Details | |
10.65 KB,
patch
|
bzbarsky
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
We need to propagate the disabled state change to the anonymous content.
Even if it doesn't look disabled, it is.
Updated•14 years ago
|
blocking2.0: --- → ?
blocking2.0: ? → final+
Assignee | ||
Comment 1•14 years ago
|
||
Assignee | ||
Comment 2•14 years ago
|
||
How do content states work with anonymous children? It looks like they got the same state as their parents. Here, the button inside <input type='file'> correctly update its state but the text inside the button doesn't. If I call SetContentState() with any state on anonymous content, when the disabled state of the <input type='file'> changes, everything is fine.
Could that be a bug with content states updates?
Olli, can you answer comment #2?
Comment 4•14 years ago
|
||
Actually David has done more work with content states.
I need to read some code before answering...
Comment 5•14 years ago
|
||
> How do content states work with anonymous children?
Hmm... They should Just Work, generally.
> It looks like they got the same state as their parents.
Er... no. They don't. They get an independent state.
It looks like in this case, the anonymous button is inheriting its border color from its ancestor (so it changes when you toggle the fieldset) but not actually changing its own state, right? And specifically, that changing the <select>'s disabled state doesn't send a ContentStatesChanged notification for it or something? Or does it?
Assignee | ||
Comment 6•14 years ago
|
||
(In reply to comment #5)
> It looks like in this case, the anonymous button is inheriting its border color
> from its ancestor (so it changes when you toggle the fieldset) but not actually
> changing its own state, right?
Indeed.
> And specifically, that changing the <select>'s
> disabled state doesn't send a ContentStatesChanged notification for it or
> something? Or does it?
Hmm, I don't follow. did you meant <legend> instead of <select>? In that case, yes, it should notify. Otherwise, I don't follow why you are speaking of <select>.
But I still don't understand why a call to SetContentStates() fix the issue with the button text color?
Comment 7•14 years ago
|
||
Er, I meant "fieldset", not "select". I just checked in a debugger, and there is no ContentStatesChanged for the anon inputs when the select state is toggled.
If you call SetContentState() on the anon content what state are you passing to it? Presumably ContentStatesChanged in that situation just ends up triggering a style reresolve...
Assignee | ||
Comment 8•14 years ago
|
||
(In reply to comment #7)
> Er, I meant "fieldset", not "select". I just checked in a debugger, and there
> is no ContentStatesChanged for the anon inputs when the select state is
> toggled.
Indeed, ContentStatesChanged is called on the <input type='file'> inside the <fieldest> but not explicitely on anonymous content and I guess that might explain why SetContentState correctly update the style.
I'm wondering what would be the right way to fix this.
1. Can we consider that if the anonymous inputs have the correct style (disabled), it will be fine even if they are not really disabled? Given that no events can go through the <input type='file'> when disabled, I guess yes but I might be wrong.
2. Should we call ContentStatesChanged on anonymous children when ContentStatesChanged is called for an <input type='file'>? Should we make sure that the disabled state is correctly set in IntrinsicState() for the anonymous children? (related to 1.). This seem a bit ugly to me but I don't really know what is possible.
Comment 9•14 years ago
|
||
> Can we consider that if the anonymous inputs have the correct style
> (disabled), it will be fine even if they are not really disabled?
Imo, yes. Getting them to have the right style almost certainly involves them having the right intrinsic state.
Assignee | ||
Comment 10•14 years ago
|
||
(In reply to comment #9)
> > Can we consider that if the anonymous inputs have the correct style
> > (disabled), it will be fine even if they are not really disabled?
>
> Imo, yes. Getting them to have the right style almost certainly involves them
> having the right intrinsic state.
As I said, I was able to get them to have the right style without the right intrinsic state.
Comment 11•14 years ago
|
||
Whether you can or not depends on your OS and theme, no?
Assignee | ||
Comment 12•14 years ago
|
||
This seems to be easily fixable by introducing a ContentStatesChanged method to nsIFrame.
FWIW, I think this would be useful for other form controls (non-implemented HTML5 input types) at least.
Assignee: nobody → mounir.lamouri
Status: NEW → ASSIGNED
Attachment #493844 -
Flags: review?(bzbarsky)
Comment 13•14 years ago
|
||
Comment on attachment 493844 [details] [diff] [review]
Patch v1
1) Setting attrs inside ContentStatesChanged directly is unsafe. It needs to
happen off a script runner, at least.
2) You need to change the IID of nsIFrame if you want to add methods to it.
And you can't do that on trunk for 2.0....
3) There's no good reason for this to be NS_IMETHOD if/when we do add it to
nsIFrame; just make it virtual void?
4) Are we ok with the perf loss of an extra virtual call per
ContentStatesChanged on anything with a frame? I guess it shouldn't be
too bad.
I'd like either roc or dbaron to sr the nsIFrame change, if we still want to make it.
Attachment #493844 -
Flags: review?(bzbarsky) → review-
(In reply to comment #13)
> 2) You need to change the IID of nsIFrame if you want to add methods to it.
> And you can't do that on trunk for 2.0....
nsIFrame doesn't have an IID anymore, so this is a non-issue. yay!
Comment 15•14 years ago
|
||
Well, more to the point you can't change the vtable for 2.0, right?
I asked bsmedberg about this and he claimed that we can. See
https://bugzilla.mozilla.org/show_bug.cgi?id=581596#c78
and context.
Comment 17•14 years ago
|
||
But we _know_ binary extensions use nsIFrame... am I just missing something?
Comment 18•14 years ago
|
||
I was under the impression that it was impossible for extensions to use nsIFrame any more, partly because we added a MOZILLA_INTERNAL_API guard somewhere.
Assignee | ||
Comment 19•14 years ago
|
||
1. Fixed.
2. I saw there were no IID so I assumed it was fine.
3. Fixed.
4. Actually, I chose to do that instead of making nsFileControlFrame observing ContentStatesChanged because I will have to use this kind of behavior for other elements like <input type='number'> which will have a few anonymous content. If this seems to be a very specific need (IOW, if it sounds there is no other use case), I would understand to not add this virtual call. But, to me, with very small knowledge of the layout code, it doesn't sound useless to have this method in nsIFrame.
Attachment #493844 -
Attachment is obsolete: true
Attachment #493988 -
Flags: superreview?(roc)
Attachment #493988 -
Flags: review?(bzbarsky)
Comment 20•14 years ago
|
||
> partly because we added a MOZILLA_INTERNAL_API guard somewhere.
I don't see any such guards on nsIFrame or on the GetPrimaryFrame method of nsIContent...
So I'd bet money that things like roboform are still using nsIFrame.
Can we add such guards?
Attachment #493988 -
Flags: superreview?(roc) → superreview+
Assignee | ||
Updated•14 years ago
|
Whiteboard: [needs-review]
Comment 22•14 years ago
|
||
Comment on attachment 493988 [details] [diff] [review]
Patch v2
>+ * This call is invoked when the content states of a content object's is
>+ * changed.
>+ * The first frame that maps that content is asked to deal with the change
>+ * by doing whatever is appropriate.
How about:
When the content states of a content object change, this method is invoked on
the primary frame of that content object.
r=me with that.
Attachment #493988 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Updated•14 years ago
|
Whiteboard: [needs-review] → [needs-landing]
Assignee | ||
Updated•14 years ago
|
Whiteboard: [needs-landing] → [needs-landing][passed-try]
Assignee | ||
Comment 23•14 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [needs-landing][passed-try]
Target Milestone: --- → mozilla2.0b9
You need to log in
before you can comment on or make changes to this bug.
Description
•