Closed Bug 366722 Opened 18 years ago Closed 18 years ago

make non-boxes support nsITheme::GetMinimumWidgetSize

Categories

(Core :: Layout: Form Controls, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dbaron, Assigned: dbaron)

References

(Depends on 3 open bugs)

Details

(Whiteboard: [patch])

Attachments

(2 files, 5 obsolete files)

Currently only nsBox and nsTreeBodyFrame (for twisties) call nsITheme::GetMinimumWidgetSize.  However, Josh needs this for an nsITheme implementation of checkboxes on the Mac, so that he can make the checkboxes the right size without forms.css hacks (which could in turn be overridden by authors).

This might cause some existing code that never did anything to suddenly start working, so it could break some things, but if it does we can fix the existing code.
Attached patch patch (obsolete) — Splinter Review
Attachment #251212 - Flags: superreview?(roc)
Attachment #251212 - Flags: review?(roc)
Don't you need to change GetMinWidth and GetPrefWidth too?
Yeah.  This also may be border-box width rather than content-box width -- I need to investigate that further.
Although it's not clear from the nsBox.cpp code (and I think box code sometimes uses the width/height properties as border-box), it's clear from nsCSSRendering that these sizes should be border-box.
Attached patch patch (obsolete) — Splinter Review
Attachment #251212 - Attachment is obsolete: true
Attachment #251254 - Flags: superreview?(roc)
Attachment #251254 - Flags: review?(roc)
Attachment #251212 - Flags: superreview?(roc)
Attachment #251212 - Flags: review?(roc)
We should probably have GetWidgetOverflow in here too.
Attached patch patchSplinter Review
Handled overflow, by moving the handling of GetWidgetOverflow from nsBox's call to FinishAndStoreOverflow to inside FinishAndStoreOverflow.  I also fixed a bunch of comments in nsITheme.h
Attachment #251254 - Attachment is obsolete: true
Attachment #251289 - Flags: superreview?(roc)
Attachment #251289 - Flags: review?(roc)
Attachment #251254 - Flags: superreview?(roc)
Attachment #251254 - Flags: review?(roc)
Attachment #251289 - Flags: superreview?(roc)
Attachment #251289 - Flags: superreview+
Attachment #251289 - Flags: review?(roc)
Attachment #251289 - Flags: review+
Checked in to trunk.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Attached patch pay better attention to borders (obsolete) — Splinter Review
This might help some problems josh is having with borders.
Depends on: 367320
Wouldn't we need something similar for padding?

Should we store the padding and borders in the properties, perhaps, for efficiency and less code duplication?

Does this fix bug 367320?
Blocks: 365413
What do you think about putting theme borders/padding in the properties?
I was thinking about that.  We'd have to inhibit rule tree sharing (which would be a space/perf loss), but it would probably make things a good bit simpler.
Sorry, I don't mean the style properties, but the frame properties that you use to store percentage padding/borders
The only change relative to the last patch is changing GetUsedPadding too.
Attachment #252140 - Attachment is obsolete: true
Depends on: 368258
I'm hoping this will fix the bad-layout aspects of the regressions.

However, we really need to figure out a better way for the windows native theme code to decide whether to pass TS_TRUE or TS_MIN.  Basically GetMinimumWidgetSize on Windows in many cases returns the Windows theme API's pref size rather than its min size.  I'm not sure whether we want to extend the theme API to report both pref size and min size or whether we want the nsITheme code to do one or the other based on whether the frame is an HTML form control or not.
Attachment #252174 - Attachment is obsolete: true
Comment on attachment 252939 [details] [diff] [review]
pay better attention to borders and padding

This fixes the regressions from the previous patch based on the testcases in bug 367320 and bug 368258.
Attachment #252939 - Attachment is patch: true
Attachment #252939 - Attachment mime type: application/octet-stream → text/plain
Attachment #252939 - Flags: superreview?(roc)
Attachment #252939 - Flags: review?(roc)
Depends on: 368385
Comment on attachment 252939 [details] [diff] [review]
pay better attention to borders and padding

looks OK, but I still want to know whether it would be simpler to just store widget padding and border in frame properties the way we do for percentage padding.
Attachment #252939 - Flags: superreview?(roc)
Attachment #252939 - Flags: superreview+
Attachment #252939 - Flags: review?(roc)
Attachment #252939 - Flags: review+
I don't think it would be much simpler, since we'd have to find an earlier time to store the properties and we'd still have to check IsThemed all over the place.  Common functions to get the padding and border from the theme might help more (although again not all that much).
Anyway, above patch checked in.
Depends on: 368740
Depends on: 368445
Depends on: 375073
Depends on: 388379
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: