Skip to content

Commit

Permalink
Update Sidebar to 1.0.0.2.
Browse files Browse the repository at this point in the history
* Keep sidebar showing after leaving  fullscreen mode.
* Respect user's choice about browser.tabs.insertAfterCurrent and browser.tabs.insertRelatedAfterCurrent
  • Loading branch information
MrAlex94 committed May 13, 2024
1 parent 4bf9859 commit c47cb10
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 8 deletions.
2 changes: 1 addition & 1 deletion waterfox/browser/components/WaterfoxGlue.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ export const WaterfoxGlue = {
addon =
(await lazy.AddonManager.maybeInstallBuiltinAddon(
ID,
"1.0.0.1",
"1.0.0.2",
"resource://builtin-addons/sidebar/"
)) || addon;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,10 @@ Tab.onUpdated.addListener((tab, changeInfo) => {
const siteMatcher = /^\w+:\/\/([^\/]+)(?:$|\/.*$)/;
const openerTabSite = possibleOpenerTab.url.match(siteMatcher);
const newTabSite = tab.url.match(siteMatcher);
if (openerTabSite && newTabSite && openerTabSite[1] == newTabSite[1]) {
if (openerTabSite &&
newTabSite &&
tab.url != possibleOpenerTab.url && // It may be opened by "Duplciate Tab" or "Open in New Container Tab" if the URL is completely same.
openerTabSite[1] == newTabSite[1]) {
log('behave as a tab opened from same site (delayed)');
tab.$TST.addState(Constants.kTAB_STATE_OPENED_FOR_SAME_WEBSITE);
handleNewTabFromActiveTab(tab, {
Expand Down
4 changes: 3 additions & 1 deletion waterfox/browser/components/sidebar/common/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const WATERFOX_SPECIFIC_VALUES = {
syncParentTabAndOpenerTab: false,

// don't attach tabs as children of the active tab by default if possible
autoAttachOnOpenedWithOwner: Constants.kNEWTAB_OPEN_AS_CHILD_NEXT_TO_LAST_RELATED_TAB,
autoAttachOnOpenedWithOwner: Constants.kNEWTAB_DO_NOTHING,
insertNewTabFromPinnedTabAt: Constants.kINSERT_NO_CONTROL,
insertNewTabFromFirefoxViewAt: Constants.kINSERT_NO_CONTROL,
autoGroupNewTabsFromPinned: false,
autoAttachOnNewTabButtonMiddleClick: Constants.kNEWTAB_OPEN_AS_NEXT_SIBLING,
autoAttachSameSiteOrphan: Constants.kNEWTAB_OPEN_AS_NEXT_SIBLING,
Expand Down
26 changes: 26 additions & 0 deletions waterfox/browser/components/sidebar/experiments/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,31 @@ const AboutPreferencesWatcher = {
case 'browser.tabs.searchclipboardfor.middleclick':
Services.prefs.setBoolPref(`${this.BASE_PREF}middleClickPasteURLOnNewTabButton`, Services.prefs.getBoolPref(name));
break;

case 'browser.tabs.insertAfterCurrent':
case 'browser.tabs.insertRelatedAfterCurrent': {
const insertAfterCurrent = Services.prefs.getBoolPref('browser.tabs.insertAfterCurrent');
const insertRelatedAfterCurrent = Services.prefs.getBoolPref('browser.tabs.insertRelatedAfterCurrent');
const useTree = (
Services.prefs.getBoolPref(`${this.BASE_PREF}autoAttach`, false) &&
Services.prefs.getBoolPref(`${this.BASE_PREF}syncParentTabAndOpenerTab`, false)
);
Services.prefs.setStringPref(`${this.BASE_PREF}autoAttachOnOpenedWithOwner`,
!useTree ? -1 :
insertRelatedAfterCurrent ? 5 :
insertAfterCurrent ? 6 :
0);
Services.prefs.setStringPref(`${this.BASE_PREF}insertNewTabFromPinnedTabAt`,
!useTree ? -1 :
insertRelatedAfterCurrent ? 3 :
insertAfterCurrent ? 0 :
1);
Services.prefs.setStringPref(`${this.BASE_PREF}insertNewTabFromFirefoxViewAt`,
!useTree ? -1 :
insertRelatedAfterCurrent ? 3 :
insertAfterCurrent ? 0 :
1);
}; break;
}
},

Expand Down Expand Up @@ -1081,6 +1106,7 @@ this.prefs = class extends ExtensionAPI {
Services.prefs.setBoolPref(dest, Services.prefs.getBoolPref(source));
}
Services.prefs.addObserver('browser.tabs.', AboutPreferencesWatcher);
AboutPreferencesWatcher.onPrefChanged('browser.tabs.insertAfterCurrent');

return {
prefs: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ const BrowserWindowWatcher = {
}
}
else {
FullScreen.__ws_sidebar.show();
FullScreen.__ws_sidebar.show({ exitting: true });
FullScreen.__ws_sidebar.cleanup();
}

Expand Down Expand Up @@ -830,12 +830,14 @@ const BrowserWindowWatcher = {
this.startListenToShow();
},

show() {
show({ exitting } = {}) {
sidebarBox.removeAttribute('fullscreenShouldAnimate');
sidebarBox.style.marginLeft = sidebarBox.style.marginRight = '';

this.endListenToShow();
this.updateMouseTargetRect();
if (!exitting) {
this.updateMouseTargetRect();
}
},

cleanup() {
Expand Down
2 changes: 1 addition & 1 deletion waterfox/browser/components/sidebar/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "__MSG_extensionName__",
"version": "1.0.0.1",
"version": "1.0.0.2",
"author": "Waterfox",
"hidden": true,
"description": "__MSG_extensionDescription__",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ tab-item:not(.collapsed) tab-closebox:active {
/* contextual identity (aka Container Tab) */

.contextual-identity-marker {
--contextual-identity-marker-width: calc(var(--tab-current-size) / 12);
--contextual-identity-marker-width: calc(var(--favicon-size) / 5.5);
position: absolute;
z-index: var(--tab-ui-z-index);
}
Expand Down

0 comments on commit c47cb10

Please sign in to comment.