author | Tim Taubert <ttaubert@mozilla.com> |
Thu, 11 Jun 2015 14:21:54 +0200 | |
changeset 250167 | 2555d8ffbd6b9d511e98110520dceaf3fa012dc9 |
parent 250166 | 3606409b170fbadec766916c5c8ccfcada8bc179 |
child 250168 | dbb2669057808e7f95d81b8a88e0c75aa0365269 |
push id | 61471 |
push user | cbook@mozilla.com |
push date | Thu, 25 Jun 2015 09:33:34 +0000 |
treeherder | mozilla-inbound@5b38df79819f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | Gijs |
bugs | 1170759 |
milestone | 41.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/components/customizableui/content/panelUI.xml +++ b/browser/components/customizableui/content/panelUI.xml @@ -235,25 +235,34 @@ if (aAnchor) { // We need to find the edge of the anchor, relative to the main panel. // Then we need to add half the width of the anchor. This is the target // that we need to transition to. let anchorRect = aAnchor.getBoundingClientRect(); let mainViewRect = this._mainViewContainer.getBoundingClientRect(); let center = aAnchor.clientWidth / 2; let direction = aAnchor.ownerDocument.defaultView.getComputedStyle(aAnchor, null).direction; - let edge, target; + let edge; if (direction == "ltr") { edge = anchorRect.left - mainViewRect.left; - target = "-" + (edge + center); } else { edge = mainViewRect.right - anchorRect.right; - target = edge + center; } - this._mainViewContainer.style.transform = "translateX(" + target + "px)"; + + // If the anchor is an element on the far end of the mainView we + // don't want to shift the mainView too far, we would reveal empty + // space otherwise. + let cstyle = window.getComputedStyle(document.documentElement, null); + let exitSubViewGutterWidth = + cstyle.getPropertyValue("--panel-ui-exit-subview-gutter-width"); + let maxShift = mainViewRect.width - parseInt(exitSubViewGutterWidth); + let target = Math.min(maxShift, edge + center); + + let neg = direction == "ltr" ? "-" : ""; + this._mainViewContainer.style.transform = `translateX(${neg}${target}px)`; aAnchor.setAttribute("panel-multiview-anchor", true); } else { this._mainViewContainer.style.transform = ""; if (this.anchorElement) this.anchorElement.removeAttribute("panel-multiview-anchor"); } this.anchorElement = aAnchor; ]]></body>
--- a/browser/themes/shared/customizableui/panelUIOverlay.inc.css +++ b/browser/themes/shared/customizableui/panelUIOverlay.inc.css @@ -7,32 +7,32 @@ %define menuPanelWidth 22.35em %define standaloneSubviewWidth 30em % XXXgijs This is the ugliest bit of code I think I've ever written for Mozilla. % Basically, the 0.1px is there to avoid CSS rounding errors causing buttons to wrap. % For gory details, refer to https://bugzilla.mozilla.org/show_bug.cgi?id=963365#c11 % There's no calc() here (and therefore lots of calc() where this is used) because % we don't support nested calc(): https://bugzilla.mozilla.org/show_bug.cgi?id=968761 %define menuPanelButtonWidth (@menuPanelWidth@ / 3 - 0.1px) -%define exitSubviewGutterWidth 38px %define buttonStateHover :not(:-moz-any([disabled],[open],:active)):hover %define menuStateHover :not(:-moz-any([disabled],:active))[_moz-menuactive] %define buttonStateActive :not([disabled]):-moz-any([open],:hover:active) %define menuStateActive :not([disabled])[_moz-menuactive]:active %define menuStateMenuActive :not([disabled])[_moz-menuactive] %include ../browser.inc :root { --panel-ui-button-background-image: linear-gradient(to bottom, transparent, hsla(0,0%,100%,.3) 30%, hsla(0,0%,100%,.3) 70%, transparent), linear-gradient(to bottom, transparent, hsla(210,54%,20%,.3) 30%, hsla(210,54%,20%,.3) 70%, transparent), linear-gradient(to bottom, transparent, hsla(0,0%,100%,.3) 30%, hsla(0,0%,100%,.3) 70%, transparent); --panel-ui-button-background-size: 1px calc(100% - 1px), 1px calc(100% - 1px), 1px calc(100% - 1px) !important; --panel-ui-button-background-position: 0px 0px, 1px 0px, 2px 0px; --panel-ui-button-background-repeat: no-repeat; + --panel-ui-exit-subview-gutter-width: 38px; } #PanelUI-popup #PanelUI-contents:empty { height: 128px; } #PanelUI-popup #PanelUI-contents:empty::before { content: ""; @@ -114,17 +114,17 @@ } .panel-subviews { padding: 4px; background-clip: padding-box; border-left: 1px solid hsla(210,4%,10%,.3); box-shadow: 0 3px 5px hsla(210,4%,10%,.1), 0 0 7px hsla(210,4%,10%,.1); - -moz-margin-start: @exitSubviewGutterWidth@; + -moz-margin-start: var(--panel-ui-exit-subview-gutter-width); } .panel-viewstack[viewtype="main"] > .panel-subviews { transform: translateX(@menuPanelWidth@); } .panel-viewstack[viewtype="main"] > .panel-subviews:-moz-locale-dir(rtl) { transform: translateX(-@menuPanelWidth@); @@ -968,41 +968,41 @@ toolbarbutton[panel-multiview-anchor="tr background-position: 0; } #PanelUI-help[panel-multiview-anchor="true"]::after { content: ""; position: absolute; top: 0; height: 100%; - width: @exitSubviewGutterWidth@; + width: var(--panel-ui-exit-subview-gutter-width); background-image: url(chrome://browser/skin/customizableui/subView-arrow-back-inverted.png), linear-gradient(rgba(255,255,255,0.3), transparent); background-repeat: no-repeat; background-color: Highlight; background-position: left 10px center, 0; } #PanelUI-help[panel-multiview-anchor="true"]:-moz-locale-dir(rtl)::after { background-image: url(chrome://browser/skin/customizableui/subView-arrow-back-inverted-rtl.png), linear-gradient(rgba(255,255,255,0.3), transparent); background-position: right 10px center, 0; } toolbarbutton[panel-multiview-anchor="true"] { background-image: url(chrome://browser/skin/customizableui/subView-arrow-back-inverted.png), linear-gradient(rgba(255,255,255,0.3), transparent); - background-position: right calc(@menuPanelButtonWidth@ / 2 - @exitSubviewGutterWidth@ + 2px) center; + background-position: right calc(@menuPanelButtonWidth@ / 2 - var(--panel-ui-exit-subview-gutter-width) + 2px) center; background-repeat: no-repeat, repeat; } toolbarbutton[panel-multiview-anchor="true"]:-moz-locale-dir(rtl) { background-image: url(chrome://browser/skin/customizableui/subView-arrow-back-inverted-rtl.png), linear-gradient(rgba(255,255,255,0.3), transparent); - background-position: left calc(@menuPanelButtonWidth@ / 2 - @exitSubviewGutterWidth@ + 2px) center; + background-position: left calc(@menuPanelButtonWidth@ / 2 - var(--panel-ui-exit-subview-gutter-width) + 2px) center; } toolbarpaletteitem[place="palette"] > .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker, #bookmarks-menu-button[cui-areatype="menu-panel"] > .toolbarbutton-menubutton-dropmarker { display: none; } #search-container[cui-areatype="menu-panel"],