Last Comment Bug 322890 - Input type="file" has opaque/white background
: Input type="file" has opaque/white background
Status: RESOLVED FIXED
[camino-1.0][camino-1.0.1]
: fixed1.8.0.4, fixed1.8.1
Product: Core
Classification: Components
Component: Layout: Form Controls (show other bugs)
: 1.8 Branch
: All All
: -- normal (vote)
: mozilla1.8.1
Assigned To: Boris Zbarsky [:bz] (TPAC)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-09 21:25 PST by Smokey Ardisson (offline for a while; not following bugs - do not email)
Modified: 2006-08-15 17:23 PDT (History)
10 users (show)
jaymoz: blocking1.8.0.4+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
testcase (463 bytes, text/html)
2006-01-09 21:28 PST, Smokey Ardisson (offline for a while; not following bugs - do not email)
no flags Details
patch (708 bytes, patch)
2006-01-09 22:29 PST, Smokey Ardisson (offline for a while; not following bugs - do not email)
no flags Details | Diff | Splinter Review
patch v2 (712 bytes, patch)
2006-01-09 23:30 PST, Smokey Ardisson (offline for a while; not following bugs - do not email)
no flags Details | Diff | Splinter Review
Expanded testcase including all possible form input elements (2.69 KB, text/html)
2006-01-10 22:23 PST, Chris Lawson (gone)
no flags Details
Even more expanded testcase (2.88 KB, text/html)
2006-01-10 23:12 PST, Chris Lawson (gone)
no flags Details
"Even more expanded testcase" as we currently see it in Camino (95.06 KB, image/png)
2006-01-12 01:33 PST, Smokey Ardisson (offline for a while; not following bugs - do not email)
no flags Details
"Even more expanded testcase" with Chris's hacked forms.css (96.55 KB, image/png)
2006-01-12 01:35 PST, Smokey Ardisson (offline for a while; not following bugs - do not email)
no flags Details
prevents painting a background on the file widget (1.12 KB, patch)
2006-01-12 22:37 PST, Chris Lawson (gone)
dbaron: review+
dbaron: superreview+
dbaron: approval‑branch‑1.8.1-
Details | Diff | Splinter Review
Updated to dbaron's comments -- check in this one (1.49 KB, patch)
2006-02-05 09:03 PST, Boris Zbarsky [:bz] (TPAC)
dbaron: approval‑branch‑1.8.1+
dveditz: approval1.8.0.2-
timr: approval1.8.0.4+
Details | Diff | Splinter Review
Additional patch to do that (for 1.8/1.8.0 branches only) (1.00 KB, patch)
2006-04-05 16:55 PDT, Boris Zbarsky [:bz] (TPAC)
roc: review+
roc: superreview+
roc: approval‑branch‑1.8.1+
dveditz: approval1.8.0.4+
Details | Diff | Splinter Review

Description Smokey Ardisson (offline for a while; not following bugs - do not email) 2006-01-09 21:25:34 PST
If the parent/ancestor element of an <input type="file"> element has a background color other than white specified and the <input type="file"> element has no bgcolor specified, the area between the button and the input, as well as the "corners" of the gfx button area, still appear white.  These areas should inherit the bg color of the parent/ancestor.  Fx does this correctly.
Comment 1 Smokey Ardisson (offline for a while; not following bugs - do not email) 2006-01-09 21:28:10 PST
Created attachment 208056 [details]
testcase

Compare Camino's rendering to Firefox's
Comment 2 Chris Lawson (gone) 2006-01-09 21:29:52 PST
As you can see in the testcase, this is only a problem with INPUT TYPE=FILE and not with other input boxes or buttons.

cl
Comment 3 Chris Lawson (gone) 2006-01-09 21:51:53 PST
Another forms.css issue. Smokey's got the patch on this one.

cl
Comment 4 Smokey Ardisson (offline for a while; not following bugs - do not email) 2006-01-09 22:29:13 PST
Created attachment 208062 [details] [diff] [review]
patch

So this fixes the issue by adding

input[type="file"] {
  background-color: inherit;
}

to the top of the "input" rules in the Cocoa section of forms.css so as not to mess with Fx or the rest of our cascade.

I haven't run this through the battery of form widget tests I used with the last bug yet, so I'm not requesting reviews until I do some testing later in the week (plus I'd like some thoughts on whether this could potentially break anything, but so far Chris and I haven't come up with anything).
Comment 5 Smokey Ardisson (offline for a while; not following bugs - do not email) 2006-01-09 23:30:32 PST
Created attachment 208064 [details] [diff] [review]
patch v2

