2 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
16 * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
20 * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * @extends {WebInspector.View}
32 * @param {boolean} isVertical
33 * @param {boolean} secondIsSidebar
34 * @param {string=} settingName
35 * @param {number=} defaultSidebarWidth
36 * @param {number=} defaultSidebarHeight
38 WebInspector.SplitView = function(isVertical, secondIsSidebar, settingName, defaultSidebarWidth, defaultSidebarHeight)
40 WebInspector.View.call(this);
42 this.registerRequiredCSS("splitView.css");
43 this.element.classList.add("split-view");
45 this._mainView = new WebInspector.VBox();
46 this._mainElement = this._mainView.element;
47 this._mainElement.className = "split-view-contents scroll-target split-view-main vbox"; // Override
49 this._sidebarView = new WebInspector.VBox();
50 this._sidebarElement = this._sidebarView.element;
51 this._sidebarElement.className = "split-view-contents scroll-target split-view-sidebar vbox"; // Override
53 this._resizerElement = this.element.createChild("div", "split-view-resizer");
54 this._resizerElement.createChild("div", "split-view-resizer-border");
55 if (secondIsSidebar) {
56 this._mainView.show(this.element);
57 this._sidebarView.show(this.element);
59 this._sidebarView.show(this.element);
60 this._mainView.show(this.element);
63 this._resizerWidget = new WebInspector.ResizerWidget();
64 this._resizerWidget.setEnabled(true);
65 this._resizerWidget.addEventListener(WebInspector.ResizerWidget.Events.ResizeStart, this._onResizeStart, this);
66 this._resizerWidget.addEventListener(WebInspector.ResizerWidget.Events.ResizeUpdate, this._onResizeUpdate, this);
67 this._resizerWidget.addEventListener(WebInspector.ResizerWidget.Events.ResizeEnd, this._onResizeEnd, this);
69 this._defaultSidebarWidth = defaultSidebarWidth || 200;
70 this._defaultSidebarHeight = defaultSidebarHeight || this._defaultSidebarWidth;
71 this._settingName = settingName;
73 this.setSecondIsSidebar(secondIsSidebar);
75 this._innerSetVertical(isVertical);
76 this._showMode = WebInspector.SplitView.ShowMode.Both;
78 // Should be called after isVertical has the right value.
79 this.installResizer(this._resizerElement);
82 /** @typedef {{showMode: string, size: number}} */
83 WebInspector.SplitView.SettingForOrientation;
85 WebInspector.SplitView.ShowMode = {
88 OnlySidebar: "OnlySidebar"
91 WebInspector.SplitView.Events = {
92 SidebarSizeChanged: "SidebarSizeChanged",
93 ShowModeChanged: "ShowModeChanged"
96 WebInspector.SplitView.MinPadding = 20;
98 WebInspector.SplitView.prototype = {
102 isVertical: function()
104 return this._isVertical;
108 * @param {boolean} isVertical
110 setVertical: function(isVertical)
112 if (this._isVertical === isVertical)
115 this._innerSetVertical(isVertical);
117 if (this.isShowing())
118 this._updateLayout();
122 * @param {boolean} isVertical
124 _innerSetVertical: function(isVertical)
126 this.element.classList.remove(this._isVertical ? "hbox" : "vbox");
127 this._isVertical = isVertical;
128 this.element.classList.add(this._isVertical ? "hbox" : "vbox");
129 delete this._resizerElementSize;
130 this._sidebarSize = -1;
131 this._restoreSidebarSizeFromSettings();
132 if (this._shouldSaveShowMode)
133 this._restoreAndApplyShowModeFromSettings();
134 this._updateShowHideSidebarButton();
135 // FIXME: reverse SplitView.isVertical meaning.
136 this._resizerWidget.setVertical(!isVertical);
137 this.invalidateConstraints();
141 * @param {boolean=} animate
143 _updateLayout: function(animate)
145 delete this._totalSize; // Lazy update.
146 delete this._totalSizeOtherDimension;
148 // Remove properties that might affect total size calculation.
149 this._mainElement.style.removeProperty("width");
150 this._mainElement.style.removeProperty("height");
151 this._sidebarElement.style.removeProperty("width");
152 this._sidebarElement.style.removeProperty("height");
154 this._innerSetSidebarSize(this._preferredSidebarSize(), !!animate);
160 mainElement: function()
162 return this._mainElement;
168 sidebarElement: function()
170 return this._sidebarElement;
176 isSidebarSecond: function()
178 return this._secondIsSidebar;
181 enableShowModeSaving: function()
183 this._shouldSaveShowMode = true;
184 this._restoreAndApplyShowModeFromSettings();
192 return this._showMode;
196 * @param {boolean} secondIsSidebar
198 setSecondIsSidebar: function(secondIsSidebar)
200 this._mainElement.classList.toggle("split-view-contents-first", secondIsSidebar);
201 this._mainElement.classList.toggle("split-view-contents-second", !secondIsSidebar);
202 this._sidebarElement.classList.toggle("split-view-contents-first", !secondIsSidebar);
203 this._sidebarElement.classList.toggle("split-view-contents-second", secondIsSidebar);
205 // Make sure second is last in the children array.
206 if (secondIsSidebar) {
207 if (this._sidebarElement.parentElement && this._sidebarElement.nextSibling)
208 this.element.appendChild(this._sidebarElement);
210 if (this._mainElement.parentElement && this._mainElement.nextSibling)
211 this.element.appendChild(this._mainElement);
214 this._secondIsSidebar = secondIsSidebar;
220 sidebarSide: function()
222 if (this._showMode !== WebInspector.SplitView.ShowMode.Both)
224 return this._isVertical ?
225 (this._secondIsSidebar ? "right" : "left") :
226 (this._secondIsSidebar ? "bottom" : "top");
232 preferredSidebarSize: function()
234 return this._preferredSidebarSize();
240 resizerElement: function()
242 return this._resizerElement;
246 * @param {boolean=} animate
248 hideMain: function(animate)
250 this._showOnly(this._sidebarView, this._mainView, animate);
251 this._updateShowMode(WebInspector.SplitView.ShowMode.OnlySidebar);
255 * @param {boolean=} animate
257 hideSidebar: function(animate)
259 this._showOnly(this._mainView, this._sidebarView, animate);
260 this._updateShowMode(WebInspector.SplitView.ShowMode.OnlyMain);
266 detachChildViews: function()
268 this._mainView.detachChildViews();
269 this._sidebarView.detachChildViews();
273 * @param {!WebInspector.View} sideToShow
274 * @param {!WebInspector.View} sideToHide
275 * @param {boolean=} animate
277 _showOnly: function(sideToShow, sideToHide, animate)
279 this._cancelAnimation();
282 * @this {WebInspector.SplitView}
286 sideToShow.show(this.element);
288 sideToShow.element.classList.add("maximized");
289 sideToHide.element.classList.remove("maximized");
290 this._resizerElement.classList.add("hidden");
291 this._removeAllLayoutProperties();
295 this._animate(true, callback.bind(this));
301 this._sidebarSize = -1;
302 this.setResizable(false);
305 _removeAllLayoutProperties: function()
307 this._sidebarElement.style.removeProperty("flexBasis");
309 this._mainElement.style.removeProperty("width");
310 this._mainElement.style.removeProperty("height");
311 this._sidebarElement.style.removeProperty("width");
312 this._sidebarElement.style.removeProperty("height");
314 this._resizerElement.style.removeProperty("left");
315 this._resizerElement.style.removeProperty("right");
316 this._resizerElement.style.removeProperty("top");
317 this._resizerElement.style.removeProperty("bottom");
319 this._resizerElement.style.removeProperty("margin-left");
320 this._resizerElement.style.removeProperty("margin-right");
321 this._resizerElement.style.removeProperty("margin-top");
322 this._resizerElement.style.removeProperty("margin-bottom");
326 * @param {boolean=} animate
328 showBoth: function(animate)
330 if (this._showMode === WebInspector.SplitView.ShowMode.Both)
333 this._cancelAnimation();
334 this._mainElement.classList.remove("maximized");
335 this._sidebarElement.classList.remove("maximized");
336 this._resizerElement.classList.remove("hidden");
338 this._mainView.show(this.element);
339 this._sidebarView.show(this.element);
340 // Order views in DOM properly.
341 this.setSecondIsSidebar(this._secondIsSidebar);
343 this._sidebarSize = -1;
344 this.setResizable(true);
345 this._updateShowMode(WebInspector.SplitView.ShowMode.Both);
346 this._updateLayout(animate);
350 * @param {boolean} resizable
352 setResizable: function(resizable)
354 this._resizerWidget.setEnabled(resizable);
358 * @param {number} size
360 setSidebarSize: function(size)
362 this._savedSidebarSize = size;
364 this._innerSetSidebarSize(size, false, true);
370 sidebarSize: function()
372 return Math.max(0, this._sidebarSize);
376 * Returns total size in DIP.
379 _totalSizeDIP: function()
381 if (!this._totalSize) {
382 this._totalSize = this._isVertical ? this.element.offsetWidth : this.element.offsetHeight;
383 this._totalSizeOtherDimension = this._isVertical ? this.element.offsetHeight : this.element.offsetWidth;
385 return this._totalSize * WebInspector.zoomManager.zoomFactor();
389 * @param {string} showMode
391 _updateShowMode: function(showMode)
393 this._showMode = showMode;
394 this._saveShowModeToSettings();
395 this._updateShowHideSidebarButton();
396 this.dispatchEventToListeners(WebInspector.SplitView.Events.ShowModeChanged, showMode);
397 this.invalidateConstraints();
401 * @param {number} size
402 * @param {boolean} animate
403 * @param {boolean=} userAction
405 _innerSetSidebarSize: function(size, animate, userAction)
407 if (this._showMode !== WebInspector.SplitView.ShowMode.Both || !this.isShowing())
410 size = this._applyConstraints(size, userAction);
411 if (this._sidebarSize === size)
414 if (!this._resizerElementSize)
415 this._resizerElementSize = this._isVertical ? this._resizerElement.offsetWidth : this._resizerElement.offsetHeight;
417 // Invalidate layout below.
419 this._removeAllLayoutProperties();
421 // this._totalSize is available below since we successfully applied constraints.
422 var sidebarSizeValue = (size / WebInspector.zoomManager.zoomFactor()) + "px";
423 var mainSizeValue = (this._totalSize - size / WebInspector.zoomManager.zoomFactor()) + "px";
424 this.sidebarElement().style.flexBasis = sidebarSizeValue;
426 // Make both sides relayout boundaries.
427 if (this._isVertical) {
428 this._sidebarElement.style.width = sidebarSizeValue;
429 this._mainElement.style.width = mainSizeValue;
430 this._sidebarElement.style.height = this._totalSizeOtherDimension + "px";
431 this._mainElement.style.height = this._totalSizeOtherDimension + "px";
433 this._sidebarElement.style.height = sidebarSizeValue;
434 this._mainElement.style.height = mainSizeValue;
435 this._sidebarElement.style.width = this._totalSizeOtherDimension + "px";
436 this._mainElement.style.width = this._totalSizeOtherDimension + "px";
440 if (this._isVertical) {
441 if (this._secondIsSidebar) {
442 this._resizerElement.style.right = sidebarSizeValue;
443 this._resizerElement.style.marginRight = -this._resizerElementSize / 2 + "px";
445 this._resizerElement.style.left = sidebarSizeValue;
446 this._resizerElement.style.marginLeft = -this._resizerElementSize / 2 + "px";
449 if (this._secondIsSidebar) {
450 this._resizerElement.style.bottom = sidebarSizeValue;
451 this._resizerElement.style.marginBottom = -this._resizerElementSize / 2 + "px";
453 this._resizerElement.style.top = sidebarSizeValue;
454 this._resizerElement.style.marginTop = -this._resizerElementSize / 2 + "px";
458 this._sidebarSize = size;
463 this._animate(false);
465 // No need to recalculate this._sidebarSize and this._totalSize again.
467 this.dispatchEventToListeners(WebInspector.SplitView.Events.SidebarSizeChanged, this.sidebarSize());
472 * @param {boolean} reverse
473 * @param {function()=} callback
475 _animate: function(reverse, callback)
477 var animationTime = 50;
478 this._animationCallback = callback;
480 var animatedMarginPropertyName;
481 if (this._isVertical)
482 animatedMarginPropertyName = this._secondIsSidebar ? "margin-right" : "margin-left";
484 animatedMarginPropertyName = this._secondIsSidebar ? "margin-bottom" : "margin-top";
486 var zoomFactor = WebInspector.zoomManager.zoomFactor();
487 var marginFrom = reverse ? "0" : "-" + (this._sidebarSize / zoomFactor) + "px";
488 var marginTo = reverse ? "-" + (this._sidebarSize / zoomFactor) + "px" : "0";
490 // This order of things is important.
491 // 1. Resize main element early and force layout.
492 this.element.style.setProperty(animatedMarginPropertyName, marginFrom);
494 suppressUnused(this._mainElement.offsetWidth);
495 suppressUnused(this._sidebarElement.offsetWidth);
498 // 2. Issue onresize to the sidebar element, its size won't change.
500 this._sidebarView.doResize();
502 // 3. Configure and run animation
503 this.element.style.setProperty("transition", animatedMarginPropertyName + " " + animationTime + "ms linear");
505 var boundAnimationFrame;
508 * @this {WebInspector.SplitView}
510 function animationFrame()
512 delete this._animationFrameHandle;
515 // Kick animation on first frame.
516 this.element.style.setProperty(animatedMarginPropertyName, marginTo);
517 startTime = window.performance.now();
518 } else if (window.performance.now() < startTime + animationTime) {
519 // Process regular animation frame.
520 this._mainView.doResize();
522 // Complete animation.
523 this._cancelAnimation();
524 this._mainView.doResize();
525 this.dispatchEventToListeners(WebInspector.SplitView.Events.SidebarSizeChanged, this.sidebarSize());
528 this._animationFrameHandle = window.requestAnimationFrame(boundAnimationFrame);
530 boundAnimationFrame = animationFrame.bind(this);
531 this._animationFrameHandle = window.requestAnimationFrame(boundAnimationFrame);
534 _cancelAnimation: function()
536 this.element.style.removeProperty("margin-top");
537 this.element.style.removeProperty("margin-right");
538 this.element.style.removeProperty("margin-bottom");
539 this.element.style.removeProperty("margin-left");
540 this.element.style.removeProperty("transition");
542 if (this._animationFrameHandle) {
543 window.cancelAnimationFrame(this._animationFrameHandle);
544 delete this._animationFrameHandle;
546 if (this._animationCallback) {
547 this._animationCallback();
548 delete this._animationCallback;
553 * @param {number} sidebarSize
554 * @param {boolean=} userAction
557 _applyConstraints: function(sidebarSize, userAction)
559 var totalSize = this._totalSizeDIP();
561 var constraints = this._sidebarView.constraints();
562 var minSidebarSize = this.isVertical() ? constraints.minimum.width : constraints.minimum.height;
564 minSidebarSize = WebInspector.SplitView.MinPadding;
566 var preferredSidebarSize = this.isVertical() ? constraints.preferred.width : constraints.preferred.height;
567 if (!preferredSidebarSize)
568 preferredSidebarSize = WebInspector.SplitView.MinPadding;
569 // Allow sidebar to be less than preferred by explicit user action.
570 if (sidebarSize < preferredSidebarSize)
571 preferredSidebarSize = Math.max(sidebarSize, minSidebarSize);
573 constraints = this._mainView.constraints();
574 var minMainSize = this.isVertical() ? constraints.minimum.width : constraints.minimum.height;
576 minMainSize = WebInspector.SplitView.MinPadding;
578 var preferredMainSize = this.isVertical() ? constraints.preferred.width : constraints.preferred.height;
579 if (!preferredMainSize)
580 preferredMainSize = WebInspector.SplitView.MinPadding;
581 var savedMainSize = this.isVertical() ? this._savedVerticalMainSize : this._savedHorizontalMainSize;
582 if (typeof savedMainSize !== "undefined")
583 preferredMainSize = Math.min(preferredMainSize, savedMainSize);
585 preferredMainSize = minMainSize;
587 // Enough space for preferred.
588 var totalPreferred = preferredMainSize + preferredSidebarSize;
589 if (totalPreferred <= totalSize)
590 return Number.constrain(sidebarSize, preferredSidebarSize, totalSize - preferredMainSize);
592 // Enough space for minimum.
593 if (minMainSize + minSidebarSize <= totalSize) {
594 var delta = totalPreferred - totalSize;
595 var sidebarDelta = delta * preferredSidebarSize / totalPreferred;
596 sidebarSize = preferredSidebarSize - sidebarDelta;
597 return Number.constrain(sidebarSize, minSidebarSize, totalSize - minMainSize);
600 // Not enough space even for minimum sizes.
601 return Math.max(0, totalSize - minMainSize);
606 this._forceUpdateLayout();
607 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.ZoomChanged, this._onZoomChanged, this);
612 WebInspector.zoomManager.removeEventListener(WebInspector.ZoomManager.Events.ZoomChanged, this._onZoomChanged, this);
617 this._updateLayout();
622 this._updateLayout();
626 * @return {!Constraints}
628 calculateConstraints: function()
630 if (this._showMode === WebInspector.SplitView.ShowMode.OnlyMain)
631 return this._mainView.constraints();
632 if (this._showMode === WebInspector.SplitView.ShowMode.OnlySidebar)
633 return this._sidebarView.constraints();
635 var mainConstraints = this._mainView.constraints();
636 var sidebarConstraints = this._sidebarView.constraints();
637 var min = WebInspector.SplitView.MinPadding;
638 if (this._isVertical) {
639 mainConstraints = mainConstraints.widthToMax(min);
640 sidebarConstraints = sidebarConstraints.widthToMax(min);
641 return mainConstraints.addWidth(sidebarConstraints).heightToMax(sidebarConstraints);
643 mainConstraints = mainConstraints.heightToMax(min);
644 sidebarConstraints = sidebarConstraints.heightToMax(min);
645 return mainConstraints.widthToMax(sidebarConstraints).addHeight(sidebarConstraints);
650 * @param {!WebInspector.Event} event
652 _onResizeStart: function(event)
654 this._resizeStartSize = this._sidebarSize;
658 * @param {!WebInspector.Event} event
660 _onResizeUpdate: function(event)
662 var cssOffset = event.data.currentPosition - event.data.startPosition;
663 var dipOffset = cssOffset * WebInspector.zoomManager.zoomFactor();
664 var newSize = this._secondIsSidebar ? this._resizeStartSize - dipOffset : this._resizeStartSize + dipOffset;
665 var constrainedSize = this._applyConstraints(newSize, true);
666 this._savedSidebarSize = constrainedSize;
668 this._innerSetSidebarSize(constrainedSize, false, true);
669 if (this.isVertical())
670 this._savedVerticalMainSize = this._totalSizeDIP() - this._sidebarSize;
672 this._savedHorizontalMainSize = this._totalSizeDIP() - this._sidebarSize;
676 * @param {!WebInspector.Event} event
678 _onResizeEnd: function(event)
680 delete this._resizeStartSize;
683 hideDefaultResizer: function()
685 this.uninstallResizer(this._resizerElement);
689 * @param {!Element} resizerElement
691 installResizer: function(resizerElement)
693 this._resizerWidget.addElement(resizerElement);
697 * @param {!Element} resizerElement
699 uninstallResizer: function(resizerElement)
701 this._resizerWidget.removeElement(resizerElement);
707 hasCustomResizer: function()
709 var elements = this._resizerWidget.elements();
710 return elements.length > 1 || (elements.length == 1 && elements[0] !== this._resizerElement);
714 * @param {!Element} resizer
715 * @param {boolean} on
717 toggleResizer: function(resizer, on)
720 this.installResizer(resizer);
722 this.uninstallResizer(resizer);
726 * @return {?WebInspector.Setting}
730 if (!this._settingName)
733 if (!WebInspector.settings[this._settingName])
734 WebInspector.settings[this._settingName] = WebInspector.settings.createSetting(this._settingName, {});
736 return WebInspector.settings[this._settingName];
740 * @return {?WebInspector.SplitView.SettingForOrientation}
742 _settingForOrientation: function()
744 var state = this._setting() ? this._setting().get() : {};
745 return this._isVertical ? state.vertical : state.horizontal;
751 _preferredSidebarSize: function()
753 var size = this._savedSidebarSize;
755 size = this._isVertical ? this._defaultSidebarWidth : this._defaultSidebarHeight;
756 // If we have default value in percents, calculate it on first use.
757 if (0 < size && size < 1)
758 size *= this._totalSizeDIP();
763 _restoreSidebarSizeFromSettings: function()
765 var settingForOrientation = this._settingForOrientation();
766 this._savedSidebarSize = settingForOrientation ? settingForOrientation.size : 0;
769 _restoreAndApplyShowModeFromSettings: function()
771 var orientationState = this._settingForOrientation();
772 this._savedShowMode = orientationState ? orientationState.showMode : WebInspector.SplitView.ShowMode.Both;
773 this._showMode = this._savedShowMode;
775 switch (this._savedShowMode) {
776 case WebInspector.SplitView.ShowMode.Both:
779 case WebInspector.SplitView.ShowMode.OnlyMain:
782 case WebInspector.SplitView.ShowMode.OnlySidebar:
788 _saveShowModeToSettings: function()
790 this._savedShowMode = this._showMode;
794 _saveSetting: function()
796 var setting = this._setting();
799 var state = setting.get();
800 var orientationState = (this._isVertical ? state.vertical : state.horizontal) || {};
802 orientationState.size = this._savedSidebarSize;
803 if (this._shouldSaveShowMode)
804 orientationState.showMode = this._savedShowMode;
806 if (this._isVertical)
807 state.vertical = orientationState;
809 state.horizontal = orientationState;
813 _forceUpdateLayout: function()
815 // Force layout even if sidebar size does not change.
816 this._sidebarSize = -1;
817 this._updateLayout();
821 * @param {!WebInspector.Event} event
823 _onZoomChanged: function(event)
825 this._forceUpdateLayout();
829 * @param {string} title
830 * @param {string} className
831 * @return {!WebInspector.StatusBarButton}
833 createShowHideSidebarButton: function(title, className)
835 console.assert(this.isVertical(), "Buttons for split view with horizontal split are not supported yet.");
837 this._showHideSidebarButtonTitle = WebInspector.UIString(title);
838 this._showHideSidebarButton = new WebInspector.StatusBarButton("", "sidebar-show-hide-button " + className, 3);
839 this._showHideSidebarButton.addEventListener("click", buttonClicked.bind(this));
840 this._updateShowHideSidebarButton();
843 * @this {WebInspector.SplitView}
844 * @param {!WebInspector.Event} event
846 function buttonClicked(event)
848 if (this._showMode !== WebInspector.SplitView.ShowMode.Both)
851 this.hideSidebar(true);
854 return this._showHideSidebarButton;
857 _updateShowHideSidebarButton: function()
859 if (!this._showHideSidebarButton)
861 var sidebarHidden = this._showMode === WebInspector.SplitView.ShowMode.OnlyMain;
862 this._showHideSidebarButton.state = sidebarHidden ? "show" : "hide";
863 this._showHideSidebarButton.element.classList.toggle("top-sidebar-show-hide-button", !this.isVertical() && !this.isSidebarSecond());
864 this._showHideSidebarButton.element.classList.toggle("right-sidebar-show-hide-button", this.isVertical() && this.isSidebarSecond());
865 this._showHideSidebarButton.element.classList.toggle("bottom-sidebar-show-hide-button", !this.isVertical() && this.isSidebarSecond());
866 this._showHideSidebarButton.element.classList.toggle("left-sidebar-show-hide-button", this.isVertical() && !this.isSidebarSecond());
867 this._showHideSidebarButton.title = sidebarHidden ? WebInspector.UIString("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s", this._showHideSidebarButtonTitle);
870 __proto__: WebInspector.View.prototype