Bug 1553768 - [de-xbl] remove the menu-vertical, appmenu-vertical bindings - convert to <toolbarbutton is="toolbarbutton-appmenu">. rs=bustage-fix,jorgk

This commit is contained in:
Magnus Melin 2019-05-23 13:07:49 +03:00
Родитель b493127181
Коммит cb837aff69
12 изменённых файлов: 61 добавлений и 83 удалений

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

@ -128,7 +128,7 @@
defaultlabelalign="end">
<!-- more toolbarpalette items are added with an overlay -->
<toolbarpalette id="event-toolbarpalette">
<toolbarbutton id="calendar-item-appmenu-button"
<toolbarbutton is="toolbarbutton-appmenu" id="calendar-item-appmenu-button"
type="menu"
class="toolbarbutton-1 button-appmenu"
label="&lightning.toolbar.appmenuButton.label;"

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

@ -117,7 +117,7 @@
label="&showUnifinderCmd.label;"
tooltiptext="&showUnifinderCmd.tooltip;"
observes="calendar_show_unifinder_command"/>
<toolbarbutton id="calendar-appmenu-button"
<toolbarbutton is="toolbarbutton-appmenu" id="calendar-appmenu-button"
type="menu"
class="toolbarbutton-1 button-appmenu"
label="&lightning.toolbar.appmenuButton.label;"
@ -174,7 +174,7 @@
label="&lightning.toolbar.print.label;"
tooltiptext="&lightning.toolbar.print.tooltip;"
observes="cmd_print"/>
<toolbarbutton id="task-appmenu-button"
<toolbarbutton is="toolbarbutton-appmenu" id="task-appmenu-button"
type="menu"
class="toolbarbutton-1 button-appmenu"
label="&lightning.toolbar.appmenuButton.label;"

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

@ -1,31 +0,0 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<bindings id="generalBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="menu-vertical"
extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton">
<content>
<children includes="observes|template|menupopup|panel|tooltip"/>
<xul:hbox flex="1" align="center">
<xul:vbox flex="1" align="center">
<xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,label,consumeanchor"/>
<xul:label class="toolbarbutton-text" crop="right" flex="1"
xbl:inherits="value=label,accesskey,crop,dragover-top,wrap"/>
<xul:label class="toolbarbutton-multiline-text" flex="1"
xbl:inherits="xbl:text=label,accesskey,wrap"/>
</xul:vbox>
<xul:dropmarker anonid="dropmarker" type="menu"
class="toolbarbutton-menu-dropmarker" xbl:inherits="disabled,label"/>
</xul:hbox>
</content>
</binding>
</bindings>

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

@ -19,6 +19,7 @@ if (!isDummyDocument) {
"chrome://messenger/content/foldersummary.js",
"chrome://messenger/content/addressbook/menulist-addrbooks.js",
"chrome://messenger/content/toolbarbutton-menu-button.js",
"chrome://messenger/content/toolbarbutton-appmenu.js",
]) {
Services.scriptloader.loadSubScript(script, window);
}

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

@ -202,33 +202,4 @@
]]></handler>
</handlers>
</binding>
<binding id="appmenu-vertical" extends="chrome://messenger/content/generalBindings.xml#menu-vertical">
<implementation>
<method name="_setupAppmenu">
<parameter name="event"/>
<body><![CDATA[
if (event.target == this) {
let appmenuPopup = document.getElementById("appmenu-popup");
if (this.lastChild != appmenuPopup) {
this.appendChild(appmenuPopup);
}
}
]]></body>
</method>
</implementation>
<handlers>
<!-- While it would seem we could do this by handling oncommand, we can't
because any external oncommand handlers might get called before ours,
and then they would see the incorrect value of checked. Additionally
a command attribute would redirect the command events anyway.
Also, the appmenu-popup needs to be appended to the target 'Hamburger
button' dynamically at every button click (as opposed to appended
once in the binding's constructor) otherwise only one of the four
Hamburger buttons (on the Mail, Calendar, Tasks and Chat tabs) will
get the popup menu (namely, Mail). See Bug 890332. -->
<handler event="mousedown" button="0" action="this._setupAppmenu(event);"/>
<handler event="keypress" key=" " action="this._setupAppmenu(event);"/>
</handlers>
</binding>
</bindings>

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

@ -314,7 +314,7 @@
label="&stopButton.label;"
tooltiptext="&stopButton.tooltip;"
command="cmd_stop"/>
<toolbarbutton id="button-appmenu"
<toolbarbutton is="toolbarbutton-appmenu" id="button-appmenu"
type="menu"
class="toolbarbutton-1 button-appmenu"
label="&appmenuButton.label;"

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