The braintrust on irc decided that "transparent" was more appropriate than "inherit"; the same caveats apply.
Comment 6 Smokey Ardisson (offline for a while; not following bugs - do not email) 2006-01-09 23:54:22 PST
Comment on attachment 208064 [details] [diff] [review]
patch v2

This doesn't work, though.  Either it needs to special-case the text part of the input, or we need to go back to v1.

Right now the text field is transparent, which is bad.  Sorry for the bugspam.
Comment 7 Chris Lawson (gone) 2006-01-10 21:36:41 PST
Line 556 in forms.css is what broke this.

http://lxr.mozilla.org/mozilla/source/layout/style/forms.css#556

We force the -moz-field background colour on the all input elements, including input type=file.

For reasons I don't yet understand, overriding it in line 684/685 by inserting

background-color: transparent;

doesn't work.

cl
Comment 8 Chris Lawson (gone) 2006-01-10 22:23:54 PST
Created attachment 208175 [details]
Expanded testcase including all possible form input elements

As you can see in this testcase, we also do the wrong thing on disabled INPUT TYPE=IMAGE backgrounds. We should try to fix this as well.

cl
Comment 9 Chris Lawson (gone) 2006-01-10 23:12:37 PST
Created attachment 208179 [details]
Even more expanded testcase

Adds untyped INPUT element (defaults to TEXT according to spec) to testcase.

I've sent a doctored forms.css file to Smokey for his perusal/testing. Will make a patch (or Smokey can) around the weekend.

cl
Comment 10 Chris Lawson (gone) 2006-01-10 23:13:45 PST
Tweaking summary to reflect comment 7.

cl
Comment 11 Smokey Ardisson (offline for a while; not following bugs - do not email) 2006-01-11 14:38:47 PST
I think Sam's screenshot http://www.samuelsidler.com/camino/bugs/322890.png shows that Chris was right and this really is a Core bug.  

That said, it's barely noticeable on WinXP (which is the only other place it appears so far), so we may still want to consider fixing this ourselves in the Cocoa section because it really affects Camino and makes things ugly.

I'm going to give Chris's latest forms.css a spin later tonight.
Comment 12 Chris Lawson (gone) 2006-01-11 17:16:47 PST
--> Core per josh on IRC, after seeing the screenshot in comment 11.

cl
Comment 13 Chris Lawson (gone) 2006-01-11 17:18:37 PST
Hardware/OS -> All/All, also per comment 11.

This affects Camino the worst, and affects XP stuff as well. It will probably affect Firefox/Mac when the switch to Cocoa widgets is complete.

cl
Comment 14 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2006-01-12 00:42:36 PST
So, it seems like the obvious solution here would be to add 'background: transparent' to the input[type="file"] rule in forms.css and remove the 'background-color: inherit' from the input[type="file"] > input[type="text"][disabled] rule.  That would change the color in any pages that specify a background color for a file input, though.  I'm not sure if anyone cares.  I certainly don't; I'd rather all these rules were !important.
Comment 15 Smokey Ardisson (offline for a while; not following bugs - do not email) 2006-01-12 01:31:19 PST
Sam asked me to post some screenshots of what we currently see in Camino and then what we see with Chris's hacked forms.css; those are forthcoming.

The hacked forms.css I think is generally in line with dbaron's suggestion in comment 14 (though there are lots of tiny changes in there messing with line numbers and making it hard for me to tell for sure)--but with those rules applied only in the Cocoa section--plus a Cocoa-section fix for the white/opaque bg in disabled input[type=image].

Since this is now a Core bug that affects multiple products and platforms, I don't think it's appropriate for me to own it any longer.
Comment 16 Smokey Ardisson (offline for a while; not following bugs - do not email) 2006-01-12 01:33:03 PST
Created attachment 208258 [details]
"Even more expanded testcase" as we currently see it in Camino
Comment 17 Smokey Ardisson (offline for a while; not following bugs - do not email) 2006-01-12 01:35:42 PST
Created attachment 208259 [details]
"Even more expanded testcase" with Chris's hacked forms.css
Comment 18 Chris Lawson (gone) 2006-01-12 19:03:58 PST
The patch that bz gave me on IRC fixes the original issue (FILE input).

We can take the second issue separately in Camino.

cl
Comment 19 Chris Lawson (gone) 2006-01-12 22:37:48 PST
Created attachment 208354 [details] [diff] [review]
prevents painting a background on the file widget

This is the patch bz gave me on IRC last night. It fixes the issue in a trunk build of Camino that I built. Unfortunately, that's all the testing I can offer at this time. (I don't have access to a Windows machine for building, although I'd be happy to test a custom build if someone else can build it.)

Could someone more knowledgeable about Windows widgets please have a look at the SUBMIT button in the screenshot in comment 11? I can't tell if the white line under the button is supposed to be there or not.

