autohide bm and main toolbars: Add dpi dependent bottom margin for toolbox

On Windows 10 at least, the -1px static bottom margin we were using
causes a empty row of pixels to appear between tabs toolbar and nav-bar
when: 1. compact mode is used and 2. window scaling is at least 120% and
3. menubar is disabled.

This might be useful to be made to apply to Windows only, but that needs
testing. I suspect that this is also somewhat system dependent or
depends on more than just display scaling and density.
This commit is contained in:
MrOtherGuy
2025-03-01 09:09:20 +02:00
parent 2147612b2d
commit 0bdc0db51f
@@ -6,8 +6,8 @@ See the above repository for updates as well as full license text. */
--uc-bm-height: calc(20px + 2 * var(--uc-bm-padding)); /* Might need to adjust if the toolbar has other buttons */ --uc-bm-height: calc(20px + 2 * var(--uc-bm-padding)); /* Might need to adjust if the toolbar has other buttons */
--uc-navbar-height: -40px; /* navbar is main toolbar. Use negative value */ --uc-navbar-height: -40px; /* navbar is main toolbar. Use negative value */
--uc-autohide-toolbar-delay: 600ms; /* The toolbar is hidden after 0.6s */ --uc-autohide-toolbar-delay: 600ms; /* The toolbar is hidden after 0.6s */
--uc-toolbox-browser-area-overlap: -1px;
} }
:root[uidensity="compact"] #navigator-toolbox{ :root[uidensity="compact"] #navigator-toolbox{
--uc-navbar-height: -34px; --uc-navbar-height: -34px;
} }
@@ -19,6 +19,20 @@ See the above repository for updates as well as full license text. */
:root[chromehidden~="toolbar"] #navigator-toolbox{ :root[chromehidden~="toolbar"] #navigator-toolbox{
--uc-navbar-height: 0px; --uc-navbar-height: 0px;
} }
/* At least on Windows 10 display scaling > 100% causes 1px gap to appear below tabs depending on Firefox
* density settings and whether or not menubar is enabled.
*/
@media (min-resolution: 120dpi){
:root[uidensity="compact"] #navigator-toolbox:has(> #toolbar-menubar[autohide="false"]){
--uc-toolbox-browser-area-overlap: -0.5px;
}
}
@media (min-resolution: 140dpi){
#navigator-toolbox{
--uc-toolbox-browser-area-overlap: -0.5px;
}
}
#navigator-toolbox, #navigator-toolbox,
#sidebar-box, #sidebar-box,
#sidebar-main, #sidebar-main,
@@ -76,7 +90,7 @@ See the above repository for updates as well as full license text. */
} }
:root[sessionrestored]:not([customizing]) #navigator-toolbox{ :root[sessionrestored]:not([customizing]) #navigator-toolbox{
margin-bottom: calc(-1px - var(--uc-bm-height) + var(--uc-navbar-height)); margin-bottom: calc(var(--uc-toolbox-browser-area-overlap,0px) - var(--uc-bm-height) + var(--uc-navbar-height));
} }
/* Make sure the bookmarks toolbar is never collapsed even if it is disabled */ /* Make sure the bookmarks toolbar is never collapsed even if it is disabled */
@@ -111,7 +125,7 @@ See the above repository for updates as well as full license text. */
/* Show when cursor is over the toolbar area or when some menu panel is open */ /* Show when cursor is over the toolbar area or when some menu panel is open */
#mainPopupSet:has(> [panelopen]:not(#ask-chat-shortcuts,#tab-preview-panel)) ~ #navigator-toolbox > :is(#nav-bar,#PersonalToolbar), #mainPopupSet:has(> [panelopen]:not(#ask-chat-shortcuts,#tab-preview-panel)) ~ #navigator-toolbox > :is(#nav-bar,#PersonalToolbar),
#navigator-toolbox:hover > .browser-toolbar{ #navigator-toolbox:hover > :is(#nav-bar,#PersonalToolbar){
transition-delay: 100ms !important; transition-delay: 100ms !important;
transform: rotateX(0); transform: rotateX(0);
} }