|
1 | 1 | diff --git a/browser/base/content/browser-sidebar.js b/browser/base/content/browser-sidebar.js |
2 | | -index eb1ee9e2b868fa06af4ed88e1d54583cd4196880..faa86a8037a36652e8507d631354e11a7852db07 100644 |
| 2 | +index eb1ee9e2b868fa06af4ed88e1d54583cd4196880..4a4f2e926d2954003cd4b8cbacc318dc820f8cc8 100644 |
3 | 3 | --- a/browser/base/content/browser-sidebar.js |
4 | 4 | +++ b/browser/base/content/browser-sidebar.js |
5 | 5 | @@ -2,10 +2,14 @@ |
@@ -179,7 +179,54 @@ index eb1ee9e2b868fa06af4ed88e1d54583cd4196880..faa86a8037a36652e8507d631354e11a |
179 | 179 | /** |
180 | 180 | * Opens the switcher panel if it's closed, or closes it if it's open. |
181 | 181 | */ |
182 | | -@@ -575,21 +681,31 @@ var SidebarUI = { |
| 182 | +@@ -457,6 +563,10 @@ var SidebarUI = { |
| 183 | + return this._show(commandID).then(() => { |
| 184 | + this._loadSidebarExtension(commandID); |
| 185 | + |
| 186 | ++ // Pulse: Reset sidebar margin to zero to allow for correct animations to |
| 187 | ++ // take place (adapted from dot browser, se below) |
| 188 | ++ this._box.style.marginLeft = '0px' |
| 189 | ++ |
| 190 | + if (triggerNode) { |
| 191 | + updateToggleControlLabel(triggerNode); |
| 192 | + } |
| 193 | +@@ -552,6 +662,25 @@ var SidebarUI = { |
| 194 | + |
| 195 | + this.selectMenuItem(""); |
| 196 | + |
| 197 | ++ // The below code was, in part, based on Dot Browser's source code |
| 198 | ++ // https://github.com/dothq/browser-desktop/blob/3c6b992af8946e1c30180cc824a78d4bb85ba868/patches/browser-base-content-browser-sidebar-js.patch#L183 |
| 199 | ++ |
| 200 | ++ // Pulse Browser: Helper stuff for sidebar animation. We can fake sliding in |
| 201 | ++ // and out by changing the left margin to be a negative value. Then, inside |
| 202 | ++ // of our css code, we can animate it to close. |
| 203 | ++ this._box.style.marginLeft = `${-Math.abs(this._box.getBoundingClientRect().width)}px` |
| 204 | ++ |
| 205 | ++ // We want to fully set it to hidden to slightly improve browser performance |
| 206 | ++ // when it is hidden. Note that this replaces some of Mozilla's code that |
| 207 | ++ // would generally be down below |
| 208 | ++ setTimeout(() => { |
| 209 | ++ this._box.hidden = true |
| 210 | ++ this._splitter.hidden = true |
| 211 | ++ |
| 212 | ++ this._box.removeAttribute("checked") |
| 213 | ++ }, 170); |
| 214 | ++ |
| 215 | ++ |
| 216 | + // Replace the document currently displayed in the sidebar with about:blank |
| 217 | + // so that we can free memory by unloading the page. We need to explicitly |
| 218 | + // create a new content viewer because the old one doesn't get destroyed |
| 219 | +@@ -560,9 +689,6 @@ var SidebarUI = { |
| 220 | + this.browser.setAttribute("src", "about:blank"); |
| 221 | + this.browser.docShell.createAboutBlankContentViewer(null, null); |
| 222 | + |
| 223 | +- this._box.removeAttribute("checked"); |
| 224 | +- this._box.hidden = this._splitter.hidden = true; |
| 225 | +- |
| 226 | + let selBrowser = gBrowser.selectedBrowser; |
| 227 | + selBrowser.focus(); |
| 228 | + if (triggerNode) { |
| 229 | +@@ -575,21 +701,31 @@ var SidebarUI = { |
183 | 230 | * none if the argument is an empty string. |
184 | 231 | */ |
185 | 232 | selectMenuItem(commandID) { |
|
0 commit comments