Closed Bug 131481 Opened 24 years ago Closed 23 years ago

Menulist with width constrained max-width and crop does not report correct size to enclosing box elements in dialogs

Categories

(Core :: XUL, defect)

All
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.0

People

(Reporter: cmanske, Assigned: bryner)

References

Details

(Keywords: regression, Whiteboard: [adt2 rtm],custrtm-)

Attachments

(4 files)

I'll attach an example of Composer's publish dialog that has both style="max-width..." and crop attributes set. These do constrain the width of a menulist in the 2nd of 3 rows, but the grid uses the preferred width instead of the constrained width. The result is that the grid width is too wide for the dialog and widgets get cutoff by the right border of the dialog.
Unzip this attachment into mozilla/editor/ui/dialogs/content. Make Composer to install into chrome. Open Composer. Use File | Publish Go to the Settings panel if you aren't there already Enter in a long string (about 40 chars) for the Site Name Be sure there's some text in the "Publish URL" input field. Click on the "Publish" tab. The text you typed will become the selected item in the 'Site' menulist. It's width is constrained to only 10em, but the dialog will resize and show chopped off widgets and missing buttons.
This is probably not the fault of grid code. I rewrote the Publish Dialog UI to put the menulist in a simpe hbox and it had the same effect: the calculated width was constrained by CSS max-width style, but the dialog resized using what the menulist width would have been if it were not constrained ("prefered" width). After discussion with Hewitt the problem seems to be in menulist code. Bryner has made recent changes in menulist code, eg., nsMenuPopupFrame.cpp
Assignee: hewitt → bryner
Keywords: nsbeta1, regression
Changed summary
Summary: Grid sizing doesn't respect constrained width of menulist (has max-width and crop ) when sizing dialog → Menulist with width constrained max-width and crop does not report correct size to enclosing box elements in dialogs
*** Bug 132111 has been marked as a duplicate of this bug. ***
Is this the only dialog in the product that has this problem? Is there a cheap workaround? Couldn't we just constrain the site name length?
Whiteboard: [need info]
I tried to do that and we had to constrain it so much that you couldn't see enough of the name to be useful. Brade opposed this strongely. Surely it's a fundamental problem -- widget's must report proper size to their parents!
It may be a fundamental problem, but if it only occurs in this dialog, and the site name is only used to populate the list, then we should consider making a very safe trade between the current defect and having a shorter site name, which would certainly not be an nsbeta1+ defect on its own. We have many more bugs than we are going to be able to fix for MachV, so I need to look for workarounds where they exist. Also, a more involved fix for this could easiliy cause regressions that are themselves worse than this bug. Other possible workarounds might be to constrain the width of the site popup, allow the dialog to stretch, move or remove the New Site button, or some combination of these. Being limited to 20-30 characters to describe a site name doesn't seem like much of a constraint, considering we couldn't publish at all until now. cc Brade for input.
Charlie, I just discussed this with Syd, and he also thought it might be more appropriate to workaround it for now. We should ensure that a bug remains open for the real problem/fix.
Nav triage team: nsbeta1+, adt2 per Peter's/Syd's suggestion.
Keywords: nsbeta1nsbeta1+
Whiteboard: [need info] → [adt2]
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.0
I'm no longer seeing this bug on my own build or in a nightly (trunk)... Charlie, can you confirm this?
You probably can't see because we hacked around it by truncating all the strings we put in the menulist. Not the correct solution :-)
Ok, to remove the hack, would I change: var menuitem = AppendLabelAndValueToMenulist(gDialog.SiteList, TruncateStringAtWordEnd(name, 30, true), name); to var menuitem = AppendLabelAndValueToMenulist(gDialog.SiteList, name, name); ?
Attached patch patchSplinter Review
This should fix the problem.
Comment on attachment 79528 [details] [diff] [review] patch Tested with case for Composer Publish dialog and it works great.
Attachment #79528 - Flags: review+
Comment on attachment 79528 [details] [diff] [review] patch r=cmanske
Comment on attachment 79528 [details] [diff] [review] patch sr=hewitt
Attachment #79528 - Flags: superreview+
checked in on the trunk. Requesting ADT approval for branch checkin.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Keywords: adt1.0.0
Resolution: --- → FIXED
With above fix, we don't need any hacks in Composer. Yeah!
Attachment #79539 - Flags: review+
Comment on attachment 79539 [details] [diff] [review] Remove workarounds in Publish dialog r=bryner
Comment on attachment 79539 [details] [diff] [review] Remove workarounds in Publish dialog sr=jag
Attachment #79539 - Flags: superreview+
Please land and test on trunk. Also please attach a screen shot of the problem before the fix.
When's this gonna land on the trunk?
Keywords: approval
Whiteboard: [adt2] → [adt2] [Needs a=]
It already has, that's why I marked it RESOLVED/FIXED.
but, we need this screen shot for deciding if it goes in the branch. please add one if possible, or update the bug if not so we can try some other way to determine impact.
Top 2 images show dialog in correct form. Next 2 show how we control the resizing by an ugly hack that truncates the sitename string. Last image shows the serious basic problem: the menulist doesn't respect the "max-width: 30em" set in the dialog XUL and the result messes up dialog layout such that buttons aren't useable. The fix Bryner suggests in patch 79528 is very sound and will prevent similar problems by all menulist users. It has been working fine in the trunk -- I've found no bad side effects. Bryner: Will this affect sizing of HTML select elements use in web page forms? If yes, that would be a very strong argument for fixing this basic layout problem in the release branch.
Good work, but let's save this for rtm, marking adt2 rtm, adt1.0.0-
Keywords: adt1.0.0adt1.0.0-
Whiteboard: [adt2] [Needs a=] → [adt2 rtm] [Needs a=]
This would only affect HTML select sizing if XBL form controls were being used, which they won't be for MachV or Mozilla 1.0.
*** Bug 143789 has been marked as a duplicate of this bug. ***
Getting dups on this already from beta build. This is important to fix for RTM. Removed "-" so this will be evaluated for RTM checkin.
Keywords: adt1.0.0-adt1.0.0
Whiteboard: [adt2 rtm] [Needs a=] → [adt2 rtm]
Whiteboard: [adt2 rtm] → [adt2 rtm],custrtm-
Keywords: adt1.0.0adt1.0.1
adt1.0.1+ (on behalf ADT's behalf) for checkin to the 1.0 branch, pending Driver's approval. Pls check this in asap.
Blocks: 143047
Adding the + in the keywords section (Jaime commented it was going to be plused but change was not made)
Keywords: adt1.0.1adt1.0.1+
please checkin to the 1.0.1 branch. once there, remove the "mozilla1.0.1" keyword and add the "fixed1.0.1" keyword.
Keywords: mozilla1.0.1+
Attachment #79539 - Flags: approval+
checked into the 1.0 branch.
verified101 on 0723 brnch build
Status: RESOLVED → VERIFIED
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: shrir → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: