Closed Bug 414851 Opened 15 years ago Closed 15 years ago

CSS whitespace: nowrap not respected when inherited from a cell by a button


(Core :: Layout: Form Controls, defect)

Not set





(Reporter: jsp, Assigned: jruderman)



(Keywords: regression, testcase)


(2 files)

Attached file testcase
According to the CSS 2.1 specification, the value of the whitespace property is inherited.  This has broken in one case in Firefox 3 beta 2: when a button is contained in a cell.  If the cell specifies nowrap, any text in the button should not wrap, but it does.

This appears to be specific to the button-in-a-cell case, since whitespace: nowrap is respected in the following scenarios:
- nowrap is specified on the button directly
- rather than a button, a div is the contained element
- rather than a cell, a span is the containing element
- rather than a cell, a floated div is the containing element
According to DOM Inspector, the button's computed white-space value is "normal" because resource://gre/res/forms.css contains

button {
  /* Buttons should lay out like "normal" html, mostly */
  white-space: normal;  
  text-indent: 0;

This is a "user agent stylesheet", and the CSS spec talks about user agent stylesheets, so I don't think this is a spec violation.  But it looks like the intent of that line is to override a rule earlier in the same stylesheet, so I think it is unintentional, and easy to fix.,483#458

Dunno why Firebug was telling you something different.
Blocks: 55285
Keywords: testcase
The <span> test doesn't apply here, since there is no constraint on the available width there.

Yeah, we migh want to rearrange the rules in forms.css to take this out... Jesse, want to write up a patch?
Component: Layout → Layout: Form Controls
OS: Windows XP → All
QA Contact: layout → layout.form-controls
Hardware: PC → All
Sure.  Should I split "white-space: pre;" out of the large rule, or should I change the small rule to specify "inherit" instead of "normal"?
Specifying "inherit" seems simpler.
Keywords: regression
Assignee: nobody → jruderman
Attached patch patchSplinter Review
Think this patch should go in for 1.9 or after 1.9?
Attachment #302495 - Flags: superreview?(bzbarsky)
Attachment #302495 - Flags: review?(bzbarsky)
Comment on attachment 302495 [details] [diff] [review]

I think it's reasonable to take this for 1.9...
Attachment #302495 - Flags: superreview?(bzbarsky)
Attachment #302495 - Flags: superreview+
Attachment #302495 - Flags: review?(bzbarsky)
Attachment #302495 - Flags: review+
Attachment #302495 - Flags: approval1.9?
Attachment #302495 - Flags: approval1.9? → approval1.9+
Fix (including reftest) checked in.
Closed: 15 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.