Closed
Bug 286895
Opened 20 years ago
Closed 18 years ago
[FIX]certain seemingly-irrelevant userContent.css settings break forms completely
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha5
People
(Reporter: ssb22, Assigned: bzbarsky)
References
Details
Attachments
(1 file)
11.88 KB,
patch
|
dbaron
:
review+
dbaron
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1
If you put the following in userContent.css:
div:first-letter { color: inherit ! important;
background: inherit ! important; }
then all TEXTAREAs will not work properly (try typing something, press
Enter, then continue typing - various strange things happen to the text
you are entering). This does NOT happen when using :first-letter with
any other element, only DIV (and the universal selector which includes
DIV). I tested on a blank page with only a TEXTAREA.
Additionally, drop-down boxes sometimes do not display properly
(depending on your other CSS settings e.g. colours and sizes of fonts) -
I was unable to make a complete catalogue of when this does/doesn't
happen but you can see some of the effects using ONLY the above in your
userContent.css. Ensuring that your userContent.css does not override
DIV:first-letter (either directly or indirectly) seems to solve ALL the
problems.
Additionally, if you override :first-line (which includes TD:first-line,
TR:first-line etc) then the cursor can be positioned completely wrongly
when typing data into input boxes that occur within tables (the cursor
can be placed on another form field or in a seemingly random place
instead of in the box you're typing), and your text can be shown in the
wrong place also.
Reproducible: Always
Steps to Reproduce:
See above
Actual Results:
See above
Expected Results:
worked properly
You can see my complete stylesheets at
http://www.cus.cam.ac.uk/~ssb22/source/lv-css.html but again I emphasize
that the above test works with only the given snippet in userContent.css
and nothing else.
Comment 1•20 years ago
|
||
<textarea>s contain <div>s in Mozilla. And userContent.css applies to those
<div>s. (Normal author CSS doesn't.)
![]() |
Assignee | |
Comment 2•20 years ago
|
||
Yeah... perhaps we shouldn't apply user stylesheets to native anonymous content?
I guess the problem is people styling scrollbars?
Comment 3•20 years ago
|
||
Assuming we ever manage to make scrollbars native anonymous...
Perhaps we need a userScrollbars.css ;-)
Simply add "div {background-color: red;}" to userContent.css and all your
<Textarea> and <input type="text" ... > controls will have a red background.
But the expected result is a white background (the default).
I don't see what this has to do with scrollbars. I am not trying to style any
scrollbars, but I want my DIVs and Ps to have a certain background color and I
want my TEXTAREAs and INPUTs to have a different background color.
Adding a css rule for DIV in userContent.css should not affect a textarea or
text input control.
I forgot to mention that this happens with
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.9) Gecko/20050713
Firefox/1.0.5
and also
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050701
And please see <a href="#c2">comment 2</a> for the solution, please.
I don't think that this is still an unconfirmed bug, if several testcases are
presented and if Ian Hickson gives the reason for this bug.
Thank you for your time.
![]() |
Assignee | |
Comment 8•20 years ago
|
||
So let me make this clear:
I want to change the look and feel of element A. I do so and suddenly also the
look and feel of element B changes.
Expected behavior: ONLY element A should change, since that is what I specified.
You think that is not bug?? Well - you may as well close this bug then.
Where I work we fix bugs and make our customers happy by doing so.
![]() |
Assignee | |
Comment 10•19 years ago
|
||
Rather, you change element A and B changes because B depends on A. The fact
that you didn't realize that doesn't make it a bug in the layout engine, just a
matter of education.
Back to the question in comment 2. Do people ever style scrollbars for
<textarea> and such via userContent.css?
Comment 11•19 years ago
|
||
From a web developer perspective a "<textarea>" has nothing to do with an
"<input type="text" ... >". These are two completely different html elements.
That internally you are using a textarea to create an input field is Mozilla's
problem. And not my problem.
When I specify that I want to modify the behavior of html element A (a textarea)
then a completely unrelated html element B (an input field) should not change.
Assignee: nobody → dbaron
Status: UNCONFIRMED → NEW
Component: Layout: Form Controls → Style System (CSS)
Ever confirmed: true
QA Contact: layout.form-controls → ian
We should fix this.
The internals of our form controls should be exposed as little as possible
unless we want them to be a stable API.
![]() |
Assignee | |
Comment 13•19 years ago
|
||
Then we should also disable styling of form control and document scrollbars via
userContent.css and be done with it....
Comment 14•19 years ago
|
||
Disabling or removing a feature is not how you fix bugs.
Do not apply user stylesheets to native anonymous content is the solution.
David - thank you for your support.
(In reply to comment #13)
> Then we should also disable styling of form control and document scrollbars via
> userContent.css and be done with it....
Agreed, at least until we have a potentially-standardizable solution for styling
them.
![]() |
Assignee | |
Comment 16•19 years ago
|
||
> Do not apply user stylesheets to native anonymous content is the solution.
Scrollbars ARE native anonymous content. So we would be "disabling or removing
a feature".
Another question. What about user style sheets and XBL anonymous content (so
not native anonymous). This has exactly the same issues, it seems to me.
Unfortunately I suspect people won't see it that way...
![]() |
Assignee | |
Comment 17•19 years ago
|
||
OK. So given bug 164617 scrollbars are perhaps not an issue. What about XBL?
That is, should userContent.css and userChrome.css apply to XBL anonymous content when the binding says that document sheets should not apply to it?
I'm tempted to say "no". But that lets page authors create chunks of content not stylable via userContent.css, which seems undesirable...
![]() |
Assignee | |
Comment 18•18 years ago
|
||
The nsStyleSet changes fix the bug. The rest is just to make it easy to catch bogus binding parents....
Oh, and of course for XUL document's and scrollbars this won't help, since the frame constructor special-cases that. Have I mentioned lately how much I hate XUL?
Assignee: dbaron → bzbarsky
Status: NEW → ASSIGNED
Attachment #252029 -
Flags: superreview?(dbaron)
Attachment #252029 -
Flags: review?(dbaron)
![]() |
Assignee | |
Comment 19•18 years ago
|
||
Oh, I left user*.css applying to XBL anonymous content.
Which means that they _might_ apply to the insides of scrollbars. To fix that I'd have to actually walk the bindingParent() chain to see whether I ever get the same node. I suppose I could do that, though. Let me know?
Summary: certain seemingly-irrelevant userContent.css settings break forms completely → [FIX]certain seemingly-irrelevant userContent.css settings break forms completely
Target Milestone: --- → mozilla1.9alpha
Comment on attachment 252029 [details] [diff] [review]
Fix
We shouldn't apply author styles in these cases either. Could you at least assert that what the binding manager returns always includes this result (in other words, we never apply author styles when we don't apply user styles) -- although it might be preferable to check it explicitly. r+sr=dbaron with that
Is the XXXldb comment in nsBindingManager::WalkRules something we could do? Should we file a bug on that?
Attachment #252029 -
Flags: superreview?(dbaron)
Attachment #252029 -
Flags: superreview+
Attachment #252029 -
Flags: review?(dbaron)
Attachment #252029 -
Flags: review+
(In reply to comment #20)
> Is the XXXldb comment in nsBindingManager::WalkRules something we could do?
> Should we file a bug on that?
The comment was only in my tree, and it said:
Could we use nsIContent::IsNativeAnonymous instead of this hack?
("this hack" being the GetBindingParent returning the same node).
![]() |
Assignee | |
Comment 22•18 years ago
|
||
Added a check for !skipUserStyles in addition to the existing !cutOffInheritance checks, and fixed. Not sure how to test this...
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Target Milestone: mozilla1.9alpha1 → mozilla1.9alpha5
![]() |
Assignee | |
Comment 23•18 years ago
|
||
Ah, yeah. We can't do that, because IsNativeAnonymous() lies for XUL. See the XUL checks in the asserts in this patch. :(
Comment 24•18 years ago
|
||
Would adding some sort of functionality to Mochitest to create a userContent.css file (and add rules to it) be appropriate here, or is there another way to do this? Not sure how we'd handle this since it'd require a browser restart to pick up these rules...
You need to log in
before you can comment on or make changes to this bug.
Description
•