Closed Bug 706609 Opened 14 years ago Closed 13 years ago

drop downs do not resize to the text properly when in portrait mode

Categories

(Firefox for Android Graveyard :: General, defect, P1)

ARM
Android
defect

Tracking

(fennec11+)

VERIFIED FIXED
Firefox 12
Tracking Status
fennec 11+ ---

People

(Reporter: nhirata, Assigned: dbaron)

References

()

Details

(Whiteboard: readability, [font-inflation: form controls])

Attachments

(12 files, 5 obsolete files)

30.35 KB, image/png
Details
39.17 KB, image/png
Details
2.11 KB, patch
roc
: review+
Details | Diff | Splinter Review
7.53 KB, patch
roc
: review+
Details | Diff | Splinter Review
11.64 KB, patch
roc
: review+
Details | Diff | Splinter Review
5.03 KB, patch
roc
: review+
Details | Diff | Splinter Review
9.81 KB, patch
roc
: review+
Details | Diff | Splinter Review
1.48 KB, patch
roc
: review+
Details | Diff | Splinter Review
7.03 KB, patch
roc
: review+
Details | Diff | Splinter Review
39.28 KB, patch
roc
: review+
Details | Diff | Splinter Review
25.88 KB, patch
roc
: review+
Details | Diff | Splinter Review
8.83 KB, patch
roc
: review+
Details | Diff | Splinter Review
Attached image screenshot
1. install latest nightly (20111130) 2. set device to portrait mode 3. go to http://people.mozilla.com/~nhirata/html_tp/formsninput.html 4. look at dropdown Expected: to be able to read the current selection Actual: the dropdown is not resized to the text. Note: 1. does not occur on the default browser
OS: Mac OS X → Android
Hardware: x86 → ARM
Assignee: nobody → dbaron
Priority: -- → P2
Whiteboard: readability
Yeah, this requires changes to nsListControlFrame.
Whiteboard: readability → readability, [font-inflation: form controls]
Priority: -- → P1
So I think the best way to proceed here, since a combobox contains a listbox in its dropdown, is to: 1. fix listboxes 2. fix comboboxes, if the fix for (1) doesn't already fix comboboxes I tried https://hg.mozilla.org/users/dbaron_mozilla.com/patches/file/fdf7f5b496e4/font-inflation-selects but it doesn't work yet, though; I haven't yet had a chance to debug why.
Handling nsSelectsAreaFrame in IsContainerForFontSizeInflation: https://hg.mozilla.org/users/dbaron_mozilla.com/patches/file/be2789ce52ad/font-inflation-selects fixes the text size and height issues for both list boxes and comboboxes, but widths are still wrong. That probably does require hacking list controls and or comboboxes.
I think the width calculation for dropdowns is just nsContainerFrame::ComputeAutoSize and nsFrame::ShrinkWidthToFit. Ideally, ComputeAutoSize would consider inflation throughout when we're in subtrees that don't contain inflation containers, but it depends on GetMinWidth and GetPrefWidth which, in general, can't.
(In reply to David Baron [:dbaron] from comment #6) > I think the width calculation for dropdowns is just > nsContainerFrame::ComputeAutoSize and nsFrame::ShrinkWidthToFit. Ideally, > ComputeAutoSize would consider inflation throughout when we're in subtrees > that don't contain inflation containers, but it depends on GetMinWidth and > GetPrefWidth which, in general, can't. Er, really, it's not specific to ComputeAutoSize: it's just about doing intrinsic width calculations in subtrees that don't contain inflation containers.
The simplest solution to that problem I can think of is: * add a frame state bit for whether a frame is a container for font size inflation, and set it during frame construction so we have it cheaply in the future * add a boolean parameter to GetPrefWidth, GetMinWidth, and AddInline{Min,Pref}Width that says whether to consider font size inflation. Set it to false at the very start of the method for anything that's an inflation container; then pass it down to descendants.
tracking-fennec: --- → 11+
Comment on attachment 589941 [details] [diff] [review] Add a frame state bit for whether a frame is a container for font size inflation (, patch 1) Review of attachment 589941 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/generic/nsFrame.cpp @@ +519,5 @@ > +#endif > + ) { > + if (IsFontSizeInflationContainer(this)) { > + mState |= NS_FRAME_FONT_INFLATION_CONTAINER; > + } Pass nsStyleDisplay as a parameter to IsFontSizeInflationContainer and reuse the call to GetStyleDisplay() for transforms.
Attachment #589941 - Flags: review?(roc) → review+
In addition to addressing comment 17, this also adds an exception to an assertion for br frames, since the assertion was firing in a harmless way.
Attachment #590047 - Flags: review?(roc)
Comment on attachment 589944 [details] [diff] [review] Set inflation container to null during parts of intrinsic sizing that should not have inflation applied. (, patch 4) Review of attachment 589944 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/base/nsLayoutUtils.cpp @@ +2240,5 @@ > + if (nsLayoutUtils::IsContainerForFontSizeInflation(aFrame)) { > + // If aFrame is a container for font size inflation, then shrink > + // wrapping inside of it should not apply font size inflation. > + presContext->mCurrentInflationContainer = nsnull; > + } What about having a slightly different and more efficient AutoRestore API that doesn't save and restore unless the condition is true? e.g. AutoRestore<T> ar; if (cond) { ar.SaveAndSet(&value, v); }
Better still, have dedicated AutoSetInflationContainer(nsIFrame*) class that encapsulates this into one line.
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #20) > What about having a slightly different and more efficient AutoRestore API > that doesn't save and restore unless the condition is true? e.g. > AutoRestore<T> ar; > if (cond) { > ar.SaveAndSet(&value, v); > } That's more complicated, since then the restoring has to be conditional too and the condition has to be stored. Feels like over-optimizing to me.
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #21) > Better still, have dedicated AutoSetInflationContainer(nsIFrame*) class that > encapsulates this into one line. I suppose that's probably worth it, though.
Comment on attachment 589945 [details] [diff] [review] Switch nsLayoutUtils inflation methods to the new setup with state on the pres context. (, patch 5) Review of attachment 589945 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/base/nsLayoutUtils.h @@ +1490,5 @@ > * smaller than 1. > * > + * The WidthDetermination parameter says how we determine the width of > + * the nearest inflation container: when not in reflow we look at the > + * frame tree; when in reflow we look at state stored on the pres fix double space ::: layout/forms/nsTextControlFrame.cpp @@ +503,5 @@ > // FIXME: This won't turn out so well for the height; maybe disable > // inflation entirely in this case? > inflation = 1.0f; > } else { > + // FIXME: THIS IS WRONG Why? Can this be called from outside reflow?
Comment on attachment 589948 [details] [diff] [review] Make selects and things inside them not be containers for font size inflation, so that font inflation inflate selects appropriately along with what surrounds them. (, patch 8) Review of attachment 589948 [details] [diff] [review]: ----------------------------------------------------------------- Hmm, actually, what about optgroup? This is actually a bit ugly. For example it means an <option> element outside a <select> will get special treatment. Ideally something would explicitly check if we're inside a select (or just a popup). I'm not sure what the cleanest way to do that would be...
Comment on attachment 590048 [details] [diff] [review] Make floating :first-letter frames not be containers for font size inflation, to avoid triggering assertions. (, patch 3.5) Review of attachment 590048 [details] [diff] [review]: ----------------------------------------------------------------- I wish this wasn't getting to be more and more overhead... preface this with a check for aStyleDisplay->IsFloating()?
Attachment #590048 - Flags: review?(roc) → review+
Attachment #589944 - Attachment is obsolete: true
Attachment #589944 - Flags: review?(roc)
This is a new patch to address the FIXMEs in patch 5: I realize that treating ComputeSize the same as intrinsic width computation will simplify that FIXME.
Attachment #590885 - Flags: review?(roc)
And here's the revised version of patch 5 without those FIXMEs, on top of patch 4.5
Attachment #590886 - Flags: review?(roc)
Attachment #589945 - Attachment is obsolete: true
Attachment #589945 - Flags: review?(roc)
Comment on attachment 590884 [details] [diff] [review] Set inflation container to null during parts of intrinsic sizing that should not have inflation applied. (, patch 4) Review of attachment 590884 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/base/nsLayoutUtils.h @@ +1668,5 @@ > + } > + private: > + const bool mIsInflationContainer; > + nsPresContext *mPresContext; > + nsIFrame *mOldValue; You don't need the bool, you can just let mPresContext be null to indicate that you didn't set the current container to null.
Attachment #590884 - Attachment is obsolete: true
Attachment #590884 - Flags: review?(roc)
To address the optgroup issue (comment 25), this adds one extra check for optgroup (didn't see any obvious better choice), and adds select-listbox-2 and select-combobox-2 tests to match.
Attachment #590928 - Flags: review?(roc)
Every one of these checks adds a tiny bit of overhead to the construction of most frames. And I'm not super happy about <option>s and <optgroup>s getting special treatment when outside a <select>, either. Could nsCSSFrameConstructor detect when we're constructing frames under a <select>, and clear out the inflation-container bits for those frames?
(In reply to David Baron [:dbaron] from comment #18) > In addition to addressing comment 17, this also adds an exception to an > assertion for br frames, since the assertion was firing in a harmless way. It turns out I need to make the same exception for MathML frames, for the same reason. With that fix, try is green; now just waiting on review on the changes to patch 8.
Sorry, I missed comment 33. I suppose I should do something about the fact that I'm getting too much bugmail to actually read it and have time to do other things. (In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #33) > Every one of these checks adds a tiny bit of overhead to the construction of > most frames. See below (last comment). > And I'm not super happy about <option>s and <optgroup>s getting > special treatment when outside a <select>, either. I'm not concerned about that. I think the fact that we, internally, treat option and optgroup as 'display:block' isn't something that Web authors should depend on. If we were honestly concerned about this we should make them display:block only when they're inside selects -- and then your concern would go away since as non-blocks outside of selects they wouldn't be inflation containers. > Could nsCSSFrameConstructor detect when we're constructing frames under a > <select>, and clear out the inflation-container bits for those frames? I'm not sure this would be faster, since we'd have to set up this state on every mutation. I could move this into a frame subclass, except that we're going to have to make this code a *lot* more complicated to fix bug 706193 -- that's going to make inflation container setting require textrun-construction-like analysis (but slightly different). So I'd really rather not try to optimize it until during or after I work on bug 706193.
Comment on attachment 590928 [details] [diff] [review] Make selects and things inside them not be containers for font size inflation, so that font inflation inflate selects appropriately along with what surrounds them. (, patch 8) Review of attachment 590928 [details] [diff] [review]: ----------------------------------------------------------------- OK.
Attachment #590928 - Flags: review?(roc) → review+
Blocks: 721304
Verified fix on 1-26-2012 nightly. Changing font size also retains the text size property in the drop down.
Status: RESOLVED → VERIFIED
Comment on attachment 590928 [details] [diff] [review] Make selects and things inside them not be containers for font size inflation, so that font inflation inflate selects appropriately along with what surrounds them. (, patch 8) [Approval Request Comment] Regression caused by (bug #): User impact if declined: Testing completed (on m-c, etc.): Risk to taking this patch (and alternatives if risky):
Attachment #590928 - Flags: approval-mozilla-aurora?
Attachment #589942 - Flags: approval-mozilla-aurora?
Attachment #589943 - Flags: approval-mozilla-aurora?
Attachment #589946 - Flags: approval-mozilla-aurora?
Attachment #589947 - Flags: approval-mozilla-aurora?
Attachment #590047 - Flags: approval-mozilla-aurora?
Attachment #590048 - Flags: approval-mozilla-aurora?
Attachment #590885 - Flags: approval-mozilla-aurora?
Attachment #590886 - Flags: approval-mozilla-aurora?
Attachment #590898 - Flags: approval-mozilla-aurora?
[Approval Request Comment] Regression caused by (bug #): bug 627842 (new feature) User impact if declined: Font inflation won't apply to <select> elements. Testing completed (on m-c, etc.): Risk to taking this patch (and alternatives if risky): Changes behavior of font size inflation a bit. Shouldn't change behavior in non-DEBUG cases where font size inflation isn't enabled.
Comment on attachment 590928 [details] [diff] [review] Make selects and things inside them not be containers for font size inflation, so that font inflation inflate selects appropriately along with what surrounds them. (, patch 8) [Triage Comment] Mobile only - approved for Aurora.
Attachment #590928 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #589942 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #589943 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #589946 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #589947 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #590047 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #590048 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #590885 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #590886 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #590898 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
I'm not going to have time to land this on aurora before leaving for vacation. It turns out it also requires landing on aurora some other font inflation patches that haven't been landed on aurora, and figuring out what those are will be a bit of work. (The first one I hit is changeset c248c37f9cf7, but it has a merge conflict in tests which indicates there's something else under it.) (If we're going to ship font inflation from a release based on current aurora, we'll want them... though I'm honestly not sure what our current plans are.)
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: