App Tab Adventures

Discuss application theming and theme development.
User avatar
ehume
Posts: 6743
Joined: November 17th, 2002, 12:33 pm
Location: Princeton, NJ, USA

App Tab Adventures

Post by ehume »

This is what Aeon Big's tabs look like with nothing pinned:

Image

This is what Aeon Big's tabs look like with one pinned tab:

Image

I can't figure out what I'm doing wrong.

Code: Select all

/* border away from tabs and under non-selected tabs */

tabs.tabbrowser-tabs {
  background: url("chrome://global/skin/tabstrip-bottom.png") repeat-x bottom !important;
} /* Thanks to mcdavis941 for this */

.tabbrowser-arrowscrollbox > scrollbox > .scrollbox-innerbox {
  border-bottom: 3px solid;
  -moz-border-bottom-colors: #000000 #E2E2E2 #D6D6D6;
  border-left: none !important;
}
Firefox: Sic transit gloria mundi.
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Re: App Tab Adventures

Post by patrickjdempsey »

Somewhere you must be forcing the tab label to be visible, as it is automatically hidden in /content/ stuff. Try inspecting the pinned tab's label element and see if you see "display:-moz-box!important;" anywhere.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
User avatar
ShareBird
Posts: 2740
Joined: December 8th, 2004, 7:09 am
Location: Berlin | Made in Brasil
Contact:

Re: App Tab Adventures

Post by ShareBird »

patrickjdempsey wrote:Somewhere you must be forcing the tab label to be visible, as it is automatically hidden in /content/ stuff. Try inspecting the pinned tab's label element and see if you see "display:-moz-box!important;" anywhere.

They "hide" the text using width=0, instead of display=hidden (although they were using it). The changes was done by: Bug 597353.
The width=0 trick doesn't work for me, for some reason, so I've added the code:

Code: Select all

.tabbrowser-tab[pinned] .tab-label {
  display: none;
}

to my theme...
Silvermel - A Theme for Firefox and Thunderbird
YATT - Yet Another Theme Tutorial
Don't give a man a fish. Teach him how to fish instead.
User avatar
mcdavis
Posts: 3195
Joined: December 9th, 2005, 5:51 am

Re: App Tab Adventures

Post by mcdavis »

Ed,

Here's what I have, for what it's worth. It seems like you're past most of this already and just nailing down your last few edge cases.

My approach for apptabs came down to a few basics:

1 - Switch to using -moz-border-image instead of border. You still need a border-width, but the colors come from -moz-border-image.
2 - Don't use a margin on browsertabs at all. Mozilla code is doing math based on browsertab width, and it leaves margin out of that calc, which breaks things if you're actually using margin.
3 - If you want the visual appearance of a margin, add some transparent pixels in the -moz-border-image PNG and increase the border-width accordingly.
4 - Don't use vertical padding on browsertabs. Horizontal padding is OK. Vertical padding will fail when you have pinned tabs and also enough tabs to trigger tabstrip scrolling.
5 - Do set min-height on apptabs. I think this should always equal the height of the favicon ie 16px. More about this below.
6 - I'm also setting min-height on unpinned browsertabs, but this is the full height of the -moz-border-image rather than just the favicon height. I can't remember if or why I needed this.
7 - Also switch to -moz-border-image on the tab scroll arrows. Mozilla code is also doing math based on tab scrollarrow width, and it also leaves margin out of that calc, which breaks things if you're actually using margin on those, so also switch to -moz-border-image on the scroll arrows, again with transparent pixels to synthesize margins.
8 - Make sure the width of both scroll arrows is the same because Mozilla code is checking the width of the right scroll arrow to position things relative to the left arrow. It probably would have been better for us if that code measured the left arrow instead, but this doesn't make any difference in the default theme because they're both the same size. I'd been using different sizes to help with layout of the new tab and alltabs buttons. Had to quit that.

This is working with both Fx3.6 and Fx4. A couple caveats:

1 - If you're using a solid center image for the border image, there's a Mac bug where it doesn't always stretch all the way across, but that can be gotten around by using 'repeat stretch' on -moz-border-image, which actually works on all platforms. (This is what DMCrimson worked out.)
2 - You need to test both when you have enough tabs to trigger tabstrip scrolling, and when you don't, because Firefox code handles those separately. All the fancy apptab JS stuff is done when you have enough tabs to scroll.
3 - There are bugs with drop indicator positioning with apptabs; it's not your fault. :)

Everything else I saw while looking at this:

Code: Select all

observed:
- see tabbrowser.xml method _positionPinnedTabs(), this is where the action is
- handles pinned-tab positioning differently for the case of having an overflowing #tabbrowser-tabs vs. non-overflowing
  - as of Bug 601228, sets attr [positionpinnedtabs] on #tabbrowser-tabs iff overflowing, triggering different layout
    - content/browser.css sets display:block (as opposed to the previously-used display:-moz-box) on .tabbrowser-tab[pinned] in the [positionpinnedtabs] case
      - no need to fix up display on child elements under .tabbrowser-tab[pinned] because display does not inherit
- JS sets large -moz-margin-start on #tabbrowser-tabs to make room for app tabs to the left of it
- JS sets large negative margins on app tabs (i.e., .tabbrowser-tab[pinned]) to position each to the left of the start of regular tabs in #tabbrowser-tabs
- JS uses width of right-most (down) browsertab scroll button in calculation of tab positions
  - does not include margin in that calculation
  - also assumes that left and right scroll buttons both have same width
- regarding height:
  - in the overflowed-tabstrip case, height of app tabs does correctly handle an increase in font size
  - in the overflowed-tabstrip case, height of app tabs does not handle other things in tabstrip which increase tab height, other than font size
    - ie set min-height:40px!important on some non-app-tab or on #tabbrowser-tabs .. apptabs don't get any taller and look wrong
    - although this is handled fine in the non-overflowing-tabstrip case
  - from the border image, app tab has border-top 6px and border-bottom 4px and no padding
  - favicon height should be 16px, with border-image adding 10px for resulting 26px visual height
  - because favicon height not calculated correctly, instead setting min-height:16px on app tabs

conclusions:
- it's ok to solve horizontal settings separately from vertical .. they're separate issues
- wrt width
  - you can set margins, but don't expect them to apply because they'll be overridden
    - (by JS as el.style, which has specificity 1000, which will win)
  - instead, use -moz-border-image with transparent pixels in it to get same effect as margin without actually using margin
  - don't use !important when setting margins, else overrides the value set by JS and breaks layout
    - be careful: easy to do this with stylish
- wrt apptab height
  - for some reason, the favicon is not sufficient to support the height of the apptab
    -- label and closebutton suppressed
  - per dao in bug 601228 #c25: this may be an issue in layout (i.e. in core layout algorithms, not in UI code or CSS)
  - however, an increase in font size is enough to increase the height of child elements (the label) within the apptab, and app tab height correctly increases in response
  - so in other words, it works like you expect if you assume layout sees the favicon and tab close button having zero height
  - so for NNL, apptab min-height should be set to desired resulting visual height - the height of any border image
    - for apptabs with tabs on bottom, this is 28px-12px = 16px
    - for apptabs with tabs on top, this is 27px-11px = 16px
    - min-height on normal tabs should be the full border image height, ie 27px on top and 28px on bottom
    - note that there's no design constraint giving tabsontop and tabsonbottom the same height .. they can be the same or not, as long as you adjust code separately for those two cases
Theme Development is Radical Participation.
NNL Beta Builds for Current and Up-coming Firefox
Dear User: Your Help is Needed
User avatar
KLB
Posts: 2282
Joined: December 21st, 2003, 9:25 am
Location: Saco Maine
Contact:

Re: App Tab Adventures

Post by KLB »

I'm using the default themes style rule to hide label text of pinned tabs:

Code: Select all

.tab-label[pinned] {
  width: 0;
}
Ken Barbalace - AMO Editor (I focus on reviewing themes)
I maintain Classic Compact, a very compact yet clean Firefox theme.
EnvironmentalChemistry.com (Periodic Table)
User avatar
ehume
Posts: 6743
Joined: November 17th, 2002, 12:33 pm
Location: Princeton, NJ, USA

Re: App Tab Adventures

Post by ehume »

I just noted mcdavis is not mcdavis941 anymore.

Thank you all for the advice. mcdavis, especially: I've been having a dvil of a time trying to figure out why the height of my tab toolbar changes when it gets enough tabs to scroll. Now I know.

So, I need to learn how to use border images. Any quick and easy tutorials on that come to mind?
Firefox: Sic transit gloria mundi.
User avatar
KLB
Posts: 2282
Joined: December 21st, 2003, 9:25 am
Location: Saco Maine
Contact:

Re: App Tab Adventures

Post by KLB »

One thing that screws up tab height is when the new tab button is pushed to the right of the right scroll button. A contributing factor is the margins of the new tab icon. I've found it necessary to give this icon negative top and bottom margins so that it doesn't screw around with other stuff. Once to the right of the scroll button, the new tab button wants to start taking on styling of toolbar buttons.

I think border images are stupid. What they do is dynamically stretch an image and I found them unpredictable to work with. Once I figured out what they were doing, I just got rid of them and went back to normal borders with border-radius.
Ken Barbalace - AMO Editor (I focus on reviewing themes)
I maintain Classic Compact, a very compact yet clean Firefox theme.
EnvironmentalChemistry.com (Periodic Table)
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Re: App Tab Adventures

