Closed
Bug 418294
Opened 16 years ago
Closed 16 years ago
[10.5] Text pop-up <select> is not vertically centered (1px too low)
Categories
(Core :: Widget: Cocoa, defect, P2)
Tracking
()
RESOLVED
FIXED
People
(Reporter: johan, Assigned: vlad)
References
()
Details
Attachments
(7 files, 3 obsolete files)
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9b3) Gecko/2008020511 Firefox/3.0b3 Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9b3) Gecko/2008020511 Firefox/3.0b3 It's one pixel off, not in the center. Reproducible: Always Steps to Reproduce: Render this HTML with Firefox 3 Beta 3: <select style="font-size: 12px;"> <option>Lorem ipsum</option> </select> <select style="font-size: 11px;"> <option>Lorem ipsum</option> </select> Actual Results: Wrong rendering Expected Results: Display the text exactly in the middle See Safari 3 for correct implementation.
Comment 1•16 years ago
|
||
Can you attach a screenshot of what you see ? (using the 'Add an attachment' link)
Component: OS Integration → Widget: Cocoa
Product: Firefox → Core
Version: unspecified → Trunk
Reporter | ||
Comment 2•16 years ago
|
||
Reporter | ||
Comment 3•16 years ago
|
||
Reporter | ||
Comment 4•16 years ago
|
||
I added 2 attachments, example shows the bug, the other shows how it should be.
Summary: Input type select text is not vertically centered → Text pop-up <select> is not vertically centered (1px too low)
Comment 5•16 years ago
|
||
Thanks, I don't see that on 10.4, but it is indeed the case on 10.5. The descenders ar touching the bottom edge of the widget. The text part is correctly aligned, but the 'aqua layer' is painted too high / or is no tall enough. Josh, I thought we had already a bug on this, but I can't find it atm.
QA Contact: os.integration → cocoa
Comment 6•16 years ago
|
||
Based on comment 0. On the second row, I added 1 px bottom padding to the select widget, that sort of 'fixes' the issue.
Reporter | ||
Comment 7•16 years ago
|
||
Re: p(In reply to comment #6) > Created an attachment (id=304120) [details] > test case > > Based on comment 0. > > On the second row, I added 1 px bottom padding to the select widget, that sort > of 'fixes' the issue. > It's better but not a 100%... it needs to use the calculated line height of the select box
Comment 8•16 years ago
|
||
So, I didn't find any dupes, or previous mention of this issue -> confirming (In reply to comment #7) That 1px bottom-padding is a hack , not a fix :-)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking1.9?
It looks like we have the same problem we had with push buttons - the native drawing routines will only draw particular sizes and nothing else. We're probably going to have to scale just like we do for push buttons.
Updated•16 years ago
|
Flags: tracking1.9+
Assignee | ||
Updated•16 years ago
|
Assignee: joshmoz → vladimir
Status: ASSIGNED → NEW
Summary: Text pop-up <select> is not vertically centered (1px too low) → [10.5] Text pop-up <select> is not vertically centered (1px too low)
Assignee | ||
Comment 10•16 years ago
|
||
Add some more dropdown sizes to the testcase
Assignee | ||
Comment 11•16 years ago
|
||
Would be helpful if someone could compile this and run on 10.4, and screenshot the result.. I only have 10.5 handy here, just want to make sure it's not affected.
Assignee | ||
Comment 12•16 years ago
|
||
This fixes things for me.. essentially, the result of the test program on 10.5 is that HITheme will happily scale things from 20px height and up, drawing the actual border 1px below the given rectangle (but using up 2 pixels below, to draw a shadow border). The original problem here was that we were decreasing the height by 2px instead of 1, so the dark border was being drawn too high. For below 20px, HITheme will only draw 18px or 15px, using whatever the nearest value is to the requested height. Note that there's no way to natively draw a 20px high "real" border, since specifying 20px will get you 21px, and specifying 19px will get you 18px. So, for desired heights 20 or below, that are not 15 or 18, we draw to an offscreen context and scale. This looks pretty good in practice.
Attachment #308763 -
Flags: review?(joshmoz)
Comment 13•16 years ago
|
||
Comment 14•16 years ago
|
||
Comment on attachment 308763 [details] [diff] [review] after all that, a patch This patch breaks focus rings. >@@ -1438,7 +1506,6 @@ nsNativeThemeCocoa::GetMinimumWidgetSize > { > SInt32 popupHeight = 0; > ::GetThemeMetric(kThemeMetricPopupButtonHeight, &popupHeight); >- aResult->SizeTo(0, popupHeight); > break; > } I don't doubt that the theme metric here is bogus, but just removing the result assignment is incorrect. We need to replace it with a hard-coded value (probably the right thing to do) and get rid of the then-useless ::GetThemeMetric call.
Attachment #308763 -
Flags: review?(joshmoz) → review-
Comment 15•16 years ago
|
||
Comment on attachment 308763 [details] [diff] [review] after all that, a patch + CGContextScaleCTM (ctx, 1.0f, -1.0f); Also space between the function name and opening arg "(" should be removed. Happens a bunch of places.
Assignee | ||
Comment 16•16 years ago
|
||
(In reply to comment #14) > (From update of attachment 308763 [details] [diff] [review]) > This patch breaks focus rings. > > >@@ -1438,7 +1506,6 @@ nsNativeThemeCocoa::GetMinimumWidgetSize > > { > > SInt32 popupHeight = 0; > > ::GetThemeMetric(kThemeMetricPopupButtonHeight, &popupHeight); > >- aResult->SizeTo(0, popupHeight); > > break; > > } > > I don't doubt that the theme metric here is bogus, but just removing the result > assignment is incorrect. We need to replace it with a hard-coded value > (probably the right thing to do) and get rid of the then-useless > ::GetThemeMetric call. Yeah, this was a typo, I meant to leave everything here as-is. It's odd that it doesn't seem to actually affect anything, which is weird, but that's to fix another day. Things seem to work fine even with the height coming from GetThemeMetric.
Assignee | ||
Comment 17•16 years ago
|
||
Updated patch, fixes focus ring stuff and whatnot.
Attachment #308763 -
Attachment is obsolete: true
Attachment #309561 -
Flags: review?(joshmoz)
Comment 18•16 years ago
|
||
Comment on attachment 309561 [details] [diff] [review] updated patch The dropdown buttons now render upside-down on Mac OS X 10.5. The horizontal shadow goes on the bottom of the control. See the top of any bugzilla bug report.
Attachment #309561 -
Flags: review?(joshmoz) → review-
Comment 19•16 years ago
|
||
In case it only renders upside down depending on the scaling path, I see the upside down problem with a frame height of 20.
Assignee | ||
Comment 20•16 years ago
|
||
Bah, I was even staring at it to make sure that the flip was right, but the scaling was throwing me off.
Attachment #309561 -
Attachment is obsolete: true
Attachment #310032 -
Flags: review?(joshmoz)
Comment 21•16 years ago
|
||
Comment on attachment 310032 [details] [diff] [review] updated, again + PRBool needsScaling = PR_FALSE; + int drawWidth, drawHeight; These can get declared further down, above the block where they are first used. Because it isn't obvious that the ints are initialized before use, please init them to 0. + else if (drawFrame.size.height == 18 || + drawFrame.size.height == 15) + { + // these two get drawn correctly, don't munge anything + needsScaling = PR_FALSE; PR_FALSE is the default value for needsScaling. Please rearrange the logic so that this else if statement that sets it to false again isn't necessary. Like this: // Don't do anything for sizes that draw naturally if (height != 18 && height != 15) { if (height > 20) { ... } else { needsScaling = PR_TRUE; ... } } I still have to test on Tiger.
Comment 22•16 years ago
|
||
Comment on attachment 310032 [details] [diff] [review] updated, again + // leave things alone on Tiger + drawFrame.size.height -= 2; This patch doesn't fix this bug on Tiger. The above needs to subtract 1, not 2. That fixes things on Tiger.
Attachment #310032 -
Flags: review?(joshmoz) → review-
Assignee | ||
Comment 23•16 years ago
|
||
updated
Attachment #310032 -
Attachment is obsolete: true
Attachment #310395 -
Flags: review?(joshmoz)
Attachment #310395 -
Flags: review?(joshmoz) → review+
Attachment #310395 -
Flags: superreview?(pavlov)
Updated•16 years ago
|
Attachment #310395 -
Flags: superreview?(pavlov) → superreview+
Assignee | ||
Comment 24•16 years ago
|
||
Checked in.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•