@ -170,10 +170,6 @@ splitmenu {
pointer-events: none;
}
.button-appmenu {
-moz-binding: url("chrome://messenger/content/mailWidgets.xml#appmenu-vertical") !important;
}
%ifndef XP_MACOSX
toolbar[type="menubar"][autohide="true"] {
overflow: hidden;
@ -295,4 +291,4 @@ statuspanel:not([label]) {
.statuspanel-inner {
height: 3em;
-moz-box-align: end;
}
}

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

@ -0,0 +1,53 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* global MozXULElement */
// Wrap in a block to prevent leaking to window scope.
{
/**
* The MozToolbarButtonAppmenu is a toolbarbutton to display an appmenu
* (a.k.a. hamburger menu) button.
*
* @extends MozToolbarbutton
*/
class MozToolbarButtonAppmenu extends customElements.get("toolbarbutton") {
constructor() {
super();
// While it would seem we could do this by handling oncommand, we can't
// because any external oncommand handlers might get called before ours,
// and then they would see the incorrect value of checked. Additionally
// a command attribute would redirect the command events anyway.
// Also, the appmenu-popup needs to be appended to the target 'Hamburger
// button' dynamically at every button click (as opposed to appended
// once in the binding's constructor) otherwise only one of the four
// Hamburger buttons (on the Mail, Calendar, Tasks and Chat tabs) will
// get the popup menu (namely, Mail). See Bug 890332.
this.addEventListener("mousedown", (event) => {
if (event.button != 0) {
return;
}
this._setupAppmenu(event);
});
this.addEventListener("keypress", (event) => {
this._setupAppmenu(event); }
);
}
_setupAppmenu(event) {
if (event.target == this) {
let appmenuPopup = document.getElementById("appmenu-popup");
if (this.lastChild != appmenuPopup) {
this.appendChild(appmenuPopup);
}
}
}
}
customElements.define("toolbarbutton-appmenu",
MozToolbarButtonAppmenu, { extends: "toolbarbutton" }
);
}

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

@ -30,6 +30,7 @@ messenger.jar:
content/messenger/mailWidgets.js (content/mailWidgets.js)
content/messenger/button-menu-button.js (content/button-menu-button.js)
content/messenger/toolbarbutton-menu-button.js (content/toolbarbutton-menu-button.js)
content/messenger/toolbarbutton-appmenu.js (content/toolbarbutton-appmenu.js)
content/messenger/customElements.js (content/customElements.js)
content/messenger/customizeToolbar.css (../../common/src/customizeToolbar.css)
content/messenger/customizeToolbar.js (../../common/src/customizeToolbar.js)
@ -37,7 +38,6 @@ messenger.jar:
content/messenger/viewSource.js (../../common/src/viewSource.js)
* content/messenger/viewSource.xul (../../common/src/viewSource.xul)
content/messenger/viewZoomOverlay.js (../../common/src/viewZoomOverlay.js)
content/messenger/generalBindings.xml (../../common/bindings/generalBindings.xml)
content/messenger/generalBindings.js (../../common/bindings/generalBindings.js)
content/messenger/richlistbox.xml (../../common/bindings/richlistbox.xml)
* content/messenger/toolbar.xml (../../common/bindings/toolbar.xml)

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

@ -84,7 +84,7 @@
</hbox>
</textbox>
</toolbaritem>
<toolbarbutton id="button-chat-appmenu"
<toolbarbutton is="toolbarbutton-appmenu" id="button-chat-appmenu"
type="menu"
class="toolbarbutton-1 button-appmenu"
label="&appmenuButton.label;"

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

@ -306,10 +306,6 @@ toolbarbutton[type="menu-button"][disabled="true"]:hover:active {
border-bottom-left-radius: 0;
}
toolbox[labelalign="end"] toolbarpaletteitem .toolbarbutton-1[type="menu"] {
-moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton");
}
.toolbarbutton-1[type="menu-button"] {
padding: 0;
}

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

@ -40,14 +40,6 @@ toolbox[labelalign="end"] > toolbar[mode="full"] deck .toolbarbutton-text {
text-align: start;
}
.toolbarbutton-1[type="menu"] {
-moz-binding: url("chrome://messenger/content/generalBindings.xml#menu-vertical");
}
toolbox[labelalign="end"] > toolbar[mode="full"] .toolbarbutton-1[type="menu"] {
-moz-binding: url("chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton");
}
description.error {
color: #f00;
}