Post by patrickjdempsey »

Ed, make sure you read this:
viewtopic.php?f=18&t=1949789&hilit=backwards+compatible+tab

I haven't updated the main page since the summer and there are several tricks and tweaks I should go back and include but it's a good primer on the differences between 3.x and 4.0 tabs structure at least.

EDIT: Oh yeah, I see you did comment on it. It might be worth reviewing again as a refresher.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
User avatar
ehume
Posts: 6743
Joined: November 17th, 2002, 12:33 pm
Location: Princeton, NJ, USA

Re: App Tab Adventures

Post by ehume »

patrickjdempsey wrote:Ed, make sure you read this:
viewtopic.php?f=18&t=1949789&hilit=backwards+compatible+tab

I haven't updated the main page since the summer and there are several tricks and tweaks I should go back and include but it's a good primer on the differences between 3.x and 4.0 tabs structure at least.

EDIT: Oh yeah, I see you did comment on it. It might be worth reviewing again as a refresher.


I've forgotten so much. Thanks for the link.
Firefox: Sic transit gloria mundi.
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Re: App Tab Adventures

Post by patrickjdempsey »

No problem, reminding you reminded me to update a few of the entries!
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
User avatar
ehume
Posts: 6743
Joined: November 17th, 2002, 12:33 pm
Location: Princeton, NJ, USA

Re: App Tab Adventures

Post by ehume »

Fx3.6:

Code: Select all

/* border away from tabs and under non-selected tabs */

tabs.tabbrowser-tabs {
  background: url("chrome://global/skin/tabstrip-bottom.png") repeat-x bottom !important;
} /* Thanks to mcdavis941 for this */

.tabbrowser-arrowscrollbox > scrollbox > .scrollbox-innerbox {
  border-bottom: 3px solid;
  -moz-border-bottom-colors: #000000 #E2E2E2 #D6D6D6;
  border-left: none !important;
}


Fx4:

Code: Select all

#TabsToolbar {
  min-height: 0;
  padding: 0;
  background: url("chrome://global/skin/tabstrip-bottom.png") repeat-x bottom !important;
} /* border away from tabs and under non-selected tabs. Thanks to mcdavis for this */

.tabbrowser-arrowscrollbox > scrollbox > .scrollbox-innerbox {
  border-bottom: 3px solid;
  -moz-border-bottom-colors: #000000 #E2E2E2 #D6D6D6;
  border-left: none !important;
} /* need this */

.tabbrowser-tab[pinned] {
  min-width: 0;
}


This fixes the problem I ran into with the App Tab. It also fixes the problem I had with the App Tab and the New Tab button having no bottom border when in tabs overflow mode:

Image
Firefox: Sic transit gloria mundi.
User avatar
KLB
Posts: 2282
Joined: December 21st, 2003, 9:25 am
Location: Saco Maine
Contact:

Re: App Tab Adventures

Post by KLB »

ehume wrote:Image

You guys get to have so much more fun with cool tab styling than I do. All I get to do is squeeze every last pixel out of them and then find ways to squeeze out one more. :(
Ken Barbalace - AMO Editor (I focus on reviewing themes)
I maintain Classic Compact, a very compact yet clean Firefox theme.
EnvironmentalChemistry.com (Periodic Table)
User avatar
ehume
Posts: 6743
Joined: November 17th, 2002, 12:33 pm
Location: Princeton, NJ, USA

Re: App Tab Adventures

Post by ehume »

Oh yeah, lots of fun. Check out how that app tab and the left scrollbutton overlap:

Image

Lots of fun, that.
Firefox: Sic transit gloria mundi.
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Re: App Tab Adventures

Post by patrickjdempsey »

That looks like one of those MARGIN issues Ed. You can't have *any* margins defined for App tabs, they used to fail all of the time and now they fail in "tab overflow mode".... I think I liked it better when they just failed all of the time.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
User avatar
mcdavis
Posts: 3195
Joined: December 9th, 2005, 5:51 am

Re: App Tab Adventures

Post by mcdavis »

patrickjdempsey wrote:That looks like one of those MARGIN issues Ed. You can't have *any* margins defined for App tabs, they used to fail all of the time and now they fail in "tab overflow mode".... I think I liked it better when they just failed all of the time.


Right. Ed, if you're using margins, then Mozilla's code thinks your tabs are more narrow than they really are, and it doesn't make enough room for them when they're pinned with scrolling. The code doesn't know to count the margin in figuring out the width, for reasons that are a mystery to me, but probably because it was written to work with the default theme and its non-margin tabs.
Theme Development is Radical Participation.
NNL Beta Builds for Current and Up-coming Firefox
Dear User: Your Help is Needed
Post Reply