Merging cedar with mozilla-central.

This commit is contained in:
Mounir Lamouri 2011-05-25 10:03:25 +02:00
commit dc834941e6
95 changed files with 753 additions and 806 deletions

View File

@ -3346,7 +3346,7 @@ const BrowserSearch = {
var win = getTopWin();
if (win) {
// If there's an open browser window, it should handle this command
win.focus()
win.focus();
win.BrowserSearch.webSearch();
} else {
// If there are no open browser windows, open a new one
@ -3356,7 +3356,7 @@ const BrowserSearch = {
Services.obs.removeObserver(observer, "browser-delayed-startup-finished");
}
}
win = window.openDialog("chrome://browser/content/", "_blank",
win = window.openDialog(getBrowserURL(), "_blank",
"chrome,all,dialog=no", "about:blank");
Services.obs.addObserver(observer, "browser-delayed-startup-finished", false);
}

View File

@ -95,7 +95,7 @@
<property name="visibleTabs" readonly="true">
<getter><![CDATA[
return Array.filter(this.tabs, function(tab) {
return !tab.hidden && this._removingTabs.indexOf(tab) == -1;
return !tab.hidden && !tab.closing;
}, this);
]]></getter>
</property>
@ -208,7 +208,7 @@
//
// Fixing bug 630826 could make that happen automatically.
// Fixing bug 630830 could avoid the ugly hack below.
let closeMenuItem = document.getElementById("menu_close");
let parentPopup = closeMenuItem.parentNode;
let nextItem = closeMenuItem.nextSibling;
@ -999,7 +999,7 @@
<method name="_tabAttrModified">
<parameter name="aTab"/>
<body><![CDATA[
if (this._removingTabs.indexOf(aTab) > -1)
if (aTab.closing)
return;
// This event should be dispatched when any of these attributes change:
@ -1455,7 +1455,7 @@
// Handle requests for synchronously removing an already
// asynchronously closing tab.
if (!animate &&
this._removingTabs.indexOf(aTab) > -1) {
aTab.closing) {
this._endRemoveTab(aTab);
return;
}
@ -1509,7 +1509,7 @@
<parameter name="aCloseWindowFastpath"/>
<body>
<![CDATA[
if (this._removingTabs.indexOf(aTab) > -1 || this._windowIsClosing)
if (aTab.closing || this._windowIsClosing)
return false;
var browser = this.getBrowserForTab(aTab);
@ -1539,6 +1539,7 @@
newTab = true;
}
aTab.closing = true;
this._removingTabs.push(aTab);
if (newTab)
this.addTab("about:blank", {skipAnimation: true});
@ -1707,7 +1708,7 @@
if (aTab.owner &&
!aTab.owner.hidden &&
this._removingTabs.indexOf(aTab.owner) == -1 &&
!aTab.owner.closing &&
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")) {
this.selectedTab = aTab.owner;
return;
@ -1718,7 +1719,7 @@
let numTabs = remainingTabs.length;
if (numTabs == 0 || numTabs == 1 && remainingTabs[0] == aTab) {
remainingTabs = Array.filter(this.tabs, function(tab) {
return this._removingTabs.indexOf(tab) == -1;
return !tab.closing;
}, this);
}
@ -1933,7 +1934,7 @@
<body>
<![CDATA[
if (!aTab.hidden && !aTab.pinned && !aTab.selected &&
this._removingTabs.indexOf(aTab) == -1) {
!aTab.closing) {
aTab.setAttribute("hidden", "true");
this.tabContainer.adjustTabstrip();
let event = document.createEvent("Events");
@ -2948,8 +2949,7 @@
<body><![CDATA[
var numPinned = this.tabbrowser._numPinnedTabs;
var doPosition = this.getAttribute("overflow") == "true" &&
numPinned > 0 &&
numPinned < this.tabbrowser.visibleTabs.length;
numPinned > 0;
if (doPosition) {
this.setAttribute("positionpinnedtabs", "true");
@ -3077,7 +3077,7 @@
var tab = this._getDragTargetTab(event);
if (window.getComputedStyle(this, null).direction == "ltr") {
for (let i = tab ? tab._tPos : 0; i < tabs.length; i++)
if (event.screenX < tabs[i].boxObject.screenX + tabs[i].boxObject.width / 2)
if (event.screenX < tabs[i].boxObject.screenX + tabs[i].boxObject.width / 2)
return i;
} else {
for (let i = tab ? tab._tPos : 0; i < tabs.length; i++)
@ -3171,7 +3171,7 @@
<parameter name="aTab"/>
<body>
<![CDATA[
return this.tabbrowser._removingTabs.indexOf(aTab) == -1;
return !aTab.closing;
]]>
</body>
</method>
@ -3194,7 +3194,7 @@
if (tab.getAttribute("fadein") == "true")
this._handleNewTab(tab);
else if (this.tabbrowser._removingTabs.indexOf(tab) > -1)
else if (tab.closing)
this.tabbrowser._endRemoveTab(tab);
]]></handler>
@ -3337,7 +3337,7 @@
var scrollRect = tabStrip.scrollClientRect;
var rect = this.getBoundingClientRect();
var minMargin = scrollRect.left - rect.left;
var maxMargin = Math.min(minMargin + scrollRect.width,
var maxMargin = Math.min(minMargin + scrollRect.width,
scrollRect.right);
if (!ltr)
[minMargin, maxMargin] = [this.clientWidth - maxMargin,
@ -3635,6 +3635,7 @@
<field name="mOverCloseButton">false</field>
<field name="mCorrespondingMenuitem">null</field>
<field name="_fullyOpen">false</field>
<field name="closing">false</field>
</implementation>
<handlers>
@ -3746,7 +3747,7 @@
continue;
if (curTabBO.screenX >= tabstripBO.screenX &&
curTabBO.screenX + curTabBO.width <= tabstripBO.screenX + tabstripBO.width)
this.childNodes[i].setAttribute("tabIsVisible", "true");
this.childNodes[i].setAttribute("tabIsVisible", "true");
else
this.childNodes[i].removeAttribute("tabIsVisible");
}
@ -3757,7 +3758,7 @@
<parameter name="aTab"/>
<body><![CDATA[
var menuItem = document.createElementNS(
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"menuitem");
menuItem.setAttribute("class", "menuitem-iconic alltabs-item menuitem-with-favicon");

View File

@ -221,6 +221,19 @@
accesskey="&cmd.new_separator.accesskey;"/>
#ifndef XP_MACOSX
<menuseparator id="orgUndoSeparator"/>
<menuitem id="orgUndo"
command="cmd_undo"
label="&undoCmd.label;"
key="key_undo"
accesskey="&undoCmd.accesskey;"/>
<menuitem id="orgRedo"
command="cmd_redo"
label="&redoCmd.label;"
key="key_redo"
accesskey="&redoCmd.accesskey;"/>
<menuseparator id="orgCutSeparator"/>
<menuitem id="orgCut"
@ -241,19 +254,14 @@
key="key_paste"
accesskey="&pasteCmd.accesskey;"
selection="mutable"/>
<menuitem id="orgUndo"
command="cmd_undo"
label="&undoCmd.label;"
key="key_undo"
accesskey="&undoCmd.accesskey;"/>
<menuitem id="orgRedo"
command="cmd_redo"
label="&redoCmd.label;"
key="key_redo"
accesskey="&redoCmd.accesskey;"/>
<menuitem id="orgDelete"
command="cmd_delete"
label="&deleteCmd.label;"
key="key_delete"
accesskey="&deleteCmd.accesskey;"/>
<menuseparator id="selectAllSeparator"/>
<menuitem id="orgSelectAll"
command="cmd_selectAll"
label="&selectAllCmd.label;"
@ -262,16 +270,18 @@
#endif
<menuseparator id="orgMoveSeparator"/>
<menuitem id="orgMoveBookmarks"
command="placesCmd_moveBookmarks"
label="&cmd.moveBookmarks.label;"
accesskey="&cmd.moveBookmarks.accesskey;"/>
#ifdef XP_MACOSX
<menuitem id="orgDelete"
command="cmd_delete"
label="&deleteCmd.label;"
key="key_delete"
accesskey="&deleteCmd.accesskey;"/>
#ifndef XP_MACOSX
#else
<menuseparator id="orgCloseSeparator"/>
<menuitem id="orgClose"
@ -369,12 +379,12 @@
<hbox flex="1" id="placesView">
<tree id="placesList"
class="placesTree"
class="plain placesTree"
type="places"
hidecolumnpicker="true" context="placesContext"
onselect="PlacesOrganizer.onPlaceSelected(true);"
onclick="PlacesOrganizer.onTreeClick(event);"
onfocus="PlacesOrganizer.onTreeFocus(event);"
onfocus="PlacesOrganizer.onTreeFocus(event);"
seltype="single"
persist="width"
width="200"
@ -387,116 +397,112 @@
</tree>
<splitter collapse="none" persist="state"></splitter>
<vbox id="contentView" flex="4">
<deck id="contentDeck" flex="1">
<vbox id="defaultView" flex="1">
<vbox id="searchModifiers" hidden="true">
<toolbar id="organizerScopeBar" class="chromeclass-toolbar" align="center">
<label id="scopeBarTitle" value="&search.in.label;"/>
<toolbarbutton id="scopeBarAll" type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
label="&search.scopeBookmarks.label;"
accesskey="&search.scopeBookmarks.accesskey;"/>
<!--
<toolbarbutton id="scopeBarDownloads" type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
label="&search.scopeDownloads.label;"
accesskey="&search.scopeDownloads.accesskey;"/>
-->
<toolbarbutton id="scopeBarHistory" type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
label="&search.scopeHistory.label;"
accesskey="&search.scopeHistory.accesskey;"/>
<toolbarbutton id="scopeBarFolder" type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
accesskey="&search.scopeFolder.accesskey;"
emptytitle="&search.scopeFolder.label;" flex="1"/>
<!-- The folder scope button should flex but not take up more room
than its label needs. The only simple way to do that is to
set a really big flex on the spacer, e.g., 2^31 - 1. -->
<spacer flex="2147483647"/>
<button id="saveSearch" class="small"
label="&saveSearch.label;" accesskey="&saveSearch.accesskey;"
command="OrganizerCommand_search:save"/>
</toolbar>
<toolbox id="searchModifiers" hidden="true">
<toolbar id="organizerScopeBar" class="chromeclass-toolbar" align="center">
<label id="scopeBarTitle" value="&search.in.label;"/>
<toolbarbutton id="scopeBarAll" class="small-margin"
type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
label="&search.scopeBookmarks.label;"
accesskey="&search.scopeBookmarks.accesskey;"/>
<!--
<toolbarbutton id="scopeBarDownloads" class="small-margin"
type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
label="&search.scopeDownloads.label;"
accesskey="&search.scopeDownloads.accesskey;"/>
-->
<toolbarbutton id="scopeBarHistory" class="small-margin"
type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
label="&search.scopeHistory.label;"
accesskey="&search.scopeHistory.accesskey;"/>
<toolbarbutton id="scopeBarFolder" class="small-margin"
type="radio" group="scopeBar"
oncommand="PlacesQueryBuilder.onScopeSelected(this);"
accesskey="&search.scopeFolder.accesskey;"
emptytitle="&search.scopeFolder.label;" flex="1"/>
<!-- The folder scope button should flex but not take up more room
than its label needs. The only simple way to do that is to
set a really big flex on the spacer, e.g., 2^31 - 1. -->
<spacer flex="2147483647"/>
<button id="saveSearch" class="small-margin"
label="&saveSearch.label;" accesskey="&saveSearch.accesskey;"
command="OrganizerCommand_search:save"/>
</toolbar>
</toolbox>
<tree id="placeContent"
class="plain placesTree"
context="placesContext"
hidecolumnpicker="true"
flex="1"
type="places"
flatList="true"
enableColumnDrag="true"
onkeypress="if (event.keyCode == KeyEvent.DOM_VK_RETURN) PlacesOrganizer.openSelectedNode(event);"
onopenflatcontainer="PlacesOrganizer.openFlatContainer(aContainer);"
onselect="PlacesOrganizer.onContentTreeSelect();"
onfocus="PlacesOrganizer.onTreeFocus(event);"
onclick="PlacesOrganizer.onTreeClick(event);">
<treecols id="placeContentColumns" context="placesColumnsContext">
<treecol label="&col.name.label;" id="placesContentTitle" anonid="title" flex="5" primary="true" ordinal="1"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.tags.label;" id="placesContentTags" anonid="tags" flex="2"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.url.label;" id="placesContentUrl" anonid="url" flex="5"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.lastvisit.label;" id="placesContentDate" anonid="date" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.visitcount.label;" id="placesContentVisitCount" anonid="visitCount" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.keyword.label;" id="placesContentKeyword" anonid="keyword" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.description.label;" id="placesContentDescription" anonid="description" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.dateadded.label;" id="placesContentDateAdded" anonid="dateAdded" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.lastmodified.label;" id="placesContentLastModified" anonid="lastModified" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
</treecols>
<treechildren flex="1"/>
</tree>
<deck id="detailsDeck" style="height: 11em;">
<vbox id="itemsCountBox" align="center">
<spacer flex="3"/>
<label id="itemsCountText"/>
<spacer flex="1"/>
<description id="selectItemDescription">
&detailsPane.selectAnItemText.description;
</description>
<spacer flex="3"/>
</vbox>
<vbox id="infoBox" minimal="true">
<vbox id="editBookmarkPanelContent" flex="1"/>
<hbox id="infoBoxExpanderWrapper" align="center">
</vbox>
<vbox flex="1">
<tree id="placeContent" class="placesTree" context="placesContext"
hidecolumnpicker="true"
flex="1" type="places"
flatList="true"
enableColumnDrag="true"
onkeypress="if (event.keyCode == KeyEvent.DOM_VK_RETURN) PlacesOrganizer.openSelectedNode(event);"
onopenflatcontainer="PlacesOrganizer.openFlatContainer(aContainer);"
onselect="PlacesOrganizer.onContentTreeSelect();"
onfocus="PlacesOrganizer.onTreeFocus(event);"
onclick="PlacesOrganizer.onTreeClick(event);">
<treecols id="placeContentColumns" context="placesColumnsContext">
<treecol label="&col.name.label;" id="placesContentTitle" anonid="title" flex="5" primary="true" ordinal="1"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.tags.label;" id="placesContentTags" anonid="tags" flex="2"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.url.label;" id="placesContentUrl" anonid="url" flex="5"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.lastvisit.label;" id="placesContentDate" anonid="date" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.visitcount.label;" id="placesContentVisitCount" anonid="visitCount" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.keyword.label;" id="placesContentKeyword" anonid="keyword" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.description.label;" id="placesContentDescription" anonid="description" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.dateadded.label;" id="placesContentDateAdded" anonid="dateAdded" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
<splitter class="tree-splitter"/>
<treecol label="&col.lastmodified.label;" id="placesContentLastModified" anonid="lastModified" flex="1" hidden="true"
persist="width hidden ordinal sortActive sortDirection"/>
</treecols>
<treechildren flex="1"/>
</tree>
<hbox id="infoPaneBox" style="height: 11em;">
<deck flex="1" id="detailsDeck">
<vbox id="itemsCountBox" align="center">
<spacer flex="3"/>
<label id="itemsCountText"/>
<spacer flex="1"/>
<description id="selectItemDescription">
&detailsPane.selectAnItemText.description;
</description>
<spacer flex="3"/>
</vbox>
<vbox id="infoBox" minimal="true">
<vbox id="editBookmarkPanelContent"/>
<spacer flex="1"/>
<hbox id="infoBoxExpanderWrapper" align="center">
<button type="image" id="infoBoxExpander"
class="expander-down"
oncommand="PlacesOrganizer.toggleAdditionalInfoFields();"
observes="paneElementsBroadcaster"/>
<button type="image" id="infoBoxExpander"
class="expander-down"
oncommand="PlacesOrganizer.toggleAdditionalInfoFields();"
observes="paneElementsBroadcaster"/>
<label id="infoBoxExpanderLabel"
lesslabel="&detailsPane.less.label;"
lessaccesskey="&detailsPane.less.accesskey;"
morelabel="&detailsPane.more.label;"
moreaccesskey="&detailsPane.more.accesskey;"
value="&detailsPane.more.label;"
accesskey="&detailsPane.more.accesskey;"
control="infoBoxExpander"/>
<label id="infoBoxExpanderLabel"
lesslabel="&detailsPane.less.label;"
lessaccesskey="&detailsPane.less.accesskey;"
morelabel="&detailsPane.more.label;"
moreaccesskey="&detailsPane.more.accesskey;"
value="&detailsPane.more.label;"
accesskey="&detailsPane.more.accesskey;"
control="infoBoxExpander"/>
<spacer flex="1"/>
</hbox>
</vbox>
</deck>
</hbox>
</vbox>
</hbox>
</vbox>
</deck>
</vbox>

View File

@ -81,29 +81,29 @@ function Site(host) {
this.httpURI = NetUtil.newURI("http://" + this.host);
this.httpsURI = NetUtil.newURI("https://" + this.host);
this._favicon = "";
}
Site.prototype = {
/**
* Gets the favicon to use for the site. This will return the default favicon
* if there is no favicon stored for the site.
* Gets the favicon to use for the site. The callback only gets called if
* a favicon is found for either the http URI or the https URI.
*
* @return A favicon image URL.
* @param aCallback
* A callback function that takes a favicon image URL as a parameter.
*/
get favicon() {
if (!this._favicon) {
// TODO: Bug 657961: Make this async when bug 655270 is fixed.
getFavicon: function Site_getFavicon(aCallback) {
function faviconDataCallback(aURI, aDataLen, aData, aMimeType) {
try {
// First try to see if a favicon is stored for the http URI.
this._favicon = gFaviconService.getFaviconForPage(this.httpURI).spec;
aCallback(aURI.spec);
} catch (e) {
// getFaviconImageForPage returns the default favicon if no stored favicon is found.
this._favicon = gFaviconService.getFaviconImageForPage(this.httpsURI).spec;
Cu.reportError("AboutPermissions: " + e);
}
}
return this._favicon;
// Try to find favicion for both URIs. Callback will only be called if a
// favicon URI is found, so this means we'll always prefer the https favicon.
gFaviconService.getFaviconURLForPage(this.httpURI, faviconDataCallback);
gFaviconService.getFaviconURLForPage(this.httpsURI, faviconDataCallback);
},
/**
@ -542,7 +542,10 @@ let AboutPermissions = {
let item = document.createElement("richlistitem");
item.setAttribute("class", "site");
item.setAttribute("value", aSite.host);
item.setAttribute("favicon", aSite.favicon);
aSite.getFavicon(function(aURL) {
item.setAttribute("favicon", aURL);
});
aSite.listitem = item;
this.sitesList.appendChild(item);

View File

@ -41,6 +41,7 @@
#
# ***** END LICENSE BLOCK *****
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const DEBUG = false; /* set to false to suppress debug messages */
@ -56,15 +57,6 @@ const SHERLOCK_FILE_EXT_REGEXP = /\.src$/i;
function nsSidebar()
{
const PROMPTSERVICE_CONTRACTID = "@mozilla.org/embedcomp/prompt-service;1";
const nsIPromptService = Components.interfaces.nsIPromptService;
this.promptService =
Components.classes[PROMPTSERVICE_CONTRACTID].getService(nsIPromptService);
const SEARCHSERVICE_CONTRACTID = "@mozilla.org/browser/search-service;1";
const nsIBrowserSearchService = Components.interfaces.nsIBrowserSearchService;
this.searchService =
Components.classes[SEARCHSERVICE_CONTRACTID].getService(nsIBrowserSearchService);
}
nsSidebar.prototype.classID = SIDEBAR_CID;
@ -102,20 +94,15 @@ function(aTitle, aContentURL, aCustomizeURL)
nsSidebar.prototype.addPanelInternal =
function (aTitle, aContentURL, aCustomizeURL, aPersist)
{
var WINMEDSVC = Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator);
// XXX Bug 620418: We shouldn't do this anymore. Instead, we should find the
// global object for our caller and use it.
var win = WINMEDSVC.getMostRecentWindow( "navigator:browser" );
var win = Services.wm.getMostRecentWindow("navigator:browser");
if (!sidebarURLSecurityCheck(aContentURL))
return;
var uri = null;
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
try {
uri = ioService.newURI(aContentURL, null, null);
uri = Services.io.newURI(aContentURL, null, null);
}
catch(ex) { return; }
@ -141,7 +128,7 @@ function (engineURL, iconURL)
if (!isWeb.test(engineURL))
throw "Unsupported search engine URL";
if (iconURL && !isWeb.test(iconURL))
throw "Unsupported search icon URL.";
}
@ -149,19 +136,17 @@ function (engineURL, iconURL)
{
debug(ex);
Components.utils.reportError("Invalid argument passed to window.sidebar.addSearchEngine: " + ex);
var searchBundle = srGetStrBundle("chrome://global/locale/search/search.properties");
var brandBundle = srGetStrBundle("chrome://branding/locale/brand.properties");
var searchBundle = Services.strings.createBundle("chrome://global/locale/search/search.properties");
var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
var brandName = brandBundle.GetStringFromName("brandShortName");
var title = searchBundle.GetStringFromName("error_invalid_engine_title");
var msg = searchBundle.formatStringFromName("error_invalid_engine_msg",
[brandName], 1);
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].
getService(Components.interfaces.nsIWindowWatcher);
ww.getNewPrompter(null).alert(title, msg);
Services.ww.getNewPrompter(null).alert(title, msg);
return false;
}
return true;
}
@ -185,7 +170,7 @@ function (engineURL, iconURL, suggestedTitle, suggestedCategory)
else
dataType = Components.interfaces.nsISearchEngine.DATA_XML;
this.searchService.addEngine(engineURL, dataType, iconURL, true);
Services.search.addEngine(engineURL, dataType, iconURL, true);
}
// This function exists largely to implement window.external.AddSearchProvider(),
@ -198,23 +183,21 @@ function (aDescriptionURL)
// page since we don't have easy access to the active document. Most search
// engines will override this with an icon specified in the OpenSearch
// description anyway.
var WINMEDSVC = Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator);
var win = WINMEDSVC.getMostRecentWindow("navigator:browser");
var browser = win.document.getElementById("content");
var win = Services.wm.getMostRecentWindow("navigator:browser");
var browser = win.gBrowser;
var iconURL = "";
// Use documentURIObject in the check for shouldLoadFavIcon so that we
// do the right thing with about:-style error pages. Bug 453442
if (browser.shouldLoadFavIcon(browser.selectedBrowser
.contentDocument
.documentURIObject))
iconURL = win.gBrowser.getIcon();
iconURL = browser.getIcon();
if (!this.validateSearchEngine(aDescriptionURL, iconURL))
return;
const typeXML = Components.interfaces.nsISearchEngine.DATA_XML;
this.searchService.addEngine(aDescriptionURL, typeXML, iconURL, true);
Services.search.addEngine(aDescriptionURL, typeXML, iconURL, true);
}
// This function exists to implement window.external.IsSearchProviderInstalled(),
@ -265,16 +248,3 @@ if (DEBUG)
debug = function (s) { dump("-*- sidebar component: " + s + "\n"); }
else
debug = function (s) {}
// String bundle service
var gStrBundleService = null;
function srGetStrBundle(path)
{
if (!gStrBundleService)
gStrBundleService =
Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService);
return gStrBundleService.createBundle(path);
}

View File

@ -1697,6 +1697,11 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
.alltabs-item[tabIsVisible] {
/* box-shadow instead of background-color to work around native styling */
box-shadow: inset 0 0 0 2em hsla(0,0%,50%,.15);
}
/* Sidebar */
#sidebar-header > .tabs-closebutton {
margin-bottom: 0px !important;

View File

@ -64,38 +64,11 @@
background-color: Window;
}
/* Place List, Place Content */
.placesTree {
margin: 0px;
}
#placesList {
margin: 0px;
border: none;
padding: 0;
}
#placeContent {
border: 0px;
}
#infoPaneBox {
/* Info box */
#detailsDeck {
padding: 5px;
}
.small, .small[disabled="true"] {
min-width: 0px;
padding: 0px 4px 0px 4px;
margin: 0px;
border: 0px;
}
.small .button-text,
.small .button-box {
padding: 0px;
border: 0px;
}
#infoBoxExpanderLabel {
-moz-padding-start: 2px;
}

View File

@ -32,6 +32,11 @@
height: 16px;
width: 16px;
-moz-margin-end: 4px;
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
}
#all-sites-item > .site-container > .site-favicon {
list-style-image: none;
}
.site-domain {

View File

@ -2006,6 +2006,11 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
list-style-image: url("chrome://global/skin/icons/loading_16.png") !important;
}
.alltabs-item[tabIsVisible] {
/* box-shadow instead of background-color to work around native styling */
box-shadow: inset 0 0 0 2em hsla(0,0%,50%,.15);
}
/* Tabstrip close button */
.tabs-closebutton {
-moz-padding-end: 4px;

View File

@ -2,12 +2,6 @@
/* Places Organizer Sidebars */
#placesList {
-moz-appearance: none;
border: none;
margin: 0;
}
#placesList > treechildren::-moz-tree-row {
background-color: transparent;
border-color: transparent;
@ -179,23 +173,17 @@
}
/* Place List, Place Content */
.placesTree {
margin: 0px;
}
#placesList {
-moz-appearance: none;
background-color: #d2d8e2;
width: 160px;
margin: 0px;
border: 0px;
}
#placesList:-moz-window-inactive {
background-color: #e8e8e8;
}
#infoPaneBox {
/* Info box */
#detailsDeck {
border-top: 1px solid #919191;
background-color: #f0f0f0;
padding: 10px;
@ -235,19 +223,6 @@
border-color: transparent;
}
.small {
min-width: 0px;
padding: 0px 4px 0px 4px;
margin: 0px;
border: 0px;
}
.small .button-text,
.small .button-box {
padding: 0px;
border: 0px;
}
/* Scope Bar */
#advancedSearch > hbox,

