Bug 1369729 - use descriptionheightworkaround for sync panel, r=Paolo

MozReview-Commit-ID: LQg6NEgCqz2

--HG--
extra : rebase_source : bfe13f52ec729a24ac53854b67d4613fd47b52bb
This commit is contained in:
Gijs Kruitbosch 2017-06-19 16:06:01 +01:00
Родитель 86a3479659
Коммит 28f0bb0532
5 изменённых файлов: 37 добавлений и 20 удалений

Просмотреть файл

@ -16,10 +16,9 @@
</broadcasterset>
<panelmultiview id="identity-popup-multiView"
mainViewId="identity-popup-mainView"
descriptionheightworkaround="true">
<panelview id="identity-popup-mainView" flex="1">
mainViewId="identity-popup-mainView">
<panelview id="identity-popup-mainView" flex="1"
descriptionheightworkaround="true">
<!-- Security Section -->
<hbox id="identity-popup-security" class="identity-popup-section">
<vbox id="identity-popup-security-content" flex="1">
@ -97,7 +96,8 @@
</panelview>
<!-- Security SubView -->
<panelview id="identity-popup-securityView">
<panelview id="identity-popup-securityView"
descriptionheightworkaround="true">
<vbox id="identity-popup-securityView-header">
<label class="plain">
<label class="identity-popup-headline identity-popup-host"></label>

Просмотреть файл

@ -442,6 +442,8 @@ const CustomizableWidgets = [
}
}
this._tabsList.appendChild(fragment);
let panelView = this._tabsList.closest("panelview");
panelView.panelMultiView.descriptionHeightWorkaround(panelView);
}).catch(err => {
Cu.reportError(err);
}).then(() => {

Просмотреть файл

@ -1012,10 +1012,10 @@ this.PanelMultiView = class {
/**
* If the main view or a subview contains wrapping elements, the attribute
* "descriptionheightworkaround" should be set on the view to force all the
* "description" or wrapping toolbarbutton elements to a fixed height.
* If the attribute is set and the visibility, contents, or width of any of
* these elements changes, this function should be called to refresh the
* calculated heights.
* wrapping "description", "label" or "toolbarbutton" elements to a fixed
* height. If the attribute is set and the visibility, contents, or width
* of any of these elements changes, this function should be called to
* refresh the calculated heights.
*
* This may trigger a synchronous layout.
*
@ -1024,7 +1024,7 @@ this.PanelMultiView = class {
* view if omitted.
*/
descriptionHeightWorkaround(viewNode = this._mainView) {
if (!this.node.hasAttribute("descriptionheightworkaround")) {
if (!viewNode.hasAttribute("descriptionheightworkaround")) {
// This view does not require the workaround.
return;
}
@ -1033,8 +1033,20 @@ this.PanelMultiView = class {
// First we reset any change we may have made previously. The first time
// this is called, and in the best case scenario, this has no effect.
let items = [];
for (let element of viewNode.querySelectorAll(
"description:not([hidden]):not([value]),toolbarbutton[wrap]:not([hidden])")) {
// Non-hidden <label> or <description> elements that also aren't empty
// and also don't have a value attribute can be multiline (if their
// text content is long enough).
let isMultiline = ":not(:-moz-any([hidden],[value],:empty))";
let selector = [
"description" + isMultiline,
"label" + isMultiline,
"toolbarbutton[wrap]:not([hidden])",
].join(",");
for (let element of viewNode.querySelectorAll(selector)) {
// Ignore items in hidden containers.
if (element.closest("[hidden]")) {
continue;
}
// Take the label for toolbarbuttons; it only exists on those elements.
element = element.labelElement || element;

Просмотреть файл

@ -11,7 +11,8 @@
noautofocus="true">
<panelmultiview id="PanelUI-multiView" mainViewId="PanelUI-mainView"
viewCacheId="appMenu-viewCache">
<panelview id="PanelUI-mainView" context="customizationPanelContextMenu">
<panelview id="PanelUI-mainView" context="customizationPanelContextMenu"
descriptionheightworkaround="true">
<vbox id="PanelUI-contents-scroller">
<vbox id="PanelUI-contents" class="panelUI-grid"/>
</vbox>
@ -109,7 +110,8 @@
oncommand="PlacesCommandHook.showPlacesOrganizer('History'); CustomizableUI.hidePanelForNode(this);"/>
</panelview>
<panelview id="PanelUI-remotetabs" flex="1" class="PanelUI-subView">
<panelview id="PanelUI-remotetabs" flex="1" class="PanelUI-subView"
descriptionheightworkaround="true">
<label value="&appMenuRemoteTabs.label;" class="panel-subview-header"/>
<vbox class="panel-subview-body">
<!-- this widget has 3 boxes in the body, but only 1 is ever visible -->
@ -298,7 +300,8 @@
</vbox>
</panelview>
<panelview id="PanelUI-panicView" flex="1">
<panelview id="PanelUI-panicView" flex="1"
descriptionheightworkaround="true">
<vbox class="panel-subview-body">
<hbox id="PanelUI-panic-timeframe">
<image id="PanelUI-panic-timeframe-icon" alt=""/>
@ -512,9 +515,9 @@
position="bottomcenter topright"
noautofocus="true">
<photonpanelmultiview id="appMenu-multiView" mainViewId="appMenu-mainView"
descriptionheightworkaround="true"
viewCacheId="appMenu-viewCache">
<panelview id="appMenu-mainView" class="PanelUI-subView">
<panelview id="appMenu-mainView" class="PanelUI-subView"
descriptionheightworkaround="true">
<vbox class="panel-subview-body">
<vbox id="appMenu-addon-banners"/>
<toolbarbutton class="panel-banner-item"

Просмотреть файл

@ -107,8 +107,7 @@
</menupopup>
<panelmultiview id="downloadsPanel-multiView"
mainViewId="downloadsPanel-mainView"
descriptionheightworkaround="true">
mainViewId="downloadsPanel-mainView">
<panelview id="downloadsPanel-mainView">
<vbox class="panel-view-body-unscrollable">
@ -157,7 +156,8 @@
</vbox>
</panelview>
<panelview id="downloadsPanel-blockedSubview">
<panelview id="downloadsPanel-blockedSubview"
descriptionheightworkaround="true">
<vbox class="panel-view-body-unscrollable">
<description id="downloadsPanel-blockedSubview-title"/>
<description id="downloadsPanel-blockedSubview-details1"/>