cl
Comment 20 Boris Zbarsky [:bz] (TPAC) 2006-01-12 22:47:25 PST
Comment on attachment 208354 [details] [diff] [review]
prevents painting a background on the file widget

It's pretty silly for me to review a patch I basically wrote... ;)
Comment 21 Samuel Sidler (old account; do not CC) 2006-01-12 22:49:06 PST
dbaron: We'd like this on the 1.8 branch and, if possible, on the 1.8.0 branch, though I know that's less likely. It should be low risk though.
Comment 22 Chris Lawson (gone) 2006-01-13 23:46:43 PST
Fixing summary to reflect current scope of bug. Apologies for the bugspam.

cl
Comment 23 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2006-01-19 15:11:19 PST
Comment on attachment 208354 [details] [diff] [review]
prevents painting a background on the file widget

Paint layers aren't really the ideal way to do this, but probably the best one available, at least until roc's rework lands.  But please add a comment explaining that the background is inherited to the text input.  But what about border and padding?  Have you tested the effects this has one those?
Comment 24 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2006-01-24 21:09:21 PST
Comment on attachment 208354 [details] [diff] [review]
prevents painting a background on the file widget

minusing for lack of response to questions
Comment 25 Boris Zbarsky [:bz] (TPAC) 2006-01-24 21:30:34 PST
Comment on attachment 208354 [details] [diff] [review]
prevents painting a background on the file widget

Sorry.  Didn't realize those were directed at me.

The relevant rule in forms.css is:

309 input[type="file"] {
...
315   padding: 0 !important;
316   border-style: none !important;
317 }