View File

@ -34,6 +34,11 @@
height: 16px;
width: 16px;
-moz-margin-end: 4px;
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
}
#all-sites-item > .site-container > .site-favicon {
list-style-image: none;
}
.site-domain {

View File

@ -1881,6 +1881,11 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
.alltabs-item[tabIsVisible] {
/* box-shadow instead of background-color to work around native styling */
box-shadow: inset 0 0 0 2em hsla(0,0%,50%,.15);
}
/* Tabstrip close button */
.tabs-closebutton {
-moz-appearance: none;

View File

@ -65,7 +65,7 @@
border: none;
}
#infoPaneBox {
#detailsDeck {
border-top-color: #A9B7C9;
}

View File

@ -110,47 +110,17 @@
border-top: 1px solid ThreeDDarkShadow;
}
/* Place List, Place Content */
.placesTree {
margin: 0px;
}
#placesList {
-moz-appearance: none;
margin: 0px;
border: none;
padding: 0;
}
#placeContent {
-moz-appearance: none;
border: 0px;
}
#infoPaneBox {
/* Info box */
#detailsDeck {
border-top: 1px solid ThreeDShadow;
padding: 5px;
}
.small, .small[disabled="true"] {
min-width: 0px;
padding: 0px 4px 0px 4px;
margin: 0px;
border: 0px;
}
.small .button-text,
.small .button-box {
padding: 0px;
border: 0px;
}
#infoBoxExpanderLabel {
-moz-padding-start: 2px;
}
#organizerScopeBar {
-moz-appearance: toolbox;
padding: 2px 0;
-moz-padding-end: 3px;
}

View File

@ -37,6 +37,11 @@
height: 16px;
width: 16px;
-moz-margin-end: 4px;
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
}
#all-sites-item > .site-container > .site-favicon {
list-style-image: none;
}
.site-domain {

View File

@ -259,6 +259,7 @@ MOZ_CSS_ANIMATIONS = @MOZ_CSS_ANIMATIONS@
MOZ_PERMISSIONS = @MOZ_PERMISSIONS@
MOZ_XTF = @MOZ_XTF@
MOZ_SVG = @MOZ_SVG@
MOZ_SVG_DLISTS = @MOZ_SVG_DLISTS@
MOZ_CAIRO_CFLAGS = @MOZ_CAIRO_CFLAGS@
MOZ_SMIL = @MOZ_SMIL@
MOZ_XSLT_STANDALONE = @MOZ_XSLT_STANDALONE@

View File

@ -4836,6 +4836,7 @@ MOZ_SPELLCHECK=1
MOZ_SPLASHSCREEN=
MOZ_STORAGE=1
MOZ_SVG=1
MOZ_SVG_DLISTS=
MOZ_THUMB2=
MOZ_TIMELINE=
MOZ_TOOLKIT_SEARCH=1
@ -6407,6 +6408,13 @@ dnl Keeping AC_DEFINE(MOZ_SVG) for the moment in case of something needs it.
dnl ========================================================
AC_DEFINE(MOZ_SVG)
dnl ========================================================
dnl SVG Display Lists
dnl ========================================================
if test -n "$MOZ_SVG_DLISTS"; then
AC_DEFINE(MOZ_SVG_DLISTS)
fi
dnl ========================================================
dnl SMIL
dnl ========================================================

View File

@ -551,9 +551,6 @@ public:
nsIAtom **aTagName, PRInt32 *aNameSpaceID);
static nsAdoptingCString GetCharPref(const char *aPref);
static PRPackedBool GetBoolPref(const char *aPref,
PRBool aDefault = PR_FALSE);
static PRInt32 GetIntPref(const char *aPref, PRInt32 aDefault = 0);
static nsAdoptingString GetLocalizedStringPref(const char *aPref);
static nsAdoptingString GetStringPref(const char *aPref);
static void RegisterPrefCallback(const char *aPref,

View File

@ -211,8 +211,11 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#endif
#include "nsDOMTouchEvent.h"
#include "mozilla/Preferences.h"
using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla;
const char kLoadAsData[] = "loadAsData";
@ -2608,34 +2611,6 @@ nsContentUtils::GetCharPref(const char *aPref)
return result;
}
// static
PRPackedBool
nsContentUtils::GetBoolPref(const char *aPref, PRBool aDefault)
{
PRBool result;
if (!sPrefBranch ||
NS_FAILED(sPrefBranch->GetBoolPref(aPref, &result))) {
result = aDefault;
}
return (PRPackedBool)result;
}
// static
PRInt32
nsContentUtils::GetIntPref(const char *aPref, PRInt32 aDefault)
{
PRInt32 result;
if (!sPrefBranch ||
NS_FAILED(sPrefBranch->GetIntPref(aPref, &result))) {
result = aDefault;
}
return result;
}
// static
nsAdoptingString
nsContentUtils::GetLocalizedStringPref(const char *aPref)
@ -2734,8 +2709,8 @@ BoolVarChanged(const char *aPref, void *aClosure)
{
PrefCacheData* cache = static_cast<PrefCacheData*>(aClosure);
*((PRBool*)cache->cacheLocation) =
nsContentUtils::GetBoolPref(aPref, cache->defaultValueBool);
Preferences::GetBool(aPref, cache->defaultValueBool);
return 0;
}
@ -2744,7 +2719,7 @@ nsContentUtils::AddBoolPrefVarCache(const char *aPref,
PRBool* aCache,
PRBool aDefault)
{
*aCache = GetBoolPref(aPref, aDefault);
*aCache = Preferences::GetBool(aPref, aDefault);
PrefCacheData* data = new PrefCacheData;
data->cacheLocation = aCache;
data->defaultValueBool = aDefault;
@ -2757,7 +2732,7 @@ IntVarChanged(const char *aPref, void *aClosure)
{
PrefCacheData* cache = static_cast<PrefCacheData*>(aClosure);
*((PRInt32*)cache->cacheLocation) =
nsContentUtils::GetIntPref(aPref, cache->defaultValueInt);
Preferences::GetInt(aPref, cache->defaultValueInt);
return 0;
}
@ -2767,7 +2742,7 @@ nsContentUtils::AddIntPrefVarCache(const char *aPref,
PRInt32* aCache,
PRInt32 aDefault)
{
*aCache = GetIntPref(aPref, aDefault);
*aCache = Preferences::GetInt(aPref, aDefault);
PrefCacheData* data = new PrefCacheData;
data->cacheLocation = aCache;
data->defaultValueInt = aDefault;

View File

@ -203,6 +203,9 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
#include "nsXULAppAPI.h"
#include "nsDOMTouchEvent.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
typedef nsTArray<Link*> LinkArray;
@ -8261,7 +8264,7 @@ nsresult
nsDocument::SetImageLockingState(PRBool aLocked)
{
if (XRE_GetProcessType() == GeckoProcessType_Content &&
!nsContentUtils::GetBoolPref("content.image.allow_locking", PR_TRUE)) {
!Preferences::GetBool("content.image.allow_locking", PR_TRUE)) {
return NS_OK;
}

View File

@ -57,6 +57,9 @@
#include "nsICharsetConverterManager.h"
#include "nsIChannelPolicy.h"
#include "nsIContentSecurityPolicy.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
#define REPLACEMENT_CHAR (PRUnichar)0xFFFD
#define BOM_CHAR (PRUnichar)0xFEFF
@ -296,8 +299,8 @@ nsEventSource::Init(nsIPrincipal* aPrincipal,
mOrigin = origin;
mReconnectionTime =
nsContentUtils::GetIntPref("dom.server-events.default-reconnection-time",
DEFAULT_RECONNECTION_TIME_VALUE);
Preferences::GetInt("dom.server-events.default-reconnection-time",
DEFAULT_RECONNECTION_TIME_VALUE);
nsCOMPtr<nsICharsetConverterManager> convManager =
do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
@ -775,7 +778,7 @@ nsEventSource::GetInterface(const nsIID & aIID,
PRBool
nsEventSource::PrefEnabled()
{
return nsContentUtils::GetBoolPref("dom.server-events.enabled", PR_FALSE);
return Preferences::GetBool("dom.server-events.enabled", PR_FALSE);
}
nsresult

View File

@ -114,6 +114,8 @@
#include "TabParent.h"
#include "mozilla/layout/RenderFrameParent.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
@ -1346,8 +1348,8 @@ nsFrameLoader::ShouldUseRemoteProcess()
return false;
}
PRBool remoteDisabled = nsContentUtils::GetBoolPref("dom.ipc.tabs.disabled",
PR_FALSE);
PRBool remoteDisabled =
Preferences::GetBool("dom.ipc.tabs.disabled", PR_FALSE);
if (remoteDisabled) {
return false;
}
@ -1366,8 +1368,7 @@ nsFrameLoader::ShouldUseRemoteProcess()
return true;
}
PRBool remoteEnabled = nsContentUtils::GetBoolPref("dom.ipc.tabs.enabled",
PR_FALSE);
PRBool remoteEnabled = Preferences::GetBool("dom.ipc.tabs.enabled", PR_FALSE);
return (bool) remoteEnabled;
}

View File

@ -846,52 +846,6 @@ nsGenericDOMDataNode::SplitText(PRUint32 aOffset, nsIDOMText** aReturn)
return rv;
}
//----------------------------------------------------------------------
// Implementation of the nsGenericDOMDataNode nsIDOM3Text tearoff
NS_IMPL_CYCLE_COLLECTION_CLASS(nsText3Tearoff)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsText3Tearoff)
NS_INTERFACE_MAP_ENTRY(nsIDOM3Text)
NS_INTERFACE_MAP_END_AGGREGATED(mNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsText3Tearoff)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsText3Tearoff)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mNode, nsIContent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsText3Tearoff)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsText3Tearoff)
NS_IMETHODIMP
nsText3Tearoff::GetIsElementContentWhitespace(PRBool *aReturn)
{
*aReturn = mNode->IsElementContentWhitespace();
return NS_OK;
}
NS_IMETHODIMP
nsText3Tearoff::GetWholeText(nsAString& aWholeText)
{
return mNode->GetWholeText(aWholeText);
}
NS_IMETHODIMP
nsText3Tearoff::ReplaceWholeText(const nsAString& aContent,
nsIDOMText **aReturn)
{
nsresult rv;
nsIContent* result = mNode->ReplaceWholeText(PromiseFlatString(aContent),
&rv);
return result ? CallQueryInterface(result, aReturn) : rv;
}
// Implementation of the nsIDOM3Text interface
/* static */ PRInt32
nsGenericDOMDataNode::FirstLogicallyAdjacentTextNode(nsIContent* aParent,
PRInt32 aIndex)
@ -918,7 +872,7 @@ nsGenericDOMDataNode::LastLogicallyAdjacentTextNode(nsIContent* aParent,
}
nsresult
nsGenericTextNode::GetWholeText(nsAString& aWholeText)
nsGenericDOMDataNode::GetWholeText(nsAString& aWholeText)
{
nsIContent* parent = GetParent();
@ -949,21 +903,21 @@ nsGenericTextNode::GetWholeText(nsAString& aWholeText)
return NS_OK;
}
nsIContent*
nsGenericTextNode::ReplaceWholeText(const nsAFlatString& aContent,
nsresult* aResult)
nsresult
nsGenericDOMDataNode::ReplaceWholeText(const nsAString& aContent,
nsIDOMText **aResult)
{
*aResult = NS_OK;
*aResult = nsnull;
// Handle parent-less nodes
nsCOMPtr<nsIContent> parent = GetParent();
if (!parent) {
if (aContent.IsEmpty()) {
return nsnull;
return NS_OK;
}
SetNodeValue(aContent);
return this;
return CallQueryInterface(this, aResult);
}
// We're relying on mozAutoSubtreeModified to keep the doc alive here.
@ -976,8 +930,7 @@ nsGenericTextNode::ReplaceWholeText(const nsAFlatString& aContent,
if (index < 0) {
NS_WARNING("Trying to use .replaceWholeText with an anonymous text node "
"child of a binding parent?");
*aResult = NS_ERROR_DOM_NOT_SUPPORTED_ERR;
return nsnull;
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
// We don't support entity references or read-only nodes, so remove the
@ -1016,11 +969,11 @@ nsGenericTextNode::ReplaceWholeText(const nsAFlatString& aContent,
// Empty string means we removed this node too.
if (aContent.IsEmpty()) {
return nsnull;
return NS_OK;
}
SetText(aContent.get(), aContent.Length(), PR_TRUE);
return this;
SetText(aContent.BeginReading(), aContent.Length(), PR_TRUE);
return CallQueryInterface(this, aResult);
}
//----------------------------------------------------------------------

View File

@ -46,7 +46,6 @@
#include "nsIContent.h"
#include "nsIDOMCharacterData.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOM3Text.h"
#include "nsTextFragment.h"
#include "nsDOMError.h"
#include "nsIEventListenerManager.h"
@ -328,7 +327,15 @@ protected:
nsresult SplitText(PRUint32 aOffset, nsIDOMText** aReturn);
friend class nsText3Tearoff;
nsresult GetWholeText(nsAString& aWholeText);
nsresult ReplaceWholeText(const nsAString& aContent, nsIDOMText **aReturn);
nsresult GetIsElementContentWhitespace(PRBool *aReturn)
{
*aReturn = TextIsOnlyWhitespace();
return NS_OK;
}
static PRInt32 FirstLogicallyAdjacentTextNode(nsIContent* aParent,
PRInt32 aIndex);
@ -360,45 +367,6 @@ private:
already_AddRefed<nsIAtom> GetCurrentValueAtom();
};
class nsGenericTextNode : public nsGenericDOMDataNode
{
public:
nsGenericTextNode(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericDOMDataNode(aNodeInfo)
{
}
PRBool IsElementContentWhitespace()
{
return TextIsOnlyWhitespace();
}
nsresult GetWholeText(nsAString& aWholeText);
nsIContent* ReplaceWholeText(const nsAFlatString& aContent,
nsresult *aResult);
};
/** Tearoff class for the nsIDOM3Text portion of nsGenericDOMDataNode. */
class nsText3Tearoff : public nsIDOM3Text
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOM3TEXT
NS_DECL_CYCLE_COLLECTION_CLASS(nsText3Tearoff)
nsText3Tearoff(nsGenericTextNode *aNode) : mNode(aNode)
{
}
protected:
virtual ~nsText3Tearoff() {}
private:
nsRefPtr<nsGenericTextNode> mNode;
};
//----------------------------------------------------------------------
/**

View File

@ -58,7 +58,9 @@
#include "nsCRT.h"
#include "nsIParserService.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
#define PREF_STRUCTS "converter.html2txt.structs"
@ -206,28 +208,27 @@ nsPlainTextSerializer::Init(PRUint32 aFlags, PRUint32 aWrapColumn,
if (mFlags & nsIDocumentEncoder::OutputFormatted) {
// Get some prefs that controls how we do formatted output
mStructs = nsContentUtils::GetBoolPref(PREF_STRUCTS, mStructs);
mStructs = Preferences::GetBool(PREF_STRUCTS, mStructs);
mHeaderStrategy =
nsContentUtils::GetIntPref(PREF_HEADER_STRATEGY, mHeaderStrategy);
Preferences::GetInt(PREF_HEADER_STRATEGY, mHeaderStrategy);
// The quotesPreformatted pref is a temporary measure. See bug 69638.
mQuotesPreformatted =
nsContentUtils::GetBoolPref("editor.quotesPreformatted",
mQuotesPreformatted);
Preferences::GetBool("editor.quotesPreformatted", mQuotesPreformatted);
// DontWrapAnyQuotes is set according to whether plaintext mail
// is wrapping to window width -- see bug 134439.
// We'll only want this if we're wrapping and formatted.
if (mFlags & nsIDocumentEncoder::OutputWrap || mWrapColumn > 0) {
mDontWrapAnyQuotes =
nsContentUtils::GetBoolPref("mail.compose.wrap_to_window_width",
mDontWrapAnyQuotes);
Preferences::GetBool("mail.compose.wrap_to_window_width",
mDontWrapAnyQuotes);
}
}
// XXX We should let the caller pass this in.
if (nsContentUtils::GetBoolPref("browser.frames.enabled")) {
if (Preferences::GetBool("browser.frames.enabled")) {
mFlags &= ~nsIDocumentEncoder::OutputNoFramesContent;
}
else {

View File

@ -40,7 +40,6 @@
*/
#include "nsTextNode.h"
#include "nsIDOM3Text.h"
#include "nsContentUtils.h"
#include "nsIDOMEventListener.h"
#include "nsIDOMEventTarget.h"
@ -142,7 +141,7 @@ NS_NewTextNode(nsIContent** aInstancePtrResult,
}
nsTextNode::nsTextNode(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericTextNode(aNodeInfo)
: nsGenericDOMDataNode(aNodeInfo)
{
}
@ -159,7 +158,6 @@ DOMCI_NODE_DATA(Text, nsTextNode)
NS_INTERFACE_TABLE_HEAD(nsTextNode)
NS_NODE_INTERFACE_TABLE3(nsTextNode, nsIDOMNode, nsIDOMText,
nsIDOMCharacterData)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Text, new nsText3Tearoff(this))
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsTextNode)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Text)
NS_INTERFACE_MAP_END_INHERITING(nsGenericDOMDataNode)

