Bug 1441378 - Replace baseMenuOverlay.xul with inlining and preprocessing. r=Gijs

The overlay defined two elements (helpMenu, menu_ToolsPopup) for all
platforms and three others (windowMenu, baseMenuCommandSet, baseMenuKeyset)
that were MacOS only. The two all platform elements and windowMenu were only
used once and inlined into browser-menubar.inc. The rest of the MacOS only
elements were conditionally inlined into browser-sets.inc.

MozReview-Commit-ID: D2uyCrnepuH

--HG--
extra : rebase_source : a3f7ecaf70c55574ee87091027a651ce429c6876
This commit is contained in:
Brendan Dahl 2018-02-26 16:49:34 -08:00
Родитель 313990638b
Коммит 77ac1fd5c8
15 изменённых файлов: 146 добавлений и 168 удалений

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

@ -13,6 +13,10 @@
%brandDTD;
<!ENTITY % aboutDialogDTD SYSTEM "chrome://browser/locale/aboutDialog.dtd" >
%aboutDialogDTD;
#ifdef XP_MACOSX
<!ENTITY % baseMenuOverlayDTD SYSTEM "chrome://browser/locale/baseMenuOverlay.dtd">
%baseMenuOverlayDTD;
#endif
]>
#ifdef XP_MACOSX

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

@ -1,124 +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/.
<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
%brandDTD;
<!ENTITY % baseMenuOverlayDTD SYSTEM "chrome://browser/locale/baseMenuOverlay.dtd">
%baseMenuOverlayDTD;
<!ENTITY % reportphishDTD SYSTEM "chrome://browser/locale/safebrowsing/report-phishing.dtd">
%reportphishDTD;
<!ENTITY % safebrowsingDTD SYSTEM "chrome://browser/locale/safebrowsing/phishing-afterload-warning-message.dtd">
%safebrowsingDTD;
]>
<overlay id="baseMenuOverlay"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
#ifdef XP_MACOSX
<!-- nsMenuBarX hides these and uses them to build the Application menu.
When using Carbon widgets for Mac OS X widgets, some of these are not
used as they only apply to Cocoa widget builds. All version of Firefox
through Firefox 2 will use Carbon widgets. -->
<menupopup id="menu_ToolsPopup">
<menuitem id="menu_preferences" label="&preferencesCmdMac.label;" key="key_preferencesCmdMac" oncommand="openPreferences(undefined, {origin: 'commandLineLegacy'});"/>
<menuitem id="menu_mac_services" label="&servicesMenuMac.label;"/>
<menuitem id="menu_mac_hide_app" label="&hideThisAppCmdMac2.label;" key="key_hideThisAppCmdMac"/>
<menuitem id="menu_mac_hide_others" label="&hideOtherAppsCmdMac.label;" key="key_hideOtherAppsCmdMac"/>
<menuitem id="menu_mac_show_all" label="&showAllAppsCmdMac.label;"/>
</menupopup>
<!-- Mac window menu -->
#include ../../../toolkit/content/macWindowMenu.inc
#endif
#ifdef XP_WIN
<menu id="helpMenu"
label="&helpMenuWin.label;"
accesskey="&helpMenuWin.accesskey;">
#else
<menu id="helpMenu"
label="&helpMenu.label;"
accesskey="&helpMenu.accesskey;">
#endif
<menupopup id="menu_HelpPopup" onpopupshowing="buildHelpMenu();">
<menuitem id="menu_openHelp"
oncommand="openHelpLink('firefox-help')"
onclick="checkForMiddleClick(this, event);"
label="&productHelp2.label;"
accesskey="&productHelp2.accesskey;"
#ifdef XP_MACOSX
key="key_openHelpMac"/>
#else
/>
#endif
<menuitem id="menu_openTour"
oncommand="openTourPage();"
label="&helpShowTour2.label;"
accesskey="&helpShowTour2.accesskey;"/>
<menuitem id="menu_keyboardShortcuts"
oncommand="openHelpLink('keyboard-shortcuts')"
onclick="checkForMiddleClick(this, event);"
label="&helpKeyboardShortcuts.label;"
accesskey="&helpKeyboardShortcuts.accesskey;"/>
<menuitem id="troubleShooting"
accesskey="&helpTroubleshootingInfo.accesskey;"
label="&helpTroubleshootingInfo.label;"
oncommand="openTroubleshootingPage()"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="feedbackPage"
accesskey="&helpFeedbackPage.accesskey;"
label="&helpFeedbackPage.label;"
oncommand="openFeedbackPage()"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="helpSafeMode"
accesskey="&helpSafeMode.accesskey;"
label="&helpSafeMode.label;"
stopaccesskey="&helpSafeMode.stop.accesskey;"
stoplabel="&helpSafeMode.stop.label;"
oncommand="safeModeRestart();"/>
<menuitem id="menu_HelpPopup_reportPhishingtoolmenu"
label="&reportDeceptiveSiteMenu.title;"
accesskey="&reportDeceptiveSiteMenu.accesskey;"
observes="reportPhishingBroadcaster"
oncommand="openUILink(gSafeBrowsing.getReportURL('Phish'), event);"
onclick="checkForMiddleClick(this, event);"
hidden="true"/>
<menuitem id="menu_HelpPopup_reportPhishingErrortoolmenu"
label="&safeb.palm.notdeceptive.label;"
accesskey="&safeb.palm.notdeceptive.accesskey;"
observes="reportPhishingErrorBroadcaster"
oncommand="ReportFalseDeceptiveSite();"
onclick="checkForMiddleClick(this, event);"
hidden="true"/>
<menuseparator id="aboutSeparator"/>
<menuitem id="aboutName"
accesskey="&aboutProduct2.accesskey;"
label="&aboutProduct2.label;"
oncommand="openAboutDialog();"/>
</menupopup>
</menu>
<keyset id="baseMenuKeyset">
#ifdef XP_MACOSX
<key id="key_openHelpMac"
oncommand="openHelpLink('firefox-osxkey');"
key="&helpMac.commandkey;"
modifiers="accel"/>
<!-- These are used to build the Application menu under Cocoa widgets -->
<key id="key_preferencesCmdMac"
key="&preferencesCmdMac.commandkey;"
modifiers="accel"/>
<key id="key_hideThisAppCmdMac"
key="&hideThisAppCmdMac2.commandkey;"
modifiers="accel"/>
<key id="key_hideOtherAppsCmdMac"
key="&hideOtherAppsCmdMac.commandkey;"
modifiers="accel,alt"/>
#endif
</keyset>
</overlay>

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

@ -19,5 +19,7 @@
%aboutHomeDTD;
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
%syncBrandDTD;
<!ENTITY % reportphishDTD SYSTEM "chrome://browser/locale/safebrowsing/report-phishing.dtd">
%reportphishDTD;
]>

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

@ -539,12 +539,97 @@
accesskey="&ldbCmd.accesskey;"
oncommand="toOpenWindowByType('mozapp:layoutdebug',
'chrome://layoutdebug/content/');"/>
#endif
#ifdef XP_MACOSX
<!-- nsMenuBarX hides these and uses them to build the Application menu. -->
<menuitem id="menu_preferences" label="&preferencesCmdMac.label;" key="key_preferencesCmdMac" oncommand="openPreferences(undefined, {origin: 'commandLineLegacy'});"/>
<menuitem id="menu_mac_services" label="&servicesMenuMac.label;"/>
<menuitem id="menu_mac_hide_app" label="&hideThisAppCmdMac2.label;" key="key_hideThisAppCmdMac"/>
<menuitem id="menu_mac_hide_others" label="&hideOtherAppsCmdMac.label;" key="key_hideOtherAppsCmdMac"/>
<menuitem id="menu_mac_show_all" label="&showAllAppsCmdMac.label;"/>
#endif
</menupopup>
</menu>
#ifdef XP_MACOSX
<menu id="windowMenu" />
<menu id="windowMenu"
label="&windowMenu.label;"
onpopupshowing="macWindowMenuDidShow();"
onpopuphidden="macWindowMenuDidHide();"
>
<menupopup id="windowPopup">
<menuitem command="minimizeWindow" key="key_minimizeWindow"/>
<menuitem command="zoomWindow"/>
<!-- decomment when "BringAllToFront" is implemented
<menuseparator/>
<menuitem label="&bringAllToFront.label;" disabled="true"/> -->
<menuseparator id="sep-window-list"/>
</menupopup>
</menu>
#endif
<menu id="helpMenu" />
<menu id="helpMenu"
#ifdef XP_WIN
label="&helpMenuWin.label;"
accesskey="&helpMenuWin.accesskey;"
#else
label="&helpMenu.label;"
accesskey="&helpMenu.accesskey;"
#endif
>
<menupopup id="menu_HelpPopup" onpopupshowing="buildHelpMenu();">
<menuitem id="menu_openHelp"
oncommand="openHelpLink('firefox-help')"
onclick="checkForMiddleClick(this, event);"
label="&productHelp2.label;"
accesskey="&productHelp2.accesskey;"
#ifdef XP_MACOSX
key="key_openHelpMac"/>
#else
/>
#endif
<menuitem id="menu_openTour"
oncommand="openTourPage();"
label="&helpShowTour2.label;"
accesskey="&helpShowTour2.accesskey;"/>
<menuitem id="menu_keyboardShortcuts"
oncommand="openHelpLink('keyboard-shortcuts')"
onclick="checkForMiddleClick(this, event);"
label="&helpKeyboardShortcuts.label;"
accesskey="&helpKeyboardShortcuts.accesskey;"/>
<menuitem id="troubleShooting"
accesskey="&helpTroubleshootingInfo.accesskey;"
label="&helpTroubleshootingInfo.label;"
oncommand="openTroubleshootingPage()"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="feedbackPage"
accesskey="&helpFeedbackPage.accesskey;"
label="&helpFeedbackPage.label;"
oncommand="openFeedbackPage()"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="helpSafeMode"
accesskey="&helpSafeMode.accesskey;"
label="&helpSafeMode.label;"
stopaccesskey="&helpSafeMode.stop.accesskey;"
stoplabel="&helpSafeMode.stop.label;"
oncommand="safeModeRestart();"/>
<menuitem id="menu_HelpPopup_reportPhishingtoolmenu"
label="&reportDeceptiveSiteMenu.title;"
accesskey="&reportDeceptiveSiteMenu.accesskey;"
observes="reportPhishingBroadcaster"
oncommand="openUILink(gSafeBrowsing.getReportURL('Phish'), event);"
onclick="checkForMiddleClick(this, event);"
hidden="true"/>
<menuitem id="menu_HelpPopup_reportPhishingErrortoolmenu"
label="&safeb.palm.notdeceptive.label;"
accesskey="&safeb.palm.notdeceptive.accesskey;"
observes="reportPhishingErrorBroadcaster"
oncommand="ReportFalseDeceptiveSite();"
onclick="checkForMiddleClick(this, event);"
hidden="true"/>
<menuseparator id="aboutSeparator"/>
<menuitem id="aboutName"
accesskey="&aboutProduct2.accesskey;"
label="&aboutProduct2.label;"
oncommand="openAboutDialog();"/>
</menupopup>
</menu>
</menubar>

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

@ -105,6 +105,14 @@
#ifdef NIGHTLY_BUILD
<command id="wrCaptureCmd" oncommand="gWebRender.capture();"/>
#endif
#ifdef XP_MACOSX
<command id="minimizeWindow"
label="&minimizeWindow.label;"
oncommand="window.minimize();" />
<command id="zoomWindow"
label="&zoomWindow.label;"
oncommand="zoomWindow();" />
#endif
</commandset>
@ -397,10 +405,24 @@
#endif
command="wrCaptureCmd"/>
#endif
</keyset>
# Used by baseMenuOverlay
#ifdef XP_MACOSX
<commandset id="baseMenuCommandSet" />
<key id="key_minimizeWindow"
command="minimizeWindow"
key="&minimizeWindow.key;"
modifiers="accel"/>
<key id="key_openHelpMac"
oncommand="openHelpLink('firefox-osxkey');"
key="&helpMac.commandkey;"
modifiers="accel"/>
<!-- These are used to build the Application menu -->
<key id="key_preferencesCmdMac"
key="&preferencesCmdMac.commandkey;"
modifiers="accel"/>
<key id="key_hideThisAppCmdMac"
key="&hideThisAppCmdMac2.commandkey;"
modifiers="accel"/>
<key id="key_hideOtherAppsCmdMac"
key="&hideOtherAppsCmdMac.commandkey;"
modifiers="accel,alt"/>
#endif
<keyset id="baseMenuKeyset" />
</keyset>

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

@ -16,7 +16,6 @@
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/tabbrowser.css" type="text/css"?>
<?xul-overlay href="chrome://browser/content/baseMenuOverlay.xul"?>
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
# All DTD information is stored in a separate file so that it can be shared by

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

@ -1,10 +1,8 @@
<commandset id="mainCommandSet"/>
<commandset id="baseMenuCommandSet"/>
<commandset id="placesCommands"/>
<broadcasterset id="mainBroadcasterSet"/>
<keyset id="mainKeyset"/>
<keyset id="baseMenuKeyset"/>
<menubar id="main-menubar"/>

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

@ -24,6 +24,9 @@ for (let script of [
"chrome://browser/content/browser-sidebar.js",
"chrome://browser/content/browser-tabsintitlebar.js",
"chrome://browser/content/browser-trackingprotection.js",
#ifdef XP_MACOSX
"chrome://global/content/macWindowMenu.js",
#endif
#ifdef MOZ_DATA_REPORTING
"chrome://browser/content/browser-data-submission-info-bar.js",
#endif

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

@ -9,6 +9,11 @@
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
<?xml-stylesheet href="chrome://browser/skin/webRTC-indicator.css" type="text/css"?>
<!DOCTYPE window [
<!ENTITY % baseMenuOverlayDTD SYSTEM "chrome://browser/locale/baseMenuOverlay.dtd">
%baseMenuOverlayDTD;
]>
<window id="main-window"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

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

@ -10,7 +10,6 @@
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
<?xul-overlay href="chrome://browser/content/baseMenuOverlay.xul"?>
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
# All DTD information is stored in a separate file so that it can be shared by

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

@ -9,6 +9,10 @@
<!DOCTYPE window [
<!ENTITY % pageInfoDTD SYSTEM "chrome://browser/locale/pageInfo.dtd">
%pageInfoDTD;
#ifdef XP_MACOSX
<!ENTITY % baseMenuOverlayDTD SYSTEM "chrome://browser/locale/baseMenuOverlay.dtd">
%baseMenuOverlayDTD;
#endif
]>
#ifdef XP_MACOSX

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

@ -125,7 +125,6 @@ browser.jar:
* content/browser/web-panels.xul (content/web-panels.xul)
content/browser/webext-panels.js (content/webext-panels.js)
* content/browser/webext-panels.xul (content/webext-panels.xul)
* content/browser/baseMenuOverlay.xul (content/baseMenuOverlay.xul)
content/browser/nsContextMenu.js (content/nsContextMenu.js)
# XXX: We should exclude this one as well (bug 71895)
* content/browser/hiddenWindow.xul (content/hiddenWindow.xul)

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

@ -16,7 +16,6 @@
#ifdef XP_MACOSX
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
#else
<?xul-overlay href="chrome://browser/content/baseMenuOverlay.xul"?>
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
#endif
@ -27,6 +26,10 @@
%editMenuOverlayDTD;
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
%browserDTD;
#ifdef XP_MACOSX
<!ENTITY % baseMenuOverlayDTD SYSTEM "chrome://browser/locale/baseMenuOverlay.dtd">
%baseMenuOverlayDTD;
#endif
]>
<window id="places"

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

@ -7,7 +7,15 @@
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/setDesktopBackground.css" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://browser/locale/setDesktopBackground.dtd">
<!DOCTYPE dialog [
<!ENTITY % setDesktopBackgroundDTD SYSTEM "chrome://browser/locale/setDesktopBackground.dtd">
%setDesktopBackgroundDTD;
#ifdef XP_MACOSX
<!ENTITY % baseMenuOverlayDTD SYSTEM "chrome://browser/locale/baseMenuOverlay.dtd">
%baseMenuOverlayDTD;
#endif
]>
#ifdef XP_MACOSX
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>

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

@ -1,29 +0,0 @@
<script type="application/javascript" src="chrome://global/content/macWindowMenu.js"/>
<commandset id="baseMenuCommandSet">
<command id="minimizeWindow"
label="&minimizeWindow.label;"
oncommand="window.minimize();" />
<command id="zoomWindow"
label="&zoomWindow.label;"
oncommand="zoomWindow();" />
</commandset>
<keyset id="baseMenuKeyset">
<key id="key_minimizeWindow"
command="minimizeWindow"
key="&minimizeWindow.key;"
modifiers="accel"/>
</keyset>
<menu id="windowMenu"
label="&windowMenu.label;"
onpopupshowing="macWindowMenuDidShow();"
onpopuphidden="macWindowMenuDidHide();"
>
<menupopup id="windowPopup">
<menuitem command="minimizeWindow" key="key_minimizeWindow"/>
<menuitem command="zoomWindow"/>
<!-- decomment when "BringAllToFront" is implemented
<menuseparator/>
<menuitem label="&bringAllToFront.label;" disabled="true"/> -->
<menuseparator id="sep-window-list"/>
</menupopup>
</menu>