зеркало из https://github.com/mozilla/gecko-dev.git
Fix for 49431. r=ben
This commit is contained in:
Родитель
030eb2d4fc
Коммит
3280667d72
|
@ -79,6 +79,14 @@ pref("browser.chrome.show_url_bar", true);
|
|||
pref("browser.chrome.show_security_bar", true);
|
||||
pref("browser.chrome.button_style", 0);
|
||||
|
||||
pref("browser.toolbars.showbutton.bookmarks", false);
|
||||
pref("browser.toolbars.showbutton.go", false);
|
||||
pref("browser.toolbars.showbutton.home", true);
|
||||
pref("browser.toolbars.showbutton.mynetscape", true);
|
||||
pref("browser.toolbars.showbutton.net2phone", true);
|
||||
pref("browser.toolbars.showbutton.print", true);
|
||||
pref("browser.toolbars.showbutton.search", true);
|
||||
|
||||
pref("browser.background_option", 0); // DEFAULT_BACKGROUND
|
||||
pref("browser.link_expiration", 9);
|
||||
pref("browser.cache.check_doc_frequency", 0);
|
||||
|
|
|
@ -118,12 +118,7 @@ window[chromehidden~="extrachrome"] .chromeclass-extrachrome {
|
|||
{
|
||||
list-style-image : url("chrome://communicator/skin/document-error.gif");
|
||||
}
|
||||
|
||||
#go-button
|
||||
{
|
||||
display : none;
|
||||
}
|
||||
|
||||
|
||||
#nav-bar-inner
|
||||
{
|
||||
padding-left : 6px;
|
||||
|
@ -134,7 +129,7 @@ window[chromehidden~="extrachrome"] .chromeclass-extrachrome {
|
|||
margin-right : 1px;
|
||||
}
|
||||
|
||||
#homebutton
|
||||
#home-button
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/home.gif");
|
||||
}
|
||||
|
|
|
@ -30,17 +30,17 @@
|
|||
/**
|
||||
* Home button
|
||||
**/
|
||||
#homebutton
|
||||
#home-button
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/home.gif");
|
||||
}
|
||||
|
||||
#homebutton:hover
|
||||
#home-button:hover
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/home-hover.gif");
|
||||
}
|
||||
|
||||
#homebutton:hover:active
|
||||
#home-button:hover:active
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/home-active.gif");
|
||||
}
|
||||
|
|
|
@ -193,11 +193,6 @@ window[chromehidden~="extrachrome"] .chromeclass-extrachrome {
|
|||
min-height : 0px;
|
||||
}
|
||||
|
||||
#go-button
|
||||
{
|
||||
display : none;
|
||||
}
|
||||
|
||||
#nav-bar-inner
|
||||
{
|
||||
padding-left : 6px;
|
||||
|
|
|
@ -170,11 +170,6 @@ window[chromehidden~="extrachrome"] .chromeclass-extrachrome {
|
|||
min-height : 0px;
|
||||
}
|
||||
|
||||
#go-button
|
||||
{
|
||||
display : none;
|
||||
}
|
||||
|
||||
#nav-bar-inner
|
||||
{
|
||||
padding-left : 6px;
|
||||
|
@ -185,7 +180,7 @@ window[chromehidden~="extrachrome"] .chromeclass-extrachrome {
|
|||
margin-right : 1px;
|
||||
}
|
||||
|
||||
#homebutton
|
||||
#home-button
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/home.gif");
|
||||
}
|
||||
|
|
|
@ -188,11 +188,6 @@ window[chromehidden~="extrachrome"] .chromeclass-extrachrome {
|
|||
min-width : 0px;
|
||||
min-height : 0px;
|
||||
}
|
||||
|
||||
#go-button
|
||||
{
|
||||
display : none;
|
||||
}
|
||||
|
||||
#nav-bar-inner
|
||||
{
|
||||
|
|
|
@ -119,11 +119,6 @@ window[chromehidden~="extrachrome"] .chromeclass-extrachrome {
|
|||
list-style-image : url("chrome://communicator/skin/document-error.gif");
|
||||
}
|
||||
|
||||
#go-button
|
||||
{
|
||||
display : none;
|
||||
}
|
||||
|
||||
#nav-bar-inner
|
||||
{
|
||||
padding-left : 6px;
|
||||
|
@ -134,7 +129,7 @@ window[chromehidden~="extrachrome"] .chromeclass-extrachrome {
|
|||
margin-right : 1px;
|
||||
}
|
||||
|
||||
#homebutton
|
||||
#home-button
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/home.gif");
|
||||
}
|
||||
|
|
|
@ -1070,7 +1070,7 @@ int main(int argc, char* argv[])
|
|||
#endif
|
||||
|
||||
// Handle -help and -version command line arguments.
|
||||
// They should return quick, so we deal with them here.
|
||||
// They should% return quick, so we deal with them here.
|
||||
if (HandleDumpArguments(argc, argv))
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -295,18 +295,19 @@ Contributor(s): ______________________________________. -->
|
|||
<menuitem value=" "/>
|
||||
</menupopup>
|
||||
</menubutton>
|
||||
<button class="button-toolbar-3" id="go-button" value="&goButton.label;" oncommand="addToUrlbarHistory(); BrowserLoadURL();"
|
||||
<button class="button-toolbar-3" id="go-button" persist="hidden" hidden="true" value="&goButton.label;" oncommand="addToUrlbarHistory(); BrowserLoadURL();"
|
||||
tooltip="aTooltip" tooltiptext="&goButton.tooltip;"/>
|
||||
</box>
|
||||
|
||||
<button class="button-toolbar-3 chromeclass-location" id="search-button" value="&searchButton.label;"
|
||||
<button class="button-toolbar-3 chromeclass-location" persist="hidden"
|
||||
id="search-button" value="&searchButton.label;"
|
||||
oncommand="OpenSearch('internet',false, document.getElementById('urlbar').value);"
|
||||
tooltip="aTooltip" tooltiptext="&searchButton.tooltip;"/>
|
||||
</box>
|
||||
|
||||
<toolbarseparator/>
|
||||
|
||||
<menubutton class="menubutton-dual toolbar top" id="print-button" value="&printButton.label;"
|
||||
<menubutton class="menubutton-dual toolbar top" id="print-button" persist="hidden" value="&printButton.label;"
|
||||
crop="right" buttonaction="BrowserPrint()" tooltip="aTooltip" buttontooltiptext="&printButton.tooltip;">
|
||||
<menupopup id="printMenu">
|
||||
<menuitem value="&printCmd.label;" accesskey="&printCmd.accesskey;" oncommand="BrowserPrint()" default="true"/>
|
||||
|
@ -326,6 +327,47 @@ Contributor(s): ______________________________________. -->
|
|||
grippytooltip="aTooltip" grippytooltiptext="&personalBar.tooltip;"
|
||||
last-toolbar="true">
|
||||
|
||||
|
||||
|
||||
<!-- "Bookmarks" button on personal toolbar -->
|
||||
|
||||
|
||||
<menubutton hidden="true" persist="hidden" class="button-toolbar bookmarkfolder" id="bookmarks-button"
|
||||
datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch rdf:httpindex"
|
||||
ref="NC:BookmarksRoot" container="true" value="&bookmarksButton.label;"
|
||||
flags="dont-test-empty">
|
||||
<template>
|
||||
<rule iscontainer="true">
|
||||
<menupopup>
|
||||
<menu class="menu-iconic bookmarkfolder" uri="rdf:*"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Name" >
|
||||
<menupopup/>
|
||||
</menu>
|
||||
</menupopup>
|
||||
</rule>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<menupopup>
|
||||
<menuseparator uri="rdf:*"/>
|
||||
</menupopup>
|
||||
</rule>
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem class="menuitem-iconic bookmarkitem" uri="rdf:*"
|
||||
value="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
oncommand="OpenBookmarkURL(event.target,document.getElementById(
|
||||
'PersonalMenu').database)" />
|
||||
</menupopup>
|
||||
</rule>
|
||||
</template>
|
||||
<menupopup>
|
||||
<menuitem accesskey="&addCurPageCmd.accesskey;"
|
||||
key="addBookmarkKb" observes="Browser:AddBookmark"/>
|
||||
<menuitem accesskey="&manBookmarksCmd.accesskey;"
|
||||
key="manBookmarkKb" observes="Browser:ManageBookmark"/>
|
||||
<menuseparator/>
|
||||
</menupopup>
|
||||
</menubutton>
|
||||
|
||||
<!-- Personal toolbar items -->
|
||||
<box id="innermostBox" flex="1" style="min-width: 1px;" context="contextual"
|
||||
datasources="rdf:bookmarks" ref="NC:PersonalToolbarFolder" flags="dont-test-empty">
|
||||
|
@ -368,8 +410,8 @@ Contributor(s): ______________________________________. -->
|
|||
</rule>
|
||||
</template>
|
||||
|
||||
<button class="button-toolbar bookmarkitem" id="homebutton" value="&homeButton.label;"
|
||||
tooltip="aTooltip"
|
||||
<button class="button-toolbar bookmarkitem" id="home-button" value="&homeButton.label;"
|
||||
tooltip="aTooltip" persist="hidden"
|
||||
ondraggesture="nsDragAndDrop.startDrag(event, homeButtonObserver);"
|
||||
ondragover="nsDragAndDrop.dragOver(event, homeButtonObserver);"
|
||||
ondragdrop="nsDragAndDrop.drop(event, homeButtonObserver);"
|
||||
|
|
|
@ -103,6 +103,8 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsICmdLineHandler.h"
|
||||
|
||||
#include "nsIWindowMediator.h"
|
||||
|
||||
#include "nsIDocumentCharsetInfo.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsICharsetConverterManager2.h"
|
||||
|
@ -153,6 +155,8 @@ static NS_DEFINE_IID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID);
|
|||
static NS_DEFINE_IID(kCGlobalHistoryCID, NS_GLOBALHISTORY_CID);
|
||||
static NS_DEFINE_CID(kCPrefServiceCID, NS_PREF_CID);
|
||||
static NS_DEFINE_CID(kTimeBombCID, NS_TIMEBOMB_CID);
|
||||
static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
static int APP_DEBUG = 0; // Set to 1 in debugger to turn on debugging.
|
||||
|
@ -370,6 +374,9 @@ void TimesUp(nsITimer *aTimer, void *aClosure)
|
|||
|
||||
#endif //ENABLE_PAGE_CYCLER
|
||||
|
||||
PRUint32 nsBrowserInstance::gRefCnt = 0;
|
||||
int ButtonShowHideCallback(const char* aPref, void* aClosure);
|
||||
static const char kShowToolbarElts[] = "browser.toolbars.showbutton";
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsBrowserInstance: Object Management
|
||||
|
@ -385,11 +392,29 @@ nsBrowserInstance::nsBrowserInstance() : mIsClosed(PR_FALSE)
|
|||
mContentAreaDocShellWeak = nsnull;
|
||||
mContentAreaDocLoaderWeak = nsnull;
|
||||
NS_INIT_REFCNT();
|
||||
gRefCnt++;
|
||||
if (gRefCnt == 1) {
|
||||
nsresult rv;
|
||||
// Add callback listeners for toolbar buttons showing/hiding.
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->RegisterCallback(kShowToolbarElts, ButtonShowHideCallback, nsnull);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsBrowserInstance::~nsBrowserInstance()
|
||||
{
|
||||
Close();
|
||||
gRefCnt--;
|
||||
if (gRefCnt == 0) {
|
||||
// Remove callback listeners for toolbar buttons showing/hiding.
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefs->UnregisterCallback(kShowToolbarElts, ButtonShowHideCallback, nsnull);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2384,3 +2409,79 @@ static nsModuleComponentInfo components[] = {
|
|||
|
||||
NS_IMPL_NSGETMODULE("nsBrowserModule", components)
|
||||
|
||||
// =================================================================================
|
||||
// Toolbar button pref callback
|
||||
// =================================================================================
|
||||
|
||||
int ButtonShowHideCallback(const char* aPref, void* aClosure)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return 0;
|
||||
|
||||
// There is an intelligent mapping from
|
||||
// the name of the pref to the id of the element in the XUL.
|
||||
//
|
||||
// browser.toolbars.showbutton.XXX maps to
|
||||
// an element with an ID of XXX-button. If the ID is of the
|
||||
// correct form, then this code will scale tolerably
|
||||
// as new buttons are added, and I won't need to have special
|
||||
// "My Netscape" and "Net2Phone" cases in the Netscape tree (which
|
||||
// would be non-ideal to say the least).
|
||||
//
|
||||
// hyatt
|
||||
|
||||
nsAutoString pref; pref.AssignWithConversion(aPref);
|
||||
PRInt32 index = pref.RFindChar('.');
|
||||
if (index == -1)
|
||||
return 0;
|
||||
|
||||
nsAutoString element;
|
||||
pref.Right(element, pref.Length()-index-1);
|
||||
element += NS_LITERAL_STRING("-button");
|
||||
|
||||
PRBool show = PR_TRUE;
|
||||
prefs->GetBoolPref(aPref, &show);
|
||||
|
||||
// Get the window mediator and loop over all navigator windows.
|
||||
NS_WITH_SERVICE(nsIWindowMediator, windowMediator, kWindowMediatorCID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
|
||||
|
||||
if (NS_SUCCEEDED(windowMediator->GetEnumerator(NS_LITERAL_STRING("navigator:browser"),
|
||||
getter_AddRefs(windowEnumerator)))) {
|
||||
// Get each dom window
|
||||
PRBool more;
|
||||
windowEnumerator->HasMoreElements(&more);
|
||||
while (more) {
|
||||
nsCOMPtr<nsISupports> protoWindow;
|
||||
windowEnumerator->GetNext(getter_AddRefs(protoWindow));
|
||||
if (protoWindow) {
|
||||
nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(protoWindow);
|
||||
if (domWindow) {
|
||||
nsCOMPtr<nsIDOMDocument> doc;
|
||||
domWindow->GetDocument(getter_AddRefs(doc));
|
||||
|
||||
nsCOMPtr<nsIDOMElement> elt;
|
||||
doc->GetElementById(element, getter_AddRefs(elt));
|
||||
if (elt) {
|
||||
if (show)
|
||||
elt->SetAttribute(NS_LITERAL_STRING("hidden"), NS_LITERAL_STRING("false"));
|
||||
else elt->SetAttribute(NS_LITERAL_STRING("hidden"), NS_LITERAL_STRING("true"));
|
||||
|
||||
// Modality issues with the (sigh) modal prefs dialog necessitate a synchronous
|
||||
// reflow. Otherwise the reflow seems to get "lost".
|
||||
// Do that here by flushing all pending reflows.
|
||||
nsCOMPtr<nsIDocument> document(do_QueryInterface(doc));
|
||||
document->FlushPendingNotifications();
|
||||
}
|
||||
}
|
||||
}
|
||||
windowEnumerator->HasMoreElements(&more);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -90,6 +90,8 @@ class nsBrowserInstance : public nsIBrowserInstance,
|
|||
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
|
||||
static PRUint32 gRefCnt;
|
||||
|
||||
public:
|
||||
nsIDocShell* GetContentAreaDocShell();
|
||||
nsIDOMWindow* GetContentWindow();
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/communicatorOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://communicator/locale/pref/pref-navigator.dtd" >
|
||||
|
||||
|
@ -38,7 +39,8 @@
|
|||
</script>
|
||||
<script language="JavaScript">
|
||||
<![CDATA[
|
||||
_elementIDs = ["startupPage", "browserStartupHomepage"];
|
||||
_elementIDs = ["startupPage", "browserStartupHomepage", "bookmarksButton", "goButton",
|
||||
"homeButton", "printButton", "searchButton" ];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
|
@ -83,7 +85,84 @@
|
|||
pref="true" preftype="bool" prefstring="browser.homepage.enable_home_button_drop"
|
||||
prefattribute="checked"/>
|
||||
</box>
|
||||
</titledbox>
|
||||
|
||||
</titledbox>
|
||||
|
||||
<!-- toolbar buttons customization -->
|
||||
<titledbox flex="1" orient="vertical">
|
||||
<title value="&header3.label;"/>
|
||||
<html>&toolbarIntro.label;</html>
|
||||
<tree flex="1" class="dialog inset">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
</treecolgroup>
|
||||
<treechildren flex="1" id="prefShowButtons">
|
||||
<treeitem>
|
||||
<treerow>
|
||||
<treecell>
|
||||
<checkbox allowevents="true"
|
||||
id="bookmarksButton"
|
||||
value="&bookmarksButton.label;"
|
||||
pref="true"
|
||||
preftype="bool"
|
||||
prefstring="browser.toolbars.showbutton.bookmarks"
|
||||
prefattribute = "checked"/>
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<treeitem>
|
||||
<treerow>
|
||||
<treecell>
|
||||
<checkbox allowevents="true"
|
||||
id="goButton"
|
||||
value="&goButton.label;"
|
||||
pref="true"
|
||||
preftype="bool"
|
||||
prefstring="browser.toolbars.showbutton.go"
|
||||
prefattribute = "checked"/>
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<treeitem id="homeItem">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<checkbox allowevents="true"
|
||||
id="homeButton"
|
||||
value="&homeButton.label;"
|
||||
pref="true"
|
||||
preftype="bool"
|
||||
prefstring="browser.toolbars.showbutton.home"
|
||||
prefattribute = "checked"/>
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<treeitem id="printItem">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<checkbox allowevents="true"
|
||||
id="printButton"
|
||||
value="&printButton.label;"
|
||||
pref="true"
|
||||
preftype="bool"
|
||||
prefstring="browser.toolbars.showbutton.print"
|
||||
prefattribute = "checked"/>
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<treeitem>
|
||||
<treerow>
|
||||
<treecell>
|
||||
<checkbox allowevents="true"
|
||||
id="searchButton"
|
||||
value="&searchButton.label;"
|
||||
pref="true"
|
||||
preftype="bool"
|
||||
prefstring="browser.toolbars.showbutton.search"
|
||||
prefattribute = "checked"/>
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</tree>
|
||||
</titledbox>
|
||||
</window>
|
||||
|
||||
|
|
|
@ -20,4 +20,13 @@
|
|||
<!ENTITY browseFile.accesskey "c">
|
||||
|
||||
<!ENTITY alwaysCheckWhenDropHome.label "Always check when I drag an address to the Home button">
|
||||
<!ENTITY alwaysCheckWhenDropHome.accesskey "d">
|
||||
<!ENTITY alwaysCheckWhenDropHome.accesskey "d">
|
||||
|
||||
<!ENTITY header3.label "Toolbar Customization">
|
||||
<!ENTITY toolbarIntro.label "Select the buttons that should be visible from the list below.">
|
||||
|
||||
<!ENTITY bookmarksButton.label "Bookmarks">
|
||||
<!ENTITY goButton.label "Go">
|
||||
<!ENTITY homeButton.label "Home">
|
||||
<!ENTITY printButton.label "Print">
|
||||
<!ENTITY searchButton.label "Search">
|
||||
|
|
Загрузка…
Ссылка в новой задаче