View File

@ -41,7 +41,6 @@
#include "nsGenericDOMDataNode.h"
#include "nsIDOMText.h"
#include "nsIDOM3Text.h"
#include "nsContentUtils.h"
#include "nsIDOMEventListener.h"
#include "nsIDOMEventTarget.h"
@ -53,7 +52,7 @@
/**
* Class used to implement DOM text nodes
*/
class nsTextNode : public nsGenericTextNode,
class nsTextNode : public nsGenericDOMDataNode,
public nsIDOMText
{
public:

View File

@ -75,6 +75,7 @@
#include "nsIWebSocketProtocol.h"
#include "nsILoadGroup.h"
#include "nsIRequest.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
@ -902,7 +903,7 @@ nsWebSocket::CreateAndDispatchCloseEvent(PRBool aWasClean)
PRBool
nsWebSocket::PrefEnabled()
{
return nsContentUtils::GetBoolPref("network.websocket.enabled", PR_TRUE);
return Preferences::GetBool("network.websocket.enabled", PR_TRUE);
}
void

View File

@ -426,7 +426,8 @@ nsXMLHttpRequest::nsXMLHttpRequest()
mErrorLoad(PR_FALSE), mTimerIsActive(PR_FALSE),
mProgressEventWasDelayed(PR_FALSE),
mLoadLengthComputable(PR_FALSE), mLoadTotal(0),
mFirstStartRequestSeen(PR_FALSE)
mFirstStartRequestSeen(PR_FALSE),
mResultArrayBuffer(nsnull)
{
mResponseBodyUnicode.SetIsVoid(PR_TRUE);
nsLayoutStatics::AddRef();
@ -450,6 +451,12 @@ nsXMLHttpRequest::~nsXMLHttpRequest()
nsLayoutStatics::Release();
}
void
nsXMLHttpRequest::RootResultArrayBuffer()
{
nsContentUtils::PreserveWrapper(static_cast<nsPIDOMEventTarget*>(this), this);
}
/**
* This Init method is called from the factory constructor.
*/
@ -572,9 +579,9 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXMLHttpRequest,
nsIXMLHttpRequestUpload)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXMLHttpRequest,
nsXHREventTarget)
tmp->mResultArrayBuffer = nsnull;
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mChannel)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mReadRequest)
@ -592,6 +599,14 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXMLHttpRequest,
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mUpload)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(nsXMLHttpRequest,
nsXHREventTarget)
if(tmp->mResultArrayBuffer) {
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_CALLBACK(tmp->mResultArrayBuffer,
"mResultArrayBuffer")
}
NS_IMPL_CYCLE_COLLECTION_TRACE_END
DOMCI_DATA(XMLHttpRequest, nsXMLHttpRequest)
// QueryInterface implementation for nsXMLHttpRequest
@ -839,27 +854,20 @@ NS_IMETHODIMP nsXMLHttpRequest::GetResponseText(nsAString& aResponseText)
return rv;
}
nsresult nsXMLHttpRequest::GetResponseArrayBuffer(jsval *aResult)
nsresult nsXMLHttpRequest::CreateResponseArrayBuffer(JSContext *aCx)
{
JSContext *cx = nsContentUtils::GetCurrentJSContext();
if (!cx)
if (!aCx)
return NS_ERROR_FAILURE;
if (!(mState & (XML_HTTP_REQUEST_DONE |
XML_HTTP_REQUEST_LOADING))) {
*aResult = JSVAL_NULL;
return NS_OK;
}
PRInt32 dataLen = mResponseBody.Length();
JSObject *obj = js_CreateArrayBuffer(cx, dataLen);
if (!obj)
RootResultArrayBuffer();
mResultArrayBuffer = js_CreateArrayBuffer(aCx, dataLen);
if (!mResultArrayBuffer) {
return NS_ERROR_FAILURE;
*aResult = OBJECT_TO_JSVAL(obj);
}
if (dataLen > 0) {
js::ArrayBuffer *abuf = js::ArrayBuffer::fromJSObject(obj);
js::ArrayBuffer *abuf = js::ArrayBuffer::fromJSObject(mResultArrayBuffer);
NS_ASSERTION(abuf, "What happened?");
memcpy(abuf->data, mResponseBody.BeginReading(), dataLen);
}
@ -954,7 +962,11 @@ NS_IMETHODIMP nsXMLHttpRequest::GetResponse(JSContext *aCx, jsval *aResult)
case XML_HTTP_RESPONSE_TYPE_ARRAYBUFFER:
if (mState & XML_HTTP_REQUEST_DONE) {
rv = GetResponseArrayBuffer(aResult);
if (!mResultArrayBuffer) {
rv = CreateResponseArrayBuffer(aCx);
NS_ENSURE_SUCCESS(rv, rv);
}
*aResult = OBJECT_TO_JSVAL(mResultArrayBuffer);
} else {
*aResult = JSVAL_NULL;
}
@ -1073,7 +1085,8 @@ nsXMLHttpRequest::Abort()
mResponseBodyUnicode.SetIsVoid(PR_TRUE);
mResponseBlob = nsnull;
mState |= XML_HTTP_REQUEST_ABORTED;
mResultArrayBuffer = nsnull;
if (!(mState & (XML_HTTP_REQUEST_UNSENT |
XML_HTTP_REQUEST_OPENED |
XML_HTTP_REQUEST_DONE))) {

View File

@ -208,11 +208,11 @@ public:
void SetRequestObserver(nsIRequestObserver* aObserver);
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXMLHttpRequest,
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsXMLHttpRequest,
nsXHREventTarget)
PRBool AllowUploadProgress();
void RootResultArrayBuffer();
protected:
friend class nsMultipartProxyListener;
@ -224,7 +224,7 @@ protected:
PRUint32 toOffset,
PRUint32 count,
PRUint32 *writeCount);
nsresult GetResponseArrayBuffer(jsval *aResult);
nsresult CreateResponseArrayBuffer(JSContext* aCx);
void CreateResponseBlob(nsIRequest *request);
// Change the state of the object with this. The broadcast argument
// determines if the onreadystatechange listener should be called.
@ -345,6 +345,8 @@ protected:
nsCOMPtr<nsIAsyncVerifyRedirectCallback> mRedirectCallback;
nsCOMPtr<nsIChannel> mNewRedirectChannel;
JSObject* mResultArrayBuffer;
};
// helper class to expose a progress DOM Event

View File

