Closed
Bug 359903
Opened 18 years ago
Closed 18 years ago
[FIX][reflow branch] Form buttons have improper text alignment
Categories
(Core :: Layout: Form Controls, defect, P1)
Core
Layout: Form Controls
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha1
People
(Reporter: alex+list, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
(Whiteboard: [ComputeSize aAvailableWidth])
Attachments
(4 files)
(deleted),
text/html
|
Details | |
(deleted),
patch
|
dbaron
:
review-
|
Details | Diff | Splinter Review |
(deleted),
patch
|
bzbarsky
:
review-
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061107 Minefield/3.0a1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061107 Minefield/3.0a1
The text inside form buttons is not centered as it should be, but aligned farther to the right.
Take a look at any button here on Bugzilla, or anywhere else.
Reproducible: Always
Comment 1•18 years ago
|
||
Updated•18 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 2•18 years ago
|
||
Hrmph. This used to work; the tests at http://lxr.mozilla.org/seamonkey/source/layout/html/tests/formctls/base/button_overconstrained.html http://lxr.mozilla.org/seamonkey/source/layout/html/tests/formctls/base/button_overconstrained_strict.html http://lxr.mozilla.org/seamonkey/source/layout/html/tests/formctls/base/input_button_overconstrained_strict.html
http://lxr.mozilla.org/seamonkey/source/layout/html/tests/formctls/base/input_button_overconstrained.html
used to pass...
Assignee | ||
Comment 3•18 years ago
|
||
So this is a ComputeSize regression. nsHTMLButtonControlFrame::ReflowButtonContents munges the availSize of the child reflow state, but the child area frame no longer uses the availSize for its sizing -- it now uses the mComputedWidth.
Assignee | ||
Comment 4•18 years ago
|
||
Assignee | ||
Updated•18 years ago
|
OS: Windows XP → All
Priority: -- → P1
Hardware: PC → All
Summary: [reflow branch] Form buttons have improper text alignment → [FIX][reflow branch] Form buttons have improper text alignment
Target Milestone: --- → mozilla1.9alpha
Comment 5•18 years ago
|
||
This was fixed by switching ComputeSize to use aAvailableWidth.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: [ComputeSize aAvailableWidth]
Comment 6•18 years ago
|
||
Comment on attachment 247372 [details] [diff] [review]
Fix
minusing since patch is no longer needed
Attachment #247372 -
Flags: review?(dbaron) → review-
Comment 8•18 years ago
|
||
So test 1 is currently failing on Mac, and it seems like it ought to for any platforms without native-theme buttons. The rule on forms.css line 448 gives buttons 6px of horizontal padding.
Now, what I don't understand is why the failure manifests itself only as a difference in subpixel positioning of the "M" glyph. (It looks like Mac does subpixel positioning of text.)
Assignee | ||
Comment 9•18 years ago
|
||
The rule in forms.css is more or less ignored for too-small button widths due to the code at http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/layout/forms/nsHTMLButtonControlFrame.cpp&rev=3.216&mark=355-372,378#354
As for subpixel positioning, we should probably round extraleft to the nearest pixel.
Assignee | ||
Comment 10•18 years ago
|
||
David, does that make your tests pass?
Attachment #253974 -
Flags: review?(dbaron)
Comment 11•18 years ago
|
||
Why do you expect this to help?
Assignee | ||
Comment 12•18 years ago
|
||
Well, the only way I can think of for the text to not end up on a pixel boundary is if extraleft is an odd number of pixels and we end up with extraleft being a non-integral pixel offset....
Comment 13•18 years ago
|
||
And no, it does not make the test pass.
Assignee | ||
Comment 14•18 years ago
|
||
Comment on attachment 253974 [details] [diff] [review]
Round to the nearest pixel
OK. Which way is the test image text offset from the ref?
Attachment #253974 -
Flags: review?(dbaron) → review-
Comment 15•18 years ago
|
||
So, the differences between test and reference according to frame dumps are:
ButtonControl (input): width=293 (in both test and reference)
Area (input): test width=143 reference width=180
test overflow width=168; no overflow in reference
Text: width=168 (in both test and reference)
test x=0 reference x=6
Comment 16•18 years ago
|
||
The Area frame is at x=75 in both test and reference.
Comment 17•18 years ago
|
||
Oh, and that's all *with* your patch above.
Assignee | ||
Comment 18•18 years ago
|
||
Oh. Right. The problem is that in the reference the area is wider than the text, so the text-align:center kicks in and (180-168)/2 == 6 is exactly how far to the right it gets moved.
Does setting "text-align: left" on the reference button fix the issue?
Comment 19•18 years ago
|
||
Yes, putting text-align: left on the input in 359903-1-ref.html makes the test pass.
(But under what conditions should things really be centered? It seems like currently both are off-center, but by different amounts.)
Comment 20•18 years ago
|
||
(That said, adding text-align:left to both the reference *and* the test and then filing another bug for the centering might be the best path forward.)
Assignee | ||
Comment 21•18 years ago
|
||
Basically, the text is centered within the Area (whatever "text-align: center" does, including whatever it does when the text is wider than the Area). The problems start if the Area is wider than the content-width of the button. We attempt to center it within the button anyway by overlapping it with the left padding, up to the point where the left edge of the Area is up against the left padding edge.
So if the Area's width is wider than the padding-box width of the button the text will not really end up centered in the button overall...
I'm seeing this failure in my Linux build too.
Assignee | ||
Comment 23•18 years ago
|
||
> That said, adding text-align:left to both the reference *and* the test
Checked in this change.
Comment 24•18 years ago
|
||
...which makes 359903-1 pass and makes 359903-2 fail.
Assignee | ||
Comment 25•18 years ago
|
||
Ugh. Let me look into that.
Assignee | ||
Comment 26•18 years ago
|
||
Er, yeah. That change to -2 was just wrong; I backed it out. I should figure out why it was passing here...
You need to log in
before you can comment on or make changes to this bug.
Description
•