зеркало из https://github.com/mozilla/gecko-dev.git
bug 68136, full screen mode, r/sr=ben/alecf
This commit is contained in:
Родитель
c62897b9af
Коммит
eee486ee49
|
@ -366,6 +366,10 @@ function Startup()
|
||||||
// Perform default browser checking.
|
// Perform default browser checking.
|
||||||
checkForDefaultBrowser();
|
checkForDefaultBrowser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (document.getElementById("main-window").getAttribute("fullScreen") == "true") {
|
||||||
|
BrowserFullScreenEnter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Shutdown()
|
function Shutdown()
|
||||||
|
@ -942,6 +946,52 @@ function OpenAddressbook()
|
||||||
open("chrome://messenger/content/addressbook/addressbook.xul", "_blank", "chrome,menubar,toolbar,resizable");
|
open("chrome://messenger/content/addressbook/addressbook.xul", "_blank", "chrome,menubar,toolbar,resizable");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var gFullScreen = false;
|
||||||
|
|
||||||
|
function BrowserFullScreenToggle()
|
||||||
|
{
|
||||||
|
// toggle the attributes as indicated in the fullScreenElementChanges table
|
||||||
|
var idx, attribute, value;
|
||||||
|
var element, currentValue
|
||||||
|
var fullScreenElementChanges = document.getElementById("fullScreenElementChanges");
|
||||||
|
var next = fullScreenElementChanges.firstChild;
|
||||||
|
while (next) {
|
||||||
|
idx = next.getAttribute("idx");
|
||||||
|
attribute = next.getAttribute("attribute");
|
||||||
|
value = next.getAttribute("value");
|
||||||
|
|
||||||
|
element = document.getElementById(idx);
|
||||||
|
currentValue = element.getAttribute(attribute);
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
element.setAttribute(attribute, value);
|
||||||
|
} else {
|
||||||
|
element.removeAttribute(attribute);
|
||||||
|
}
|
||||||
|
next.setAttribute("value", currentValue);
|
||||||
|
|
||||||
|
next = next.nextSibling;
|
||||||
|
}
|
||||||
|
|
||||||
|
// toggle and save the fullScreen indicator
|
||||||
|
gFullScreen = !gFullScreen;
|
||||||
|
document.getElementById("main-window").setAttribute("fullScreen", gFullScreen?"true":"false");
|
||||||
|
}
|
||||||
|
|
||||||
|
function BrowserFullScreenEnter()
|
||||||
|
{
|
||||||
|
if (!gFullScreen) {
|
||||||
|
BrowserFullScreenToggle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function BrowserFullScreenExit()
|
||||||
|
{
|
||||||
|
if (gFullScreen) {
|
||||||
|
BrowserFullScreenToggle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function BrowserViewSource()
|
function BrowserViewSource()
|
||||||
{
|
{
|
||||||
var focusedWindow = document.commandDispatcher.focusedWindow;
|
var focusedWindow = document.commandDispatcher.focusedWindow;
|
||||||
|
|
|
@ -79,6 +79,10 @@
|
||||||
</menu>
|
</menu>
|
||||||
</menupopup>
|
</menupopup>
|
||||||
|
|
||||||
|
<data id="fullScreenElementChanges">
|
||||||
|
<data idx="linktoolbar" attribute="hidden" value="true"/>
|
||||||
|
</data>
|
||||||
|
|
||||||
<toolbox id="navigator-toolbox">
|
<toolbox id="navigator-toolbox">
|
||||||
<toolbar id="linktoolbar" class="chromeclass-directories"
|
<toolbar id="linktoolbar" class="chromeclass-directories"
|
||||||
onclick="event.preventBubble(); return linkToolbarUI.clicked(event);"
|
onclick="event.preventBubble(); return linkToolbarUI.clicked(event);"
|
||||||
|
|
|
@ -143,6 +143,10 @@ function UpdateInternetSearchResults(event)
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (document.getElementById("main-window").getAttribute("fullScreen") == "true") {
|
||||||
|
BrowserFullScreenEnter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBrowser()
|
function getBrowser()
|
||||||
|
@ -1075,6 +1079,52 @@ function OpenAddressbook()
|
||||||
open("chrome://messenger/content/addressbook/addressbook.xul", "_blank", "chrome,menubar,toolbar,resizable");
|
open("chrome://messenger/content/addressbook/addressbook.xul", "_blank", "chrome,menubar,toolbar,resizable");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var gFullScreen = false;
|
||||||
|
|
||||||
|
function BrowserFullScreenToggle()
|
||||||
|
{
|
||||||
|
// toggle the attributes as indicated in the fullScreenElementChanges table
|
||||||
|
var idx, attribute, value;
|
||||||
|
var element, currentValue
|
||||||
|
var fullScreenElementChanges = document.getElementById("fullScreenElementChanges");
|
||||||
|
var next = fullScreenElementChanges.firstChild;
|
||||||
|
while (next) {
|
||||||
|
idx = next.getAttribute("idx");
|
||||||
|
attribute = next.getAttribute("attribute");
|
||||||
|
value = next.getAttribute("value");
|
||||||
|
|
||||||
|
element = document.getElementById(idx);
|
||||||
|
currentValue = element.getAttribute(attribute);
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
element.setAttribute(attribute, value);
|
||||||
|
} else {
|
||||||
|
element.removeAttribute(attribute);
|
||||||
|
}
|
||||||
|
next.setAttribute("value", currentValue);
|
||||||
|
|
||||||
|
next = next.nextSibling;
|
||||||
|
}
|
||||||
|
|
||||||
|
// toggle and save the fullScreen indicator
|
||||||
|
gFullScreen = !gFullScreen;
|
||||||
|
document.getElementById("main-window").setAttribute("fullScreen", gFullScreen?"true":"false");
|
||||||
|
}
|
||||||
|
|
||||||
|
function BrowserFullScreenEnter()
|
||||||
|
{
|
||||||
|
if (!gFullScreen) {
|
||||||
|
BrowserFullScreenToggle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function BrowserFullScreenExit()
|
||||||
|
{
|
||||||
|
if (gFullScreen) {
|
||||||
|
BrowserFullScreenToggle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function BrowserViewSource()
|
function BrowserViewSource()
|
||||||
{
|
{
|
||||||
var focusedWindow = document.commandDispatcher.focusedWindow;
|
var focusedWindow = document.commandDispatcher.focusedWindow;
|
||||||
|
|
|
@ -53,8 +53,8 @@ Contributor(s): ______________________________________. -->
|
||||||
titlemenuseparator="&mainWindow.titlemodifiermenuseparator;"
|
titlemenuseparator="&mainWindow.titlemodifiermenuseparator;"
|
||||||
windowtype="navigator:browser"
|
windowtype="navigator:browser"
|
||||||
width="640" height="480"
|
width="640" height="480"
|
||||||
screenX="10" screenY="10"
|
screenX="10" screenY="10" fullScreen="false"
|
||||||
persist="screenX screenY width height sizemode">
|
persist="screenX screenY width height sizemode fullScreen">
|
||||||
|
|
||||||
<!-- Generic Utility -->
|
<!-- Generic Utility -->
|
||||||
<script type="application/x-javascript" src="chrome://global/content/nsJSSupportsUtils.js"/>
|
<script type="application/x-javascript" src="chrome://global/content/nsJSSupportsUtils.js"/>
|
||||||
|
@ -165,6 +165,13 @@ Contributor(s): ______________________________________. -->
|
||||||
oncommand="BrowserStop();" observes="canStop"
|
oncommand="BrowserStop();" observes="canStop"
|
||||||
tooltiptext="&stopButton.tooltip;"/>
|
tooltiptext="&stopButton.tooltip;"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
|
|
||||||
|
<hbox id="fullscreen-extra-buttons" hidden="true">
|
||||||
|
<toolbarbutton id="fullscreen-exit-button" class="toolbarbutton-1"
|
||||||
|
label="&exitFullScreenButton.label;" crop="right"
|
||||||
|
oncommand="BrowserFullScreenExit();"
|
||||||
|
tooltiptext="&exitFullScreenButton.tooltip;"/>
|
||||||
|
</hbox>
|
||||||
|
|
||||||
<hbox id="nav-bar-inner" flex="1">
|
<hbox id="nav-bar-inner" flex="1">
|
||||||
<hbox id="urlbar-group" class="box-toolbar-group chromeclass-location" flex="1">
|
<hbox id="urlbar-group" class="box-toolbar-group chromeclass-location" flex="1">
|
||||||
|
@ -380,4 +387,16 @@ Contributor(s): ______________________________________. -->
|
||||||
<statusbarpanel class="statusbarpanel-icononly" id="security-button"/>
|
<statusbarpanel class="statusbarpanel-icononly" id="security-button"/>
|
||||||
</statusbar>
|
</statusbar>
|
||||||
|
|
||||||
|
<data id="fullScreenElementChanges">
|
||||||
|
<data idx="main-menubar" attribute="hidden" value="true"/>
|
||||||
|
<data idx="nav-bar-inner" attribute="hidden" value="true"/>
|
||||||
|
<data idx="print-button" attribute="hidden" value="true"/>
|
||||||
|
<data idx="throbber-box" attribute="hidden" value="true"/>
|
||||||
|
<data idx="PersonalToolbar" attribute="hidden" value="true"/>
|
||||||
|
<data idx="sidebar-box" attribute="hidden" value="true"/>
|
||||||
|
<data idx="sidebar-splitter" attribute="hidden" value="true"/>
|
||||||
|
<data idx="status-bar" attribute="hidden" value="true"/>
|
||||||
|
|
||||||
|
<data idx="fullscreen-extra-buttons" attribute="hidden" value=""/>
|
||||||
|
</data>
|
||||||
</window>
|
</window>
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
<!-- View Menu -->
|
<!-- View Menu -->
|
||||||
<key id="key_reload" key="&reloadCmd.commandkey;" oncommand="BrowserReload();" modifiers="accel"/>
|
<key id="key_reload" key="&reloadCmd.commandkey;" oncommand="BrowserReload();" modifiers="accel"/>
|
||||||
<key key="&reloadCmd.commandkey;" oncommand="BrowserReloadSkipCache();" modifiers="accel,shift"/>
|
<key key="&reloadCmd.commandkey;" oncommand="BrowserReloadSkipCache();" modifiers="accel,shift"/>
|
||||||
|
<key id="key_fullScreen" keycode="VK_F11" command="View:FullScreen"/>
|
||||||
<key id="key_viewSource" key="&pageSourceCmd.commandkey;" command="View:PageSource" modifiers="accel"/>
|
<key id="key_viewSource" key="&pageSourceCmd.commandkey;" command="View:PageSource" modifiers="accel"/>
|
||||||
<key id="key_viewInfo" key="&pageInfoCmd.commandkey;" command="View:PageInfo" modifiers="accel"/>
|
<key id="key_viewInfo" key="&pageInfoCmd.commandkey;" command="View:PageInfo" modifiers="accel"/>
|
||||||
|
|
||||||
|
@ -132,6 +133,7 @@
|
||||||
<command id="cmd_copyImageContents"/>
|
<command id="cmd_copyImageContents"/>
|
||||||
|
|
||||||
<!-- View Menu -->
|
<!-- View Menu -->
|
||||||
|
<command id="View:FullScreen" oncommand="BrowserFullScreenToggle();"/>
|
||||||
<command id="View:PageSource" oncommand="BrowserViewSource();"/>
|
<command id="View:PageSource" oncommand="BrowserViewSource();"/>
|
||||||
<command id="View:PageInfo" oncommand="BrowserPageInfo(getBrowser().contentDocument);"/>
|
<command id="View:PageInfo" oncommand="BrowserPageInfo(getBrowser().contentDocument);"/>
|
||||||
|
|
||||||
|
@ -241,6 +243,7 @@
|
||||||
<menuseparator />
|
<menuseparator />
|
||||||
<menuitem accesskey="&pageSourceCmd.accesskey;" label="&pageSourceCmd.label;" key="key_viewSource" command="View:PageSource"/>
|
<menuitem accesskey="&pageSourceCmd.accesskey;" label="&pageSourceCmd.label;" key="key_viewSource" command="View:PageSource"/>
|
||||||
<menuitem accesskey="&pageInfoCmd.accesskey;" label="&pageInfoCmd.label;" key="key_viewInfo" command="View:PageInfo"/>
|
<menuitem accesskey="&pageInfoCmd.accesskey;" label="&pageInfoCmd.label;" key="key_viewInfo" command="View:PageInfo"/>
|
||||||
|
<menuitem accesskey="&fullScreenCmd.accesskey;" label="&fullScreenCmd.label;" key="key_fullScreen" command="View:FullScreen"/>
|
||||||
<menuseparator />
|
<menuseparator />
|
||||||
|
|
||||||
<menuitem accesskey="&translateMenu.accesskey;" label="&translateMenu.label;" oncommand="Translate();"/>
|
<menuitem accesskey="&translateMenu.accesskey;" label="&translateMenu.label;" oncommand="Translate();"/>
|
||||||
|
|
|
@ -59,6 +59,8 @@
|
||||||
<!ENTITY useStyleSheetNone.label "None">
|
<!ENTITY useStyleSheetNone.label "None">
|
||||||
<!ENTITY showImagesCmd.label "Show Images">
|
<!ENTITY showImagesCmd.label "Show Images">
|
||||||
<!ENTITY showImagesCmd.accesskey "g">
|
<!ENTITY showImagesCmd.accesskey "g">
|
||||||
|
<!ENTITY fullScreenCmd.label "Full Screen">
|
||||||
|
<!ENTITY fullScreenCmd.accesskey "f">
|
||||||
<!ENTITY pageSourceCmd.label "Page Source">
|
<!ENTITY pageSourceCmd.label "Page Source">
|
||||||
<!ENTITY pageSourceCmd.accesskey "o">
|
<!ENTITY pageSourceCmd.accesskey "o">
|
||||||
<!ENTITY pageSourceCmd.commandkey "u">
|
<!ENTITY pageSourceCmd.commandkey "u">
|
||||||
|
@ -283,6 +285,8 @@
|
||||||
<!ENTITY reloadButton.tooltip "Reload current page">
|
<!ENTITY reloadButton.tooltip "Reload current page">
|
||||||
<!ENTITY stopButton.label "Stop">
|
<!ENTITY stopButton.label "Stop">
|
||||||
<!ENTITY stopButton.tooltip "Stop loading this page">
|
<!ENTITY stopButton.tooltip "Stop loading this page">
|
||||||
|
<!ENTITY exitFullScreenButton.label "Normal Screen">
|
||||||
|
<!ENTITY exitFullScreenButton.tooltip "Exit full-screen mode">
|
||||||
<!ENTITY searchButton.label "Search">
|
<!ENTITY searchButton.label "Search">
|
||||||
<!ENTITY searchButton.tooltip "Type a word in the field to the left, then click Search">
|
<!ENTITY searchButton.tooltip "Type a word in the field to the left, then click Search">
|
||||||
<!ENTITY goButton.label "Go">
|
<!ENTITY goButton.label "Go">
|
||||||
|
|
Загрузка…
Ссылка в новой задаче