Closed Bug 33557 Opened 24 years ago Closed 24 years ago

background-color: inherit on html:input type="text" only appears to check for background color on parent node

Categories

(Core :: DOM: Editor, defect, P3)

x86
Windows 98
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: bugs, Assigned: pierre)

Details

Attachments

(2 files)

e.g.


<html>
<head>
  <style type="text/css">
  #boo {
    background-color: blue;
  }
  #foo {
    border: 1px solid red;
    background-color: inherit;
    color: white;
  }
  </style>
</head>

<body>

<div id="boo">
<div>
<input type="text" id="foo"/>
</div>
</div>
</body>
</html>

Note the extra div separating foo from boo. When you try this example, you'll 
notice that the initial display is /correct/, however when the widget is 
focussed, it defaults to white. 

Now remove the extra div, so that boo is the direct parent of foo. Try the 
example again and you'll find that when you focus the widget, the background 
colour is maintained.

What this appears to be doing is only looking for bgcolors to inherit on the 
parent node, and if one is not specified, giving up and not going any further.
This is required for skinnability, beta2. 
Keywords: beta2
Simon--can you look into this?
Assignee: brade → sfraser
Target Milestone: --- → M15
Is this the same as 20572?
OK, this is too hard for my little brain.

Before we instantiate the editor, the background of the text field is painted by 
a container frame (the DIV frame, I presume), so the text field never actually 
gets that background color.

When we instantiate the editor, nsGfxTextControlFrame::InitializeTextControl()
gets the background color from a call to mStyleContext->GetStyleData(), which 
returns gray for the background color of the text field.

So I've no idea how to fix this. Should 
nsGfxTextControlFrame::InitializeTextControl() walk up the frame container 
hierarchy, looking for a parent frame that sets the background color?
Status: NEW → ASSIGNED
The problem is possibly coming from the code that propogates the background color 
from a text control to its embedded webshell (see bug 22926). IMO, the thing 
which is happening is that we propagate to the webshell the background-color from 
the parent, and if the parent's color has not been set, we propagate the default 
value which is 'transparent'. The bug doesn't happen if the background is 
'inherited' certainly because then we inherit from the grand-parent's color.

Maybe the style system should interpret "background: transparent" as "background: 
inherit". I don't understand the difference between a transparent and an 
inherited background anyhow. It is interesting to note that 'inherit' was not 
legal in CSS1. It came with CSS2.
I have a fix: reassigned to myself.
Assignee: sfraser → pierre
Status: ASSIGNED → NEW
Fix checked in nsCSSStyleRule.cpp
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
rock! thanks, pierre!
Thanks pierre!
verified in 4/4 build.
Status: RESOLVED → VERIFIED
Keywords: nsbeta2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: