Closed Bug 379297 Opened 18 years ago Closed 18 years ago

allow native buttons to render at any size (much smaller minimum sizes)

Categories

(Core :: Widget: Cocoa, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jaas, Assigned: jaas)

References

Details

Attachments

(1 file, 4 obsolete files)

Right now native buttons drawn with HITheme can only draw at height 17, 19, and 22 or higher. So, if we want a size 15, 16, 18, or 20 button for example, we can't draw that. This is an HITheme limitation. To solve this problem, I propose drawing into an offscreen buffer and scaling the images such that we don't distort the endcaps.
Attached patch fix v0.9 (obsolete) (deleted) — Splinter Review
This allows us to render any size greater than 20x12, a huge improvement over what was effectively 70x22. If we need to do any offscreen scaling, we first resize to adjust height only and if we need to shrink the width we do that by "cutting out the middle" of the image to preserve the shape of endcaps. This has one major bug remaining, and it could use a couple more comments. The bug is that since we now set min-width and min-height on chrome buttons to conform to Apple HIG, the button/icons in the URL bar got a lot taller and the URL bar is thus too tall. I haven't figured out how to stop that from happening yet. Mano - any ideas?
set min-width/height for these in browser's browser.css; it already has rules for overriding -moz-appearance for these buttons. Another approach would be to keep the current nsNativeTheme sizes in place for the xul namespace and not set min-width/height in button.css at all.
Blocks: 376695
Attached patch fix v1.0 (obsolete) (deleted) — Splinter Review
This fixes the URL bar issue with v0.9 and also fixes bug 376695.
Attachment #263283 - Attachment is obsolete: true
Attachment #263321 - Flags: review?(mano)
Attached patch fix v1.0.1 (obsolete) (deleted) — Splinter Review
Need to make sure to draw into the CGContext we're given in DrawButton instead of the current graphics context. Thanks for pointing that out cbarrett.
Attachment #263321 - Attachment is obsolete: true
Attachment #263326 - Flags: review?(mano)
Attachment #263321 - Flags: review?(mano)
Comment on attachment 263326 [details] [diff] [review] fix v1.0.1 Looks good to me. Excited about this!
Attachment #263326 - Flags: review+
Does this applies to disabled html buttons as well? On my Camino build with patch v1.0, a disabled input[type="submit"] is 2px taller than the enabled one.
I'd rather you not test this stuff in Camino until Camino stops using its own CSS for things. Because it uses that CSS bug reports from Camino don't really mean much.
Don't remove the margin around .button-text, it will break iconic buttons. Also, s/0px/0/
Attached patch fix v1.0.2 (obsolete) (deleted) — Splinter Review
Attachment #263326 - Attachment is obsolete: true
Attachment #263379 - Flags: review?(mano)
Attachment #263326 - Flags: review?(mano)
Comment on attachment 263379 [details] [diff] [review] fix v1.0.2 r=mano on the toolkit & browser bits.
Attachment #263379 - Flags: review?(mano) → review+
Attachment #263379 - Flags: superreview?(roc)
Comment on attachment 263379 [details] [diff] [review] fix v1.0.2 sr=pink
Attachment #263379 - Flags: superreview?(roc) → superreview+
landed on trunk
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
I backed this out because it broke 3 mochitests and no-one was around to clean up.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attached patch fix v1.1 (deleted) — Splinter Review
The unit test failures let me to finding some other things to fix. First of all, the Apple HIG documentation says that the minimum button size should be 68, but that is a type and it is actually 79. I have filed that doc bug with Apple and fixed that in this patch. Secondly, it turns out HITheme can render buttons at widths as small as 28. That is small enough for us so I made the minimum width 28 and it eliminates the need to ever make a second offscreen buffer for width scaling. Third, I have changed the pinstripe button test itself to reflect the minimum chrome aqua button size, have better descriptions, and I eliminated the button-small test because that doesn't really mean anything any more (it doesn't have a different minimum size than a regular button).
Attachment #263379 - Attachment is obsolete: true
Attachment #263436 - Flags: review?(mano)
Comment on attachment 263436 [details] [diff] [review] fix v1.1 assuming these huge buttons look OK ;) Please file a bug on cleaning up button-small usage in Pinstripe, I would bet this breaks the appearance of the buttons in the toolbar customization dialog.
Attachment #263436 - Flags: review?(mano) → review+
landed on trunk again, filing followup per comment #15
Status: REOPENED → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
checked in a compile fix that just renders to the current context, filed bug 379640 on rendering to the correct context
Status: REOPENED → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → FIXED
Depends on: 382147
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: