mirror of
https://github.com/zen-browser/desktop.git
synced 2026-04-30 11:14:19 +00:00
chore: Several QA fixes and options added, b=closes #11105, closes https://github.com/zen-browser/desktop/issues/11020, closes https://github.com/zen-browser/desktop/issues/11105, https://github.com/zen-browser/desktop/issues/10752, c=common, compact-mode, workspaces
This commit is contained in:
@@ -610,10 +610,59 @@ var gZenUIManager = {
|
||||
this._toastTimeouts[messageId] = setTimeout(timeoutFunction, options.timeout || 2000);
|
||||
},
|
||||
|
||||
get panelUIPosition() {
|
||||
return gZenVerticalTabsManager._hasSetSingleToolbar && !gZenVerticalTabsManager._prefsRightSide
|
||||
? 'bottomleft topleft'
|
||||
: 'bottomright topright';
|
||||
panelUIPosition(panel, anchor) {
|
||||
void panel;
|
||||
// The alignment position of the panel is determined during the "popuppositioned" event
|
||||
// when the panel opens. The alignment positions help us determine in which orientation
|
||||
// the panel is anchored to the screen space.
|
||||
//
|
||||
// * "after_start": The panel is anchored at the top-left corner in LTR locales, top-right in RTL locales.
|
||||
// * "after_end": The panel is anchored at the top-right corner in LTR locales, top-left in RTL locales.
|
||||
// * "before_start": The panel is anchored at the bottom-left corner in LTR locales, bottom-right in RTL locales.
|
||||
// * "before_end": The panel is anchored at the bottom-right corner in LTR locales, bottom-left in RTL locales.
|
||||
//
|
||||
// ┌─Anchor(LTR) ┌─Anchor(RTL)
|
||||
// │ Anchor(RTL)─┐ │ Anchor(LTR)─┐
|
||||
// │ │ │ │
|
||||
// x───────────────────x x───────────────────x
|
||||
// │ │ │ │
|
||||
// │ Panel │ │ Panel │
|
||||
// │ "after_start" │ │ "after_end" │
|
||||
// │ │ │ │
|
||||
// └───────────────────┘ └───────────────────┘
|
||||
//
|
||||
// ┌───────────────────┐ ┌───────────────────┐
|
||||
// │ │ │ │
|
||||
// │ Panel │ │ Panel │
|
||||
// │ "before_start" │ │ "before_end" │
|
||||
// │ │ │ │
|
||||
// x───────────────────x x───────────────────x
|
||||
// │ │ │ │
|
||||
// │ Anchor(RTL)─┘ │ Anchor(LTR)─┘
|
||||
// └─Anchor(LTR) └─Anchor(RTL)
|
||||
//
|
||||
// The default choice for the panel is "after_start", to match the content context menu's alignment. However, it is
|
||||
// possible to end up with any of the four combinations. Before the panel is opened, the XUL popup manager needs to
|
||||
// make a determination about the size of the panel and whether or not it will fit within the visible screen area with
|
||||
// the intended alignment. The manager may change the panel's alignment before opening to ensure the panel is fully visible.
|
||||
//
|
||||
// For example, if the panel is opened such that the bottom edge would be rendered off screen, then the XUL popup manager
|
||||
// will change the alignment from "after_start" to "before_start", anchoring the panel's bottom corner to the target screen
|
||||
// location instead of its top corner. This transformation ensures that the whole of the panel is visible on the screen.
|
||||
//
|
||||
// When the panel is anchored by one of its bottom corners (the "before_..." options), then it causes unintentionally odd
|
||||
// behavior where dragging the text-area resizer downward with the mouse actually grows the panel's top edge upward, since
|
||||
// the bottom of the panel is anchored in place. We want to disable the resizer if the panel was positioned to be anchored
|
||||
// from one of its bottom corners.
|
||||
let block = 'before';
|
||||
let inline = 'end';
|
||||
if (anchor?.closest('#zen-sidebar-top-buttons')) {
|
||||
block = 'after';
|
||||
}
|
||||
if (gZenVerticalTabsManager._hasSetSingleToolbar && !gZenVerticalTabsManager._prefsRightSide) {
|
||||
inline = 'start';
|
||||
}
|
||||
return `${block}_${inline}`;
|
||||
},
|
||||
|
||||
urlStringsDomainMatch(url1, url2) {
|
||||
|
||||
@@ -189,6 +189,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media -moz-pref('zen.urlbar.single-toolbar-show-copy-url', false) {
|
||||
:root[zen-single-toolbar='true'] #zen-copy-url-button {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.urlbar-page-action,
|
||||
#tracking-protection-icon-container {
|
||||
padding: 0 !important;
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
:root[zen-no-padding='true'] & {
|
||||
--zen-compact-float: 10px;
|
||||
--zen-compact-top-toolbar-hidden-fix: var(--zen-compact-float);
|
||||
--zen-compact-mode-no-padding-radius-fix: 2px;
|
||||
}
|
||||
|
||||
@@ -68,7 +69,7 @@
|
||||
bottom: calc(var(--zen-compact-float) / 2);
|
||||
height: calc(100% - var(--zen-toolbar-height-with-bookmarks));
|
||||
@media -moz-pref('zen.view.compact.hide-toolbar') {
|
||||
height: 100%;
|
||||
height: calc(100% - var(--zen-compact-top-toolbar-hidden-fix, 0px));
|
||||
}
|
||||
}
|
||||
& #zen-sidebar-top-buttons {
|
||||
|
||||
@@ -52,6 +52,7 @@ export class nsZenSiteDataPanel {
|
||||
this.panel.addEventListener('popupshowing', this);
|
||||
this.document.getElementById('zen-site-data-manage-addons').addEventListener('click', this);
|
||||
this.document.getElementById('zen-site-data-settings-more').addEventListener('click', this);
|
||||
this.anchor.addEventListener('click', this);
|
||||
const kCommandIDs = [
|
||||
'zen-site-data-header-share',
|
||||
'zen-site-data-header-bookmark',
|
||||
@@ -139,6 +140,12 @@ export class nsZenSiteDataPanel {
|
||||
}
|
||||
}
|
||||
|
||||
get #currentPageIsBookmarked() {
|
||||
// A hacky way to check if the current page is bookmarked, but
|
||||
// it works for our purposes.
|
||||
return this.window.BookmarkingUI.star?.hasAttribute('starred');
|
||||
}
|
||||
|
||||
#setSiteHeader() {
|
||||
{
|
||||
const button = this.document.getElementById('zen-site-data-header-reader-mode');
|
||||
@@ -156,7 +163,7 @@ export class nsZenSiteDataPanel {
|
||||
}
|
||||
{
|
||||
const button = this.document.getElementById('zen-site-data-header-bookmark');
|
||||
const isPageBookmarked = this.window.BookmarkingUI.star?.hasAttribute('starred');
|
||||
const isPageBookmarked = this.#currentPageIsBookmarked;
|
||||
|
||||
if (isPageBookmarked) {
|
||||
button.classList.add('active');
|
||||
@@ -548,6 +555,10 @@ export class nsZenSiteDataPanel {
|
||||
BrowserCommands.pageInfo(null, 'permTab');
|
||||
break;
|
||||
}
|
||||
case 'zen-site-data-icon-button': {
|
||||
this.window.gUnifiedExtensions.togglePanel(event);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
const item = event.target.closest('.permission-popup-permission-item');
|
||||
if (!item) {
|
||||
|
||||
@@ -2502,7 +2502,7 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
|
||||
}
|
||||
// Only animate if it's from an event
|
||||
let animateContainer = target && target.target instanceof EventTarget;
|
||||
if (target?.type === 'TabClose' || target?.type === 'TabOpened') {
|
||||
if (target?.type === 'TabClose' || target?.type === 'TabOpen') {
|
||||
animateContainer = target.target.pinned;
|
||||
}
|
||||
await this.onPinnedTabsResize(
|
||||
@@ -2514,14 +2514,29 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
|
||||
);
|
||||
}
|
||||
|
||||
updateShouldHideSeparator(arrowScrollbox, pinnedContainer) {
|
||||
updateShouldHideSeparator(arrowScrollbox, pinnedContainer, fromTabSelection = false) {
|
||||
const visibleTabsFound = () => {
|
||||
let count = 0;
|
||||
for (const child of arrowScrollbox.children) {
|
||||
if (
|
||||
!child.hasAttribute('hidden') &&
|
||||
!child.closing &&
|
||||
!child.hasAttribute('zen-empty-tab')
|
||||
) {
|
||||
count++;
|
||||
if (count > 1) {
|
||||
// Early return
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// <= 2 because we have the empty tab and the new tab button
|
||||
const shouldHideSeparator =
|
||||
pinnedContainer.children.length === 1 ||
|
||||
Array.from(arrowScrollbox.children).filter(
|
||||
(child) =>
|
||||
!child.hasAttribute('hidden') && !child.closing && !child.hasAttribute('zen-empty-tab')
|
||||
).length <= 1;
|
||||
const shouldHideSeparator = fromTabSelection
|
||||
? pinnedContainer.hasAttribute('hide-separator')
|
||||
: pinnedContainer.children.length === 1 || !visibleTabsFound();
|
||||
if (shouldHideSeparator) {
|
||||
pinnedContainer.setAttribute('hide-separator', 'true');
|
||||
} else {
|
||||
@@ -2656,7 +2671,7 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature {
|
||||
}
|
||||
const workspaceID = tab.getAttribute('zen-workspace-id');
|
||||
const isEssential = tab.getAttribute('zen-essential') === 'true';
|
||||
|
||||
this.updateShouldHideSeparator(this.activeWorkspaceStrip, this.pinnedTabsContainer, true);
|
||||
if (tab.hasAttribute('zen-empty-tab')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user