So there are no borders or padding.
Comment 26 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2006-01-24 21:45:03 PST
Given that roc's patch is going to land very soon, probably better to wait, since the solution once that lands will be far superior (you'll actually be able to skip the background and border explicitly).
Comment 27 Samuel Sidler (old account; do not CC) 2006-01-24 21:48:49 PST
(In reply to comment #26)
> Given that roc's patch is going to land very soon, probably better to wait,
> since the solution once that lands will be far superior (you'll actually be
> able to skip the background and border explicitly).
> 

I think we'd like to get this on the branch, if possible. It really looks horrible in Camino with our Cocoa widgets. Taking it on a minibranch is acceptable, but not desired. It would improve Fx as well.
Comment 28 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2006-01-24 22:01:42 PST
Comment on attachment 208354 [details] [diff] [review]
prevents painting a background on the file widget

ok, r+sr=dbaron, with comments above
Comment 29 Samuel Sidler (old account; do not CC) 2006-01-24 22:03:26 PST
Comment on attachment 208354 [details] [diff] [review]
prevents painting a background on the file widget

Requesting approval for both branches. This is a low risk-patch which helps form widgets visually and will especially help cocoa widgets (i.e. Camino). It's not being landed on the trunk for reasons explained in comment 26.
Comment 30 Samuel Sidler (old account; do not CC) 2006-01-24 22:06:13 PST
Reassigning this bug to bz since it's his patch.
Comment 31 Mike Pinkerton (not reading bugmail) 2006-01-26 10:18:06 PST
can someone poke drivers? we won't hold for this, but....
Comment 32 Samuel Sidler (old account; do not CC) 2006-01-30 11:47:28 PST
Comment on attachment 208354 [details] [diff] [review]
prevents painting a background on the file widget

Moving request to branch-1.8.1.

dbaron, since you own this, do you mind approving this for the 1.8.1 branch? (Still waiting on drivers for the 1.8.0 branch.)
Comment 33 Mark Mentovai 2006-02-02 20:41:01 PST
Checked in on CAMINO_1_0_BRANCH.
Comment 34 Boris Zbarsky [:bz] (TPAC) 2006-02-05 09:03:11 PST
Created attachment 210774 [details] [diff] [review]
Updated to dbaron's comments -- check in this one

Has someone filed a followup on doing this the right way on trunk?  If not, please do so.
Comment 35 Boris Zbarsky [:bz] (TPAC) 2006-02-05 14:58:03 PST
Fixed on the 1.8.1 branch.  Please do file a bug on fixing this on trunk, ok?
Comment 36 Samuel Sidler (old account; do not CC) 2006-02-05 15:04:57 PST
(In reply to comment #35)
> Fixed on the 1.8.1 branch.  Please do file a bug on fixing this on trunk, ok?
> 

Filed bug 326019 to evaluate how to fix it on the trunk.
Comment 37 Samuel Sidler (old account; do not CC) 2006-02-05 15:05:33 PST
Comment on attachment 208354 [details] [diff] [review]
prevents painting a background on the file widget

Approval should be on the other patch.
Comment 38 Samuel Sidler (old account; do not CC) 2006-02-05 15:06:36 PST
Comment on attachment 210774 [details] [diff] [review]
Updated to dbaron's comments -- check in this one

Requesting approval for this patch. See comment 29 for more information. r+sr=dbaron per comment 28.
Comment 39 Boris Zbarsky [:bz] (TPAC) 2006-02-05 15:16:23 PST
Samuel, please make sure to check that patch in when it gets approved... I won't get bugmail for it, since I didn't make the request.
Comment 40 Daniel Veditz [:dveditz] 2006-02-22 11:56:11 PST
Comment on attachment 210774 [details] [diff] [review]
Updated to dbaron's comments -- check in this one

not a 1.8.0.x blocker
Comment 41 Samuel Sidler (old account; do not CC) 2006-02-23 03:15:14 PST
bz, can you please request approval for the 1.8.0 branch using words more eloquent than mine? Thank you.
Comment 42 Boris Zbarsky [:bz] (TPAC) 2006-02-23 03:59:20 PST
I'm not sure I can, if nothing else because I have no idea what the scope of the problem is.  Someone who does and feels this is appropriate for a stability branch could mail drivers and explain why.
Comment 43 Samuel Sidler (old account; do not CC) 2006-03-07 16:25:26 PST
We'll need to take this on a minibranch for 1.0.1.
Comment 44 Samuel Sidler (old account; do not CC) 2006-03-07 17:01:43 PST
Comment on attachment 210774 [details] [diff] [review]
Updated to dbaron's comments -- check in this one

Per conversation with dveditz, requesting approval for 1.8.0.3.

This was tested in Camino (and is even in Camino 1.0) and was also tested in Firefox/Win and Firefox/Lin. It is low risk, visually affecting Camino-only (due to how Cocoa widgets are rendered), but will help Camino not minibranch for each release.
Comment 45 Tim Riley [:timr] 2006-04-05 11:58:42 PDT
Comment on attachment 210774 [details] [diff] [review]
Updated to dbaron's comments -- check in this one

Important camino patch.  a=timr for drivers.
Comment 46 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2006-04-05 12:01:58 PDT
I just realized this patch should be updated so that nsFileControlFrame::CanPaintBackground returns false.  Otherwise an expose that's entirely within the bounds of a file control could paint garbage.  Right?
Comment 47 Robert O'Callahan (:roc) (email my personal email if necessary) 2006-04-05 15:57:45 PDT
Yes.
Comment 48 Boris Zbarsky [:bz] (TPAC) 2006-04-05 16:55:50 PDT
Created attachment 217354 [details] [diff] [review]
Additional patch to do that (for 1.8/1.8.0 branches only)
Comment 49 Boris Zbarsky [:bz] (TPAC) 2006-04-07 13:22:30 PDT
Checked in additional patch to 1.8.1.  Waiting for that to get approval before landing both patches on 1.8.0.x.
Comment 50 Darin Fisher 2006-04-10 12:01:17 PDT
Comment on attachment 217354 [details] [diff] [review]
Additional patch to do that (for 1.8/1.8.0 branches only)

can someone comment on the risk/reward of this patch w.r.t. to the 1.8.0.x branch?  how badly do we want this?  is this also only going to affect builds with cocoa widgets?  thanks!
Comment 51 Boris Zbarsky [:bz] (TPAC) 2006-04-10 12:06:48 PDT
> can someone comment on the risk/reward of this patch w.r.t. to the 1.8.0.x
> branch? 

For the patch in question, the risk is 0 -- the "can paint background" thing is an optimization.

The reward is that we can land the already-approved patch in this bug.

Or is the question what the risk/reward analysis is for the already-approved patch?
Comment 52 Darin Fisher 2006-04-10 13:07:31 PDT
Thanks, that answers the question.  The relationship between the patches wasn't clear to me.
Comment 53 Samuel Sidler (old account; do not CC) 2006-04-18 15:01:34 PDT
Mark, when you get a chance, can you land the last patch here on CAMINO_1_0_1_MINIBRANCH?
Comment 54 Mark Mentovai 2006-04-18 15:14:54 PDT
Attachment 210774 [details] [diff], attachment 217354 [details] [diff] [review] landed on CAMINO_1_0_1_MINIBRANCH off of 1.8.0.2.
Comment 55 Daniel Veditz [:dveditz] 2006-04-19 12:17:17 PDT
Comment on attachment 217354 [details] [diff] [review]
Additional patch to do that (for 1.8/1.8.0 branches only)

approved for 1.8.0 branch, a=dveditz for drivers
Comment 56 Boris Zbarsky [:bz] (TPAC) 2006-04-19 19:43:15 PDT
Fixed on 1.8.0.3

Note You need to log in before you can comment on or make changes to this bug.