@ -134,6 +134,16 @@ ab = xhr.response;
ok(ab != null, "should have a non-null arraybuffer");
arraybuffer_equals_to(ab, "\xaa\xee\0\x03\xff\xff\xff\xff\xbb\xbb\xbb\xbb");
// test array buffer GetResult returns the same object
xhr = new XMLHttpRequest();
xhr.open("GET", 'file_XHR_binary1.bin', false);
xhr.responseType = 'arraybuffer';
xhr.send(null)
is(xhr.status, 200, "wrong status");
checkResponseTextAccessThrows(xhr);
checkResponseXMLAccessThrows(xhr);
is(xhr.response, xhr.response, "returns the same ArrayBuffer");
// test response (responseType='blob')
var onloadCount = 0;
function checkOnloadCount() {

View File

@ -41,6 +41,9 @@
#include "nsIClassInfo.h"
#include "nsIXPCScriptable.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
DOMCI_DATA(Touch, nsDOMTouch)
@ -323,7 +326,7 @@ nsDOMTouchEvent::PrefEnabled()
static PRBool sPrefValue = PR_FALSE;
if (!sDidCheckPref) {
sDidCheckPref = PR_TRUE;
sPrefValue = nsContentUtils::GetBoolPref("dom.w3c_touch_events.enabled", PR_FALSE);
sPrefValue = Preferences::GetBool("dom.w3c_touch_events.enabled", PR_FALSE);
if (sPrefValue) {
nsContentUtils::InitializeTouchEventTable();
}

View File

@ -155,10 +155,13 @@
#include "mozAutoDocUpdate.h"
#include "nsHTMLLabelElement.h"
#include "mozilla/Preferences.h"
#ifdef XP_MACOSX
#import <ApplicationServices/ApplicationServices.h>
#endif
using namespace mozilla;
using namespace mozilla::dom;
//#define DEBUG_DOCSHELL_FOCUS
@ -326,7 +329,7 @@ GetDocumentFromWindow(nsIDOMWindow *aWindow)
static PRInt32
GetAccessModifierMaskFromPref(PRInt32 aItemType)
{
PRInt32 accessKey = nsContentUtils::GetIntPref("ui.key.generalAccessKey", -1);
PRInt32 accessKey = Preferences::GetInt("ui.key.generalAccessKey", -1);
switch (accessKey) {
case -1: break; // use the individual prefs
case nsIDOMKeyEvent::DOM_VK_SHIFT: return NS_MODIFIER_SHIFT;
@ -338,9 +341,9 @@ GetAccessModifierMaskFromPref(PRInt32 aItemType)
switch (aItemType) {
case nsIDocShellTreeItem::typeChrome:
return nsContentUtils::GetIntPref("ui.key.chromeAccess", 0);
return Preferences::GetInt("ui.key.chromeAccess", 0);
case nsIDocShellTreeItem::typeContent:
return nsContentUtils::GetIntPref("ui.key.contentAccess", 0);
return Preferences::GetInt("ui.key.contentAccess", 0);
default:
return 0;
}
@ -585,7 +588,7 @@ nsMouseWheelTransaction::OnFailToScrollTarget()
{
NS_PRECONDITION(sTargetFrame, "We don't have mouse scrolling transaction");
if (nsContentUtils::GetBoolPref("test.mousescroll", PR_FALSE)) {
if (Preferences::GetBool("test.mousescroll", PR_FALSE)) {
// This event is used for automated tests, see bug 442774.
nsContentUtils::DispatchTrustedEvent(
sTargetFrame->GetContent()->GetOwnerDoc(),
@ -613,7 +616,7 @@ nsMouseWheelTransaction::OnTimeout(nsITimer* aTimer, void* aClosure)
// the next DOM event might create strange situation for us.
EndTransaction();
if (nsContentUtils::GetBoolPref("test.mousescroll", PR_FALSE)) {
if (Preferences::GetBool("test.mousescroll", PR_FALSE)) {
// This event is used for automated tests, see bug 442774.
nsContentUtils::DispatchTrustedEvent(
frame->GetContent()->GetOwnerDoc(),
@ -652,15 +655,13 @@ nsMouseWheelTransaction::GetScreenPoint(nsGUIEvent* aEvent)
PRUint32
nsMouseWheelTransaction::GetTimeoutTime()
{
return (PRUint32)
nsContentUtils::GetIntPref("mousewheel.transaction.timeout", 1500);
return Preferences::GetUint("mousewheel.transaction.timeout", 1500);
}
PRUint32
nsMouseWheelTransaction::GetIgnoreMoveDelayTime()
{
return (PRUint32)
nsContentUtils::GetIntPref("mousewheel.transaction.ignoremovedelay", 100);
return Preferences::GetUint("mousewheel.transaction.ignoremovedelay", 100);
}
PRBool
@ -709,13 +710,13 @@ nsMouseWheelTransaction::ComputeAcceleratedWheelDelta(PRInt32 aDelta,
PRInt32
nsMouseWheelTransaction::GetAccelerationStart()
{
return nsContentUtils::GetIntPref("mousewheel.acceleration.start", -1);
return Preferences::GetInt("mousewheel.acceleration.start", -1);
}
PRInt32
nsMouseWheelTransaction::GetAccelerationFactor()
{
return nsContentUtils::GetIntPref("mousewheel.acceleration.factor", -1);
return Preferences::GetInt("mousewheel.acceleration.factor", -1);
}
PRInt32
@ -844,8 +845,8 @@ nsEventStateManager::Init()
if (prefBranch) {
if (sESMInstanceCount == 1) {
sLeftClickOnly =
nsContentUtils::GetBoolPref("nglayout.events.dispatchLeftClickOnly",
sLeftClickOnly);
Preferences::GetBool("nglayout.events.dispatchLeftClickOnly",
sLeftClickOnly);
sChromeAccessModifier =
GetAccessModifierMaskFromPref(nsIDocShellTreeItem::typeChrome);
sContentAccessModifier =
@ -876,7 +877,7 @@ nsEventStateManager::Init()
}
mClickHoldContextMenu =
nsContentUtils::GetBoolPref("ui.click_hold_context_menus", PR_FALSE);
Preferences::GetBool("ui.click_hold_context_menus", PR_FALSE);
return NS_OK;
}
@ -969,12 +970,12 @@ nsEventStateManager::Observe(nsISupports *aSubject,
nsDependentString data(someData);
if (data.EqualsLiteral("accessibility.accesskeycausesactivation")) {
sKeyCausesActivation =
nsContentUtils::GetBoolPref("accessibility.accesskeycausesactivation",
sKeyCausesActivation);
Preferences::GetBool("accessibility.accesskeycausesactivation",
sKeyCausesActivation);
} else if (data.EqualsLiteral("nglayout.events.dispatchLeftClickOnly")) {
sLeftClickOnly =
nsContentUtils::GetBoolPref("nglayout.events.dispatchLeftClickOnly",
sLeftClickOnly);
Preferences::GetBool("nglayout.events.dispatchLeftClickOnly",
sLeftClickOnly);
} else if (data.EqualsLiteral("ui.key.generalAccessKey")) {
sChromeAccessModifier =
GetAccessModifierMaskFromPref(nsIDocShellTreeItem::typeChrome);
@ -988,7 +989,7 @@ nsEventStateManager::Observe(nsISupports *aSubject,
GetAccessModifierMaskFromPref(nsIDocShellTreeItem::typeContent);
} else if (data.EqualsLiteral("ui.click_hold_context_menus")) {
mClickHoldContextMenu =
nsContentUtils::GetBoolPref("ui.click_hold_context_menus", PR_FALSE);
Preferences::GetBool("ui.click_hold_context_menus", PR_FALSE);
#if 0
} else if (data.EqualsLiteral("mousewheel.withaltkey.action")) {
} else if (data.EqualsLiteral("mousewheel.withaltkey.numlines")) {
@ -1721,7 +1722,7 @@ nsEventStateManager::CreateClickHoldTimer(nsPresContext* inPresContext,
mClickHoldTimer = do_CreateInstance("@mozilla.org/timer;1");
if (mClickHoldTimer) {
PRInt32 clickHoldDelay =
nsContentUtils::GetIntPref("ui.click_hold_context_menus.delay", 500);
Preferences::GetInt("ui.click_hold_context_menus.delay", 500);
mClickHoldTimer->InitWithFuncCallback(sClickHoldCallback, this,
clickHoldDelay,
nsITimer::TYPE_ONE_SHOT);
@ -2402,8 +2403,8 @@ nsEventStateManager::ChangeTextSize(PRInt32 change)
NS_ENSURE_SUCCESS(rv, rv);
float textzoom;
float zoomMin = ((float)nsContentUtils::GetIntPref("zoom.minPercent", 50)) / 100;
float zoomMax = ((float)nsContentUtils::GetIntPref("zoom.maxPercent", 300)) / 100;
float zoomMin = ((float)Preferences::GetInt("zoom.minPercent", 50)) / 100;
float zoomMax = ((float)Preferences::GetInt("zoom.maxPercent", 300)) / 100;
mv->GetTextZoom(&textzoom);
textzoom += ((float)change) / 10;
if (textzoom < zoomMin)
@ -2423,8 +2424,8 @@ nsEventStateManager::ChangeFullZoom(PRInt32 change)
NS_ENSURE_SUCCESS(rv, rv);
float fullzoom;
float zoomMin = ((float)nsContentUtils::GetIntPref("zoom.minPercent", 50)) / 100;
float zoomMax = ((float)nsContentUtils::GetIntPref("zoom.maxPercent", 300)) / 100;
float zoomMin = ((float)Preferences::GetInt("zoom.minPercent", 50)) / 100;
float zoomMax = ((float)Preferences::GetInt("zoom.maxPercent", 300)) / 100;
mv->GetFullZoom(&fullzoom);
fullzoom += ((float)change) / 10;
if (fullzoom < zoomMin)
@ -2465,10 +2466,11 @@ nsEventStateManager::DoScrollZoom(nsIFrame *aTargetFrame,
// positive adjustment to decrease zoom, negative to increase
PRInt32 change = (adjustment > 0) ? -1 : 1;
if (nsContentUtils::GetBoolPref("browser.zoom.full"))
if (Preferences::GetBool("browser.zoom.full")) {
ChangeFullZoom(change);
else
} else {
ChangeTextSize(change);
}
}
}
@ -2609,7 +2611,7 @@ nsEventStateManager::GetWheelActionFor(nsMouseScrollEvent* aMouseEvent)
nsCAutoString prefName;
GetBasePrefKeyForMouseWheel(aMouseEvent, prefName);
prefName.Append(".action");
return nsContentUtils::GetIntPref(prefName.get());
return Preferences::GetInt(prefName.get());
}
PRInt32
@ -2620,7 +2622,7 @@ nsEventStateManager::GetScrollLinesFor(nsMouseScrollEvent* aMouseEvent)
nsCAutoString prefName;
GetBasePrefKeyForMouseWheel(aMouseEvent, prefName);
prefName.Append(".numlines");
return nsContentUtils::GetIntPref(prefName.get());
return Preferences::GetInt(prefName.get());
}
PRBool
@ -2629,7 +2631,7 @@ nsEventStateManager::UseSystemScrollSettingFor(nsMouseScrollEvent* aMouseEvent)
nsCAutoString prefName;
GetBasePrefKeyForMouseWheel(aMouseEvent, prefName);
prefName.Append(".sysnumlines");
return nsContentUtils::GetBoolPref(prefName.get());
return Preferences::GetBool(prefName.get());
}
nsresult
@ -3468,7 +3470,7 @@ nsEventStateManager::UpdateCursor(nsPresContext* aPresContext,
hotspotY = framecursor.mHotspotY;
}
if (nsContentUtils::GetBoolPref("ui.use_activity_cursor", PR_FALSE)) {
if (Preferences::GetBool("ui.use_activity_cursor", PR_FALSE)) {
// Check whether or not to show the busy cursor
nsCOMPtr<nsISupports> pcContainer = aPresContext->GetContainer();
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(pcContainer));

View File

@ -116,6 +116,9 @@
#include "mozilla/dom/Element.h"
#include "nsHTMLFieldSetElement.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
#include "nsThreadUtils.h"
@ -896,8 +899,7 @@ nsGenericHTMLElement::GetSpellcheck(PRBool* aSpellcheck)
// NOTE: Do not reflect a pref value of 0 back to the DOM getter.
// The web page should not know if the user has disabled spellchecking.
// We'll catch this in the editor itself.
PRInt32 spellcheckLevel =
nsContentUtils::GetIntPref("layout.spellcheckDefault", 1);
PRInt32 spellcheckLevel = Preferences::GetInt("layout.spellcheckDefault", 1);
if (spellcheckLevel == 2) { // "Spellcheck multi- and single-line"
*aSpellcheck = PR_TRUE; // Spellchecked by default
}
@ -2545,7 +2547,7 @@ nsGenericHTMLFormElement::BindToTree(nsIDocument* aDocument,
// the document should not be already loaded and the "browser.autofocus"
// preference should be 'true'.
if (IsAutofocusable() && HasAttr(kNameSpaceID_None, nsGkAtoms::autofocus) &&
nsContentUtils::GetBoolPref("browser.autofocus", PR_TRUE)) {
Preferences::GetBool("browser.autofocus", PR_TRUE)) {
nsCOMPtr<nsIRunnable> event = new nsAutoFocusEvent(this);
rv = NS_DispatchToCurrentThread(event);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -62,6 +62,9 @@
#include "nsIObserverService.h"
#include "mozilla/dom/Link.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::net;
@ -99,7 +102,7 @@ nsHTMLDNSPrefetch::Initialize()
// Default is false, so we need an explicit call to prime the cache.
sDisablePrefetchHTTPSPref =
nsContentUtils::GetBoolPref("network.dns.disablePrefetchFromHTTPS", PR_TRUE);
Preferences::GetBool("network.dns.disablePrefetchFromHTTPS", PR_TRUE);
NS_IF_RELEASE(sDNSService);
nsresult rv;

View File

@ -75,7 +75,9 @@
#include "nsEventDispatcher.h"
#include "nsLayoutUtils.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
// XXX nav attrs: suppress
@ -500,7 +502,7 @@ nsHTMLImageElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
// If caller is not chrome and dom.disable_image_src_set is true,
// prevent setting image.src by exiting early
if (nsContentUtils::GetBoolPref("dom.disable_image_src_set") &&
if (Preferences::GetBool("dom.disable_image_src_set") &&
!nsContentUtils::IsCallerChrome()) {
return NS_OK;
}

View File

@ -119,6 +119,9 @@ static PRLogModuleInfo* gMediaElementEventsLog;
#include "nsIChannelPolicy.h"
#include "nsChannelPolicy.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
@ -838,7 +841,7 @@ void nsHTMLMediaElement::ResumeLoad(PreloadAction aAction)
static PRBool IsAutoplayEnabled()
{
return nsContentUtils::GetBoolPref("media.autoplay.enabled");
return Preferences::GetBool("media.autoplay.enabled");
}
void nsHTMLMediaElement::UpdatePreloadAction()
@ -854,10 +857,12 @@ void nsHTMLMediaElement::UpdatePreloadAction()
// Find the appropriate preload action by looking at the attribute.
const nsAttrValue* val = mAttrsAndChildren.GetAttr(nsGkAtoms::preload,
kNameSpaceID_None);
PRUint32 preloadDefault = nsContentUtils::GetIntPref("media.preload.default",
nsHTMLMediaElement::PRELOAD_ATTR_METADATA);
PRUint32 preloadAuto = nsContentUtils::GetIntPref("media.preload.auto",
nsHTMLMediaElement::PRELOAD_ENOUGH);
PRUint32 preloadDefault =
Preferences::GetInt("media.preload.default",
nsHTMLMediaElement::PRELOAD_ATTR_METADATA);
PRUint32 preloadAuto =
Preferences::GetInt("media.preload.auto",
nsHTMLMediaElement::PRELOAD_ENOUGH);
if (!val) {
// Attribute is not set. Use the preload action specified by the
// media.preload.default pref, or just preload metadata if not present.
@ -1536,7 +1541,7 @@ static const char* gRawCodecs[] = {
static PRBool IsRawEnabled()
{
return nsContentUtils::GetBoolPref("media.raw.enabled");
return Preferences::GetBool("media.raw.enabled");
}
static PRBool IsRawType(const nsACString& aType)
@ -1568,7 +1573,7 @@ char const *const nsHTMLMediaElement::gOggCodecs[3] = {
bool
nsHTMLMediaElement::IsOggEnabled()
{
return nsContentUtils::GetBoolPref("media.ogg.enabled");
return Preferences::GetBool("media.ogg.enabled");
}
bool
@ -1603,7 +1608,7 @@ char const *const nsHTMLMediaElement::gWaveCodecs[2] = {
bool
nsHTMLMediaElement::IsWaveEnabled()
{
return nsContentUtils::GetBoolPref("media.wave.enabled");
return Preferences::GetBool("media.wave.enabled");
}
bool
@ -1635,7 +1640,7 @@ char const *const nsHTMLMediaElement::gWebMCodecs[4] = {
bool
nsHTMLMediaElement::IsWebMEnabled()
{
return nsContentUtils::GetBoolPref("media.webm.enabled");
return Preferences::GetBool("media.webm.enabled");
}
bool
@ -2083,8 +2088,7 @@ void nsHTMLMediaElement::DownloadStalled()
PRBool nsHTMLMediaElement::ShouldCheckAllowOrigin()
{
return nsContentUtils::GetBoolPref("media.enforce_same_site_origin",
PR_TRUE);
return Preferences::GetBool("media.enforce_same_site_origin", PR_TRUE);
}
void nsHTMLMediaElement::UpdateReadyStateForData(NextFrameStatus aNextFrame)

View File

@ -63,6 +63,7 @@
#include "nsNodeUtils.h"
#include "nsIContent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
#include "nsGenericHTMLElement.h"
@ -122,6 +123,7 @@
#include "nsContentCreatorFunctions.h"
#include "mozAutoDocUpdate.h"
using namespace mozilla;
using namespace mozilla::dom;
#ifdef NS_DEBUG
@ -1597,7 +1599,7 @@ HTMLContentSink::Init(nsIDocument* aDoc,
// Changed from 8192 to greatly improve page loading performance on
// large pages. See bugzilla bug 77540.
mMaxTextRun = nsContentUtils::GetIntPref("content.maxtextrun", 8191);
mMaxTextRun = Preferences::GetInt("content.maxtextrun", 8191);
nsCOMPtr<nsINodeInfo> nodeInfo;
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::html, nsnull,

View File

@ -74,7 +74,9 @@
#include "nsThreadUtils.h"
#include "nsIScrollableFrame.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
#define AUTOMATIC_IMAGE_RESIZING_PREF "browser.enable_automatic_image_resizing"
@ -288,10 +290,8 @@ nsImageDocument::Init()
nsresult rv = nsMediaDocument::Init();
NS_ENSURE_SUCCESS(rv, rv);
mResizeImageByDefault =
nsContentUtils::GetBoolPref(AUTOMATIC_IMAGE_RESIZING_PREF);
mClickResizingEnabled =
nsContentUtils::GetBoolPref(CLICK_IMAGE_RESIZING_PREF);
mResizeImageByDefault = Preferences::GetBool(AUTOMATIC_IMAGE_RESIZING_PREF);
mClickResizingEnabled = Preferences::GetBool(CLICK_IMAGE_RESIZING_PREF);
mShouldResize = mResizeImageByDefault;
mFirstResize = PR_TRUE;
@ -316,8 +316,7 @@ nsImageDocument::StartDocumentLoad(const char* aCommand,
}
mOriginalZoomLevel =
nsContentUtils::GetBoolPref(SITE_SPECIFIC_ZOOM, PR_FALSE) ?
1.0 : GetZoomLevel();
Preferences::GetBool(SITE_SPECIFIC_ZOOM, PR_FALSE) ? 1.0 : GetZoomLevel();
NS_ASSERTION(aDocListener, "null aDocListener");
*aDocListener = new ImageListener(this);
@ -398,8 +397,7 @@ nsImageDocument::OnPageShow(PRBool aPersisted,
{
if (aPersisted) {
mOriginalZoomLevel =
nsContentUtils::GetBoolPref(SITE_SPECIFIC_ZOOM, PR_FALSE) ?
1.0 : GetZoomLevel();
Preferences::GetBool(SITE_SPECIFIC_ZOOM, PR_FALSE) ? 1.0 : GetZoomLevel();
}
nsMediaDocument::OnPageShow(aPersisted, aDispatchStartTarget);
}

View File

@ -40,7 +40,6 @@
#include "mozilla/XPCOM.h"
#include "nsMediaCache.h"
#include "nsContentUtils.h"
#include "nsDirectoryServiceUtils.h"
#include "nsDirectoryServiceDefs.h"
#include "nsNetUtil.h"
@ -50,6 +49,7 @@
#include "nsMathUtils.h"
#include "prlog.h"
#include "nsIPrivateBrowsingService.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
@ -739,7 +739,7 @@ static PRInt32 GetMaxBlocks()
// We look up the cache size every time. This means dynamic changes
// to the pref are applied.
// Cache size is in KB
PRInt32 cacheSize = nsContentUtils::GetIntPref("media.cache_size", 500*1024);
PRInt32 cacheSize = Preferences::GetInt("media.cache_size", 500*1024);
PRInt64 maxBlocks = static_cast<PRInt64>(cacheSize)*1024/nsMediaCache::BLOCK_SIZE;
maxBlocks = PR_MAX(maxBlocks, 1);
return PRInt32(PR_MIN(maxBlocks, PR_INT32_MAX));

View File

@ -43,6 +43,7 @@
#include "imgIContainer.h"
#include "imgIDecoderObserver.h"
#include "gfxContext.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
@ -170,7 +171,7 @@ nsSVGImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
// If caller is not chrome and dom.disable_image_src_set is true,
// prevent setting image.src by exiting early
if (nsContentUtils::GetBoolPref("dom.disable_image_src_set") &&
if (Preferences::GetBool("dom.disable_image_src_set") &&
!nsContentUtils::IsCallerChrome()) {
return NS_OK;
}

View File

@ -80,6 +80,9 @@
#include "nsCRT.h"
#include "nsXBLEventHandler.h"
#include "nsEventDispatcher.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID,
NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
@ -206,8 +209,8 @@ nsXBLPrototypeHandler::InitAccessKeys()
// Get the menu access key value from prefs, overriding the default:
kMenuAccessKey =
nsContentUtils::GetIntPref("ui.key.menuAccessKey", kMenuAccessKey);
kAccelKey = nsContentUtils::GetIntPref("ui.key.accelKey", kAccelKey);
Preferences::GetInt("ui.key.menuAccessKey", kMenuAccessKey);
kAccelKey = Preferences::GetInt("ui.key.accelKey", kAccelKey);
}
nsresult

View File

@ -36,14 +36,13 @@
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMCDATASection.h"
#include "nsIDOM3Text.h"
#include "nsGenericDOMDataNode.h"
#include "nsGkAtoms.h"
#include "nsIDocument.h"
#include "nsContentUtils.h"
class nsXMLCDATASection : public nsGenericTextNode,
class nsXMLCDATASection : public nsGenericDOMDataNode,
public nsIDOMCDATASection
{
public:
@ -99,7 +98,7 @@ NS_NewXMLCDATASection(nsIContent** aInstancePtrResult,
}
nsXMLCDATASection::nsXMLCDATASection(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericTextNode(aNodeInfo)
: nsGenericDOMDataNode(aNodeInfo)
{
}
@ -114,7 +113,6 @@ DOMCI_NODE_DATA(CDATASection, nsXMLCDATASection)
NS_INTERFACE_TABLE_HEAD(nsXMLCDATASection)
NS_NODE_INTERFACE_TABLE4(nsXMLCDATASection, nsIDOMNode, nsIDOMCharacterData,
nsIDOMText, nsIDOMCDATASection)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Text, new nsText3Tearoff(this))
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CDATASection)
NS_INTERFACE_MAP_END_INHERITING(nsGenericDOMDataNode)

View File

@ -52,7 +52,9 @@
#include "nsIDOMDocumentFragment.h"
#include "nsBindingManager.h"
#include "nsIScriptSecurityManager.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
NS_IMPL_ISUPPORTS2(nsXMLPrettyPrinter,
@ -114,7 +116,7 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocument* aDocument,
}
// check the pref
if (!nsContentUtils::GetBoolPref("layout.xml.prettyprint", PR_TRUE)) {
if (!Preferences::GetBool("layout.xml.prettyprint", PR_TRUE)) {
return NS_OK;
}

View File

@ -70,6 +70,7 @@
#include "nsFrameManager.h"
#include "nsHTMLReflowState.h"
#include "nsIObjectLoadingContent.h"
#include "mozilla/Preferences.h"
// for event firing in context menus
#include "nsPresContext.h"
@ -80,6 +81,8 @@
#include "nsDOMError.h"
#include "nsIMenuFrame.h"
using namespace mozilla;
// on win32 and os/2, context menus come up on mouse up. On other platforms,
// they appear on mouse down. Certain bits of code care about this difference.
#if !defined(XP_WIN) && !defined(XP_OS2)
@ -175,7 +178,7 @@ nsXULPopupListener::PreLaunchPopup(nsIDOMEvent* aMouseEvent)
// Someone called preventDefault on a context menu.
// Let's make sure they are allowed to do so.
PRBool eventEnabled =
nsContentUtils::GetBoolPref("dom.event.contextmenu.enabled", PR_TRUE);
Preferences::GetBool("dom.event.contextmenu.enabled", PR_TRUE);
if (!eventEnabled) {
// If the target node is for plug-in, we should not open XUL context
// menu on windowless plug-ins.

View File

@ -63,6 +63,10 @@
#include "jsxdrapi.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
static NS_DEFINE_CID(kXULPrototypeCacheCID, NS_XULPROTOTYPECACHE_CID);
static PRBool gDisableXULCache = PR_FALSE; // enabled by default
@ -74,7 +78,7 @@ static int
DisableXULCacheChangedCallback(const char* aPref, void* aClosure)
{
gDisableXULCache =
nsContentUtils::GetBoolPref(kDisableXULCachePref, gDisableXULCache);
Preferences::GetBool(kDisableXULCachePref, gDisableXULCache);
// Flush the cache, regardless
nsXULPrototypeCache* cache = nsXULPrototypeCache::GetInstance();
@ -132,7 +136,7 @@ NS_NewXULPrototypeCache(nsISupports* aOuter, REFNSIID aIID, void** aResult)
// XXX Ignore return values.
gDisableXULCache =
nsContentUtils::GetBoolPref(kDisableXULCachePref, gDisableXULCache);
Preferences::GetBool(kDisableXULCachePref, gDisableXULCache);
nsContentUtils::RegisterPrefCallback(kDisableXULCachePref,
DisableXULCacheChangedCallback,
nsnull);
@ -596,8 +600,7 @@ FastLoadPrefChangedCallback(const char* aPref, void* aClosure)
{
PRBool wasEnabled = !gDisableXULFastLoad;
gDisableXULFastLoad =
nsContentUtils::GetBoolPref(kDisableXULFastLoadPref,
gDisableXULFastLoad);
Preferences::GetBool(kDisableXULFastLoadPref, gDisableXULFastLoad);
if (wasEnabled && gDisableXULFastLoad) {
static NS_DEFINE_CID(kXULPrototypeCacheCID, NS_XULPROTOTYPECACHE_CID);
@ -609,8 +612,8 @@ FastLoadPrefChangedCallback(const char* aPref, void* aClosure)
}
gChecksumXULFastLoadFile =
nsContentUtils::GetBoolPref(kChecksumXULFastLoadFilePref,
gChecksumXULFastLoadFile);
Preferences::GetBool(kChecksumXULFastLoadFilePref,
gChecksumXULFastLoadFile);
return 0;
}
@ -725,11 +728,10 @@ nsXULPrototypeCache::StartFastLoad(nsIURI* aURI)
return NS_ERROR_FAILURE;
gDisableXULFastLoad =
nsContentUtils::GetBoolPref(kDisableXULFastLoadPref,
gDisableXULFastLoad);
Preferences::GetBool(kDisableXULFastLoadPref, gDisableXULFastLoad);
gChecksumXULFastLoadFile =
nsContentUtils::GetBoolPref(kChecksumXULFastLoadFilePref,
gChecksumXULFastLoadFile);
Preferences::GetBool(kChecksumXULFastLoadFilePref,
gChecksumXULFastLoadFile);
nsContentUtils::RegisterPrefCallback(kDisableXULFastLoadPref,
FastLoadPrefChangedCallback,
nsnull);

View File

@ -93,6 +93,7 @@
#include "nsContentUtils.h"
#include "nsDOMWindowUtils.h"
#include "nsIDOMGlobalPropertyInitializer.h"
#include "mozilla/Preferences.h"
// Window scriptable helper includes
#include "nsIDocShell.h"
@ -224,7 +225,6 @@
#include "nsIDOMDocumentFragment.h"
#include "nsDOMAttribute.h"
#include "nsIDOMText.h"
#include "nsIDOM3Text.h"
#include "nsIDOMComment.h"
#include "nsIDOMCDATASection.h"
#include "nsIDOMProcessingInstruction.h"
@ -517,6 +517,7 @@
#include "nsDOMTouchEvent.h"
#include "nsIDOMCustomEvent.h"
using namespace mozilla;
using namespace mozilla::dom;
static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
@ -2547,7 +2548,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Text)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(Comment, nsIDOMComment)
@ -2562,7 +2562,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Text)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(ProcessingInstruction, nsIDOMProcessingInstruction)
@ -4435,10 +4434,10 @@ nsDOMClassInfo::Init()
RegisterExternalClasses();
sDisableDocumentAllSupport =
nsContentUtils::GetBoolPref("browser.dom.document.all.disabled");
Preferences::GetBool("browser.dom.document.all.disabled");
sDisableGlobalScopePollutionSupport =
nsContentUtils::GetBoolPref("browser.dom.global_scope_pollution.disabled");
Preferences::GetBool("browser.dom.global_scope_pollution.disabled");
sIsInitialized = PR_TRUE;

View File

@ -80,13 +80,12 @@ DOMCI_CASTABLE_INTERFACE(nsIContent, nsIContent, 1, _extra) \
DOMCI_CASTABLE_INTERFACE(nsIDocument, nsIDocument, 2, _extra) \
DOMCI_CASTABLE_INTERFACE(nsINodeList, nsINodeList, 3, _extra) \
DOMCI_CASTABLE_INTERFACE(nsICSSDeclaration, nsICSSDeclaration, 4, _extra) \
DOMCI_CASTABLE_INTERFACE(nsGenericTextNode, nsGenericTextNode, 5, _extra) \
DOMCI_CASTABLE_INTERFACE(nsDocument, nsIDocument, 6, _extra) \
DOMCI_CASTABLE_INTERFACE(nsGenericHTMLElement, nsGenericHTMLElement, 7, \
DOMCI_CASTABLE_INTERFACE(nsDocument, nsIDocument, 5, _extra) \
DOMCI_CASTABLE_INTERFACE(nsGenericHTMLElement, nsGenericHTMLElement, 6, \
_extra) \
DOMCI_CASTABLE_INTERFACE(nsHTMLDocument, nsIDocument, 8, _extra) \
DOMCI_CASTABLE_INTERFACE(nsStyledElement, nsStyledElement, 9, _extra) \
DOMCI_CASTABLE_INTERFACE(nsSVGStylableElement, nsIContent, 10, _extra)
DOMCI_CASTABLE_INTERFACE(nsHTMLDocument, nsIDocument, 7, _extra) \
DOMCI_CASTABLE_INTERFACE(nsStyledElement, nsStyledElement, 8, _extra) \
DOMCI_CASTABLE_INTERFACE(nsSVGStylableElement, nsIContent, 9, _extra)
// Make sure all classes mentioned in DOMCI_CASTABLE_INTERFACES
// have been declared.

View File

@ -85,12 +85,14 @@
#include "nsIPrincipal.h"
#include "mozilla/dom/Element.h"
#include "mozAutoDocUpdate.h"
#include "mozilla/Preferences.h"
#ifdef MOZ_XUL
#include "nsIDOMXULTextboxElement.h"
#include "nsIDOMXULMenuListElement.h"
#endif
using namespace mozilla;
using namespace mozilla::dom;
//#define DEBUG_FOCUS 1
@ -188,11 +190,11 @@ nsFocusManager::Init()
sInstance = fm;
nsIContent::sTabFocusModelAppliesToXUL =
nsContentUtils::GetBoolPref("accessibility.tabfocus_applies_to_xul",
nsIContent::sTabFocusModelAppliesToXUL);
Preferences::GetBool("accessibility.tabfocus_applies_to_xul",
nsIContent::sTabFocusModelAppliesToXUL);
sMouseFocusesFormControl =
nsContentUtils::GetBoolPref("accessibility.mouse_focuses_formcontrol", PR_FALSE);
Preferences::GetBool("accessibility.mouse_focuses_formcontrol", PR_FALSE);
nsIPrefBranch2* prefBranch = nsContentUtils::GetPrefBranch();
if (prefBranch) {
@ -228,12 +230,13 @@ nsFocusManager::Observe(nsISupports *aSubject,
}
else if (data.EqualsLiteral("accessibility.tabfocus_applies_to_xul")) {
nsIContent::sTabFocusModelAppliesToXUL =
nsContentUtils::GetBoolPref("accessibility.tabfocus_applies_to_xul",
nsIContent::sTabFocusModelAppliesToXUL);
Preferences::GetBool("accessibility.tabfocus_applies_to_xul",
nsIContent::sTabFocusModelAppliesToXUL);
}
else if (data.EqualsLiteral("accessibility.mouse_focuses_formcontrol")) {
sMouseFocusesFormControl =
nsContentUtils::GetBoolPref("accessibility.mouse_focuses_formcontrol", PR_FALSE);
Preferences::GetBool("accessibility.mouse_focuses_formcontrol",
PR_FALSE);
}
} else if (!nsCRT::strcmp(aTopic, "xpcom-shutdown")) {
mActiveWindow = nsnull;
@ -1955,7 +1958,7 @@ nsFocusManager::UpdateCaret(PRBool aMoveCaretToFocus,
return; // Never browse with caret in chrome
PRPackedBool browseWithCaret =
nsContentUtils::GetBoolPref("accessibility.browsewithcaret");
Preferences::GetBool("accessibility.browsewithcaret");
nsCOMPtr<nsIPresShell> presShell;
focusedDocShell->GetPresShell(getter_AddRefs(presShell));

View File

@ -69,6 +69,7 @@
#include "nsJSEnvironment.h"
#include "nsCharSeparatedTokenizer.h" // for Accept-Language parsing
#include "nsUnicharUtils.h"
#include "mozilla/Preferences.h"
// Other Classes
#include "nsIEventListenerManager.h"
@ -244,6 +245,7 @@ static PRLogModuleInfo* gDOMLeakPRLog;
static const char kStorageEnabled[] = "dom.storage.enabled";
using namespace mozilla;
using namespace mozilla::dom;
using mozilla::TimeStamp;
using mozilla::TimeDuration;
@ -2578,8 +2580,8 @@ nsGlobalWindow::DialogOpenAttempted()
topWindow->mLastDialogQuitTime);
if (dialogDuration.ToSeconds() <
nsContentUtils::GetIntPref("dom.successive_dialog_time_limit",
SUCCESSIVE_DIALOG_TIME_LIMIT)) {
Preferences::GetInt("dom.successive_dialog_time_limit",
SUCCESSIVE_DIALOG_TIME_LIMIT)) {
topWindow->mDialogAbuseCount++;
return (topWindow->GetPopupControlState() > openAllowed ||
@ -5077,7 +5079,7 @@ nsGlobalWindow::Print()
nsCOMPtr<nsIPrintSettings> printSettings;
if (printSettingsService) {
PRBool printSettingsAreGlobal =
nsContentUtils::GetBoolPref("print.use_global_printsettings", PR_FALSE);
Preferences::GetBool("print.use_global_printsettings", PR_FALSE);
if (printSettingsAreGlobal) {
printSettingsService->GetGlobalPrintSettings(getter_AddRefs(printSettings));
@ -5101,7 +5103,7 @@ nsGlobalWindow::Print()
LeaveModalState(callerWin);
PRBool savePrintSettings =
nsContentUtils::GetBoolPref("print.save_print_settings", PR_FALSE);
Preferences::GetBool("print.save_print_settings", PR_FALSE);
if (printSettingsAreGlobal && savePrintSettings) {
printSettingsService->
SavePrintSettingsToPrefs(printSettings,
@ -5551,7 +5553,7 @@ nsGlobalWindow::CanSetProperty(const char *aPrefName)
// If the pref is set to true, we can not set the property
// and vice versa.
return !nsContentUtils::GetBoolPref(aPrefName, PR_TRUE);
return !Preferences::GetBool(aPrefName, PR_TRUE);
}
PRBool
@ -5609,7 +5611,7 @@ nsGlobalWindow::RevisePopupAbuseLevel(PopupControlState aControl)
// limit the number of simultaneously open popups
if (abuse == openAbused || abuse == openControlled) {
PRInt32 popupMax = nsContentUtils::GetIntPref("dom.popup_maximum", -1);
PRInt32 popupMax = Preferences::GetInt("dom.popup_maximum", -1);
if (popupMax >= 0 && gOpenPopupSpamCount >= popupMax)
abuse = openOverridden;
}
@ -6187,8 +6189,7 @@ nsGlobalWindow::Close()
// that were not opened by script
if (!mHadOriginalOpener && !nsContentUtils::IsCallerTrustedForWrite()) {
PRBool allowClose =
nsContentUtils::GetBoolPref("dom.allow_scripts_to_close_windows",
PR_TRUE);
Preferences::GetBool("dom.allow_scripts_to_close_windows", PR_TRUE);
if (!allowClose) {
// We're blocking the close operation
// report localized error msg in JS console
@ -7844,8 +7845,9 @@ nsGlobalWindow::DispatchSyncPopState()
"Must be safe to run script here.");
// Check that PopState hasn't been pref'ed off.
if (!nsContentUtils::GetBoolPref(sPopStatePrefStr, PR_FALSE))
if (!Preferences::GetBool(sPopStatePrefStr, PR_FALSE)) {
return NS_OK;
}
nsresult rv = NS_OK;
@ -8022,7 +8024,7 @@ nsGlobalWindow::GetSessionStorage(nsIDOMStorage ** aSessionStorage)
return NS_OK;
}
if (!nsContentUtils::GetBoolPref(kStorageEnabled)) {
if (!Preferences::GetBool(kStorageEnabled)) {
*aSessionStorage = nsnull;
return NS_OK;
}
@ -8086,7 +8088,7 @@ nsGlobalWindow::GetGlobalStorage(nsIDOMStorageList ** aGlobalStorage)
NS_ENSURE_ARG_POINTER(aGlobalStorage);
#ifdef MOZ_STORAGE
if (!nsContentUtils::GetBoolPref(kStorageEnabled)) {
if (!Preferences::GetBool(kStorageEnabled)) {
*aGlobalStorage = nsnull;
return NS_OK;
}
@ -8112,7 +8114,7 @@ nsGlobalWindow::GetLocalStorage(nsIDOMStorage ** aLocalStorage)
NS_ENSURE_ARG(aLocalStorage);
if (!nsContentUtils::GetBoolPref(kStorageEnabled)) {
if (!Preferences::GetBool(kStorageEnabled)) {
*aLocalStorage = nsnull;
return NS_OK;
}
@ -8954,7 +8956,7 @@ nsGlobalWindow::SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler,
// "dom.disable_open_click_delay" is set to (in ms).
PRInt32 delay =
nsContentUtils::GetIntPref("dom.disable_open_click_delay");
Preferences::GetInt("dom.disable_open_click_delay");
// This is checking |interval|, not realInterval, on purpose,
// because our lower bound for |realInterval| could be pretty high
@ -10067,6 +10069,13 @@ nsGlobalWindow::GetURL(nsIDOMMozURLProperty** aURL)
return NS_OK;
}
// static
bool
nsGlobalWindow::HasIndexedDBSupport()
{
return Preferences::GetBool("indexedDB.feature.enabled", PR_TRUE);
}
// nsGlobalChromeWindow implementation
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGlobalChromeWindow)
@ -10850,9 +10859,8 @@ NS_IMETHODIMP
nsNavigator::GetCookieEnabled(PRBool *aCookieEnabled)
{
*aCookieEnabled =
(nsContentUtils::GetIntPref("network.cookie.cookieBehavior",
COOKIE_BEHAVIOR_REJECT) !=
COOKIE_BEHAVIOR_REJECT);
(Preferences::GetInt("network.cookie.cookieBehavior",
COOKIE_BEHAVIOR_REJECT) != COOKIE_BEHAVIOR_REJECT);
return NS_OK;
}
@ -10975,7 +10983,7 @@ nsNavigator::RefreshMIMEArray()
bool
nsNavigator::HasDesktopNotificationSupport()
{
return nsContentUtils::GetBoolPref("notification.feature.enabled", PR_FALSE);
return Preferences::GetBool("notification.feature.enabled", PR_FALSE);
}
//*****************************************************************************

View File

@ -109,7 +109,6 @@
#include "nsIIDBFactory.h"
#include "nsFrameMessageManager.h"
#include "mozilla/TimeStamp.h"
#include "nsContentUtils.h"
// JS includes
#include "jsapi.h"
@ -568,9 +567,7 @@ public:
return sOuterWindowsById ? sOuterWindowsById->Get(aWindowID) : nsnull;
}
static bool HasIndexedDBSupport() {
return nsContentUtils::GetBoolPref("indexedDB.feature.enabled", PR_TRUE);
}
static bool HasIndexedDBSupport();
private:
// Enable updates for the accelerometer.

View File

@ -44,7 +44,7 @@
#include "nsIInterfaceRequestorUtils.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
#include "nsIControllerCommandTable.h"
#include "nsICommandParams.h"
@ -64,6 +64,8 @@
#include "nsIClipboardDragDropHooks.h"
#include "nsIClipboardDragDropHookList.h"
using namespace mozilla;
const char * const sSelectAllString = "cmd_selectAll";
const char * const sSelectNoneString = "cmd_selectNone";
const char * const sCopyImageLocationString = "cmd_copyImageLocation";
@ -246,7 +248,7 @@ nsSelectMoveScrollCommand::DoSelectCommand(const char *aCommandName, nsIDOMWindo
PRBool caretOn = PR_FALSE;
selCont->GetCaretEnabled(&caretOn);
if (!caretOn) {
caretOn = nsContentUtils::GetBoolPref("accessibility.browsewithcaret");
caretOn = Preferences::GetBool("accessibility.browsewithcaret");
if (caretOn) {
nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(aWindow);
if (piWindow) {

View File

@ -60,6 +60,9 @@
#include "nsContentUtils.h"
#include "nsIDOMNSDocument.h"
#include "nsISHistoryInternal.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
static const char* sAllowPushStatePrefStr =
"browser.history.allowPushState";
@ -287,8 +290,9 @@ nsHistory::PushState(nsIVariant *aData, const nsAString& aTitle,
const nsAString& aURL, JSContext* aCx)
{
// Check that PushState hasn't been pref'ed off.
if (!nsContentUtils::GetBoolPref(sAllowPushStatePrefStr, PR_FALSE))
if (!Preferences::GetBool(sAllowPushStatePrefStr, PR_FALSE)) {
return NS_OK;
}
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mInnerWindow));
if (!win)
@ -316,8 +320,9 @@ nsHistory::ReplaceState(nsIVariant *aData, const nsAString& aTitle,
const nsAString& aURL, JSContext* aCx)
{
// Check that ReplaceState hasn't been pref'ed off
if (!nsContentUtils::GetBoolPref(sAllowReplaceStatePrefStr, PR_FALSE))
if (!Preferences::GetBool(sAllowReplaceStatePrefStr, PR_FALSE)) {
return NS_OK;
}
nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mInnerWindow));
if (!win)

View File

@ -116,6 +116,7 @@
#include "prthread.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
@ -926,9 +927,9 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
PRUint32 oldDefaultJSOptions = context->mDefaultJSOptions;
PRUint32 newDefaultJSOptions = oldDefaultJSOptions;
sPostGCEventsToConsole = nsContentUtils::GetBoolPref(js_memlog_option_str);
sPostGCEventsToConsole = Preferences::GetBool(js_memlog_option_str);
PRBool strict = nsContentUtils::GetBoolPref(js_strict_option_str);
PRBool strict = Preferences::GetBool(js_strict_option_str);
if (strict)
newDefaultJSOptions |= JSOPTION_STRICT;
else
@ -939,16 +940,16 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
// XXX components be covered by the chrome pref instead of the content one?
nsCOMPtr<nsIDOMChromeWindow> chromeWindow(do_QueryInterface(global));
PRBool useTraceJIT = nsContentUtils::GetBoolPref(chromeWindow ?
js_tracejit_chrome_str :
js_tracejit_content_str);
PRBool useMethodJIT = nsContentUtils::GetBoolPref(chromeWindow ?
js_methodjit_chrome_str :
js_methodjit_content_str);
PRBool useProfiling = nsContentUtils::GetBoolPref(chromeWindow ?
js_profiling_chrome_str :
js_profiling_content_str);
PRBool useMethodJITAlways = nsContentUtils::GetBoolPref(js_methodjit_always_str);
PRBool useTraceJIT = Preferences::GetBool(chromeWindow ?
js_tracejit_chrome_str :
js_tracejit_content_str);
PRBool useMethodJIT = Preferences::GetBool(chromeWindow ?
js_methodjit_chrome_str :
js_methodjit_content_str);
PRBool useProfiling = Preferences::GetBool(chromeWindow ?
js_profiling_chrome_str :
js_profiling_content_str);
PRBool useMethodJITAlways = Preferences::GetBool(js_methodjit_always_str);
nsCOMPtr<nsIXULRuntime> xr = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
if (xr) {
PRBool safeMode = PR_FALSE;
@ -984,7 +985,7 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
#ifdef DEBUG
// In debug builds, warnings are enabled in chrome context if
// javascript.options.strict.debug is true
PRBool strictDebug = nsContentUtils::GetBoolPref(js_strict_debug_option_str);
PRBool strictDebug = Preferences::GetBool(js_strict_debug_option_str);
// Note this callback is also called from context's InitClasses thus we don't
// need to enable this directly from InitContext
if (strictDebug && (newDefaultJSOptions & JSOPTION_STRICT) == 0) {
@ -993,13 +994,13 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
}
#endif
PRBool werror = nsContentUtils::GetBoolPref(js_werror_option_str);
PRBool werror = Preferences::GetBool(js_werror_option_str);
if (werror)
newDefaultJSOptions |= JSOPTION_WERROR;
else
newDefaultJSOptions &= ~JSOPTION_WERROR;
PRBool relimit = nsContentUtils::GetBoolPref(js_relimit_option_str);
PRBool relimit = Preferences::GetBool(js_relimit_option_str);
if (relimit)
newDefaultJSOptions |= JSOPTION_RELIMIT;
else
@ -1011,7 +1012,7 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
context->mDefaultJSOptions = newDefaultJSOptions;
#ifdef JS_GC_ZEAL
PRInt32 zeal = nsContentUtils::GetIntPref(js_zeal_option_str, -1);
PRInt32 zeal = Preferences::GetInt(js_zeal_option_str, -1);
if (zeal >= 0)
::JS_SetGCZeal(context->mContext, (PRUint8)zeal);
#endif
@ -3607,7 +3608,7 @@ MaxScriptRunTimePrefChangedCallback(const char *aPrefName, void *aClosure)
// scripts run forever.
PRBool isChromePref =
strcmp(aPrefName, "dom.max_chrome_script_run_time") == 0;
PRInt32 time = nsContentUtils::GetIntPref(aPrefName, isChromePref ? 20 : 10);
PRInt32 time = Preferences::GetInt(aPrefName, isChromePref ? 20 : 10);
PRTime t;
if (time <= 0) {
@ -3629,7 +3630,7 @@ MaxScriptRunTimePrefChangedCallback(const char *aPrefName, void *aClosure)
static int
ReportAllJSExceptionsPrefChangedCallback(const char* aPrefName, void* aClosure)
{
PRBool reportAll = nsContentUtils::GetBoolPref(aPrefName, PR_FALSE);
PRBool reportAll = Preferences::GetBool(aPrefName, PR_FALSE);
nsContentUtils::XPConnect()->SetReportAllJSExceptions(reportAll);
return 0;
}
@ -3637,7 +3638,7 @@ ReportAllJSExceptionsPrefChangedCallback(const char* aPrefName, void* aClosure)
static int
SetMemoryHighWaterMarkPrefChangedCallback(const char* aPrefName, void* aClosure)
{
PRInt32 highwatermark = nsContentUtils::GetIntPref(aPrefName, 128);
PRInt32 highwatermark = Preferences::GetInt(aPrefName, 128);
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MAX_MALLOC_BYTES,
highwatermark * 1024L * 1024L);
@ -3647,7 +3648,7 @@ SetMemoryHighWaterMarkPrefChangedCallback(const char* aPrefName, void* aClosure)
static int
SetMemoryMaxPrefChangedCallback(const char* aPrefName, void* aClosure)
{
PRInt32 pref = nsContentUtils::GetIntPref(aPrefName, -1);
PRInt32 pref = Preferences::GetInt(aPrefName, -1);
// handle overflow and negative pref values
PRUint32 max = (pref <= 0 || pref >= 0x1000) ? -1 : (PRUint32)pref * 1024 * 1024;
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MAX_BYTES, max);
@ -3657,7 +3658,7 @@ SetMemoryMaxPrefChangedCallback(const char* aPrefName, void* aClosure)
static int
SetMemoryGCModePrefChangedCallback(const char* aPrefName, void* aClosure)
{
PRBool enableCompartmentGC = nsContentUtils::GetBoolPref(aPrefName);
PRBool enableCompartmentGC = Preferences::GetBool(aPrefName);
JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MODE, enableCompartmentGC
? JSGC_MODE_COMPARTMENT
: JSGC_MODE_GLOBAL);

View File

@ -51,6 +51,7 @@
#include "nsNetUtil.h"
#include "nsThreadUtils.h"
#include "mozilla/Services.h"
#include "mozilla/Preferences.h"
#include "IndexedDatabaseManager.h"
@ -59,6 +60,7 @@
#define TOPIC_PERMISSIONS_PROMPT "indexedDB-permissions-prompt"
#define TOPIC_PERMISSIONS_RESPONSE "indexedDB-permissions-response"
using namespace mozilla;
USING_INDEXEDDB_NAMESPACE
using namespace mozilla::services;
@ -71,7 +73,7 @@ GetIndexedDBPermissions(const nsACString& aASCIIOrigin,
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
if (!nsContentUtils::GetBoolPref(PREF_INDEXEDDB_ENABLED)) {
if (!Preferences::GetBool(PREF_INDEXEDDB_ENABLED)) {
return nsIPermissionManager::DENY_ACTION;
}

View File

@ -68,7 +68,6 @@ SDK_XPIDLSRCS = \
$(NULL)
XPIDLSRCS = \
nsIDOM3Node.idl \
nsIDOM3Text.idl \
nsIDOM3TypeInfo.idl \
nsIDOM3Attr.idl \
nsIDOMDOMStringList.idl \

View File

@ -1,65 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is DOM 3 Core interface definitions.
*
* The Initial Developer of the Original Code is
* Jeff Walden <jwalden+code@mit.edu>.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "domstubs.idl"
[scriptable, uuid(BCCA052E-46F4-4B8E-8859-A86776C2F1D7)]
interface nsIDOM3Text : nsISupports
{
/**
* Indicates whether this text node contains element content whitespace.
* A text node is element content whitespace if it contains only XML
* white space characters and is a child of an element whose content
* model allows only child elements optionally separated by white space.
*/
readonly attribute boolean isElementContentWhitespace;
/**
* The concatenation of all logically adjacent text nodes with this text
* node, where "logically adjacent" consists of all text nodes which can be
* reached by traversing the document tree in either direction without
* passing an element, comment, or processing-instruction boundary.
*/
readonly attribute DOMString wholeText;
/**
* If content is empty, removes all logically adjacent text nodes (including
* this node) from the DOM tree, returning null; otherwise, replaces the
* contents of this node with aContent and removes all other logically
* adjacent text nodes from the DOM tree, returning this node.
*/
nsIDOMText replaceWholeText(in DOMString content) raises(DOMException);
};

View File

@ -49,7 +49,7 @@
* http://www.w3.org/TR/DOM-Level-2-Core/
*/
[scriptable, uuid(f8da723d-0d32-4bbc-a11e-898e506cd908)]
[scriptable, uuid(f1eea89d-8af3-4c2a-90df-6c3a75cb5005)]
interface nsIDOMCDATASection : nsIDOMText
{
};

View File

@ -44,12 +44,36 @@
* the textual content (termed character data in XML) of an Element or Attr.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Core/
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
*/
[scriptable, uuid(48642156-d686-46b7-8e96-35edd5b2afa8)]
[scriptable, uuid(04a1ec2b-491f-4a80-8db4-694c37e31a6f)]
interface nsIDOMText : nsIDOMCharacterData
{
nsIDOMText splitText(in unsigned long offset)
raises(DOMException);
/**
* Indicates whether this text node contains element content whitespace.
* A text node is element content whitespace if it contains only XML
* white space characters and is a child of an element whose content
* model allows only child elements optionally separated by white space.
*/
readonly attribute boolean isElementContentWhitespace;
/**
* The concatenation of all logically adjacent text nodes with this text
* node, where "logically adjacent" consists of all text nodes which can be
* reached by traversing the document tree in either direction without
* passing an element, comment, or processing-instruction boundary.
*/
readonly attribute DOMString wholeText;
/**
* If content is empty, removes all logically adjacent text nodes (including
* this node) from the DOM tree, returning null; otherwise, replaces the
* contents of this node with aContent and removes all other logically
* adjacent text nodes from the DOM tree, returning this node.
*/
nsIDOMText replaceWholeText(in DOMString content) raises(DOMException);
};

View File

@ -51,6 +51,7 @@
#include "base/process_util.h"
#include "mozilla/Preferences.h"
#include "mozilla/unused.h"
#include "mozilla/ipc/SyncChannel.h"
#include "mozilla/plugins/PluginModuleParent.h"
@ -71,6 +72,7 @@ using base::KillProcess;
using mozilla::PluginLibrary;
using mozilla::ipc::SyncChannel;
using namespace mozilla;
using namespace mozilla::plugins;
static const char kTimeoutPref[] = "dom.ipc.plugins.timeoutSecs";
@ -90,7 +92,7 @@ PluginModuleParent::LoadModule(const char* aFilePath)
{
PLUGIN_LOG_DEBUG_FUNCTION;
PRInt32 prefSecs = nsContentUtils::GetIntPref(kLaunchTimeoutPref, 0);
PRInt32 prefSecs = Preferences::GetInt(kLaunchTimeoutPref, 0);
// Block on the child process being launched and initialized.
nsAutoPtr<PluginModuleParent> parent(new PluginModuleParent(aFilePath));
@ -223,7 +225,7 @@ PluginModuleParent::TimeoutChanged(const char* aPref, void* aModule)
NS_ABORT_IF_FALSE(!strcmp(aPref, kTimeoutPref),
"unexpected pref callback");
PRInt32 timeoutSecs = nsContentUtils::GetIntPref(kTimeoutPref, 0);
PRInt32 timeoutSecs = Preferences::GetInt(kTimeoutPref, 0);
int32 timeoutMs = (timeoutSecs > 0) ? (1000 * timeoutSecs) :
SyncChannel::kNoTimeout;

View File

@ -72,6 +72,7 @@
#include "nsThreadUtils.h"
#include "mozilla/Services.h"
#include "mozilla/unused.h"
#include "mozilla/Preferences.h"
#include <math.h>
@ -91,6 +92,7 @@
#define MAX_GEO_REQUESTS_PER_WINDOW 1500
using mozilla::unused; // <snicker>
using namespace mozilla;
using namespace mozilla::dom;
class RequestPromptEvent : public nsRunnable
@ -499,22 +501,22 @@ static PRBool sGeoIgnoreLocationFilter = PR_FALSE;
static int
GeoEnabledChangedCallback(const char *aPrefName, void *aClosure)
{
sGeoEnabled = nsContentUtils::GetBoolPref("geo.enabled", PR_TRUE);
sGeoEnabled = Preferences::GetBool("geo.enabled", PR_TRUE);
return 0;
}
static int
GeoIgnoreLocationFilterChangedCallback(const char *aPrefName, void *aClosure)
{
sGeoIgnoreLocationFilter = nsContentUtils::GetBoolPref("geo.ignore.location_filter",
PR_TRUE);
sGeoIgnoreLocationFilter =
Preferences::GetBool("geo.ignore.location_filter", PR_TRUE);
return 0;
}
nsresult nsGeolocationService::Init()
{
mTimeout = nsContentUtils::GetIntPref("geo.timeout", 6000);
mTimeout = Preferences::GetInt("geo.timeout", 6000);
nsContentUtils::RegisterPrefCallback("geo.ignore.location_filter",
GeoIgnoreLocationFilterChangedCallback,
@ -1053,9 +1055,10 @@ nsGeolocation::RegisterRequestWithPrompt(nsGeolocationRequest* request)
return true;
}
if (nsContentUtils::GetBoolPref("geo.prompt.testing", PR_FALSE))
{
nsCOMPtr<nsIRunnable> ev = new RequestAllowEvent(nsContentUtils::GetBoolPref("geo.prompt.testing.allow", PR_FALSE), request);
if (Preferences::GetBool("geo.prompt.testing", PR_FALSE)) {
nsCOMPtr<nsIRunnable> ev =
new RequestAllowEvent(Preferences::GetBool("geo.prompt.testing.allow",
PR_FALSE), request);
NS_DispatchToMainThread(ev);
return true;
}

View File

@ -41,7 +41,9 @@
#include "mozilla/dom/PBrowserChild.h"
#include "TabChild.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
/* ------------------------------------------------------------------------ */
@ -109,13 +111,14 @@ nsDOMDesktopNotification::nsDOMDesktopNotification(const nsAString & title,
mOwner = aWindow;
mScriptContext = aScriptContext;
if (nsContentUtils::GetBoolPref("notification.disabled", PR_FALSE))
if (Preferences::GetBool("notification.disabled", PR_FALSE)) {
return;
}
// If we are in testing mode (running mochitests, for example)
// and we are suppose to allow requests, then just post an allow event.
if (nsContentUtils::GetBoolPref("notification.prompt.testing", PR_FALSE) &&
nsContentUtils::GetBoolPref("notification.prompt.testing.allow", PR_TRUE)) {
if (Preferences::GetBool("notification.prompt.testing", PR_FALSE) &&
Preferences::GetBool("notification.prompt.testing.allow", PR_TRUE)) {
mAllow = PR_TRUE;
return;
}

View File

@ -56,11 +56,14 @@
#include "nsIObserverService.h"
#include "nsIScriptGlobalObject.h"
#include "nsIWebNavigation.h"
#include "mozilla/Preferences.h"
#include "nsXULAppAPI.h"
#define IS_CHILD_PROCESS() \
(GeckoProcessType_Default != XRE_GetProcessType())
using namespace mozilla;
// Event names
#define CHECKING_STR "checking"
@ -392,8 +395,8 @@ nsDOMOfflineResourceList::MozAdd(const nsAString& aURI)
PRUint32 length;
rv = GetMozLength(&length);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 maxEntries = nsContentUtils::GetIntPref(kMaxEntriesPref,
DEFAULT_MAX_ENTRIES);
PRUint32 maxEntries =
Preferences::GetUint(kMaxEntriesPref, DEFAULT_MAX_ENTRIES);
if (length > maxEntries) return NS_ERROR_NOT_AVAILABLE;

View File

@ -71,6 +71,9 @@ using mozilla::dom::StorageChild;
#include "nsDOMString.h"
#include "nsNetCID.h"
#include "nsIProxyObjectManager.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
static const PRUint32 ASK_BEFORE_ACCEPT = 1;
static const PRUint32 ACCEPT_SESSION = 2;
@ -202,22 +205,21 @@ GetQuota(const nsACString &aDomain, PRInt32 *aQuota, PRInt32 *aWarnQuota,
PRUint32 perm = GetOfflinePermission(aDomain);
if (IS_PERMISSION_ALLOWED(perm) || aOverrideQuota) {
// This is an offline app, give more space by default.
*aQuota = ((PRInt32)nsContentUtils::GetIntPref(kOfflineAppQuota,
DEFAULT_OFFLINE_APP_QUOTA) * 1024);
*aQuota = Preferences::GetInt(kOfflineAppQuota,
DEFAULT_OFFLINE_APP_QUOTA) * 1024;
if (perm == nsIOfflineCacheUpdateService::ALLOW_NO_WARN ||
aOverrideQuota) {
*aWarnQuota = -1;
} else {
*aWarnQuota = ((PRInt32)nsContentUtils::GetIntPref(kOfflineAppWarnQuota,
DEFAULT_OFFLINE_WARN_QUOTA) * 1024);
*aWarnQuota = Preferences::GetInt(kOfflineAppWarnQuota,
DEFAULT_OFFLINE_WARN_QUOTA) * 1024;
}
return perm;
}
// FIXME: per-domain quotas?
*aQuota = ((PRInt32)nsContentUtils::GetIntPref(kDefaultQuota,
DEFAULT_QUOTA) * 1024);
*aQuota = Preferences::GetInt(kDefaultQuota, DEFAULT_QUOTA) * 1024;
*aWarnQuota = -1;
return perm;
@ -1459,8 +1461,9 @@ nsDOMStorage::CanUseStorage(PRPackedBool* aSessionOnly)
NS_ASSERTION(aSessionOnly, "null session flag");
*aSessionOnly = PR_FALSE;
if (!nsContentUtils::GetBoolPref(kStorageEnabled))
if (!Preferences::GetBool(kStorageEnabled)) {
return PR_FALSE;
}
// chrome can always use storage regardless of permission preferences
if (nsContentUtils::IsCallerChrome())
@ -1500,8 +1503,8 @@ nsDOMStorage::CanUseStorage(PRPackedBool* aSessionOnly)
*aSessionOnly = PR_TRUE;
}
else if (perm != nsIPermissionManager::ALLOW_ACTION) {
PRUint32 cookieBehavior = nsContentUtils::GetIntPref(kCookiesBehavior);
PRUint32 lifetimePolicy = nsContentUtils::GetIntPref(kCookiesLifetimePolicy);
PRUint32 cookieBehavior = Preferences::GetUint(kCookiesBehavior);
PRUint32 lifetimePolicy = Preferences::GetUint(kCookiesLifetimePolicy);
// Treat "ask every time" as "reject always".
// Chrome persistent pages can bypass this check.

View File

@ -71,6 +71,7 @@
#include "nsXPCOMCIDInternal.h"
#include "pratom.h"
#include "prthread.h"
#include "mozilla/Preferences.h"
// DOMWorker includes
#include "nsDOMWorker.h"
@ -1593,7 +1594,7 @@ nsDOMThreadService::PrefCallback(const char* aPrefName,
// some wacky platform then the worst that could happen is that the close
// handler will run for a slightly different amount of time.
PRUint32 timeoutMS =
nsContentUtils::GetIntPref(aPrefName, gWorkerCloseHandlerTimeoutMS);
Preferences::GetUint(aPrefName, gWorkerCloseHandlerTimeoutMS);
// We must have a timeout value, 0 is not ok. If the pref is set to 0 then
// fall back to our default.

View File

@ -1,3 +1,3 @@
component {0A3BE523-0F2A-32CC-CCD8-1E5986D5A79D} GPSDGeolocationProvider.manifest
component {0A3BE523-0F2A-32CC-CCD8-1E5986D5A79D} GPSDGeolocationProvider.js
contract @mozilla.org/geolocation/gpsd/provider;1 {0A3BE523-0F2A-32CC-CCD8-1E5986D5A79D}
category geolocation-provider GPSDProvider @mozilla.org/geolocation/gpsd/provider;1

View File

@ -79,6 +79,7 @@
#include "nsEventDispatcher.h"
#include "nsGkAtoms.h"
#include "nsDebug.h"
#include "mozilla/Preferences.h"
// Drag & Drop, Clipboard
#include "nsIClipboard.h"
@ -87,6 +88,8 @@
#include "mozilla/FunctionTimer.h"
using namespace mozilla;
nsPlaintextEditor::nsPlaintextEditor()
: nsEditor()
, mIgnoreSpuriousDragEvent(PR_FALSE)
@ -171,10 +174,11 @@ static int
EditorPrefsChangedCallback(const char *aPrefName, void *)
{
if (nsCRT::strcmp(aPrefName, "editor.singleLine.pasteNewlines") == 0) {
sNewlineHandlingPref = nsContentUtils::GetIntPref("editor.singleLine.pasteNewlines",
nsIPlaintextEditor::eNewlinesPasteToFirst);
sNewlineHandlingPref =
Preferences::GetInt("editor.singleLine.pasteNewlines",
nsIPlaintextEditor::eNewlinesPasteToFirst);
} else if (nsCRT::strcmp(aPrefName, "layout.selection.caret_style") == 0) {
sCaretStylePref = nsContentUtils::GetIntPref("layout.selection.caret_style",
sCaretStylePref = Preferences::GetInt("layout.selection.caret_style",
#ifdef XP_WIN
1);
if (sCaretStylePref == 0)

View File

@ -784,19 +784,6 @@ customMethodCalls = {
'thisType': 'nsGenericElement',
'code': ' PRBool result = self->MozMatchesSelector(arg0, &rv);',
},
'nsIDOM3Text_': {
'thisType': 'nsGenericTextNode'
},
'nsIDOM3Text_IsElementContentWhitespace': {
'thisType': 'nsGenericTextNode',
'code': ' PRBool result = self->IsElementContentWhitespace();',
'canFail': False
},
'nsIDOM3Text_ReplaceWholeText': {
'thisType': 'nsGenericTextNode',
'code': ' nsIContent* result = '
'self->ReplaceWholeText(PromiseFlatString(arg0), &rv);'
},
'nsIDOMNodeSelector_QuerySelector': {
'thisType': 'nsINode',
'code': ' nsIContent* result = '

View File

@ -68,6 +68,7 @@
#include "nsMenuPopupFrame.h"
#include "nsTextFragment.h"
#include "nsThemeConstants.h"
#include "mozilla/Preferences.h"
// The bidi indicator hangs off the caret to one side, to show which
// direction the typing is in. It needs to be at least 2x2 to avoid looking like
@ -79,6 +80,8 @@ static const PRInt32 kMinBidiIndicatorPixels = 2;
#include "nsContentUtils.h"
#endif //IBMBIDI
using namespace mozilla;
/**
* Find the first frame in an in-order traversal of the frame subtree rooted
* at aFrame which is either a text frame logically at the end of a line,
@ -225,7 +228,7 @@ nsresult nsCaret::Init(nsIPresShell *inPresShell)
StartBlinking();
}
#ifdef IBMBIDI
mBidiUI = nsContentUtils::GetBoolPref("bidi.browser.ui");
mBidiUI = Preferences::GetBool("bidi.browser.ui");
#endif
return NS_OK;

View File

@ -2046,9 +2046,15 @@ private:
};
#endif
/* A display item that applies a transformation to all of its descendent
/* A display item that applies a transformation to all of its descendant
* elements. This wrapper should only be used if there is a transform applied
* to the root element.
*
* The reason that a "bounds" rect is involved in transform calculations is
* because CSS-transforms allow percentage values for the x and y components
* of <translation-value>s, where percentages are percentages of the element's
* content box.
*
* INVARIANT: The wrapped frame is transformed.
* INVARIANT: The wrapped frame is non-null.
*/

View File

@ -112,6 +112,7 @@
#include "nsContentUtils.h"
#include "nsPIWindowRoot.h"
#include "mozilla/Preferences.h"
// Needed for Start/Stop of Image Animation
#include "imgIContainer.h"
@ -490,7 +491,7 @@ nsPresContext::GetFontPreferences()
pref.Assign("font.minimum-size.");
pref.Append(langGroup);
PRInt32 size = nsContentUtils::GetIntPref(pref.get());
PRInt32 size = Preferences::GetInt(pref.get());
if (unit == eUnit_px) {
mMinimumFontSizePref = CSSPixelsToAppUnits(size);
}
@ -556,7 +557,7 @@ nsPresContext::GetFontPreferences()
// get font.size.[generic].[langGroup]
// size=0 means 'Auto', i.e., generic fonts retain the size of the variable font
MAKE_FONT_PREF_KEY(pref, "font.size", generic_dot_langGroup);
size = nsContentUtils::GetIntPref(pref.get());
size = Preferences::GetInt(pref.get());
if (size > 0) {
if (unit == eUnit_px) {
font->size = CSSPixelsToAppUnits(size);
@ -603,8 +604,7 @@ nsPresContext::GetDocumentColorPreferences()
}
if (usePrefColors) {
usePrefColors =
!nsContentUtils::GetBoolPref("browser.display.use_system_colors",
PR_FALSE);
!Preferences::GetBool("browser.display.use_system_colors", PR_FALSE);
}
if (usePrefColors) {
@ -637,8 +637,8 @@ nsPresContext::GetDocumentColorPreferences()
mBackgroundColor);
mUseDocumentColors = !useAccessibilityTheme &&
nsContentUtils::GetBoolPref("browser.display.use_document_colors",
mUseDocumentColors);
Preferences::GetBool("browser.display.use_document_colors",
mUseDocumentColors);
}
void
@ -651,23 +651,22 @@ nsPresContext::GetUserPreferences()
}
mFontScaler =
nsContentUtils::GetIntPref("browser.display.base_font_scaler",
mFontScaler);
Preferences::GetInt("browser.display.base_font_scaler", mFontScaler);
mAutoQualityMinFontSizePixelsPref =
nsContentUtils::GetIntPref("browser.display.auto_quality_min_font_size");
Preferences::GetInt("browser.display.auto_quality_min_font_size");
// * document colors
GetDocumentColorPreferences();
mSendAfterPaintToContent =
nsContentUtils::GetBoolPref("dom.send_after_paint_to_content",
mSendAfterPaintToContent);
Preferences::GetBool("dom.send_after_paint_to_content",
mSendAfterPaintToContent);
// * link colors
mUnderlineLinks =
nsContentUtils::GetBoolPref("browser.underline_anchors", mUnderlineLinks);
Preferences::GetBool("browser.underline_anchors", mUnderlineLinks);
nsAdoptingCString colorStr =
nsContentUtils::GetCharPref("browser.anchor_color");
@ -690,8 +689,7 @@ nsPresContext::GetUserPreferences()
}
mUseFocusColors =
nsContentUtils::GetBoolPref("browser.display.use_focus_colors",
mUseFocusColors);
Preferences::GetBool("browser.display.use_focus_colors", mUseFocusColors);
mFocusTextColor = mDefaultColor;
mFocusBackgroundColor = mBackgroundColor;
@ -710,26 +708,23 @@ nsPresContext::GetUserPreferences()
}
mFocusRingWidth =
nsContentUtils::GetIntPref("browser.display.focus_ring_width",
mFocusRingWidth);
Preferences::GetInt("browser.display.focus_ring_width", mFocusRingWidth);
mFocusRingOnAnything =
nsContentUtils::GetBoolPref("browser.display.focus_ring_on_anything",
mFocusRingOnAnything);
Preferences::GetBool("browser.display.focus_ring_on_anything",
mFocusRingOnAnything);
mFocusRingStyle =
nsContentUtils::GetIntPref("browser.display.focus_ring_style",
mFocusRingStyle);
Preferences::GetInt("browser.display.focus_ring_style", mFocusRingStyle);
// * use fonts?
mUseDocumentFonts =
nsContentUtils::GetIntPref("browser.display.use_document_fonts") != 0;
Preferences::GetInt("browser.display.use_document_fonts") != 0;
// * replace backslashes with Yen signs? (bug 245770)
mEnableJapaneseTransform =
nsContentUtils::GetBoolPref("layout.enable_japanese_specific_transform");
Preferences::GetBool("layout.enable_japanese_specific_transform");
mPrefScrollbarSide =
nsContentUtils::GetIntPref("layout.scrollbar.side");
mPrefScrollbarSide = Preferences::GetInt("layout.scrollbar.side");
GetFontPreferences();
@ -748,24 +743,24 @@ nsPresContext::GetUserPreferences()
PRUint32 bidiOptions = GetBidi();
PRInt32 prefInt =
nsContentUtils::GetIntPref(IBMBIDI_TEXTDIRECTION_STR,
GET_BIDI_OPTION_DIRECTION(bidiOptions));
Preferences::GetInt(IBMBIDI_TEXTDIRECTION_STR,
GET_BIDI_OPTION_DIRECTION(bidiOptions));
SET_BIDI_OPTION_DIRECTION(bidiOptions, prefInt);
mPrefBidiDirection = prefInt;
prefInt =
nsContentUtils::GetIntPref(IBMBIDI_TEXTTYPE_STR,
GET_BIDI_OPTION_TEXTTYPE(bidiOptions));
Preferences::GetInt(IBMBIDI_TEXTTYPE_STR,
GET_BIDI_OPTION_TEXTTYPE(bidiOptions));
SET_BIDI_OPTION_TEXTTYPE(bidiOptions, prefInt);
prefInt =
nsContentUtils::GetIntPref(IBMBIDI_NUMERAL_STR,
GET_BIDI_OPTION_NUMERAL(bidiOptions));
Preferences::GetInt(IBMBIDI_NUMERAL_STR,
GET_BIDI_OPTION_NUMERAL(bidiOptions));
SET_BIDI_OPTION_NUMERAL(bidiOptions, prefInt);
prefInt =
nsContentUtils::GetIntPref(IBMBIDI_SUPPORTMODE_STR,
GET_BIDI_OPTION_SUPPORT(bidiOptions));
Preferences::GetInt(IBMBIDI_SUPPORTMODE_STR,
GET_BIDI_OPTION_SUPPORT(bidiOptions));
SET_BIDI_OPTION_SUPPORT(bidiOptions, prefInt);
// We don't need to force reflow: either we are initializing a new

View File

@ -209,6 +209,7 @@
#include "gfxPlatform.h"
#include "mozilla/FunctionTimer.h"
#include "mozilla/Preferences.h"
#include "Layers.h"
@ -1859,8 +1860,7 @@ PresShell::Init(nsIDocument* aDocument,
if (gMaxRCProcessingTime == -1) {
gMaxRCProcessingTime =
nsContentUtils::GetIntPref("layout.reflow.timeslice",
NS_MAX_REFLOW_TIME);
Preferences::GetInt("layout.reflow.timeslice", NS_MAX_REFLOW_TIME);
}
{
@ -1885,13 +1885,13 @@ PresShell::Init(nsIDocument* aDocument,
#ifdef MOZ_REFLOW_PERF
if (mReflowCountMgr) {
PRBool paintFrameCounts =
nsContentUtils::GetBoolPref("layout.reflow.showframecounts");
Preferences::GetBool("layout.reflow.showframecounts");
PRBool dumpFrameCounts =
nsContentUtils::GetBoolPref("layout.reflow.dumpframecounts");
Preferences::GetBool("layout.reflow.dumpframecounts");
PRBool dumpFrameByFrameCounts =
nsContentUtils::GetBoolPref("layout.reflow.dumpframebyframecounts");
Preferences::GetBool("layout.reflow.dumpframebyframecounts");
mReflowCountMgr->SetDumpFrameCounts(dumpFrameCounts);
mReflowCountMgr->SetDumpFrameByFrameCounts(dumpFrameByFrameCounts);
@ -2816,8 +2816,8 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
// Default to PAINTLOCK_EVENT_DELAY if we can't get the pref value.
PRInt32 delay =
nsContentUtils::GetIntPref("nglayout.initialpaint.delay",
PAINTLOCK_EVENT_DELAY);
Preferences::GetInt("nglayout.initialpaint.delay",
PAINTLOCK_EVENT_DELAY);
mPaintSuppressionTimer->InitWithFuncCallback(sPaintSuppressionCallback,
this, delay,
@ -3920,7 +3920,7 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
// Should we select the target? This action is controlled by a
// preference: the default is to not select.
PRBool selectAnchor = nsContentUtils::GetBoolPref("layout.selectanchor");
PRBool selectAnchor = Preferences::GetBool("layout.selectanchor");
// Even if select anchor pref is false, we must still move the
// caret there. That way tabbing will start from the new

View File

@ -52,10 +52,13 @@
#include "nsEventDispatcher.h"
#include "jsapi.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
using mozilla::TimeStamp;
using mozilla::TimeDuration;
using namespace mozilla;
#define DEFAULT_FRAME_RATE 60
#define DEFAULT_THROTTLED_FRAME_RATE 1
@ -75,7 +78,7 @@ nsRefreshDriver::GetRefreshTimerInterval() const
{
const char* prefName =
mThrottled ? "layout.throttled_frame_rate" : "layout.frame_rate";
PRInt32 rate = nsContentUtils::GetIntPref(prefName, -1);
PRInt32 rate = Preferences::GetInt(prefName, -1);
if (rate <= 0) {
// TODO: get the rate from the platform
rate = mThrottled ? DEFAULT_THROTTLED_FRAME_RATE : DEFAULT_FRAME_RATE;

View File

@ -90,8 +90,9 @@
#include "nsThemeConstants.h"
#include "nsPLDOMEvent.h"
#include "nsRenderingContext.h"
#include "mozilla/Preferences.h"
namespace dom = mozilla::dom;
using namespace mozilla;
NS_IMETHODIMP
nsComboboxControlFrame::RedisplayTextEvent::Run()
@ -1518,6 +1519,6 @@ nsComboboxControlFrame::RestoreState(nsPresState* aState)
PRBool
nsComboboxControlFrame::ToolkitHasNativePopup()
{
return nsContentUtils::GetBoolPref("ui.use_native_popup_windows");
return Preferences::GetBool("ui.use_native_popup_windows");
}

View File

@ -130,6 +130,8 @@
#include "CSSCalc.h"
#include "nsAbsoluteContainingBlock.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::layers;
@ -2354,7 +2356,7 @@ nsFrame::HandleMultiplePress(nsPresContext* aPresContext,
if (me->clickCount == 4) {
beginAmount = endAmount = eSelectParagraph;
} else if (me->clickCount == 3) {
if (nsContentUtils::GetBoolPref("browser.triple_click_selects_paragraph")) {
if (Preferences::GetBool("browser.triple_click_selects_paragraph")) {
beginAmount = endAmount = eSelectParagraph;
} else {
beginAmount = eSelectBeginLine;
@ -2924,7 +2926,7 @@ static FrameTarget GetSelectionClosestFrameForBlock(nsIFrame* aFrame,
// up with a line or the beginning or end of the frame; 0 on Windows,
// 1 on other platforms by default at the writing of this code
PRInt32 dragOutOfFrame =
nsContentUtils::GetIntPref("browser.drag_out_of_frame_style");
Preferences::GetInt("browser.drag_out_of_frame_style");
if (prevLine == end) {
if (dragOutOfFrame == 1 || nextLine == end)
@ -5650,7 +5652,7 @@ nsIFrame::PeekOffset(nsPeekOffsetStruct* aPos)
// This pref only affects whether moving forward by word should go to the end of this word or start of the next word.
// When going backwards, the start of the word is always used, on every operating system.
wordSelectEatSpace = aPos->mDirection == eDirNext &&
nsContentUtils::GetBoolPref("layout.word_select.eat_space_to_next_word");
Preferences::GetBool("layout.word_select.eat_space_to_next_word");
}
// mSawBeforeType means "we already saw characters of the type
@ -5958,7 +5960,7 @@ nsFrame::BreakWordBetweenPunctuation(const PeekWordState* aState,
// We always stop between whitespace and punctuation
return PR_TRUE;
}
if (!nsContentUtils::GetBoolPref("layout.word_select.stop_at_punctuation")) {
if (!Preferences::GetBool("layout.word_select.stop_at_punctuation")) {
// When this pref is false, we never stop at a punctuation boundary unless
// it's after whitespace
return PR_FALSE;

View File

@ -73,6 +73,9 @@
#include "nsDisplayList.h"
#include "nsNodeUtils.h"
#include "mozAutoDocUpdate.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
// masks for mEdgeVisibility
#define LEFT_VIS 0x0001
@ -263,8 +266,7 @@ nsHTMLFramesetFrame::FrameResizePrefCallback(const char* aPref, void* aClosure)
}
frame->mForceFrameResizability =
nsContentUtils::GetBoolPref(kFrameResizePref,
frame->mForceFrameResizability);
Preferences::GetBool(kFrameResizePref, frame->mForceFrameResizability);
frame->RecalculateBorderResize();
if (doc) {
@ -974,8 +976,7 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
if (firstTime) {
nsContentUtils::RegisterPrefCallback(kFrameResizePref,
FrameResizePrefCallback, this);
mForceFrameResizability =
nsContentUtils::GetBoolPref(kFrameResizePref);
mForceFrameResizability = Preferences::GetBool(kFrameResizePref);
}
// subtract out the width of all of the potential borders. There are

View File

@ -56,6 +56,7 @@
#include "nsIPercentHeightObserver.h"
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "mozilla/Preferences.h"
#ifdef IBMBIDI
#include "nsBidiUtils.h"
#endif
@ -1613,7 +1614,7 @@ static int
PrefsChanged(const char *aPrefName, void *instance)
{
sBlinkIsAllowed =
nsContentUtils::GetBoolPref("browser.blink_allowed", sBlinkIsAllowed);
Preferences::GetBool("browser.blink_allowed", sBlinkIsAllowed);
return 0; /* PREF_OK */
}
@ -1638,9 +1639,10 @@ static eNormalLineHeightControl GetNormalLineHeightCalcControl(void)
if (sNormalLineHeightControl == eUninitialized) {
// browser.display.normal_lineheight_calc_control is not user
// changeable, so no need to register callback for it.
sNormalLineHeightControl =
static_cast<eNormalLineHeightControl>
(nsContentUtils::GetIntPref("browser.display.normal_lineheight_calc_control", eNoExternalLeading));
PRInt32 val =
Preferences::GetInt("browser.display.normal_lineheight_calc_control",
eNoExternalLeading);
sNormalLineHeightControl = static_cast<eNormalLineHeightControl>(val);
}
return sNormalLineHeightControl;
}

View File

@ -103,6 +103,10 @@
#include "gfxRect.h"
#include "ImageLayers.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
// sizes (pixels) for image icon, padding and border frame
#define ICON_SIZE (16)
#define ICON_PADDING (3)
@ -1916,11 +1920,10 @@ nsImageFrame::IconLoad::Observe(nsISupports *aSubject, const char* aTopic,
void nsImageFrame::IconLoad::GetPrefs()
{
mPrefForceInlineAltText =
nsContentUtils::GetBoolPref("browser.display.force_inline_alttext");
Preferences::GetBool("browser.display.force_inline_alttext");
mPrefShowPlaceholders =
nsContentUtils::GetBoolPref("browser.display.show_image_placeholders",
PR_TRUE);
Preferences::GetBool("browser.display.show_image_placeholders", PR_TRUE);
}

View File

@ -133,6 +133,7 @@ enum { XKeyPress = KeyPress };
#include "nsComponentManagerUtils.h"
#include "nsIObserverService.h"
#include "nsIScrollableFrame.h"
#include "mozilla/Preferences.h"
// headers for plugin scriptability
#include "nsIScriptGlobalObject.h"
@ -3373,7 +3374,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL,
}
PRInt32 blockPopups =
nsContentUtils::GetIntPref("privacy.popups.disable_from_plugins");
Preferences::GetInt("privacy.popups.disable_from_plugins");
nsAutoPopupStatePusher popupStatePusher((PopupControlState)blockPopups);
rv = lh->OnLinkClick(mContent, uri, unitarget.get(),

View File

@ -87,6 +87,7 @@ static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
#include "nsContentUtils.h"
#include "nsThreadUtils.h"
#include "mozilla/Preferences.h"
//included for desired x position;
#include "nsPresContext.h"
@ -113,6 +114,8 @@ static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
#include "nsDOMError.h"
using namespace mozilla;
//#define DEBUG_TABLE 1
static NS_DEFINE_IID(kCContentIteratorCID, NS_CONTENTITERATOR_CID);
@ -730,7 +733,7 @@ nsFrameSelection::nsFrameSelection()
// Check to see if the autocopy pref is enabled
// and add the autocopy listener if it is
if (nsContentUtils::GetBoolPref("clipboard.autocopy")) {
if (Preferences::GetBool("clipboard.autocopy")) {
nsAutoCopyListener *autoCopy = nsAutoCopyListener::GetInstance();
if (autoCopy) {
@ -1081,7 +1084,8 @@ nsFrameSelection::Init(nsIPresShell *aShell, nsIContent *aLimiter)
mMouseDownState = PR_FALSE;
mDesiredXSet = PR_FALSE;
mLimiter = aLimiter;
mCaretMovementStyle = nsContentUtils::GetIntPref("bidi.edit.caret_movement_style", 2);
mCaretMovementStyle =
Preferences::GetInt("bidi.edit.caret_movement_style", 2);
}
nsresult
@ -1140,7 +1144,8 @@ nsFrameSelection::MoveCaret(PRUint32 aKeycode,
SetDesiredX(desiredX);
}
PRInt32 caretStyle = nsContentUtils::GetIntPref("layout.selection.caret_style", 0);
PRInt32 caretStyle =
Preferences::GetInt("layout.selection.caret_style", 0);
#ifdef XP_MACOSX
if (caretStyle == 0) {
caretStyle = 2; // put caret at the selection edge in the |aKeycode| direction

View File

@ -49,6 +49,7 @@
#include "nsCSSFrameConstructor.h"
#include "nsContentUtils.h"
#include "nsDisplayList.h"
#include "mozilla/Preferences.h"
// DateTime Includes
#include "nsDateTimeFormatCID.h"
@ -61,6 +62,8 @@
#include "nsGfxCIID.h"
#include "nsIServiceManager.h"
using namespace mozilla;
static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printsettings-service;1";
//
@ -226,7 +229,7 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
// Compute the size of each page and the x coordinate that each page will
// be placed at
nscoord extraThreshold = NS_MAX(pageSize.width, pageSize.height)/10;
PRInt32 gapInTwips = nsContentUtils::GetIntPref("print.print_extra_margin");
PRInt32 gapInTwips = Preferences::GetInt("print.print_extra_margin");
gapInTwips = NS_MAX(0, gapInTwips);
nscoord extraGap = aPresContext->CSSTwipsToAppUnits(gapInTwips);

View File

@ -123,6 +123,7 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
#include "nsContentUtils.h"
#include "nsIPresShell.h"
#include "nsLayoutUtils.h"
#include "mozilla/Preferences.h"
#include "nsViewsCID.h"
#include "nsWidgetsCID.h"
@ -165,6 +166,7 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
#include "nsIURIFixup.h"
#include "mozilla/dom/Element.h"
using namespace mozilla;
using namespace mozilla::dom;
//-----------------------------------------------------
@ -597,8 +599,8 @@ nsPrintEngine::DoCommonPrint(PRBool aIsPrintPreview,
mPrt->mPrintSettings->GetPrintSilent(&printSilently);
// Check prefs for a default setting as to whether we should print silently
printSilently = nsContentUtils::GetBoolPref("print.always_print_silent",
printSilently);
printSilently =
Preferences::GetBool("print.always_print_silent", printSilently);
// Ask dialog to be Print Shown via the Plugable Printing Dialog Service
// This service is for the Print Dialog and the Print Progress Dialog
@ -1012,8 +1014,7 @@ nsPrintEngine::ShowPrintProgress(PRBool aIsForPrinting, PRBool& aDoNotify)
// if it is already being shown then don't bother to find out if it should be
// so skip this and leave mShowProgressDialog set to FALSE
if (!mProgressDialogIsShown) {
showProgresssDialog =
nsContentUtils::GetBoolPref("print.show_print_progress");
showProgresssDialog = Preferences::GetBool("print.show_print_progress");
}
// Turning off the showing of Print Progress in Prefs overrides

View File

@ -94,9 +94,10 @@
#include "mozilla/dom/Element.h"
#include "nsGenericElement.h"
#include "nsNthIndexCache.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
namespace css = mozilla::css;
#define VISITED_PSEUDO_PREF "layout.css.visited_links_enabled"
@ -964,8 +965,7 @@ nsCSSRuleProcessor::Startup()
nsContentUtils::AddBoolPrefVarCache(VISITED_PSEUDO_PREF,
&gSupportVisitedPseudo);
// We want to default to true, not false as AddBoolPrefVarCache does.
gSupportVisitedPseudo =
nsContentUtils::GetBoolPref(VISITED_PSEUDO_PREF, PR_TRUE);
gSupportVisitedPseudo = Preferences::GetBool(VISITED_PSEUDO_PREF, PR_TRUE);
gPrivateBrowsingObserver = new nsPrivateBrowsingObserver();
NS_ENSURE_TRUE(gPrivateBrowsingObserver, NS_ERROR_OUT_OF_MEMORY);

View File

@ -60,6 +60,9 @@
#include "mozilla/Services.h"
#include "mozilla/css/Loader.h"
#include "nsCSSStyleSheet.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
#ifdef CSS_REPORT_PARSE_ERRORS
static PRBool gReportErrors = PR_TRUE;
@ -325,7 +328,7 @@ nsCSSScanner::SetLowLevelError(nsresult aErrorCode)
static int
CSSErrorsPrefChanged(const char *aPref, void *aClosure)
{
gReportErrors = nsContentUtils::GetBoolPref(CSS_ERRORS_PREF, PR_TRUE);
gReportErrors = Preferences::GetBool(CSS_ERRORS_PREF, PR_TRUE);
return NS_OK;
}
#endif

View File

@ -46,6 +46,8 @@
#include "nsRect.h"
struct nsCSSValueList;
class nsStyleContext;
class nsPresContext;
/**
* A class representing a style transformation matrix. The class actually
@ -62,8 +64,6 @@ struct nsCSSValueList;
* Note that unlike the Thebes gfxMatrix, vectors are column vectors and
* consequently the multiplication of a matrix A and a vector x is Ax, not xA.
*/
class nsStyleContext;
class nsPresContext;
class nsStyleTransformMatrix
{
public:

View File

@ -88,6 +88,7 @@
#include "prdtoa.h"
#include "mozilla/dom/Element.h"
#include "gfxUtils.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -175,7 +176,7 @@ static const char SMIL_PREF_STR[] = "svg.smil.enabled";
static int
SMILPrefChanged(const char *aPref, void *aClosure)
{
PRBool prefVal = nsContentUtils::GetBoolPref(SMIL_PREF_STR);
PRBool prefVal = Preferences::GetBool(SMIL_PREF_STR);
gSMILEnabled = prefVal;
return 0;
}
@ -187,7 +188,7 @@ NS_SMILEnabled()
if (!sInitialized) {
/* check and register ourselves with the pref */
gSMILEnabled = nsContentUtils::GetBoolPref(SMIL_PREF_STR);
gSMILEnabled = Preferences::GetBool(SMIL_PREF_STR);
nsContentUtils::RegisterPrefCallback(SMIL_PREF_STR, SMILPrefChanged, nsnull);
sInitialized = PR_TRUE;
@ -1299,7 +1300,7 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame)
if (svg) {
// It is possible to apply a gradient, pattern, clipping path, mask or
// filter to text. When one of these facilities is applied to text
// the bounding box is the entire text element in all
// the bounding box is the entire text element in all
// cases.
nsSVGTextContainerFrame* metrics = do_QueryFrame(
GetFirstNonAAncestorFrame(aFrame));

View File

@ -93,13 +93,15 @@
#include "nsEventDispatcher.h"
#include "nsIDOMEvent.h"
#include "nsIPrivateDOMEvent.h"
#include "nsContentUtils.h"
#include "nsDisplayList.h"
#include "mozilla/Preferences.h"
// Needed for Print Preview
#include "nsIDocument.h"
#include "nsIURI.h"
using namespace mozilla;
//define DEBUG_REDRAW
#define DEBUG_SPRING_SIZE 8
@ -1246,7 +1248,7 @@ nsBoxFrame::AttributeChanged(PRInt32 aNameSpaceID,
void
nsBoxFrame::GetDebugPref(nsPresContext* aPresContext)
{
gDebug = nsContentUtils::GetBoolPref("xul.debug.box");
gDebug = Preferences::GetBool("xul.debug.box");
}
class nsDisplayXULDebug : public nsDisplayItem {

View File

@ -58,6 +58,9 @@
#include "nsIDOMElement.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
/*
* nsMenuBarListener implementation
@ -120,7 +123,7 @@ void nsMenuBarListener::InitAccessKey()
#endif
// Get the menu access key value from prefs, overriding the default:
mAccessKey = nsContentUtils::GetIntPref("ui.key.menuAccessKey", mAccessKey);
mAccessKey = Preferences::GetInt("ui.key.menuAccessKey", mAccessKey);
if (mAccessKey == nsIDOMKeyEvent::DOM_VK_SHIFT)
mAccessKeyMask = MODIFIER_SHIFT;
else if (mAccessKey == nsIDOMKeyEvent::DOM_VK_CONTROL)
@ -130,8 +133,7 @@ void nsMenuBarListener::InitAccessKey()
else if (mAccessKey == nsIDOMKeyEvent::DOM_VK_META)
mAccessKeyMask = MODIFIER_META;
mAccessKeyFocuses =
nsContentUtils::GetBoolPref("ui.key.menuAccessKeyFocuses");
mAccessKeyFocuses = Preferences::GetBool("ui.key.menuAccessKeyFocuses");
}
void

View File

@ -83,6 +83,9 @@
#include "nsEventStateManager.h"
#include "nsIDOMXULMenuListElement.h"
#include "mozilla/Services.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
#define NS_MENU_POPUP_LIST_INDEX 0
@ -1118,7 +1121,7 @@ nsMenuFrame::BuildAcceleratorText(PRBool aNotify)
#endif
// Get the accelerator key value from prefs, overriding the default:
accelKey = nsContentUtils::GetIntPref("ui.key.accelKey", accelKey);
accelKey = Preferences::GetInt("ui.key.accelKey", accelKey);
}
nsAutoString modifiers;

View File

@ -86,6 +86,9 @@
#include "nsIScreenManager.h"
#include "nsIServiceManager.h"
#include "nsThemeConstants.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
PRInt8 nsMenuPopupFrame::sDefaultLevelIsTop = -1;
@ -130,7 +133,7 @@ nsMenuPopupFrame::nsMenuPopupFrame(nsIPresShell* aShell, nsStyleContext* aContex
if (sDefaultLevelIsTop >= 0)
return;
sDefaultLevelIsTop =
nsContentUtils::GetBoolPref("ui.panel.default_level_parent", PR_FALSE);
Preferences::GetBool("ui.panel.default_level_parent", PR_FALSE);
} // ctor

View File

@ -70,6 +70,9 @@
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "nsDisplayList.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
PRBool nsSliderFrame::gMiddlePref = PR_FALSE;
PRInt32 nsSliderFrame::gSnapMultiplier;
@ -117,8 +120,8 @@ nsSliderFrame::Init(nsIContent* aContent,
if (!gotPrefs) {
gotPrefs = PR_TRUE;
gMiddlePref = nsContentUtils::GetBoolPref("middlemouse.scrollbarPosition");
gSnapMultiplier = nsContentUtils::GetIntPref("slider.snapMultiplier");
gMiddlePref = Preferences::GetBool("middlemouse.scrollbarPosition");
gSnapMultiplier = Preferences::GetInt("slider.snapMultiplier");
}
mCurPos = GetCurrentPosition(aContent);

View File

@ -62,6 +62,9 @@
#endif
#include "nsIRootBox.h"
#include "nsEventDispatcher.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
nsXULTooltipListener* nsXULTooltipListener::mInstance = nsnull;
@ -323,8 +326,8 @@ int
nsXULTooltipListener::ToolbarTipsPrefChanged(const char *aPref,
void *aClosure)
{
sShowTooltips = nsContentUtils::GetBoolPref("browser.chrome.toolbar_tips",
sShowTooltips);
sShowTooltips =
Preferences::GetBool("browser.chrome.toolbar_tips", sShowTooltips);
return 0;
}

View File

@ -119,6 +119,13 @@ public:
return result;
}
static PRUint32 GetUint(const char* aPref, PRUint32 aDefault = 0)
{
PRUint32 result = aDefault;
GetUint(aPref, &result);
return result;
}
/**
* Gets int or bool type pref value with raw return value of nsIPrefBranch.
*
@ -128,6 +135,15 @@ public:
*/
static nsresult GetBool(const char* aPref, PRBool* aResult);
static nsresult GetInt(const char* aPref, PRInt32* aResult);
static nsresult GetUint(const char* aPref, PRUint32* aResult)
{
PRInt32 result;
nsresult rv = GetInt(aPref, &result);
if (NS_SUCCEEDED(rv)) {
*aResult = static_cast<PRUint32>(result);
}
return rv;
}
/**
* Gets string type pref value with raw return value of nsIPrefBranch.
@ -145,6 +161,10 @@ public:
*/
static nsresult SetBool(const char* aPref, PRBool aValue);
static nsresult SetInt(const char* aPref, PRInt32 aValue);
static nsresult SetUint(const char* aPref, PRUint32 aValue)
{
return SetInt(aPref, static_cast<PRInt32>(aValue));
}
static nsresult SetChar(const char* aPref, const char* aValue);
static nsresult SetChar(const char* aPref, const nsCString &aValue);
static nsresult SetChar(const char* aPref, const PRUnichar* aValue);

View File

@ -2660,6 +2660,7 @@ nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsRenderingContext* aContext, nsIF
nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
PRInt32& aPart, PRInt32& aState, PRBool& aFocused)
{
aFocused = PR_FALSE;
switch (aWidgetType) {
case NS_THEME_BUTTON: {
nsEventStates contentState;

View File

@ -436,6 +436,20 @@ public:
"not the nsISupports pointer we expect"); \
_class *tmp = Downcast(s);
#define NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(_class, _base_class) \
void \
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Trace(void *p, \
TraceCallback aCallback, \
void *aClosure) \
{ \
nsISupports *s = static_cast<nsISupports*>(p); \
NS_ASSERTION(CheckForRightISupports(s), \
"not the nsISupports pointer we expect"); \
_class *tmp = static_cast<_class*>(Downcast(s)); \
NS_CYCLE_COLLECTION_CLASSNAME(_base_class)::Trace(s, \
aCallback, \
aClosure);
#define NS_IMPL_CYCLE_COLLECTION_TRACE_NATIVE_BEGIN(_class) \
void \
NS_CYCLE_COLLECTION_CLASSNAME(_class)::Trace(void *p, \