Closed
Bug 589132
Opened 14 years ago
Closed 13 years ago
Tab group names are too big, text needs to be cropped on end, with ellipses for long titles.
Categories
(Firefox Graveyard :: Panorama, defect, P4)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: vladmaniac, Unassigned)
References
Details
(Whiteboard: [visual][polish][good first bug])
Attachments
(3 files, 8 obsolete files)
26.38 KB,
image/png
|
Details | |
33.64 KB,
patch
|
iangilman
:
review-
|
Details | Diff | Splinter Review |
12.14 KB,
patch
|
Details | Diff | Splinter Review |
Steps:
1. Assume you have a set of tabs opened
2. Go to Tab view
3. Make a group of tabs and give it a name, preferably a long string of chars.
(to reproduce this easily)
4. Close the group
================================================================================
Name moves over to "x" button which sometimes can be difficult to access due tot this. Selection zone for text field will jump over the selection zone of "x" button.
Note: screenshot attached
Updated•14 years ago
|
Summary: [FF4][Tab Candy] Tab set names move over the "x" dismiss button → Tab set names move over the "x" dismiss button
Made a simpler calculation for available space using the left side of the close button, and the left side of the text field.
Attachment #473386 -
Flags: feedback?(ian)
Attachment #473386 -
Flags: feedback?(ian) → feedback?(mitcho)
Comment 2•14 years ago
|
||
Comment on attachment 473386 [details] [diff] [review]
v1
Looks good to me.
Attachment #473386 -
Flags: feedback?(mitcho) → feedback+
Attachment #473386 -
Flags: review?(dietrich)
Comment 5•14 years ago
|
||
Comment on attachment 473386 [details] [diff] [review]
v1
while testing to see the problem, i also noticed that when the length of the title is greater than the width of the group box, the title is cropped on the *beginning*. instead it should be cropped (with ellipsis) at the end of the title.
please ensure this patch fixes that problem, while you're in this code. also, please write a test (or modify an existing one) to 1) test the fix and 2) ensure subsequent changes do not regress this.
Attachment #473386 -
Flags: review?(dietrich) → review-
Updated•14 years ago
|
Priority: -- → P3
(In reply to comment #5)
> while testing to see the problem, i also noticed that when the length of the
> title is greater than the width of the group box, the title is cropped on the
> *beginning*. instead it should be cropped (with ellipsis) at the end of the
> title.
I see what you're talking about, but I didn't consider these issues to be part of the original bug (which only dealt with textbox size). I'll add those behaviors to this bug.
Summary: Tab set names move over the "x" dismiss button → Tab set names are too big, text needs to be cropped on end, with ellipses for long titles.
* Properly calculating text size
* Title text input follows text size more smoothly
* Needs: ellipses for long titles, code cleanup
Attachment #473386 -
Attachment is obsolete: true
* Added ellipses for long titles, which was a large change. Firefox does not have overflow:ellipses support, nor can one change the .innerHTML of a form text input to change the way the input looks (shortened with ellipses). The solution was to do clever show()/hide()ing of a div containing the abridged title, and the input field.
* Pointer over title switched from text to hand pointer.
Attachment #476190 -
Attachment is obsolete: true
Comment 10•14 years ago
|
||
Attachment #476508 -
Flags: ui-review?
Comment 11•14 years ago
|
||
* CSS fixed for Win and OSX
* Titles resize with window correctly
Attachment #476502 -
Attachment is obsolete: true
Attachment #476508 -
Attachment is obsolete: true
Attachment #476510 -
Flags: ui-review?
Attachment #476508 -
Flags: ui-review?
Attachment #476510 -
Flags: ui-review? → ui-review?(aza)
Updated•14 years ago
|
Attachment #476510 -
Flags: ui-review?(aza)
Attachment #476510 -
Flags: ui-review+
Attachment #476510 -
Flags: feedback?(ian)
Comment 12•14 years ago
|
||
This looks and acts fantastic, Sean!
Updated•14 years ago
|
Priority: P3 → P2
Target Milestone: --- → Firefox 4.0
Comment 14•14 years ago
|
||
Comment on attachment 476510 [details] [diff] [review]
v4 WIP
The approach looks good. Most of my feedback is nitpicks, but you'll get them from the reviewer if I don't give them to you now.
+ getTitleLabel: function GroupItem_getTitleLabel() {
+ let labelVal = this.$nameInput.val();
You've got 4 spaces of indent here; should be 2.
+ if ( fullWidth > labelWidth) {
Space after left paren.
+ // ----------
+ // Function: getElementFont
+ // Returns the serialized font description.
+ getElementFont : function Utils_getElementFont(elem) {
+ let font = "";
+ font = elem.css('font-style') + " " +
While this routine is called getElementFont and the argument is called elem, it appears to actually be expecting an iQ object. For greater flexibility I'd recommend actually taking in a DOM element and converting it to iQ internally:
let $elem = iQ(elem);
In fact, with that in place, you can pass either a DOM element or an iQ object and it'll do the right thing. Please also update the documentation comment to be explicit about this.
+ // ----------
+ // Function: getTextWidth
+ // Returns the number of pixels required to fit the width of the input text.
+ getTextWidth: function Utils_getTextWidth(document, text, font) {
+ // create a canvas object, draw text in object, get extents.
+ let canvas = document.createElement('canvas');
+ let ctx = canvas.getContext('2d');
+ ctx.save();
+ ctx.font = font;
+ // Calculate the text plus a space, since an exact fit is not enough
+ let metrics = ctx.measureText(text);
+ ctx.restore();
+ return metrics.width;
+ },
I wonder what the overhead is for creating a new canvas everytime (especially considering that truncateStringToWidth calls this routine repeatedly). Perhaps it would be better to create the canvas once (or once per document if necessary) and cache it? Then we'd probably have to do some clean up when the document unloads to keep from leaking.
If we don't end up caching the canvas and just use them once per, you can kill the ctx.save/restore.
Any thoughts about a test?
Attachment #476510 -
Flags: feedback?(ian) → feedback+
Comment 15•14 years ago
|
||
Attachment #476510 -
Attachment is obsolete: true
Attachment #477368 -
Flags: review?(dietrich)
Comment 16•14 years ago
|
||
Comment on attachment 477368 [details] [diff] [review]
v5
Reassigning review to dolske while dietrich is jammed up with b7 stuff.
Attachment #477368 -
Flags: review?(dietrich) → review?(dolske)
Updated•14 years ago
|
Status: NEW → ASSIGNED
Comment 17•14 years ago
|
||
Comment on attachment 477368 [details] [diff] [review]
v5
Sigh. If only we had a fix for bug 312156.
Anyway, r- for a few things that jumped out from a first-pass skim...
>+ let ellipses = "...";
That's not an ellipses. It's 3 periods. :-) You want "\u2026".
And, perhaps surprisingly, this also needs localized. There's an existing pref you can use (intl.ellipsis)... See toolkit/components/passwordmgr/src/nsLoginManagerPrompter.js#283 for an example.
>+ getTextWidth: function Utils_getTextWidth(canvas, text, font) {
>+ // draw text into canvas object, get extents.
>+ let ctx = canvas.getContext('2d');
Sigh. This is clever, but also a hack. :/
How about setting the text the usual way, and use getComputedStyle() to check if it's width is larger than you want? (Might need some cleverness to suppress line wrapping, or to watch for height increases).
Also needs the aforementioned test. Should be sufficient (wrt to overflow) to basically set a long title (that will surely overflow), and then check that the final displayed value is the expected truncated string, +/- some slop to allow for platform variances.
Attachment #477368 -
Flags: review?(dolske) → review-
Comment 18•14 years ago
|
||
Oh, hey, is the tabview iframe privileged? I think it is... That would let you solve this fairly trivially by using <xul:description crop="end"/>. I think that should work in this case (given that we generally disabled unprivileged XUL). That would avoid any need to calculate text width, just style the max-width with CSS and let XUL handle the overflow.
Comment 19•14 years ago
|
||
After trying to make XUL description work (I can't make it show up and function as a DIV), and then trying to temporarily change the CSS state of the label to measure it (this gets messy and I don't think it's a good pattern), I've settled on creating a special DIV that is solely used for measuring text, offscreen.
Attachment #477368 -
Attachment is obsolete: true
Attachment #480650 -
Flags: review?(dolske)
Comment 20•14 years ago
|
||
In addition to it using a DIV measurement technique, I added a test and fixed a previously unseen issue where the title would hang off the group during animated resizing.
Attachment #480650 -
Attachment is obsolete: true
Attachment #481571 -
Flags: review?(dolske)
Attachment #480650 -
Flags: review?(dolske)
Attachment #481571 -
Flags: review?(dolske) → review?(dietrich)
Comment 21•14 years ago
|
||
Comment on attachment 481571 [details] [diff] [review]
v7 (with test)
Switching review to dolske, as dietrich says he's not reviewing non-blockers for the time being.
Attachment #481571 -
Flags: review?(dietrich) → review?(dolske)
Comment 22•14 years ago
|
||
Comment on attachment 481571 [details] [diff] [review]
v7 (with test)
Load balancing the review to me.
Attachment #481571 -
Flags: review?(dolske) → review?(ian)
Comment 23•14 years ago
|
||
Comment on attachment 481571 [details] [diff] [review]
v7 (with test)
Sorry this has been languishing! It all basically looks good, but I'm concerned about the perf implications of adding the truncation check for every setBounds() call. At the very least, we could limit it to just setBounds calls that change the width, so it won't affect dragging speed. Beyond that we could not do it for every setBounds of a drag resize (presumably supressing it with an option) and then call it at the end. What do you think?
Beyond that, a couple of nits while you're in there:
>+ availableTitleWidth : function GroupItem_availableTitleWidth() {
>+ return this.$close.bounds().left - this.$nameContainer.bounds().left;
>+ //return this.$nameContainer.bounds().width;
>+ },
Remove the commented out code.
>+ let optionsComplete;
>+ if (typeof options.complete == "function") {
>+ optionsComplete = options.complete;
>+ } else {
>+ optionsComplete = function(){};
>+ }
Document this new option in the comment block at the top of the routine.
Attachment #481571 -
Flags: review?(ian) → review-
Comment 27•14 years ago
|
||
Sean, are you still working on this?
Whiteboard: [visual][polish][good first bug]
Comment 28•14 years ago
|
||
Yes, but it's sadly fallen behind priority on a few other things. It should be ready to go once I add Ian's changes and unrot everything.
Comment 29•14 years ago
|
||
(In reply to comment #28)
> Yes, but it's sadly fallen behind priority on a few other things. It should be
> ready to go once I add Ian's changes and unrot everything.
No problem. Might be a lot of rot, though! ;)
Updated•14 years ago
|
Priority: P2 → P3
Comment 32•14 years ago
|
||
Sean, ping again. :) While not high priority, it may solve both this immediate bug and bug 624936, and would thus be nice to have. If you'd like someone else to try unrotting and taking it the last mile, let us know.
Comment 33•14 years ago
|
||
Mitcho, I'll get this unrotted this afternoon. It's pretty gnarly.
Comment 34•14 years ago
|
||
With bug 624936, being a quick CSS fix, being more likely at this point to actually land for fx4, I'm much less concerned about this bug. I suggest formally punting it.
Priority: P3 → P4
Comment 35•14 years ago
|
||
[bugspam: mitcho's late-night betaN triage; feel free to comment or reverse]
Comment 36•14 years ago
|
||
bugspam: returning Sean's bugs to the pool
Assignee: seanedunn → nobody
Status: ASSIGNED → NEW
Comment 39•14 years ago
|
||
Bug 312156 will implement text-overflow, and it's scheduled for Fx6.
Comment 42•13 years ago
|
||
This should be trivial to fix now that bug 312156 is fixed.
Updated•13 years ago
|
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
Comment 44•13 years ago
|
||
This isn't a dupe, I don't think; this bug is for tab set names, while bug 666842 is for the tab item names.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Updated•13 years ago
|
Summary: Tab set names are too big, text needs to be cropped on end, with ellipses for long titles. → Tab group names are too big, text needs to be cropped on end, with ellipses for long titles.
Comment 46•13 years ago
|
||
This also includes some of the changes I made in my patch to 671243, which I've asked Tim to review. Don't know who wants to review this, so I chose Ian since he did the last one.
Due to text-overflow ellipsis landing, this uses that and tries to be as simple as possible. As a result, let me know if there is any bad behavior, which I can try to correct.
Next up is to add some tests, but I have very little experience with writing and running tests. This means anyone who wants to should submit tests. Otherwise, I will look through Sean's test and try to mimic that.
Thought I would get this out here first for comments and suggestions.
Attachment #546352 -
Flags: review?(ian)
Comment 47•13 years ago
|
||
Sorry for spam. Slightly updated code to keep the input box expansion less jittery with a hardcoded right padding. Don't know if there is a more elegant solution.
Attachment #546352 -
Attachment is obsolete: true
Attachment #546391 -
Flags: review?(ian)
Attachment #546352 -
Flags: review?(ian)
Comment 48•13 years ago
|
||
Comment on attachment 546391 [details] [diff] [review]
another patch
Review of attachment 546391 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for your patch! Alas, I think this is a little bit too complicated. With the new patch for bug 671243 this should be as easy as adding
input.name { text-overflow: ellipsis; }
to browser/base/content/tabview/tabview.css.
Attachment #546391 -
Flags: review?(ian)
Comment 49•13 years ago
|
||
bugspam
(Fx7 was branched, removing open bugs from Fx7 meta bug, we won't create new meta bugs for upcoming Fx versions)
No longer blocks: 660175
Comment 50•13 years ago
|
||
Indeed, only 'text-overflow: ellipsis' is needed, and one could combine that with bug 671243.
Comment 51•13 years ago
|
||
Fixed by bug 671243.
Status: REOPENED → RESOLVED
Closed: 13 years ago → 13 years ago
Resolution: --- → FIXED
Assignee | ||
Updated•9 years ago
|
Product: Firefox → Firefox Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•