Merge mc->Maple, resolved conflicts
|
@ -1,165 +0,0 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* Command Updater
|
||||
*/
|
||||
let CommandUpdater = {
|
||||
/**
|
||||
* Gets a controller that can handle a particular command.
|
||||
* @param {string} command
|
||||
* A command to locate a controller for, preferring controllers that
|
||||
* show the command as enabled.
|
||||
* @return {object} In this order of precedence:
|
||||
* - the first controller supporting the specified command
|
||||
* associated with the focused element that advertises the
|
||||
* command as ENABLED.
|
||||
* - the first controller supporting the specified command
|
||||
* associated with the global window that advertises the
|
||||
* command as ENABLED.
|
||||
* - the first controller supporting the specified command
|
||||
* associated with the focused element.
|
||||
* - the first controller supporting the specified command
|
||||
* associated with the global window.
|
||||
*/
|
||||
_getControllerForCommand: function(command) {
|
||||
try {
|
||||
let commandDispatcher = top.document.commandDispatcher;
|
||||
let controller = commandDispatcher.getControllerForCommand(command);
|
||||
if (controller && controller.isCommandEnabled(command))
|
||||
return controller;
|
||||
}
|
||||
catch (e) { }
|
||||
|
||||
let controllerCount = window.controllers.getControllerCount();
|
||||
for (let i = 0; i < controllerCount; ++i) {
|
||||
let current = window.controllers.getControllerAt(i);
|
||||
try {
|
||||
if (current.supportsCommand(command) &&
|
||||
current.isCommandEnabled(command))
|
||||
return current;
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
return controller || window.controllers.getControllerForCommand(command);
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the state of a XUL <command> element for the specified command
|
||||
* depending on its state.
|
||||
* @param {string} command
|
||||
* The name of the command to update the XUL <command> element for.
|
||||
*/
|
||||
updateCommand: function(command) {
|
||||
let enabled = false;
|
||||
try {
|
||||
let controller = this._getControllerForCommand(command);
|
||||
if (controller) {
|
||||
enabled = controller.isCommandEnabled(command);
|
||||
}
|
||||
}
|
||||
catch (ex) { }
|
||||
|
||||
this.enableCommand(command, enabled);
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the state of a XUL <command> element for the specified command
|
||||
* depending on its state.
|
||||
* @param {string} command
|
||||
* The name of the command to update the XUL <command> element for.
|
||||
*/
|
||||
updateCommands: function(_commands) {
|
||||
let commands = _commands.split(',');
|
||||
for (let command in commands) {
|
||||
this.updateCommand(commands[command]);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Enables or disables a XUL <command> element.
|
||||
* @param {string} command
|
||||
* The name of the command to enable or disable.
|
||||
* @param {bool} enabled
|
||||
* true if the command should be enabled, false otherwise.
|
||||
*/
|
||||
enableCommand: function(command, enabled) {
|
||||
let element = document.getElementById(command);
|
||||
if (!element)
|
||||
return;
|
||||
|
||||
if (enabled)
|
||||
element.removeAttribute('disabled');
|
||||
else
|
||||
element.setAttribute('disabled', 'true');
|
||||
},
|
||||
|
||||
/**
|
||||
* Performs the action associated with a specified command using the most
|
||||
* relevant controller.
|
||||
* @param {string} command
|
||||
* The command to perform.
|
||||
*/
|
||||
doCommand: function(command) {
|
||||
let controller = this._getControllerForCommand(command);
|
||||
if (!controller)
|
||||
return;
|
||||
controller.doCommand(command);
|
||||
},
|
||||
|
||||
/**
|
||||
* Changes the label attribute for the specified command.
|
||||
* @param {string} command
|
||||
* The command to update.
|
||||
* @param {string} labelAttribute
|
||||
* The label value to use.
|
||||
*/
|
||||
setMenuValue: function(command, labelAttribute) {
|
||||
let commandNode = top.document.getElementById(command);
|
||||
if (commandNode) {
|
||||
let label = commandNode.getAttribute(labelAttribute);
|
||||
if (label)
|
||||
commandNode.setAttribute('label', label);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Changes the accesskey attribute for the specified command.
|
||||
* @param {string} command
|
||||
* The command to update.
|
||||
* @param {string} valueAttribute
|
||||
* The value attribute to use.
|
||||
*/
|
||||
setAccessKey: function(command, valueAttribute) {
|
||||
let commandNode = top.document.getElementById(command);
|
||||
if (commandNode) {
|
||||
let value = commandNode.getAttribute(valueAttribute);
|
||||
if (value)
|
||||
commandNode.setAttribute('accesskey', value);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Inform all the controllers attached to a node that an event has occurred
|
||||
* (e.g. the tree controllers need to be informed of blur events so that they
|
||||
* can change some of the menu items back to their default values)
|
||||
* @param {node} node
|
||||
* The node receiving the event.
|
||||
* @param {event} event
|
||||
* The event.
|
||||
*/
|
||||
onEvent: function(node, event) {
|
||||
let numControllers = node.controllers.getControllerCount();
|
||||
let controller;
|
||||
|
||||
for (let i = 0; i < numControllers; i++) {
|
||||
controller = node.controllers.getControllerAt(i);
|
||||
if (controller)
|
||||
controller.onEvent(event);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -33,11 +33,15 @@ XPCOMUtils.defineLazyGetter(Services, 'idle', function() {
|
|||
.getService(Ci.nsIIdleService);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'fm', function(){
|
||||
return Cc['@mozilla.org/focus-managr;1']
|
||||
.getService(Ci.nsFocusManager);
|
||||
XPCOMUtils.defineLazyGetter(Services, 'audioManager', function() {
|
||||
return Cc['@mozilla.org/telephony/audiomanager;1']
|
||||
.getService(Ci.nsIAudioManager);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'fm', function() {
|
||||
return Cc['@mozilla.org/focus-manager;1']
|
||||
.getService(Ci.nsFocusManager);
|
||||
});
|
||||
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
// In order to use http:// scheme instead of file:// scheme
|
||||
|
@ -74,9 +78,6 @@ function addPermissions(urls) {
|
|||
}
|
||||
|
||||
var shell = {
|
||||
// FIXME/bug 678695: this should be a system setting
|
||||
preferredScreenBrightness: 1.0,
|
||||
|
||||
isDebug: false,
|
||||
|
||||
get contentBrowser() {
|
||||
|
@ -111,13 +112,23 @@ var shell = {
|
|||
return alert(msg);
|
||||
}
|
||||
|
||||
window.controllers.appendController(this);
|
||||
window.addEventListener('keypress', this);
|
||||
['keydown', 'keypress', 'keyup'].forEach((function listenKey(type) {
|
||||
window.addEventListener(type, this, false, true);
|
||||
window.addEventListener(type, this, true, true);
|
||||
}).bind(this));
|
||||
|
||||
window.addEventListener('MozApplicationManifest', this);
|
||||
window.addEventListener("AppCommand", this);
|
||||
window.addEventListener('mozfullscreenchange', this);
|
||||
this.contentBrowser.addEventListener('load', this, true);
|
||||
|
||||
// Until the volume can be set from the content side, set it to a
|
||||
// a specific value when the device starts. This way the front-end
|
||||
// can display a notification when the volume change and show a volume
|
||||
// level modified from this point.
|
||||
try {
|
||||
Services.audioManager.masterVolume = 0.5;
|
||||
} catch(e) {}
|
||||
|
||||
try {
|
||||
Services.io.offline = false;
|
||||
|
||||
|
@ -159,35 +170,8 @@ var shell = {
|
|||
},
|
||||
|
||||
stop: function shell_stop() {
|
||||
window.controllers.removeController(this);
|
||||
window.removeEventListener('keypress', this);
|
||||
window.removeEventListener('MozApplicationManifest', this);
|
||||
window.removeEventListener('AppCommand', this);
|
||||
},
|
||||
|
||||
supportsCommand: function shell_supportsCommand(cmd) {
|
||||
let isSupported = false;
|
||||
switch (cmd) {
|
||||
case 'cmd_close':
|
||||
isSupported = true;
|
||||
break;
|
||||
default:
|
||||
isSupported = false;
|
||||
break;
|
||||
}
|
||||
return isSupported;
|
||||
},
|
||||
|
||||
isCommandEnabled: function shell_isCommandEnabled(cmd) {
|
||||
return true;
|
||||
},
|
||||
|
||||
doCommand: function shell_doCommand(cmd) {
|
||||
switch (cmd) {
|
||||
case 'cmd_close':
|
||||
content.postMessage('appclose', '*');
|
||||
break;
|
||||
}
|
||||
window.removeEventListener('mozfullscreenchange', this);
|
||||
},
|
||||
|
||||
toggleDebug: function shell_toggleDebug() {
|
||||
|
@ -202,9 +186,7 @@ var shell = {
|
|||
}
|
||||
},
|
||||
|
||||
changeVolume: function shell_changeVolume(aDelta) {
|
||||
let audioManager = Cc["@mozilla.org/telephony/audiomanager;1"].getService(Ci.nsIAudioManager);
|
||||
|
||||
changeVolume: function shell_changeVolume(delta) {
|
||||
let steps = 10;
|
||||
try {
|
||||
steps = Services.prefs.getIntPref("media.volume.steps");
|
||||
|
@ -212,7 +194,11 @@ var shell = {
|
|||
steps = 1;
|
||||
} catch(e) {}
|
||||
|
||||
let volume = audioManager.masterVolume + aDelta / steps;
|
||||
let audioManager = Services.audioManager;
|
||||
if (!audioManager)
|
||||
return;
|
||||
|
||||
let volume = audioManager.masterVolume + delta / steps;
|
||||
if (volume > 1)
|
||||
volume = 1;
|
||||
if (volume < 0)
|
||||
|
@ -220,44 +206,58 @@ var shell = {
|
|||
audioManager.masterVolume = volume;
|
||||
},
|
||||
|
||||
forwardKeyToHomescreen: function shell_forwardKeyToHomescreen(evt) {
|
||||
let generatedEvent = content.document.createEvent('KeyboardEvent');
|
||||
generatedEvent.initKeyEvent(evt.type, true, true, evt.view, evt.ctrlKey,
|
||||
evt.altKey, evt.shiftKey, evt.metaKey,
|
||||
evt.keyCode, evt.charCode);
|
||||
|
||||
content.dispatchEvent(generatedEvent);
|
||||
},
|
||||
|
||||
handleEvent: function shell_handleEvent(evt) {
|
||||
switch (evt.type) {
|
||||
case 'keydown':
|
||||
case 'keyup':
|
||||
case 'keypress':
|
||||
switch (evt.keyCode) {
|
||||
case evt.DOM_VK_HOME:
|
||||
this.sendEvent(content, 'home');
|
||||
break;
|
||||
case evt.DOM_VK_SLEEP:
|
||||
this.toggleScreen();
|
||||
|
||||
let details = {
|
||||
'enabled': screen.mozEnabled
|
||||
};
|
||||
this.sendEvent(content, 'sleep', details);
|
||||
break;
|
||||
case evt.DOM_VK_ESCAPE:
|
||||
if (evt.defaultPrevented)
|
||||
return;
|
||||
this.doCommand('cmd_close');
|
||||
break;
|
||||
// If the home key is pressed, always forward it to the homescreen
|
||||
if (evt.eventPhase == evt.CAPTURING_PHASE) {
|
||||
if (evt.keyCode == evt.VK_DOM_HOME) {
|
||||
window.setTimeout(this.forwardKeyToHomescreen, 0, evt);
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 'AppCommand':
|
||||
switch (evt.command) {
|
||||
case 'Menu':
|
||||
if (Services.prefs.getBoolPref('b2g.keys.menu.enabled'))
|
||||
this.sendEvent(content, 'menu');
|
||||
break;
|
||||
case 'Search':
|
||||
if (Services.prefs.getBoolPref('b2g.keys.search.enabled'))
|
||||
this.toggleDebug();
|
||||
break;
|
||||
case 'VolumeUp':
|
||||
this.changeVolume(1);
|
||||
break;
|
||||
case 'VolumeDown':
|
||||
this.changeVolume(-1);
|
||||
break;
|
||||
|
||||
// If one of the other keys is used in an application and is
|
||||
// cancelled via preventDefault, do nothing.
|
||||
let homescreen = (evt.target.ownerDocument.defaultView == content);
|
||||
if (!homescreen && evt.defaultPrevented)
|
||||
return;
|
||||
|
||||
// If one of the other keys is used in an application and is
|
||||
// not used forward it to the homescreen
|
||||
if (!homescreen)
|
||||
window.setTimeout(this.forwardKeyToHomescreen, 0, evt);
|
||||
|
||||
// For debug purposes and because some of the APIs are not yet exposed
|
||||
// to the content, let's react on some of the keyup events.
|
||||
if (evt.type == 'keyup') {
|
||||
switch (evt.keyCode) {
|
||||
case evt.DOM_VK_F5:
|
||||
if (Services.prefs.getBoolPref('b2g.keys.search.enabled'))
|
||||
this.toggleDebug();
|
||||
break;
|
||||
|
||||
case evt.DOM_VK_PAGE_DOWN:
|
||||
this.changeVolume(-1);
|
||||
break;
|
||||
|
||||
case evt.DOM_VK_PAGE_UP:
|
||||
this.changeVolume(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -270,7 +270,6 @@ var shell = {
|
|||
break;
|
||||
case 'load':
|
||||
this.contentBrowser.removeEventListener('load', this, true);
|
||||
this.turnScreenOn();
|
||||
|
||||
let chromeWindow = window.QueryInterface(Ci.nsIDOMChromeWindow);
|
||||
chromeWindow.browserDOMWindow = new nsBrowserAccess();
|
||||
|
@ -317,20 +316,6 @@ var shell = {
|
|||
let event = content.document.createEvent('CustomEvent');
|
||||
event.initCustomEvent(type, true, true, details ? details : {});
|
||||
content.dispatchEvent(event);
|
||||
},
|
||||
toggleScreen: function shell_toggleScreen() {
|
||||
if (screen.mozEnabled)
|
||||
this.turnScreenOff();
|
||||
else
|
||||
this.turnScreenOn();
|
||||
},
|
||||
turnScreenOff: function shell_turnScreenOff() {
|
||||
screen.mozEnabled = false;
|
||||
screen.mozBrightness = 0.0;
|
||||
},
|
||||
turnScreenOn: function shell_turnScreenOn() {
|
||||
screen.mozEnabled = true;
|
||||
screen.mozBrightness = this.preferredScreenBrightness;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -339,7 +324,7 @@ var shell = {
|
|||
observe: function(subject, topic, time) {
|
||||
if (topic === "idle") {
|
||||
// TODO: Check wakelock status. See bug 697132.
|
||||
shell.turnScreenOff();
|
||||
screen.mozEnabled = false;
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
onload="shell.start();"
|
||||
onunload="shell.stop();">
|
||||
|
||||
<script type="application/javascript" src="chrome://browser/content/commandUtil.js"/>
|
||||
<script type="application/javascript" src="chrome://browser/content/shell.js"/>
|
||||
#ifndef MOZ_TOUCH
|
||||
<script type="application/javascript" src="chrome://browser/content/touch.js"/>
|
||||
|
@ -24,10 +23,6 @@
|
|||
<script type="application/javascript" src="chrome://browser/content/httpd.js"/>
|
||||
#endif
|
||||
|
||||
<commandset id="mainCommandSet">
|
||||
<command id="cmd_close" oncommand="CommandUpdater.doCommand(this.id);"/>
|
||||
</commandset>
|
||||
|
||||
<browser id="homescreen"
|
||||
type="content-primary"
|
||||
flex="1"
|
||||
|
|
|
@ -9,7 +9,6 @@ chrome.jar:
|
|||
#ifndef MOZ_TOUCH
|
||||
content/touch.js (content/touch.js)
|
||||
#endif
|
||||
content/commandUtil.js (content/commandUtil.js)
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
content/httpd.js (content/httpd.js)
|
||||
#endif
|
||||
|
@ -22,4 +21,4 @@ chrome.jar:
|
|||
content/netError.css (content/netError.css)
|
||||
content/images/errorpage-larry-black.png (content/images/errorpage-larry-black.png)
|
||||
content/images/errorpage-larry-white.png (content/images/errorpage-larry-white.png)
|
||||
content/images/errorpage-warning.png (content/images/errorpage-warning.png)
|
||||
content/images/errorpage-warning.png (content/images/errorpage-warning.png)
|
||||
|
|
|
@ -320,6 +320,8 @@ pref("browser.urlbar.default.behavior", 0);
|
|||
pref("browser.urlbar.formatting.enabled", true);
|
||||
pref("browser.urlbar.trimURLs", true);
|
||||
|
||||
pref("browser.altClickSave", false);
|
||||
|
||||
// Number of milliseconds to wait for the http headers (and thus
|
||||
// the Content-Disposition filename) before giving up and falling back to
|
||||
// picking a filename without that info in hand so that the user sees some
|
||||
|
|
|
@ -48,6 +48,9 @@
|
|||
<!ENTITY % syncSetupDTD
|
||||
SYSTEM "chrome://browser/locale/syncSetup.dtd">
|
||||
%syncSetupDTD;
|
||||
<!ENTITY % globalDTD
|
||||
SYSTEM "chrome://global/locale/global.dtd">
|
||||
%globalDTD;
|
||||
]>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
@ -63,7 +66,7 @@
|
|||
<script type="text/javascript;version=1.8"
|
||||
src="chrome://browser/content/sync/progress.js"/>
|
||||
</head>
|
||||
<body onload="onLoad(event)" onunload="onUnload(event)">
|
||||
<body onload="onLoad(event)" onunload="onUnload(event)" dir="&locale.dir;">
|
||||
<title>&setup.successPage.title;</title>
|
||||
<div id="floatingBox" class="main-content">
|
||||
<div id="title">
|
||||
|
|
|
@ -93,7 +93,6 @@ endif
|
|||
# browser_drag.js is disabled, as it needs to be updated for the new behavior from bug 320638.
|
||||
|
||||
# browser_bug321000.js is disabled because newline handling is shaky (bug 592528)
|
||||
# browser_urlbarAutoFillTrimURLs.js is disabled till bug 720792 is fixed
|
||||
|
||||
_BROWSER_FILES = \
|
||||
head.js \
|
||||
|
@ -223,6 +222,7 @@ _BROWSER_FILES = \
|
|||
browser_tabfocus.js \
|
||||
browser_tabs_isActive.js \
|
||||
browser_tabs_owner.js \
|
||||
browser_urlbarAutoFillTrimURLs.js \
|
||||
browser_urlbarCopying.js \
|
||||
browser_urlbarEnter.js \
|
||||
browser_urlbarRevert.js \
|
||||
|
|
|
@ -73,8 +73,12 @@ let gTests = [
|
|||
// just be like Alt click.
|
||||
{
|
||||
desc: "Shift+Alt left click",
|
||||
setup: function() {},
|
||||
clean: function() {},
|
||||
setup: function() {
|
||||
gPrefService.setBoolPref("browser.altClickSave", true);
|
||||
},
|
||||
clean: function() {
|
||||
gPrefService.clearUserPref("browser.altClickSave");
|
||||
},
|
||||
event: { shiftKey: true,
|
||||
altKey: true },
|
||||
targets: [ "commonlink", "maplink" ],
|
||||
|
@ -84,8 +88,12 @@ let gTests = [
|
|||
|
||||
{
|
||||
desc: "Shift+Alt left click on XLinks",
|
||||
setup: function() {},
|
||||
clean: function() {},
|
||||
setup: function() {
|
||||
gPrefService.setBoolPref("browser.altClickSave", true);
|
||||
},
|
||||
clean: function() {
|
||||
gPrefService.clearUserPref("browser.altClickSave");
|
||||
},
|
||||
event: { shiftKey: true,
|
||||
altKey: true },
|
||||
targets: [ "mathxlink", "svgxlink"],
|
||||
|
@ -105,8 +113,12 @@ let gTests = [
|
|||
|
||||
{
|
||||
desc: "Alt click",
|
||||
setup: function() {},
|
||||
clean: function() {},
|
||||
setup: function() {
|
||||
gPrefService.setBoolPref("browser.altClickSave", true);
|
||||
},
|
||||
clean: function() {
|
||||
gPrefService.clearUserPref("browser.altClickSave");
|
||||
},
|
||||
event: { altKey: true },
|
||||
targets: [ "commonlink", "maplink" ],
|
||||
expectedInvokedMethods: [ "gatherTextUnder", "saveURL" ],
|
||||
|
@ -115,8 +127,12 @@ let gTests = [
|
|||
|
||||
{
|
||||
desc: "Alt click on XLinks",
|
||||
setup: function() {},
|
||||
clean: function() {},
|
||||
setup: function() {
|
||||
gPrefService.setBoolPref("browser.altClickSave", true);
|
||||
},
|
||||
clean: function() {
|
||||
gPrefService.clearUserPref("browser.altClickSave");
|
||||
},
|
||||
event: { altKey: true },
|
||||
targets: [ "mathxlink", "svgxlink" ],
|
||||
expectedInvokedMethods: [ "saveURL" ],
|
||||
|
@ -149,9 +165,7 @@ let gTests = [
|
|||
gPrefService.setBoolPref("browser.tabs.opentabfor.middleclick", false);
|
||||
},
|
||||
clean: function() {
|
||||
try {
|
||||
gPrefService.clearUserPref("browser.tabs.opentabfor.middleclick");
|
||||
} catch(ex) {}
|
||||
gPrefService.clearUserPref("browser.tabs.opentabfor.middleclick");
|
||||
},
|
||||
event: { button: 1 },
|
||||
targets: [ "commonlink", "mathxlink", "svgxlink", "maplink" ],
|
||||
|
@ -166,12 +180,8 @@ let gTests = [
|
|||
gPrefService.setBoolPref("general.autoScroll", false);
|
||||
},
|
||||
clean: function() {
|
||||
try {
|
||||
gPrefService.clearUserPref("middlemouse.contentLoadURL");
|
||||
} catch(ex) {}
|
||||
try {
|
||||
gPrefService.clearUserPref("general.autoScroll");
|
||||
} catch(ex) {}
|
||||
gPrefService.clearUserPref("middlemouse.contentLoadURL");
|
||||
gPrefService.clearUserPref("general.autoScroll");
|
||||
},
|
||||
event: { button: 1 },
|
||||
targets: [ "emptylink" ],
|
||||
|
|
|
@ -9,6 +9,12 @@ let gFocusManager = Cc["@mozilla.org/focus-manager;1"].
|
|||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
Services.prefs.clearUserPref("browser.altClickSave");
|
||||
});
|
||||
Services.prefs.setBoolPref("browser.altClickSave", true);
|
||||
|
||||
runAltLeftClickTest();
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ function whereToOpenLink( e, ignoreButton, ignoreAlt )
|
|||
#endif
|
||||
return shift ? "tabshifted" : "tab";
|
||||
|
||||
if (alt)
|
||||
if (alt && getBoolPref("browser.altClickSave", false))
|
||||
return "save";
|
||||
|
||||
if (shift || (middle && !middleUsesTabs))
|
||||
|
|
|
@ -150,35 +150,35 @@ DebuggerView.Stackframes = {
|
|||
*
|
||||
* @param number aDepth
|
||||
* The frame depth specified by the debugger.
|
||||
* @param string aFrameIdText
|
||||
* The id to be displayed in the list.
|
||||
* @param string aFrameNameText
|
||||
* The name to be displayed in the list.
|
||||
* @param string aFrameDetailsText
|
||||
* The details to be displayed in the list.
|
||||
* @return object
|
||||
* The newly created html node representing the added frame.
|
||||
*/
|
||||
addFrame: function DVF_addFrame(aDepth, aFrameIdText, aFrameNameText) {
|
||||
addFrame: function DVF_addFrame(aDepth, aFrameNameText, aFrameDetailsText) {
|
||||
// make sure we don't duplicate anything
|
||||
if (document.getElementById("stackframe-" + aDepth)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let frame = document.createElement("div");
|
||||
let frameId = document.createElement("span");
|
||||
let frameName = document.createElement("span");
|
||||
let frameDetails = document.createElement("span");
|
||||
|
||||
// create a list item to be added to the stackframes container
|
||||
frame.id = "stackframe-" + aDepth;
|
||||
frame.className = "dbg-stackframe list-item";
|
||||
|
||||
// this list should display the id and name of the frame
|
||||
frameId.className = "dbg-stackframe-id";
|
||||
// this list should display the name and details for the frame
|
||||
frameName.className = "dbg-stackframe-name";
|
||||
frameId.appendChild(document.createTextNode(aFrameIdText));
|
||||
frameDetails.className = "dbg-stackframe-details";
|
||||
frameName.appendChild(document.createTextNode(aFrameNameText));
|
||||
frameDetails.appendChild(document.createTextNode(aFrameDetailsText));
|
||||
|
||||
frame.appendChild(frameId);
|
||||
frame.appendChild(frameName);
|
||||
frame.appendChild(frameDetails);
|
||||
|
||||
this._frames.appendChild(frame);
|
||||
|
||||
|
@ -1074,6 +1074,7 @@ DebuggerView.Scripts = {
|
|||
*
|
||||
* @param string aUrl
|
||||
* The script URL.
|
||||
* @return boolean
|
||||
*/
|
||||
contains: function DVS_contains(aUrl) {
|
||||
if (this._scripts.getElementsByAttribute("value", aUrl).length > 0) {
|
||||
|
@ -1082,6 +1083,21 @@ DebuggerView.Scripts = {
|
|||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks whether the script with the specified label is among the scripts
|
||||
* known to the debugger and shown in the list.
|
||||
*
|
||||
* @param string aLabel
|
||||
* The script label.
|
||||
* @return boolean
|
||||
*/
|
||||
containsLabel: function DVS_containsLabel(aLabel) {
|
||||
if (this._scripts.getElementsByAttribute("label", aLabel).length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks whether the script with the specified URL is selected in the list.
|
||||
*
|
||||
|
@ -1109,30 +1125,30 @@ DebuggerView.Scripts = {
|
|||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds a script to the scripts container.
|
||||
* If the script already exists (was previously added), null is returned.
|
||||
* Otherwise, the newly created element is returned.
|
||||
*
|
||||
* @param string aUrl
|
||||
* The script url.
|
||||
* @param string aLabel
|
||||
* The simplified script location to be shown.
|
||||
* @param string aScript
|
||||
* The source script.
|
||||
* @param string aScriptNameText
|
||||
* Optional, title displayed instead of url.
|
||||
* @return object
|
||||
* The newly created html node representing the added script.
|
||||
*/
|
||||
addScript: function DVS_addScript(aUrl, aSource, aScriptNameText) {
|
||||
addScript: function DVS_addScript(aLabel, aScript) {
|
||||
// make sure we don't duplicate anything
|
||||
if (this.contains(aUrl)) {
|
||||
if (this.containsLabel(aLabel)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let script = this._scripts.appendItem(aScriptNameText || aUrl, aUrl);
|
||||
script.setUserData("sourceScript", aSource, null);
|
||||
let script = this._scripts.appendItem(aLabel, aScript.url);
|
||||
script.setAttribute("tooltiptext", aScript.url);
|
||||
script.setUserData("sourceScript", aScript, null);
|
||||
|
||||
this._scripts.selectedItem = script;
|
||||
return script;
|
||||
},
|
||||
|
|
|
@ -67,6 +67,26 @@
|
|||
overflow: auto;
|
||||
}
|
||||
|
||||
.dbg-stackframe {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dbg-stackframe-name {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.dbg-stackframe-details {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.dbg-stackframe-name:-moz-locale-dir(rtl) {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.dbg-stackframe-details:-moz-locale-dir(rtl) {
|
||||
float: left;
|
||||
}
|
||||
|
||||
/**
|
||||
* Properties elements
|
||||
*/
|
||||
|
|
|
@ -370,10 +370,12 @@ var StackFrames = {
|
|||
*/
|
||||
_addFramePanel: function SF_addFramePanel(aFrame) {
|
||||
let depth = aFrame.depth;
|
||||
let idText = "#" + aFrame.depth + " ";
|
||||
let nameText = this._frameTitle(aFrame);
|
||||
let label = SourceScripts._getScriptLabel(aFrame.where.url);
|
||||
|
||||
let panel = DebuggerView.Stackframes.addFrame(depth, idText, nameText);
|
||||
let startText = this._frameTitle(aFrame);
|
||||
let endText = label + ":" + aFrame.where.line;
|
||||
|
||||
let panel = DebuggerView.Stackframes.addFrame(depth, startText, endText);
|
||||
|
||||
if (panel) {
|
||||
panel.stackFrame = aFrame;
|
||||
|
@ -397,7 +399,7 @@ var StackFrames = {
|
|||
*/
|
||||
_frameTitle: function SF_frameTitle(aFrame) {
|
||||
if (aFrame.type == "call") {
|
||||
return aFrame["calleeName"] ? aFrame["calleeName"] + "()" : "(anonymous)";
|
||||
return aFrame["calleeName"] ? aFrame["calleeName"] : "(anonymous)";
|
||||
}
|
||||
|
||||
return "(" + aFrame.type + ")";
|
||||
|
@ -416,6 +418,7 @@ StackFrames.onClick = StackFrames.onClick.bind(StackFrames);
|
|||
var SourceScripts = {
|
||||
pageSize: 25,
|
||||
activeThread: null,
|
||||
_labelsCache: null,
|
||||
|
||||
/**
|
||||
* Watch a given thread client.
|
||||
|
@ -431,6 +434,7 @@ var SourceScripts = {
|
|||
aThreadClient.addListener("paused", this.onPaused);
|
||||
aThreadClient.addListener("scriptsadded", this.onScripts);
|
||||
aThreadClient.addListener("scriptscleared", this.onScriptsCleared);
|
||||
this.clearLabelsCache();
|
||||
this.onScriptsCleared();
|
||||
aCallback && aCallback();
|
||||
},
|
||||
|
@ -509,26 +513,86 @@ var SourceScripts = {
|
|||
return;
|
||||
}
|
||||
|
||||
let url = aUrl;
|
||||
// Trim the query part.
|
||||
let q = url.indexOf('?');
|
||||
if (q > -1) {
|
||||
url = url.slice(0, q);
|
||||
}
|
||||
|
||||
if (url.slice(-3) == ".js") {
|
||||
if (this._trimUrlQuery(aUrl).slice(-3) == ".js") {
|
||||
window.editor.setMode(SourceEditor.MODES.JAVASCRIPT);
|
||||
} else {
|
||||
window.editor.setMode(SourceEditor.MODES.HTML);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Trims the query part of a url string, if necessary.
|
||||
*
|
||||
* @param string aUrl
|
||||
* The script url.
|
||||
* @return string
|
||||
*/
|
||||
_trimUrlQuery: function SS_trimUrlQuery(aUrl) {
|
||||
let q = aUrl.indexOf('?');
|
||||
if (q > -1) {
|
||||
return aUrl.slice(0, q);
|
||||
}
|
||||
return aUrl;
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets a unique, simplified label from a script url.
|
||||
* ex: a). ici://some.address.com/random/subrandom/
|
||||
* b). ni://another.address.org/random/subrandom/page.html
|
||||
* c). san://interesting.address.gro/random/script.js
|
||||
* d). si://interesting.address.moc/random/another/script.js
|
||||
* =>
|
||||
* a). subrandom/
|
||||
* b). page.html
|
||||
* c). script.js
|
||||
* d). another/script.js
|
||||
*
|
||||
* @param string aUrl
|
||||
* The script url.
|
||||
* @param string aHref
|
||||
* The content location href to be used. If unspecified, it will
|
||||
* defalult to debugged panrent window location.
|
||||
* @return string
|
||||
* The simplified label.
|
||||
*/
|
||||
_getScriptLabel: function SS_getScriptLabel(aUrl, aHref) {
|
||||
let url = this._trimUrlQuery(aUrl);
|
||||
|
||||
if (this._labelsCache[url]) {
|
||||
return this._labelsCache[url];
|
||||
}
|
||||
|
||||
let href = aHref || window.parent.content.location.href;
|
||||
let pathElements = url.split("/");
|
||||
let label = pathElements.pop() || (pathElements.pop() + "/");
|
||||
|
||||
// if the label as a leaf name is alreay present in the scripts list
|
||||
if (DebuggerView.Scripts.containsLabel(label)) {
|
||||
label = url.replace(href.substring(0, href.lastIndexOf("/") + 1), "");
|
||||
|
||||
// if the path/to/script is exactly the same, we're in different domains
|
||||
if (DebuggerView.Scripts.containsLabel(label)) {
|
||||
label = url;
|
||||
}
|
||||
}
|
||||
|
||||
return this._labelsCache[url] = label;
|
||||
},
|
||||
|
||||
/**
|
||||
* Clears the labels cache, populated by SS_getScriptLabel().
|
||||
* This should be done every time the content location changes.
|
||||
*/
|
||||
clearLabelsCache: function SS_clearLabelsCache() {
|
||||
this._labelsCache = {};
|
||||
},
|
||||
|
||||
/**
|
||||
* Add the specified script to the list and display it in the editor if the
|
||||
* editor is empty.
|
||||
*/
|
||||
_addScript: function SS_addScript(aScript) {
|
||||
DebuggerView.Scripts.addScript(aScript.url, aScript);
|
||||
DebuggerView.Scripts.addScript(this._getScriptLabel(aScript.url), aScript);
|
||||
|
||||
if (window.editor.getCharCount() == 0) {
|
||||
this._showScript(aScript);
|
||||
|
|
|
@ -10,9 +10,7 @@ var gTab = null;
|
|||
var gDebuggee = null;
|
||||
var gDebugger = null;
|
||||
|
||||
const DEBUGGER_TAB_URL = "http://example.com/browser/browser/devtools/" +
|
||||
"debugger/test/" +
|
||||
"browser_dbg_debuggerstatement.html";
|
||||
const DEBUGGER_TAB_URL = EXAMPLE_URL + "browser_dbg_debuggerstatement.html";
|
||||
|
||||
function test() {
|
||||
debug_tab_pane(DEBUGGER_TAB_URL, function(aTab, aDebuggee, aPane) {
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
|
||||
var gClient = null;
|
||||
var gTab = null;
|
||||
const DEBUGGER_TAB_URL = "http://example.com/browser/browser/devtools/" +
|
||||
"debugger/test/" +
|
||||
"browser_dbg_debuggerstatement.html";
|
||||
const DEBUGGER_TAB_URL = EXAMPLE_URL + "browser_dbg_debuggerstatement.html";
|
||||
|
||||
function test()
|
||||
{
|
||||
|
|
|
@ -83,7 +83,60 @@ function testSimpleCall() {
|
|||
|
||||
function resumeAndFinish() {
|
||||
gDebugger.StackFrames.activeThread.resume(function() {
|
||||
removeTab(gTab);
|
||||
finish();
|
||||
let vs = gDebugger.DebuggerView.Scripts;
|
||||
let ss = gDebugger.SourceScripts;
|
||||
|
||||
is(ss._trimUrlQuery("a/b/c.d?test=1&random=4"), "a/b/c.d",
|
||||
"Trimming the url query isn't done properly.");
|
||||
|
||||
let urls = [
|
||||
{ href: "ici://some.address.com/random/", leaf: "subrandom/" },
|
||||
{ href: "ni://another.address.org/random/subrandom/", leaf: "page.html" },
|
||||
{ href: "san://interesting.address.gro/random/", leaf: "script.js" },
|
||||
{ href: "si://interesting.address.moc/random/", leaf: "script.js" },
|
||||
{ href: "si://interesting.address.moc/random/", leaf: "x/script.js" },
|
||||
{ href: "si://interesting.address.moc/random/", leaf: "x/y/script.js?a=1" },
|
||||
{ href: "si://interesting.address.moc/random/x/", leaf: "y/script.js?a=1&b=2" },
|
||||
{ href: "si://interesting.address.moc/random/x/y/", leaf: "script.js?a=1&b=2&c=3" }
|
||||
];
|
||||
|
||||
vs._scripts.removeEventListener("select", vs._onScriptsChange, false);
|
||||
|
||||
urls.forEach(function(url) {
|
||||
executeSoon(function() {
|
||||
let loc = url.href + url.leaf;
|
||||
vs.addScript(ss._getScriptLabel(loc, url.href), { url: loc });
|
||||
});
|
||||
});
|
||||
|
||||
executeSoon(function() {
|
||||
for (let i = 0; i < vs._scripts.itemCount; i++) {
|
||||
let lab = vs._scripts.getItemAtIndex(i).getAttribute("label");
|
||||
let loc = urls[i].href + urls[i].leaf;
|
||||
|
||||
info("label: " + i + " " + lab);
|
||||
ok(vs.contains(loc), "Script url is incorrect: " + loc);
|
||||
}
|
||||
|
||||
ok(gDebugger.DebuggerView.Scripts.containsLabel("subrandom/"),
|
||||
"Script (0) label is incorrect.");
|
||||
ok(gDebugger.DebuggerView.Scripts.containsLabel("page.html"),
|
||||
"Script (1) label is incorrect.");
|
||||
ok(gDebugger.DebuggerView.Scripts.containsLabel("script.js"),
|
||||
"Script (2) label is incorrect.");
|
||||
ok(gDebugger.DebuggerView.Scripts.containsLabel("si://interesting.address.moc/random/script.js"),
|
||||
"Script (3) label is incorrect.");
|
||||
ok(gDebugger.DebuggerView.Scripts.containsLabel("x/script.js"),
|
||||
"Script (4) label is incorrect.");
|
||||
ok(gDebugger.DebuggerView.Scripts.containsLabel("x/y/script.js"),
|
||||
"Script (5) label is incorrect.");
|
||||
|
||||
is(vs._scripts.itemCount, 6,
|
||||
"Got too many script items in the list!");
|
||||
|
||||
|
||||
removeTab(gTab);
|
||||
finish();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
* Make sure that the property view displays function parameters.
|
||||
*/
|
||||
|
||||
const TAB_URL = "http://example.com/browser/browser/devtools/debugger/test/" +
|
||||
"browser_dbg_frame-parameters.html";
|
||||
const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html";
|
||||
|
||||
var gPane = null;
|
||||
var gTab = null;
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
* Make sure that the property view displays the properties of objects.
|
||||
*/
|
||||
|
||||
const TAB_URL = "http://example.com/browser/browser/devtools/debugger/test/" +
|
||||
"browser_dbg_frame-parameters.html";
|
||||
const TAB_URL = EXAMPLE_URL + "browser_dbg_frame-parameters.html";
|
||||
|
||||
var gPane = null;
|
||||
var gTab = null;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* Make sure that switching the displayed script in the UI works as advertised.
|
||||
*/
|
||||
|
||||
const TAB_URL = "http://example.com/browser/browser/devtools/debugger/" +
|
||||
"test/browser_dbg_script-switching.html";
|
||||
const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
|
||||
|
||||
let tempScope = {};
|
||||
Cu.import("resource:///modules/source-editor.jsm", tempScope);
|
||||
let SourceEditor = tempScope.SourceEditor;
|
||||
|
@ -40,6 +40,24 @@ function testScriptsDisplay() {
|
|||
|
||||
is(gScripts.itemCount, 2, "Found the expected number of scripts.");
|
||||
|
||||
for (let i = 0; i < gScripts.itemCount; i++) {
|
||||
info("label: " + i + " " + gScripts.getItemAtIndex(i).getAttribute("label"));
|
||||
}
|
||||
|
||||
let label1 = "test-script-switching-01.js";
|
||||
let label2 = "test-script-switching-02.js";
|
||||
|
||||
ok(gDebugger.DebuggerView.Scripts.contains(EXAMPLE_URL +
|
||||
label1), "First script url is incorrect.");
|
||||
ok(gDebugger.DebuggerView.Scripts.contains(EXAMPLE_URL +
|
||||
label2), "Second script url is incorrect.");
|
||||
|
||||
ok(gDebugger.DebuggerView.Scripts.containsLabel(
|
||||
label1), "First script label is incorrect.");
|
||||
ok(gDebugger.DebuggerView.Scripts.containsLabel(
|
||||
label2), "Second script label is incorrect.");
|
||||
|
||||
|
||||
ok(gDebugger.editor.getText().search(/debugger/) != -1,
|
||||
"The correct script was loaded initially.");
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* pane and highlights the proper line.
|
||||
*/
|
||||
|
||||
const TAB_URL = "http://example.com/browser/browser/devtools/debugger/" +
|
||||
"test/browser_dbg_script-switching.html";
|
||||
const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
|
||||
|
||||
let tempScope = {};
|
||||
Cu.import("resource:///modules/source-editor.jsm", tempScope);
|
||||
let SourceEditor = tempScope.SourceEditor;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* and script URIs with extra query parameters also get the right engine.
|
||||
*/
|
||||
|
||||
const TAB_URL = "http://example.com/browser/browser/devtools/debugger/" +
|
||||
"test/browser_dbg_update-editor-mode.html";
|
||||
const TAB_URL = EXAMPLE_URL + "browser_dbg_update-editor-mode.html";
|
||||
|
||||
let tempScope = {};
|
||||
Cu.import("resource:///modules/source-editor.jsm", tempScope);
|
||||
let SourceEditor = tempScope.SourceEditor;
|
||||
|
|
|
@ -14,11 +14,11 @@ let DebuggerTransport = tempScope.DebuggerTransport;
|
|||
let DebuggerClient = tempScope.DebuggerClient;
|
||||
let Services = tempScope.Services;
|
||||
|
||||
const TAB1_URL = "http://example.com/browser/browser/devtools/debugger/test/browser_dbg_tab1.html";
|
||||
const EXAMPLE_URL = "http://example.com/browser/browser/devtools/debugger/test/";
|
||||
|
||||
const TAB2_URL = "http://example.com/browser/browser/devtools/debugger/test/browser_dbg_tab2.html";
|
||||
|
||||
const STACK_URL = "http://example.com/browser/browser/devtools/debugger/test/browser_dbg_stack.html";
|
||||
const TAB1_URL = EXAMPLE_URL + "browser_dbg_tab1.html";
|
||||
const TAB2_URL = EXAMPLE_URL + "browser_dbg_tab2.html";
|
||||
const STACK_URL = EXAMPLE_URL + "browser_dbg_stack.html";
|
||||
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<link rel="stylesheet" href="chrome://browser/skin/inspector.css" type="text/css"/>
|
||||
<link rel="stylesheet" href="chrome://browser/skin/devtools/htmlpanel.css" type="text/css"/>
|
||||
</head>
|
||||
<body role="application">
|
||||
<div id="attribute-editor">
|
||||
|
|
|
@ -870,7 +870,8 @@ InspectorUI.prototype = {
|
|||
let parent = this.selection.parentNode;
|
||||
|
||||
// remove the node from the treepanel
|
||||
this.treePanel.deleteChildBox(selection);
|
||||
if (this.treePanel.isOpen())
|
||||
this.treePanel.deleteChildBox(selection);
|
||||
|
||||
// remove the node from content
|
||||
parent.removeChild(selection);
|
||||
|
@ -1234,6 +1235,7 @@ InspectorUI.prototype = {
|
|||
let iframe = this.chromeDoc.createElement("iframe");
|
||||
iframe.id = "devtools-sidebar-iframe-" + aRegObj.id;
|
||||
iframe.setAttribute("flex", "1");
|
||||
iframe.setAttribute("tooltip", "aHTMLTooltip");
|
||||
this.sidebarDeck.appendChild(iframe);
|
||||
|
||||
// wire up button to show the iframe
|
||||
|
|
|
@ -77,10 +77,18 @@ const Cc = Components.classes;
|
|||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
const RX_UNIVERSAL_SELECTOR = /\s*\*\s*/g;
|
||||
const RX_NOT = /:not\((.*?)\)/g;
|
||||
const RX_PSEUDO_CLASS_OR_ELT = /(:[\w-]+\().*?\)/g;
|
||||
const RX_CONNECTORS = /\s*[\s>+~]\s*/g;
|
||||
const RX_ID = /\s*#\w+\s*/g;
|
||||
const RX_CLASS_OR_ATTRIBUTE = /\s*(?:\.\w+|\[.+?\])\s*/g;
|
||||
const RX_PSEUDO = /\s*:?:([\w-]+)(\(?\)?)\s*/g;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
var EXPORTED_SYMBOLS = ["CssLogic"];
|
||||
var EXPORTED_SYMBOLS = ["CssLogic", "CssSelector"];
|
||||
|
||||
function CssLogic()
|
||||
{
|
||||
|
@ -1431,6 +1439,31 @@ CssSelector.prototype = {
|
|||
return this._cssRule.line;
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieve the pseudo-elements that we support. This list should match the
|
||||
* elements specified in layout/style/nsCSSPseudoElementList.h
|
||||
*/
|
||||
get pseudoElements()
|
||||
{
|
||||
if (!CssSelector._pseudoElements) {
|
||||
let pseudos = CssSelector._pseudoElements = new Set();
|
||||
pseudos.add("after");
|
||||
pseudos.add("before");
|
||||
pseudos.add("first-letter");
|
||||
pseudos.add("first-line");
|
||||
pseudos.add("selection");
|
||||
pseudos.add("-moz-focus-inner");
|
||||
pseudos.add("-moz-focus-outer");
|
||||
pseudos.add("-moz-list-bullet");
|
||||
pseudos.add("-moz-list-number");
|
||||
pseudos.add("-moz-math-anonymous");
|
||||
pseudos.add("-moz-math-stretchy");
|
||||
pseudos.add("-moz-progress-bar");
|
||||
pseudos.add("-moz-selection");
|
||||
}
|
||||
return CssSelector._pseudoElements;
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieve specificity information for the current selector.
|
||||
*
|
||||
|
@ -1446,37 +1479,58 @@ CssSelector.prototype = {
|
|||
return this._specificity;
|
||||
}
|
||||
|
||||
let specificity = {};
|
||||
let specificity = {
|
||||
ids: 0,
|
||||
classes: 0,
|
||||
tags: 0
|
||||
};
|
||||
|
||||
specificity.ids = 0;
|
||||
specificity.classes = 0;
|
||||
specificity.tags = 0;
|
||||
let text = this.text;
|
||||
|
||||
// Split on CSS combinators (section 5.2).
|
||||
// TODO: We need to properly parse the selector. See bug 592743.
|
||||
if (!this.elementStyle) {
|
||||
this.text.split(/[ >+]/).forEach(function(aSimple) {
|
||||
// The regex leaves empty nodes combinators like ' > '
|
||||
if (!aSimple) {
|
||||
return;
|
||||
}
|
||||
// See http://www.w3.org/TR/css3-selectors/#specificity
|
||||
// We can count the IDs by counting the '#' marks.
|
||||
specificity.ids += (aSimple.match(/#/g) || []).length;
|
||||
// Similar with class names and attribute matchers
|
||||
specificity.classes += (aSimple.match(/\./g) || []).length;
|
||||
specificity.classes += (aSimple.match(/\[/g) || []).length;
|
||||
// Pseudo elements count as elements.
|
||||
specificity.tags += (aSimple.match(/:/g) || []).length;
|
||||
// If we have anything of substance before we get into ids/classes/etc
|
||||
// then it must be a tag if it isn't '*'.
|
||||
let tag = aSimple.split(/[#.[:]/)[0];
|
||||
if (tag && tag != "*") {
|
||||
// Remove universal selectors as they are not relevant as far as specificity
|
||||
// is concerned.
|
||||
text = text.replace(RX_UNIVERSAL_SELECTOR, "");
|
||||
|
||||
// not() is ignored but any selectors contained by it are counted. Let's
|
||||
// remove the not() and keep the contents.
|
||||
text = text.replace(RX_NOT, " $1");
|
||||
|
||||
// Simplify remaining psuedo classes & elements.
|
||||
text = text.replace(RX_PSEUDO_CLASS_OR_ELT, " $1)");
|
||||
|
||||
// Replace connectors with spaces
|
||||
text = text.replace(RX_CONNECTORS, " ");
|
||||
|
||||
text.split(/\s/).forEach(function(aSimple) {
|
||||
// Count IDs.
|
||||
aSimple = aSimple.replace(RX_ID, function() {
|
||||
specificity.ids++;
|
||||
return "";
|
||||
});
|
||||
|
||||
// Count class names and attribute matchers.
|
||||
aSimple = aSimple.replace(RX_CLASS_OR_ATTRIBUTE, function() {
|
||||
specificity.classes++;
|
||||
return "";
|
||||
});
|
||||
|
||||
aSimple = aSimple.replace(RX_PSEUDO, function(aDummy, aPseudoName) {
|
||||
if (this.pseudoElements.has(aPseudoName)) {
|
||||
// Pseudo elements count as tags.
|
||||
specificity.tags++;
|
||||
} else {
|
||||
// Pseudo classes count as classes.
|
||||
specificity.classes++;
|
||||
}
|
||||
return "";
|
||||
}.bind(this));
|
||||
|
||||
if (aSimple) {
|
||||
specificity.tags++;
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
this._specificity = specificity;
|
||||
|
||||
return this._specificity;
|
||||
|
|
|
@ -103,6 +103,13 @@ function ElementStyle(aElement, aStore)
|
|||
{
|
||||
this.element = aElement;
|
||||
this.store = aStore || {};
|
||||
|
||||
// We don't want to overwrite this.store.userProperties so we only create it
|
||||
// if it doesn't already exist.
|
||||
if (!("userProperties" in this.store)) {
|
||||
this.store.userProperties = new UserProperties();
|
||||
}
|
||||
|
||||
if (this.store.disabled) {
|
||||
this.store.disabled = aStore.disabled;
|
||||
} else {
|
||||
|
@ -422,6 +429,7 @@ Rule.prototype = {
|
|||
applyProperties: function Rule_applyProperties()
|
||||
{
|
||||
let disabledProps = [];
|
||||
let store = this.elementStyle.store;
|
||||
|
||||
for each (let prop in this.textProps) {
|
||||
if (!prop.enabled) {
|
||||
|
@ -433,10 +441,11 @@ Rule.prototype = {
|
|||
continue;
|
||||
}
|
||||
|
||||
store.userProperties.setProperty(this.style, prop.name, prop.value);
|
||||
|
||||
this.style.setProperty(prop.name, prop.value, prop.priority);
|
||||
// Refresh the property's value from the style, to reflect
|
||||
// Refresh the property's priority from the style, to reflect
|
||||
// any changes made during parsing.
|
||||
prop.value = this.style.getPropertyValue(prop.name);
|
||||
prop.priority = this.style.getPropertyPriority(prop.name);
|
||||
prop.updateComputed();
|
||||
}
|
||||
|
@ -519,6 +528,7 @@ Rule.prototype = {
|
|||
_getTextProperties: function Rule_getTextProperties()
|
||||
{
|
||||
this.textProps = [];
|
||||
let store = this.elementStyle.store;
|
||||
let lines = this.style.cssText.match(CSS_LINE_RE);
|
||||
for each (let line in lines) {
|
||||
let matches = CSS_PROP_RE.exec(line);
|
||||
|
@ -530,8 +540,8 @@ Rule.prototype = {
|
|||
!this.elementStyle.domUtils.isInheritedProperty(name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let prop = new TextProperty(this, name, matches[2], matches[3] || "");
|
||||
let value = store.userProperties.getProperty(this.style, name, matches[2]);
|
||||
let prop = new TextProperty(this, name, value, matches[3] || "");
|
||||
this.textProps.push(prop);
|
||||
}
|
||||
|
||||
|
@ -542,8 +552,8 @@ Rule.prototype = {
|
|||
}
|
||||
|
||||
for each (let prop in disabledProps) {
|
||||
let textProp = new TextProperty(this, prop.name,
|
||||
prop.value, prop.priority);
|
||||
let value = store.userProperties.getProperty(this.style, prop.name, prop.value);
|
||||
let textProp = new TextProperty(this, prop.name, value, prop.priority);
|
||||
textProp.enabled = false;
|
||||
this.textProps.push(textProp);
|
||||
}
|
||||
|
@ -993,6 +1003,12 @@ TextPropertyEditor.prototype = {
|
|||
|
||||
appendText(this.element, ";");
|
||||
|
||||
this.warning = createChild(this.element, "div", {
|
||||
hidden: "",
|
||||
class: "ruleview-warning",
|
||||
title: CssLogic.l10n("rule.warning.title"),
|
||||
});
|
||||
|
||||
// Holds the viewers for the computed properties.
|
||||
// will be populated in |_updateComputed|.
|
||||
this.computed = createChild(this.element, "ul", {
|
||||
|
@ -1028,6 +1044,7 @@ TextPropertyEditor.prototype = {
|
|||
val += " !" + this.prop.priority;
|
||||
}
|
||||
this.valueSpan.textContent = val;
|
||||
this.warning.hidden = this._validate();
|
||||
|
||||
// Populate the computed styles.
|
||||
this._updateComputed();
|
||||
|
@ -1163,6 +1180,23 @@ TextPropertyEditor.prototype = {
|
|||
this.prop.setValue(this.committed.value, this.committed.priority);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Validate this property.
|
||||
*
|
||||
* @returns {Boolean}
|
||||
* True if the property value is valid, false otherwise.
|
||||
*/
|
||||
_validate: function TextPropertyEditor_validate()
|
||||
{
|
||||
let name = this.prop.name;
|
||||
let value = this.prop.value;
|
||||
let style = this.doc.createElementNS(HTML_NS, "div").style;
|
||||
|
||||
style.setProperty(name, value, null);
|
||||
|
||||
return !!style.getPropertyValue(name);
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1381,6 +1415,61 @@ InplaceEditor.prototype = {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Store of CSSStyleDeclarations mapped to properties that have been changed by
|
||||
* the user.
|
||||
*/
|
||||
function UserProperties()
|
||||
{
|
||||
this.weakMap = new WeakMap();
|
||||
}
|
||||
|
||||
UserProperties.prototype = {
|
||||
/**
|
||||
* Get a named property for a given CSSStyleDeclaration.
|
||||
*
|
||||
* @param {CSSStyleDeclaration} aStyle
|
||||
* The CSSStyleDeclaration against which the property is mapped.
|
||||
* @param {String} aName
|
||||
* The name of the property to get.
|
||||
* @param {Boolean} aDefault
|
||||
* Indicates whether the property value is one entered by a user.
|
||||
* @returns {String}
|
||||
* The property value if it has previously been set by the user, null
|
||||
* otherwise.
|
||||
*/
|
||||
getProperty: function UP_getProperty(aStyle, aName, aDefault) {
|
||||
let entry = this.weakMap.get(aStyle, null);
|
||||
|
||||
if (entry && aName in entry) {
|
||||
return entry[aName];
|
||||
}
|
||||
return typeof aDefault != "undefined" ? aDefault : null;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Set a named property for a given CSSStyleDeclaration.
|
||||
*
|
||||
* @param {CSSStyleDeclaration} aStyle
|
||||
* The CSSStyleDeclaration against which the property is to be mapped.
|
||||
* @param {String} aName
|
||||
* The name of the property to set.
|
||||
* @param {String} aValue
|
||||
* The value of the property to set.
|
||||
*/
|
||||
setProperty: function UP_setProperty(aStyle, aName, aValue) {
|
||||
let entry = this.weakMap.get(aStyle, null);
|
||||
if (entry) {
|
||||
entry[aName] = aValue;
|
||||
} else {
|
||||
let props = {};
|
||||
props[aName] = aValue;
|
||||
this.weakMap.set(aStyle, props);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper functions
|
||||
*/
|
||||
|
|
|
@ -82,7 +82,7 @@ StyleInspector.prototype = {
|
|||
this.registrationObject = {
|
||||
id: "styleinspector",
|
||||
label: this.l10n("style.highlighter.button.label2"),
|
||||
tooltiptext: this.l10n("style.highlighter.button.tooltip"),
|
||||
tooltiptext: this.l10n("style.highlighter.button.tooltip2"),
|
||||
accesskey: this.l10n("style.highlighter.accesskey2"),
|
||||
context: this,
|
||||
get isOpen() isOpen(),
|
||||
|
|
|
@ -55,11 +55,13 @@ _BROWSER_TEST_FILES = \
|
|||
browser_bug_692400_element_style.js \
|
||||
browser_csslogic_inherited.js \
|
||||
browser_ruleview_editor.js \
|
||||
browser_ruleview_editor_changedvalues.js \
|
||||
browser_ruleview_inherit.js \
|
||||
browser_ruleview_manipulation.js \
|
||||
browser_ruleview_override.js \
|
||||
browser_ruleview_ui.js \
|
||||
browser_bug705707_is_content_stylesheet.js \
|
||||
browser_bug_592743_specificity.js \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Tests that CSS specificity is properly calculated.
|
||||
|
||||
let tempScope = {};
|
||||
Cu.import("resource:///modules/devtools/CssLogic.jsm", tempScope);
|
||||
let CssLogic = tempScope.CssLogic;
|
||||
let CssSelector = tempScope.CssSelector;
|
||||
|
||||
function test()
|
||||
{
|
||||
let tests = [
|
||||
{text: "*", expected: "000"},
|
||||
{text: "LI", expected: "001"},
|
||||
{text: "UL LI", expected: "002"},
|
||||
{text: "UL OL+LI", expected: "003"},
|
||||
{text: "H1 + *[REL=up]", expected: "011"},
|
||||
{text: "UL OL LI.red", expected: "013"},
|
||||
{text: "LI.red.level", expected: "021"},
|
||||
{text: ".red .level", expected: "020"},
|
||||
{text: "#x34y", expected: "100"},
|
||||
{text: "#s12:not(FOO)", expected: "101"},
|
||||
{text: "body#home div#warning p.message", expected: "213"},
|
||||
{text: "* body#home div#warning p.message", expected: "213"},
|
||||
{text: "#footer *:not(nav) li", expected: "102"},
|
||||
{text: "bar:nth-child(1n+0)", expected: "011"},
|
||||
{text: "li::-moz-list-number", expected: "002"},
|
||||
{text: "a:hover", expected: "011"},
|
||||
];
|
||||
|
||||
tests.forEach(function(aTest) {
|
||||
let selector = new CssSelector(null, aTest.text);
|
||||
let specificity = selector.specificity;
|
||||
|
||||
let result = "" + specificity.ids + specificity.classes + specificity.tags;
|
||||
is(result, aTest.expected, "selector \"" + aTest.text +
|
||||
"\" produces expected result");
|
||||
});
|
||||
|
||||
finishUp();
|
||||
}
|
||||
|
||||
function finishUp()
|
||||
{
|
||||
CssLogic = CssSelector = null;
|
||||
finish();
|
||||
}
|
|
@ -0,0 +1,190 @@
|
|||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
let tempScope = {};
|
||||
Cu.import("resource:///modules/devtools/CssRuleView.jsm", tempScope);
|
||||
let CssRuleView = tempScope.CssRuleView;
|
||||
let _ElementStyle = tempScope._ElementStyle;
|
||||
let _editableField = tempScope._editableField;
|
||||
|
||||
let doc;
|
||||
let ruleDialog;
|
||||
let ruleView;
|
||||
|
||||
function waitForEditorFocus(aParent, aCallback)
|
||||
{
|
||||
aParent.addEventListener("focus", function onFocus(evt) {
|
||||
if (evt.target.inplaceEditor) {
|
||||
aParent.removeEventListener("focus", onFocus, true);
|
||||
let editor = evt.target.inplaceEditor;
|
||||
executeSoon(function() {
|
||||
aCallback(editor);
|
||||
});
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
function waitForEditorBlur(aEditor, aCallback)
|
||||
{
|
||||
let input = aEditor.input;
|
||||
input.addEventListener("blur", function onBlur() {
|
||||
input.removeEventListener("blur", onBlur, false);
|
||||
executeSoon(function() {
|
||||
aCallback();
|
||||
});
|
||||
}, false);
|
||||
}
|
||||
|
||||
var gRuleViewChanged = false;
|
||||
function ruleViewChanged()
|
||||
{
|
||||
gRuleViewChanged = true;
|
||||
}
|
||||
|
||||
function expectChange()
|
||||
{
|
||||
ok(gRuleViewChanged, "Rule view should have fired a change event.");
|
||||
gRuleViewChanged = false;
|
||||
}
|
||||
|
||||
function startTest()
|
||||
{
|
||||
let style = '' +
|
||||
'#testid {' +
|
||||
' background-color: blue;' +
|
||||
'} ' +
|
||||
'.testclass {' +
|
||||
' background-color: green;' +
|
||||
'}';
|
||||
|
||||
let styleNode = addStyle(doc, style);
|
||||
doc.body.innerHTML = '<div id="testid" class="testclass">Styled Node</div>';
|
||||
let testElement = doc.getElementById("testid");
|
||||
|
||||
ruleDialog = openDialog("chrome://browser/content/devtools/cssruleview.xul",
|
||||
"cssruleviewtest",
|
||||
"width=200,height=350");
|
||||
ruleDialog.addEventListener("load", function onLoad(evt) {
|
||||
ruleDialog.removeEventListener("load", onLoad, true);
|
||||
let doc = ruleDialog.document;
|
||||
ruleView = new CssRuleView(doc);
|
||||
doc.documentElement.appendChild(ruleView.element);
|
||||
ruleView.element.addEventListener("CssRuleViewChanged", ruleViewChanged, false);
|
||||
ruleView.highlight(testElement);
|
||||
waitForFocus(testCancelNew, ruleDialog);
|
||||
}, true);
|
||||
}
|
||||
|
||||
function testCancelNew()
|
||||
{
|
||||
// Start at the beginning: start to add a rule to the element's style
|
||||
// declaration, but leave it empty.
|
||||
|
||||
let elementRuleEditor = ruleView.element.children[0]._ruleEditor;
|
||||
waitForEditorFocus(elementRuleEditor.element, function onNewElement(aEditor) {
|
||||
is(elementRuleEditor.newPropSpan.inplaceEditor, aEditor, "Next focused editor should be the new property editor.");
|
||||
let input = aEditor.input;
|
||||
waitForEditorBlur(aEditor, function () {
|
||||
ok(!gRuleViewChanged, "Shouldn't get a change event after a cancel.");
|
||||
is(elementRuleEditor.rule.textProps.length, 0, "Should have canceled creating a new text property.");
|
||||
ok(!elementRuleEditor.propertyList.hasChildNodes(), "Should not have any properties.");
|
||||
testCreateNew();
|
||||
});
|
||||
aEditor.input.blur();
|
||||
});
|
||||
|
||||
EventUtils.synthesizeMouse(elementRuleEditor.closeBrace, 1, 1,
|
||||
{ },
|
||||
ruleDialog);
|
||||
}
|
||||
|
||||
function testCreateNew()
|
||||
{
|
||||
// Create a new property.
|
||||
let elementRuleEditor = ruleView.element.children[0]._ruleEditor;
|
||||
waitForEditorFocus(elementRuleEditor.element, function onNewElement(aEditor) {
|
||||
is(elementRuleEditor.newPropSpan.inplaceEditor, aEditor, "Next focused editor should be the new property editor.");
|
||||
let input = aEditor.input;
|
||||
input.value = "background-color";
|
||||
|
||||
waitForEditorFocus(elementRuleEditor.element, function onNewValue(aEditor) {
|
||||
expectChange();
|
||||
is(elementRuleEditor.rule.textProps.length, 1, "Should have created a new text property.");
|
||||
is(elementRuleEditor.propertyList.children.length, 1, "Should have created a property editor.");
|
||||
let textProp = elementRuleEditor.rule.textProps[0];
|
||||
is(aEditor, textProp.editor.valueSpan.inplaceEditor, "Should be editing the value span now.");
|
||||
|
||||
aEditor.input.value = "#XYZ";
|
||||
waitForEditorBlur(aEditor, function() {
|
||||
expectChange();
|
||||
is(textProp.value, "#XYZ", "Text prop should have been changed.");
|
||||
is(textProp.editor._validate(), false, "#XYZ should not be a valid entry");
|
||||
testEditProperty();
|
||||
});
|
||||
aEditor.input.blur();
|
||||
});
|
||||
EventUtils.synthesizeKey("VK_RETURN", {}, ruleDialog);
|
||||
});
|
||||
|
||||
EventUtils.synthesizeMouse(elementRuleEditor.closeBrace, 1, 1,
|
||||
{ },
|
||||
ruleDialog);
|
||||
}
|
||||
|
||||
function testEditProperty()
|
||||
{
|
||||
let idRuleEditor = ruleView.element.children[1]._ruleEditor;
|
||||
let propEditor = idRuleEditor.rule.textProps[0].editor;
|
||||
waitForEditorFocus(propEditor.element, function onNewElement(aEditor) {
|
||||
is(propEditor.nameSpan.inplaceEditor, aEditor, "Next focused editor should be the name editor.");
|
||||
let input = aEditor.input;
|
||||
waitForEditorFocus(propEditor.element, function onNewName(aEditor) {
|
||||
expectChange();
|
||||
input = aEditor.input;
|
||||
is(propEditor.valueSpan.inplaceEditor, aEditor, "Focus should have moved to the value.");
|
||||
|
||||
waitForEditorBlur(aEditor, function() {
|
||||
expectChange();
|
||||
let value = idRuleEditor.rule.style.getPropertyValue("border-color");
|
||||
is(value, "red", "border-color should have been set.");
|
||||
is(propEditor._validate(), true, "red should be a valid entry");
|
||||
finishTest();
|
||||
});
|
||||
|
||||
for each (let ch in "red;") {
|
||||
EventUtils.sendChar(ch, ruleDialog);
|
||||
}
|
||||
});
|
||||
for each (let ch in "border-color:") {
|
||||
EventUtils.sendChar(ch, ruleDialog);
|
||||
}
|
||||
});
|
||||
|
||||
EventUtils.synthesizeMouse(propEditor.nameSpan, 1, 1,
|
||||
{ },
|
||||
ruleDialog);}
|
||||
|
||||
function finishTest()
|
||||
{
|
||||
ruleView.element.removeEventListener("CssRuleViewChanged", ruleViewChanged, false);
|
||||
ruleView.clear();
|
||||
ruleDialog.close();
|
||||
ruleDialog = ruleView = null;
|
||||
doc = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function changedValues_load(evt) {
|
||||
gBrowser.selectedBrowser.removeEventListener(evt.type, changedValues_load, true);
|
||||
doc = content.document;
|
||||
waitForFocus(startTest, content);
|
||||
}, true);
|
||||
|
||||
content.location = "data:text/html,test rule view user changes";
|
||||
}
|
|
@ -94,7 +94,7 @@ tiltTranslateXDesc=X (pixels)
|
|||
# LOCALIZATION NOTE (tiltTranslateXManual) A fuller description of the 'x'
|
||||
# parameter to the 'translate' command, displayed when the user asks for help
|
||||
# on what it does.
|
||||
tiltTranslateXManual=The ammount in pixels to translate the webpage mesh on the X axis
|
||||
tiltTranslateXManual=The amount in pixels to translate the webpage mesh on the X axis
|
||||
|
||||
# LOCALIZATION NOTE (tiltTranslateYDesc) A very short string to describe the
|
||||
# 'y' parameter to the 'tilt translate' command, which is displayed in a dialog
|
||||
|
@ -104,7 +104,7 @@ tiltTranslateYDesc=Y (pixels)
|
|||
# LOCALIZATION NOTE (tiltTranslateYManual) A fuller description of the 'y'
|
||||
# parameter to the 'translate' command, displayed when the user asks for help
|
||||
# on what it does.
|
||||
tiltTranslateYManual=The ammount in pixels to translate the webpage mesh on the Y axis
|
||||
tiltTranslateYManual=The amount in pixels to translate the webpage mesh on the Y axis
|
||||
|
||||
# LOCALIZATION NOTE (tiltRotateDesc) A very short description of the 'tilt rotate'
|
||||
# command. See tiltRotateManual for a fuller description of what it does. This
|
||||
|
@ -124,7 +124,7 @@ tiltRotateXDesc=X (degrees)
|
|||
# LOCALIZATION NOTE (tiltRotateXManual) A fuller description of the 'x'
|
||||
# parameter to the 'rotate' command, displayed when the user asks for help
|
||||
# on what it does.
|
||||
tiltRotateXManual=The ammount in degrees to rotate the webpage mesh along the X axis
|
||||
tiltRotateXManual=The amount in degrees to rotate the webpage mesh along the X axis
|
||||
|
||||
# LOCALIZATION NOTE (tiltRotateYDesc) A very short string to describe the
|
||||
# 'y' parameter to the 'tilt rotate' command, which is displayed in a dialog
|
||||
|
@ -134,7 +134,7 @@ tiltRotateYDesc=Y (degrees)
|
|||
# LOCALIZATION NOTE (tiltRotateYManual) A fuller description of the 'y'
|
||||
# parameter to the 'rotate' command, displayed when the user asks for help
|
||||
# on what it does.
|
||||
tiltRotateYManual=The ammount in degrees to rotate the webpage mesh along the Y axis
|
||||
tiltRotateYManual=The amount in degrees to rotate the webpage mesh along the Y axis
|
||||
|
||||
# LOCALIZATION NOTE (tiltRotateZDesc) A very short string to describe the
|
||||
# 'z' parameter to the 'tilt rotate' command, which is displayed in a dialog
|
||||
|
@ -144,7 +144,7 @@ tiltRotateZDesc=Z (degrees)
|
|||
# LOCALIZATION NOTE (tiltRotateZManual) A fuller description of the 'z'
|
||||
# parameter to the 'rotate' command, displayed when the user asks for help
|
||||
# on what it does.
|
||||
tiltRotateZManual=The ammount in degrees to rotate the webpage mesh along the Z axis
|
||||
tiltRotateZManual=The amount in degrees to rotate the webpage mesh along the Z axis
|
||||
|
||||
# LOCALIZATION NOTE (tiltZoomDesc) A very short description of the 'tilt zoom'
|
||||
# command. See tiltZoomManual for a fuller description of what it does. This
|
||||
|
|
|
@ -37,10 +37,15 @@ rule.inheritedSource=Inherited from %S (%S)
|
|||
# "Computed" refers to the Computed Style of the element.
|
||||
style.highlighter.button.label2=Computed
|
||||
style.highlighter.accesskey2=C
|
||||
style.highlighter.button.tooltip=Inspect element computed styles
|
||||
style.highlighter.button.tooltip2=Inspect element computed styles
|
||||
|
||||
# LOCALIZATION NOTE (helpLinkTitle): For each style property
|
||||
# the user can hover it and get a help link button which allows one to
|
||||
# quickly jump to the documentation from the Mozilla Developer Network site.
|
||||
# This is the link title shown in the hover tooltip.
|
||||
helpLinkTitle=Read the documentation for this property
|
||||
|
||||
# LOCALIZATION NOTE (rule.warning.title): When an invalid property value is
|
||||
# entered into the rule view a warning icon is displayed. This text is used for
|
||||
# the title attribute of the warning icon.
|
||||
rule.warning.title=Invalid property value
|
||||
|
|
После Ширина: | Высота: | Размер: 613 B |
|
@ -217,6 +217,19 @@
|
|||
padding: 2px 5px;
|
||||
}
|
||||
|
||||
.ruleview-warning {
|
||||
background: url("chrome://browser/skin/devtools/alerticon-warning.png");
|
||||
display: inline-block;
|
||||
-moz-margin-start: 5px;
|
||||
vertical-align: middle;
|
||||
width: 13px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
.ruleview-warning[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ruleview-ruleopen {
|
||||
-moz-padding-end: 5px;
|
||||
}
|
||||
|
|
|
@ -116,8 +116,13 @@ a {
|
|||
background-color: white;
|
||||
}
|
||||
|
||||
.dbg-stackframe-id {
|
||||
-moz-padding-end: 1em;
|
||||
.dbg-stackframe {
|
||||
-moz-padding-start: 4px;
|
||||
-moz-padding-end: 4px;
|
||||
}
|
||||
|
||||
.dbg-stackframe-name {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,6 @@ browser.jar:
|
|||
* skin/classic/browser/browser.css (browser.css)
|
||||
* skin/classic/browser/engineManager.css (engineManager.css)
|
||||
skin/classic/browser/fullscreen-video.css
|
||||
skin/classic/browser/inspector.css
|
||||
skin/classic/browser/Geolocation-16.png
|
||||
skin/classic/browser/Geolocation-64.png
|
||||
skin/classic/browser/Go-arrow.png
|
||||
|
@ -88,12 +87,14 @@ browser.jar:
|
|||
skin/classic/browser/devtools/common.css (devtools/common.css)
|
||||
skin/classic/browser/devtools/arrows.png (devtools/arrows.png)
|
||||
skin/classic/browser/devtools/commandline.png (devtools/commandline.png)
|
||||
skin/classic/browser/devtools/alerticon-warning.png (devtools/alerticon-warning.png)
|
||||
skin/classic/browser/devtools/goto-mdn.png (devtools/goto-mdn.png)
|
||||
skin/classic/browser/devtools/csshtmltree.css (devtools/csshtmltree.css)
|
||||
skin/classic/browser/devtools/webconsole.css (devtools/webconsole.css)
|
||||
skin/classic/browser/devtools/webconsole_networkpanel.css (devtools/webconsole_networkpanel.css)
|
||||
skin/classic/browser/devtools/webconsole.png (devtools/webconsole.png)
|
||||
skin/classic/browser/devtools/gcli.css (devtools/gcli.css)
|
||||
skin/classic/browser/devtools/htmlpanel.css (devtools/htmlpanel.css)
|
||||
skin/classic/browser/devtools/orion.css (devtools/orion.css)
|
||||
skin/classic/browser/devtools/orion-container.css (devtools/orion-container.css)
|
||||
skin/classic/browser/devtools/orion-task.png (devtools/orion-task.png)
|
||||
|
|
После Ширина: | Высота: | Размер: 613 B |
|
@ -219,6 +219,19 @@
|
|||
padding: 2px 5px;
|
||||
}
|
||||
|
||||
.ruleview-warning {
|
||||
background: url("chrome://browser/skin/devtools/alerticon-warning.png");
|
||||
display: inline-block;
|
||||
-moz-margin-start: 5px;
|
||||
vertical-align: middle;
|
||||
width: 13px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
.ruleview-warning[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ruleview-ruleopen {
|
||||
-moz-padding-end: 5px;
|
||||
}
|
||||
|
|
|
@ -120,8 +120,13 @@ a {
|
|||
background-color: white;
|
||||
}
|
||||
|
||||
.dbg-stackframe-id {
|
||||
-moz-padding-end: 1em;
|
||||
.dbg-stackframe {
|
||||
-moz-padding-start: 4px;
|
||||
-moz-padding-end: 4px;
|
||||
}
|
||||
|
||||
.dbg-stackframe-name {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,7 +58,6 @@ browser.jar:
|
|||
skin/classic/browser/newtab/strip.png (newtab/strip.png)
|
||||
skin/classic/browser/newtab/toolbar.png (newtab/toolbar.png)
|
||||
skin/classic/browser/setDesktopBackground.css
|
||||
skin/classic/browser/inspector.css
|
||||
skin/classic/browser/monitor.png
|
||||
skin/classic/browser/monitor_16-10.png
|
||||
skin/classic/browser/places/allBookmarks.png (places/allBookmarks.png)
|
||||
|
@ -127,9 +126,11 @@ browser.jar:
|
|||
* skin/classic/browser/devtools/common.css (devtools/common.css)
|
||||
skin/classic/browser/devtools/arrows.png (devtools/arrows.png)
|
||||
skin/classic/browser/devtools/commandline.png (devtools/commandline.png)
|
||||
skin/classic/browser/devtools/alerticon-warning.png (devtools/alerticon-warning.png)
|
||||
skin/classic/browser/devtools/goto-mdn.png (devtools/goto-mdn.png)
|
||||
skin/classic/browser/devtools/csshtmltree.css (devtools/csshtmltree.css)
|
||||
skin/classic/browser/devtools/gcli.css (devtools/gcli.css)
|
||||
skin/classic/browser/devtools/htmlpanel.css (devtools/htmlpanel.css)
|
||||
skin/classic/browser/devtools/orion.css (devtools/orion.css)
|
||||
skin/classic/browser/devtools/orion-container.css (devtools/orion-container.css)
|
||||
skin/classic/browser/devtools/orion-task.png (devtools/orion-task.png)
|
||||
|
@ -165,10 +166,10 @@ browser.jar:
|
|||
skin/classic/browser/devtools/splitview.css (devtools/splitview.css)
|
||||
skin/classic/browser/devtools/styleeditor.css (devtools/styleeditor.css)
|
||||
skin/classic/browser/devtools/debugger.css (devtools/debugger.css)
|
||||
skin/classic/browser/devtools/magnifying-glass.png (devtools/magnifying-glass.png)
|
||||
skin/classic/browser/devtools/itemToggle.png (devtools/itemToggle.png)
|
||||
skin/classic/browser/devtools/itemArrow-rtl.png (devtools/itemArrow-rtl.png)
|
||||
skin/classic/browser/devtools/itemArrow-ltr.png (devtools/itemArrow-ltr.png)
|
||||
skin/classic/browser/devtools/magnifying-glass.png (devtools/magnifying-glass.png)
|
||||
skin/classic/browser/devtools/itemToggle.png (devtools/itemToggle.png)
|
||||
skin/classic/browser/devtools/itemArrow-rtl.png (devtools/itemArrow-rtl.png)
|
||||
skin/classic/browser/devtools/itemArrow-ltr.png (devtools/itemArrow-ltr.png)
|
||||
skin/classic/browser/devtools/background-noise-toolbar.png (devtools/background-noise-toolbar.png)
|
||||
#ifdef MOZ_SERVICES_SYNC
|
||||
skin/classic/browser/sync-throbber.png
|
||||
|
|
Двоичные данные
browser/themes/winstripe/Toolbar-inverted.png
До Ширина: | Высота: | Размер: 5.0 KiB После Ширина: | Высота: | Размер: 3.7 KiB |
Двоичные данные
browser/themes/winstripe/Toolbar.png
До Ширина: | Высота: | Размер: 12 KiB После Ширина: | Высота: | Размер: 8.4 KiB |
После Ширина: | Высота: | Размер: 613 B |
|
@ -217,6 +217,19 @@
|
|||
padding: 2px 5px;
|
||||
}
|
||||
|
||||
.ruleview-warning {
|
||||
background: url("chrome://browser/skin/devtools/alerticon-warning.png");
|
||||
display: inline-block;
|
||||
-moz-margin-start: 5px;
|
||||
vertical-align: middle;
|
||||
width: 13px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
.ruleview-warning[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ruleview-ruleopen {
|
||||
-moz-padding-end: 5px;
|
||||
}
|
||||
|
|
|
@ -116,8 +116,13 @@ a {
|
|||
background-color: white;
|
||||
}
|
||||
|
||||
.dbg-stackframe-id {
|
||||
-moz-padding-end: 1em;
|
||||
.dbg-stackframe {
|
||||
-moz-padding-start: 4px;
|
||||
-moz-padding-end: 4px;
|
||||
}
|
||||
|
||||
.dbg-stackframe-name {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -60,7 +60,6 @@ browser.jar:
|
|||
skin/classic/browser/newtab/newTab.css (newtab/newTab.css)
|
||||
skin/classic/browser/newtab/strip.png (newtab/strip.png)
|
||||
skin/classic/browser/newtab/toolbar.png (newtab/toolbar.png)
|
||||
skin/classic/browser/inspector.css
|
||||
skin/classic/browser/places/places.css (places/places.css)
|
||||
* skin/classic/browser/places/organizer.css (places/organizer.css)
|
||||
skin/classic/browser/places/bookmark.png (places/bookmark.png)
|
||||
|
@ -112,9 +111,11 @@ browser.jar:
|
|||
skin/classic/browser/devtools/common.css (devtools/common.css)
|
||||
skin/classic/browser/devtools/arrows.png (devtools/arrows.png)
|
||||
skin/classic/browser/devtools/commandline.png (devtools/commandline.png)
|
||||
skin/classic/browser/devtools/alerticon-warning.png (devtools/alerticon-warning.png)
|
||||
skin/classic/browser/devtools/goto-mdn.png (devtools/goto-mdn.png)
|
||||
skin/classic/browser/devtools/csshtmltree.css (devtools/csshtmltree.css)
|
||||
skin/classic/browser/devtools/gcli.css (devtools/gcli.css)
|
||||
skin/classic/browser/devtools/htmlpanel.css (devtools/htmlpanel.css)
|
||||
skin/classic/browser/devtools/orion.css (devtools/orion.css)
|
||||
skin/classic/browser/devtools/orion-container.css (devtools/orion-container.css)
|
||||
skin/classic/browser/devtools/orion-task.png (devtools/orion-task.png)
|
||||
|
@ -229,7 +230,6 @@ browser.jar:
|
|||
skin/classic/aero/browser/newtab/newTab.css (newtab/newTab.css)
|
||||
skin/classic/aero/browser/newtab/strip.png (newtab/strip.png)
|
||||
skin/classic/aero/browser/newtab/toolbar.png (newtab/toolbar.png)
|
||||
skin/classic/aero/browser/inspector.css
|
||||
* skin/classic/aero/browser/places/places.css (places/places-aero.css)
|
||||
* skin/classic/aero/browser/places/organizer.css (places/organizer-aero.css)
|
||||
skin/classic/aero/browser/places/bookmark.png (places/bookmark.png)
|
||||
|
@ -281,9 +281,11 @@ browser.jar:
|
|||
skin/classic/aero/browser/devtools/common.css (devtools/common.css)
|
||||
skin/classic/aero/browser/devtools/arrows.png (devtools/arrows.png)
|
||||
skin/classic/aero/browser/devtools/commandline.png (devtools/commandline.png)
|
||||
skin/classic/aero/browser/devtools/alerticon-warning.png (devtools/alerticon-warning.png)
|
||||
skin/classic/aero/browser/devtools/goto-mdn.png (devtools/goto-mdn.png)
|
||||
skin/classic/aero/browser/devtools/csshtmltree.css (devtools/csshtmltree.css)
|
||||
skin/classic/aero/browser/devtools/gcli.css (devtools/gcli.css)
|
||||
skin/classic/aero/browser/devtools/htmlpanel.css (devtools/htmlpanel.css)
|
||||
skin/classic/aero/browser/devtools/orion.css (devtools/orion.css)
|
||||
skin/classic/aero/browser/devtools/orion-container.css (devtools/orion-container.css)
|
||||
skin/classic/aero/browser/devtools/orion-task.png (devtools/orion-task.png)
|
||||
|
|
Двоичные данные
browser/themes/winstripe/tabbrowser/newtab.png
До Ширина: | Высота: | Размер: 445 B После Ширина: | Высота: | Размер: 237 B |
Двоичные данные
browser/themes/winstripe/tabview/tabview.png
До Ширина: | Высота: | Размер: 1.2 KiB После Ширина: | Высота: | Размер: 926 B |
|
@ -913,6 +913,7 @@ sechash.h
|
|||
secoidt.h
|
||||
certdb.h
|
||||
secerr.h
|
||||
nssutil.h
|
||||
nssb64.h
|
||||
secasn1.h
|
||||
secder.h
|
||||
|
|
|
@ -5157,10 +5157,10 @@ incorrect])
|
|||
else
|
||||
AC_CHECK_LIB(QtSensors, main, [
|
||||
MOZ_ENABLE_QTMOBILITY=1
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtMobility"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtSensors"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtFeedback"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtLocation"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
|
||||
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
|
||||
MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
|
||||
])
|
||||
fi
|
||||
|
|
|
@ -105,8 +105,6 @@ public:
|
|||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ELEMENT_IID)
|
||||
|
||||
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(Element, nsIContent)
|
||||
|
||||
/**
|
||||
* Method to get the full state of this element. See nsEventStates.h for
|
||||
* the possible bits that could be set here.
|
||||
|
|
|
@ -422,8 +422,8 @@ public:
|
|||
/**
|
||||
* Returns true if aChar is of class Ps, Pi, Po, Pf, or Pe.
|
||||
*/
|
||||
static bool IsPunctuationMark(PRUint32 aChar);
|
||||
static bool IsPunctuationMarkAt(const nsTextFragment* aFrag, PRUint32 aOffset);
|
||||
static bool IsFirstLetterPunctuation(PRUint32 aChar);
|
||||
static bool IsFirstLetterPunctuationAt(const nsTextFragment* aFrag, PRUint32 aOffset);
|
||||
|
||||
/**
|
||||
* Returns true if aChar is of class Lu, Ll, Lt, Lm, Lo, Nd, Nl or No
|
||||
|
|
|
@ -104,8 +104,6 @@ public:
|
|||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENT_IID)
|
||||
|
||||
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsIContent, nsINode);
|
||||
|
||||
/**
|
||||
* Bind this content node to a tree. If this method throws, the caller must
|
||||
* call UnbindFromTree() on the node. In the typical case of a node being
|
||||
|
@ -999,7 +997,6 @@ public:
|
|||
// accessibility.tabfocus_applies_to_xul pref - if it is set to true,
|
||||
// the tabfocus bit field applies to xul elements.
|
||||
static bool sTabFocusModelAppliesToXUL;
|
||||
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContent, NS_ICONTENT_IID)
|
||||
|
|
|
@ -111,6 +111,7 @@ class nsIBoxObject;
|
|||
class imgIRequest;
|
||||
class nsISHEntry;
|
||||
class nsDOMNavigationTiming;
|
||||
class nsWindowSizes;
|
||||
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
|
@ -156,7 +157,6 @@ public:
|
|||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_IID)
|
||||
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
|
||||
NS_DECL_DOM_MEMORY_REPORTER_SIZEOF
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
nsIDocument()
|
||||
|
@ -1617,7 +1617,15 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual size_t SizeOfStyleSheets(nsMallocSizeOfFun aMallocSizeOf) const = 0;
|
||||
// Note: nsIDocument is a sub-class of nsINode, which has a
|
||||
// SizeOfExcludingThis function. However, because nsIDocument objects can
|
||||
// only appear at the top of the DOM tree, we have a specialized measurement
|
||||
// function which returns multiple sizes.
|
||||
virtual void DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const;
|
||||
// DocSizeOfIncludingThis doesn't need to be overridden by sub-classes
|
||||
// because nsIDocument inherits from nsINode; see the comment above the
|
||||
// declaration of nsINode::SizeOfIncludingThis.
|
||||
virtual void DocSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const;
|
||||
|
||||
private:
|
||||
PRUint64 mWarnedAbout;
|
||||
|
|
|
@ -302,7 +302,39 @@ class nsINode : public nsIDOMEventTarget,
|
|||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_INODE_IID)
|
||||
|
||||
NS_DECL_DOM_MEMORY_REPORTER_SIZEOF
|
||||
// Among the sub-classes that inherit (directly or indirectly) from nsINode,
|
||||
// measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - nsGenericHTMLElement: mForm, mFieldSet
|
||||
// - nsGenericHTMLFrameElement: mFrameLoader (bug 672539), mTitleChangedListener
|
||||
// - nsHTMLBodyElement: mContentStyleRule
|
||||
// - nsHTMLDataListElement: mOptions
|
||||
// - nsHTMLFieldSetElement: mElements, mDependentElements, mFirstLegend
|
||||
// - nsHTMLFormElement: many!
|
||||
// - nsHTMLFrameSetElement: mRowSpecs, mColSpecs
|
||||
// - nsHTMLInputElement: mInputData, mFiles, mFileList, mStaticDocfileList
|
||||
// - nsHTMLMapElement: mAreas
|
||||
// - nsHTMLMediaElement: many!
|
||||
// - nsHTMLOutputElement: mDefaultValue, mTokenList
|
||||
// - nsHTMLRowElement: mCells
|
||||
// - nsHTMLSelectElement: mOptions, mRestoreState
|
||||
// - nsHTMLTableElement: mTBodies, mRows, mTableInheritedAttributes
|
||||
// - nsHTMLTableSectionElement: mRows
|
||||
// - nsHTMLTextAreaElement: mControllers, mState
|
||||
//
|
||||
// The following members don't need to be measured:
|
||||
// - nsIContent: mPrimaryFrame, because it's non-owning and measured elsewhere
|
||||
//
|
||||
NS_DECL_SIZEOF_EXCLUDING_THIS
|
||||
|
||||
// SizeOfIncludingThis doesn't need to be overridden by sub-classes because
|
||||
// sub-classes of nsINode are guaranteed to be laid out in memory in such a
|
||||
// way that |this| points to the start of the allocated object, even in
|
||||
// methods of nsINode's sub-classes, and so |aMallocSizeOf(this)| is always
|
||||
// safe to call no matter which object it was invoked on.
|
||||
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const {
|
||||
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
friend class nsNodeUtils;
|
||||
friend class nsNodeWeakReference;
|
||||
|
@ -1331,6 +1363,7 @@ protected:
|
|||
public:
|
||||
// Optimized way to get classinfo.
|
||||
virtual nsXPCClassInfo* GetClassInfo() = 0;
|
||||
|
||||
protected:
|
||||
|
||||
// Override this function to create a custom slots class.
|
||||
|
|
|
@ -210,6 +210,7 @@ INCLUDES += \
|
|||
$(NULL)
|
||||
|
||||
DEFINES += -D_IMPL_NS_LAYOUT
|
||||
DEFINES += -DHB_DONT_DEFINE_STDINT
|
||||
|
||||
# gcc requires -msse2 for this file since it uses SSE2 intrinsics. (See bug
|
||||
# 585538 comment 12.)
|
||||
|
|
|
@ -839,26 +839,22 @@ nsAttrAndChildArray::SetChildAtPos(void** aPos, nsIContent* aChild,
|
|||
}
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsAttrAndChildArray::SizeOf() const
|
||||
size_t
|
||||
nsAttrAndChildArray::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
PRInt64 size = sizeof(*this);
|
||||
|
||||
size_t n = 0;
|
||||
if (mImpl) {
|
||||
// Don't add the size taken by *mMappedAttrs because it's shared.
|
||||
|
||||
// mBuffer cointains InternalAttr and nsIContent* (even if it's void**)
|
||||
// so, we just have to compute the size of *mBuffer given that this object
|
||||
// doesn't own the children list.
|
||||
size += mImpl->mBufferSize * sizeof(*(mImpl->mBuffer)) + NS_IMPL_EXTRA_SIZE;
|
||||
n += aMallocSizeOf(mImpl);
|
||||
|
||||
PRUint32 slotCount = AttrSlotCount();
|
||||
for (PRUint32 i = 0; i < slotCount && AttrSlotIsTaken(i); ++i) {
|
||||
nsAttrValue* value = &ATTRS(mImpl)[i].mValue;
|
||||
size += value->SizeOf() - sizeof(*value);
|
||||
n += value->SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
!AttrSlotIsTaken(ATTRCHILD_ARRAY_MAX_ATTR_COUNT - 1);
|
||||
}
|
||||
|
||||
PRInt64 SizeOf() const;
|
||||
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
bool HasMappedAttrs() const
|
||||
{
|
||||
return MappedAttrCount();
|
||||
|
|
|
@ -1767,59 +1767,50 @@ nsAttrValue::StringToInteger(const nsAString& aValue, bool* aStrict,
|
|||
return value;
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsAttrValue::SizeOf() const
|
||||
size_t
|
||||
nsAttrValue::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
PRInt64 size = sizeof(*this);
|
||||
size_t n = 0;
|
||||
|
||||
switch (BaseType()) {
|
||||
case eStringBase:
|
||||
{
|
||||
// TODO: we might be counting the string size more than once.
|
||||
// This should be fixed with bug 677487.
|
||||
nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
|
||||
size += str ? str->StorageSize() : 0;
|
||||
n += str ? str->SizeOfIncludingThisIfUnshared(aMallocSizeOf) : 0;
|
||||
break;
|
||||
}
|
||||
case eOtherBase:
|
||||
{
|
||||
MiscContainer* container = GetMiscContainer();
|
||||
|
||||
if (!container) {
|
||||
break;
|
||||
}
|
||||
|
||||
size += sizeof(*container);
|
||||
n += aMallocSizeOf(container);
|
||||
|
||||
void* otherPtr = MISC_STR_PTR(container);
|
||||
// We only count the size of the object pointed by otherPtr if it's a
|
||||
// string. When it's an atom, it's counted separatly.
|
||||
if (otherPtr &&
|
||||
static_cast<ValueBaseType>(container->mStringBits & NS_ATTRVALUE_BASETYPE_MASK) == eStringBase) {
|
||||
// TODO: we might be counting the string size more than once.
|
||||
// This should be fixed with bug 677487.
|
||||
nsStringBuffer* str = static_cast<nsStringBuffer*>(otherPtr);
|
||||
size += str ? str->StorageSize() : 0;
|
||||
n += str ? str->SizeOfIncludingThisIfUnshared(aMallocSizeOf) : 0;
|
||||
}
|
||||
|
||||
// TODO: mCSSStyleRule might be owned by another object
|
||||
// which would make us count them twice, bug 677493.
|
||||
if (Type() == eCSSStyleRule && container->mCSSStyleRule) {
|
||||
// TODO: Add SizeOf() to StyleRule, bug 677503.
|
||||
size += sizeof(*container->mCSSStyleRule);
|
||||
// TODO: mCSSStyleRule might be owned by another object which would
|
||||
// make us count them twice, bug 677493.
|
||||
//n += container->mCSSStyleRule->SizeOfIncludingThis(aMallocSizeOf);
|
||||
} else if (Type() == eAtomArray && container->mAtomArray) {
|
||||
size += sizeof(container->mAtomArray) + sizeof(nsTArrayHeader);
|
||||
size += container->mAtomArray->Capacity() * sizeof(nsCOMPtr<nsIAtom>);
|
||||
// Don't count the size of each nsIAtom, they are counted separatly.
|
||||
// Don't measure each nsIAtom, they are measured separatly.
|
||||
n += container->mAtomArray->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case eAtomBase: // Atoms are counted separatly.
|
||||
case eAtomBase: // Atoms are counted separately.
|
||||
case eIntegerBase: // The value is in mBits, nothing to do.
|
||||
break;
|
||||
}
|
||||
|
||||
return size;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ public:
|
|||
*/
|
||||
bool ParseIntMarginValue(const nsAString& aString);
|
||||
|
||||
PRInt64 SizeOf() const;
|
||||
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
// These have to be the same as in ValueType
|
||||
|
|
|
@ -63,10 +63,6 @@ public:
|
|||
// nsIDOMCharacterData
|
||||
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
|
||||
|
||||
// DOM Memory Reporter participant.
|
||||
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsCommentNode,
|
||||
nsGenericDOMDataNode)
|
||||
|
||||
// nsIDOMComment
|
||||
// Empty interface
|
||||
|
||||
|
|
|
@ -123,6 +123,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
|
|||
#include "nsILineBreaker.h"
|
||||
#include "nsIWordBreaker.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
#include "harfbuzz/hb-common.h"
|
||||
#include "jsdbgapi.h"
|
||||
#include "nsIJSRuntimeService.h"
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
|
@ -1117,34 +1118,38 @@ nsContentUtils::CopyNewlineNormalizedUnicodeTo(nsReadingIterator<PRUnichar>& aSr
|
|||
return normalizer.GetCharsWritten();
|
||||
}
|
||||
|
||||
// Replaced by precompiled CCMap (see bug 180266). To update the list
|
||||
// of characters, see one of files included below. As for the way
|
||||
// the original list of characters was obtained by Frank Tang, see bug 54467.
|
||||
// Updated to fix the regression (bug 263411). The list contains
|
||||
// characters of the following Unicode character classes : Ps, Pi, Po, Pf, Pe.
|
||||
// (ref.: http://www.w3.org/TR/2004/CR-CSS21-20040225/selector.html#first-letter)
|
||||
#include "punct_marks.x-ccmap"
|
||||
DEFINE_X_CCMAP(gPuncCharsCCMapExt, const);
|
||||
/**
|
||||
* This is used to determine whether a character is in one of the punctuation
|
||||
* mark classes which CSS says should be part of the first-letter.
|
||||
* See http://www.w3.org/TR/CSS2/selector.html#first-letter and
|
||||
* http://www.w3.org/TR/selectors/#first-letter
|
||||
*/
|
||||
|
||||
// static
|
||||
bool
|
||||
nsContentUtils::IsPunctuationMark(PRUint32 aChar)
|
||||
nsContentUtils::IsFirstLetterPunctuation(PRUint32 aChar)
|
||||
{
|
||||
return CCMAP_HAS_CHAR_EXT(gPuncCharsCCMapExt, aChar);
|
||||
PRUint8 cat = mozilla::unicode::GetGeneralCategory(aChar);
|
||||
|
||||
return (cat == HB_UNICODE_GENERAL_CATEGORY_OPEN_PUNCTUATION || // Ps
|
||||
cat == HB_UNICODE_GENERAL_CATEGORY_CLOSE_PUNCTUATION || // Pe
|
||||
cat == HB_UNICODE_GENERAL_CATEGORY_INITIAL_PUNCTUATION || // Pi
|
||||
cat == HB_UNICODE_GENERAL_CATEGORY_FINAL_PUNCTUATION || // Pf
|
||||
cat == HB_UNICODE_GENERAL_CATEGORY_OTHER_PUNCTUATION); // Po
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
nsContentUtils::IsPunctuationMarkAt(const nsTextFragment* aFrag, PRUint32 aOffset)
|
||||
nsContentUtils::IsFirstLetterPunctuationAt(const nsTextFragment* aFrag, PRUint32 aOffset)
|
||||
{
|
||||
PRUnichar h = aFrag->CharAt(aOffset);
|
||||
if (!IS_SURROGATE(h)) {
|
||||
return IsPunctuationMark(h);
|
||||
return IsFirstLetterPunctuation(h);
|
||||
}
|
||||
if (NS_IS_HIGH_SURROGATE(h) && aOffset + 1 < aFrag->GetLength()) {
|
||||
PRUnichar l = aFrag->CharAt(aOffset + 1);
|
||||
if (NS_IS_LOW_SURROGATE(l)) {
|
||||
return IsPunctuationMark(SURROGATE_TO_UCS4(h, l));
|
||||
return IsFirstLetterPunctuation(SURROGATE_TO_UCS4(h, l));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -8486,19 +8486,6 @@ nsDocument::CreateTouchList(nsIVariant* aPoints,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsIDocument::SizeOf() const
|
||||
{
|
||||
PRInt64 size = MemoryReporter::GetBasicSize<nsIDocument, nsINode>(this);
|
||||
|
||||
for (nsIContent* node = GetFirstChild(); node;
|
||||
node = node->GetNextNode(this)) {
|
||||
size += node->SizeOf();
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static void
|
||||
DispatchFullScreenChange(nsIDocument* aTarget)
|
||||
{
|
||||
|
@ -9084,14 +9071,6 @@ nsDocument::IsFullScreenEnabled(bool aCallerIsChrome, bool aLogFailure)
|
|||
return true;
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsDocument::SizeOf() const
|
||||
{
|
||||
PRInt64 size = MemoryReporter::GetBasicSize<nsDocument, nsIDocument>(this);
|
||||
size += mAttrStyleSheet ? mAttrStyleSheet->DOMSizeOf() : 0;
|
||||
return size;
|
||||
}
|
||||
|
||||
#define EVENT(name_, id_, type_, struct_) \
|
||||
NS_IMETHODIMP nsDocument::GetOn##name_(JSContext *cx, jsval *vp) { \
|
||||
return nsINode::GetOn##name_(cx, vp); \
|
||||
|
@ -9164,6 +9143,24 @@ nsDocument::GetMozVisibilityState(nsAString& aState)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
nsIDocument::DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
||||
{
|
||||
aWindowSizes->mDOM +=
|
||||
nsINode::SizeOfExcludingThis(aWindowSizes->mMallocSizeOf);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it
|
||||
// is worthwhile:
|
||||
// - many!
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::DocSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const
|
||||
{
|
||||
aWindowSizes->mDOM += aWindowSizes->mMallocSizeOf(this);
|
||||
DocSizeOfExcludingThis(aWindowSizes);
|
||||
}
|
||||
|
||||
static size_t
|
||||
SizeOfStyleSheetsElementIncludingThis(nsIStyleSheet* aStyleSheet,
|
||||
nsMallocSizeOfFun aMallocSizeOf,
|
||||
|
@ -9172,9 +9169,39 @@ SizeOfStyleSheetsElementIncludingThis(nsIStyleSheet* aStyleSheet,
|
|||
return aStyleSheet->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
nsDocument::SizeOfStyleSheets(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
size_t
|
||||
nsDocument::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
return mStyleSheets.SizeOfExcludingThis(SizeOfStyleSheetsElementIncludingThis,
|
||||
aMallocSizeOf);
|
||||
// This SizeOfExcludingThis() overrides the one from nsINode. But
|
||||
// nsDocuments can only appear at the top of the DOM tree, and we use the
|
||||
// specialized DocSizeOfExcludingThis() in that case. So this should never
|
||||
// be called.
|
||||
MOZ_NOT_REACHED("nsDocument::SizeOfExcludingThis");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
||||
{
|
||||
nsIDocument::DocSizeOfExcludingThis(aWindowSizes);
|
||||
|
||||
for (nsIContent* node = nsINode::GetFirstChild();
|
||||
node;
|
||||
node = node->GetNextNode(this))
|
||||
{
|
||||
aWindowSizes->mDOM +=
|
||||
node->SizeOfIncludingThis(aWindowSizes->mMallocSizeOf);
|
||||
}
|
||||
|
||||
aWindowSizes->mStyleSheets +=
|
||||
mStyleSheets.SizeOfExcludingThis(SizeOfStyleSheetsElementIncludingThis,
|
||||
aWindowSizes->mMallocSizeOf);
|
||||
aWindowSizes->mDOM +=
|
||||
mAttrStyleSheet ?
|
||||
mAttrStyleSheet->DOMSizeOfIncludingThis(aWindowSizes->mMallocSizeOf) :
|
||||
0;
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it
|
||||
// is worthwhile:
|
||||
// - many!
|
||||
}
|
||||
|
|
|
@ -123,6 +123,7 @@ class nsXMLEventsManager;
|
|||
class nsHTMLStyleSheet;
|
||||
class nsHTMLCSSStyleSheet;
|
||||
class nsDOMNavigationTiming;
|
||||
class nsWindowSizes;
|
||||
|
||||
/**
|
||||
* Right now our identifier map entries contain information for 'name'
|
||||
|
@ -505,7 +506,8 @@ public:
|
|||
typedef mozilla::dom::Element Element;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_DOM_MEMORY_REPORTER_SIZEOF
|
||||
|
||||
NS_DECL_SIZEOF_EXCLUDING_THIS
|
||||
|
||||
using nsINode::GetScriptTypeID;
|
||||
|
||||
|
@ -990,7 +992,8 @@ public:
|
|||
// Posts an event to call UpdateVisibilityState
|
||||
virtual void PostVisibilityUpdateEvent();
|
||||
|
||||
virtual size_t SizeOfStyleSheets(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
virtual void DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const;
|
||||
// DocSizeOfIncludingThis is inherited from nsIDocument.
|
||||
|
||||
protected:
|
||||
friend class nsNodeUtils;
|
||||
|
|
|
@ -997,12 +997,11 @@ nsGenericDOMDataNode::GetClassAttributeName() const
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsGenericDOMDataNode::SizeOf() const
|
||||
size_t
|
||||
nsGenericDOMDataNode::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
PRInt64 size = dom::MemoryReporter::GetBasicSize<nsGenericDOMDataNode,
|
||||
nsIContent>(this);
|
||||
size += mText.SizeOf() - sizeof(mText);
|
||||
return size;
|
||||
size_t n = nsIContent::SizeOfExcludingThis(aMallocSizeOf);
|
||||
n += mText.SizeOfExcludingThis(aMallocSizeOf);
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class nsGenericDOMDataNode : public nsIContent
|
|||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
||||
NS_DECL_DOM_MEMORY_REPORTER_SIZEOF
|
||||
NS_DECL_SIZEOF_EXCLUDING_THIS
|
||||
|
||||
nsGenericDOMDataNode(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsGenericDOMDataNode();
|
||||
|
|
|
@ -6197,29 +6197,32 @@ nsGenericElement::MozMatchesSelector(const nsAString& aSelector, bool* aReturn)
|
|||
return rv;
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsINode::SizeOf() const
|
||||
size_t
|
||||
nsINode::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
PRInt64 size = sizeof(*this);
|
||||
|
||||
size_t n = 0;
|
||||
nsEventListenerManager* elm =
|
||||
const_cast<nsINode*>(this)->GetListenerManager(false);
|
||||
if (elm) {
|
||||
size += elm->SizeOf();
|
||||
n += elm->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
return size;
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mNodeInfo (Nb: allocated in nsNodeInfo.cpp with a nsFixedSizeAllocator)
|
||||
// - mSlots
|
||||
//
|
||||
// The following members are not measured:
|
||||
// - mParent, mNextSibling, mPreviousSibling, mFirstChild: because they're
|
||||
// non-owning
|
||||
return n;
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsGenericElement::SizeOf() const
|
||||
size_t
|
||||
nsGenericElement::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
PRInt64 size = MemoryReporter::GetBasicSize<nsGenericElement, Element>(this);
|
||||
|
||||
size -= sizeof(mAttrsAndChildren);
|
||||
size += mAttrsAndChildren.SizeOf();
|
||||
|
||||
return size;
|
||||
return Element::SizeOfExcludingThis(aMallocSizeOf) +
|
||||
mAttrsAndChildren.SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
#define EVENT(name_, id_, type_, struct_) \
|
||||
|
|
|
@ -247,7 +247,7 @@ public:
|
|||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
||||
NS_DECL_DOM_MEMORY_REPORTER_SIZEOF
|
||||
NS_DECL_SIZEOF_EXCLUDING_THIS
|
||||
|
||||
/**
|
||||
* Called during QueryInterface to give the binding manager a chance to
|
||||
|
|
|
@ -65,7 +65,7 @@ SetupCapitalization(const PRUnichar* aWord, PRUint32 aLength,
|
|||
// The only space character a word can contain is NBSP.
|
||||
bool capitalizeNextChar = true;
|
||||
for (PRUint32 i = 0; i < aLength; ++i) {
|
||||
if (capitalizeNextChar && !nsContentUtils::IsPunctuationMark(aWord[i])) {
|
||||
if (capitalizeNextChar && !nsContentUtils::IsFirstLetterPunctuation(aWord[i])) {
|
||||
aCapitalization[i] = true;
|
||||
capitalizeNextChar = false;
|
||||
}
|
||||
|
|
|
@ -66,9 +66,6 @@ protected:
|
|||
{}
|
||||
|
||||
public:
|
||||
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsMappedAttributeElement,
|
||||
nsMappedAttributeElementBase)
|
||||
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers);
|
||||
|
|
|
@ -278,18 +278,16 @@ nsMappedAttributes::IndexOfAttr(nsIAtom* aLocalName, PRInt32 aNamespaceID) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsMappedAttributes::SizeOf() const
|
||||
size_t
|
||||
nsMappedAttributes::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
NS_ASSERTION(mAttrCount == mBufferSize,
|
||||
"mBufferSize and mAttrCount are expected to be the same.");
|
||||
|
||||
PRInt64 size = sizeof(*this) - sizeof(void*) + mAttrCount * sizeof(InternalAttr);
|
||||
|
||||
size_t n = aMallocSizeOf(this);
|
||||
for (PRUint16 i = 0; i < mAttrCount; ++i) {
|
||||
size += Attrs()[i].mValue.SizeOf() - sizeof(Attrs()[i].mValue);
|
||||
n += Attrs()[i].mValue.SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
return size;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
#endif
|
||||
|
||||
PRInt64 SizeOf() const;
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
nsMappedAttributes(const nsMappedAttributes& aCopy);
|
||||
|
|
|
@ -68,10 +68,6 @@ protected:
|
|||
{}
|
||||
|
||||
public:
|
||||
|
||||
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsStyledElementNotElementCSSInlineStyle,
|
||||
nsStyledElementBase)
|
||||
|
||||
// nsIContent interface methods
|
||||
virtual nsIAtom* GetClassAttributeName() const;
|
||||
virtual nsIAtom* GetIDAttributeName() const;
|
||||
|
@ -119,10 +115,6 @@ protected:
|
|||
};
|
||||
|
||||
class nsStyledElement : public nsStyledElementNotElementCSSInlineStyle {
|
||||
public:
|
||||
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsStyledElement,
|
||||
nsStyledElementNotElementCSSInlineStyle)
|
||||
|
||||
protected:
|
||||
inline nsStyledElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsStyledElementNotElementCSSInlineStyle(aNodeInfo)
|
||||
|
|
|
@ -429,6 +429,20 @@ nsTextFragment::Append(const PRUnichar* aBuffer, PRUint32 aLength, bool aUpdateB
|
|||
|
||||
}
|
||||
|
||||
/* virtual */ size_t
|
||||
nsTextFragment::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
if (Is2b()) {
|
||||
return aMallocSizeOf(m2b);
|
||||
}
|
||||
|
||||
if (mState.mInHeap) {
|
||||
return aMallocSizeOf(m1b);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// To save time we only do this when we really want to know, not during
|
||||
// every allocation
|
||||
void
|
||||
|
|
|
@ -223,16 +223,7 @@ public:
|
|||
PRUint32 mLength : 29;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the size taken in memory by this text fragment.
|
||||
* @return the size taken in memory by this text fragment.
|
||||
*/
|
||||
PRInt64 SizeOf() const
|
||||
{
|
||||
PRInt64 size = sizeof(*this);
|
||||
size += GetLength() * (Is2b() ? sizeof(*m2b) : sizeof(*m1b));
|
||||
return size;
|
||||
}
|
||||
size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
void ReleaseText();
|
||||
|
|
|
@ -69,9 +69,6 @@ public:
|
|||
// nsIDOMText
|
||||
NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::)
|
||||
|
||||
// DOM Memory Reporter participant.
|
||||
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsTextNode, nsGenericDOMDataNode)
|
||||
|
||||
// nsINode
|
||||
virtual bool IsNodeOfType(PRUint32 aFlags) const;
|
||||
|
||||
|
|
|
@ -1004,20 +1004,20 @@ nsEventListenerManager::GetJSEventListener(nsIAtom *aEventName, jsval *vp)
|
|||
*vp = OBJECT_TO_JSVAL(listener->GetHandler());
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsEventListenerManager::SizeOf() const
|
||||
size_t
|
||||
nsEventListenerManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)
|
||||
const
|
||||
{
|
||||
PRInt64 size = sizeof(*this);
|
||||
size_t n = aMallocSizeOf(this);
|
||||
n += mListeners.SizeOfExcludingThis(aMallocSizeOf);
|
||||
PRUint32 count = mListeners.Length();
|
||||
for (PRUint32 i = 0; i < count; ++i) {
|
||||
const nsListenerStruct& ls = mListeners.ElementAt(i);
|
||||
size += sizeof(ls);
|
||||
nsIJSEventListener* jsl = ls.GetJSListener();
|
||||
nsIJSEventListener* jsl = mListeners.ElementAt(i).GetJSListener();
|
||||
if (jsl) {
|
||||
size += jsl->SizeOf();
|
||||
n += jsl->SizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
}
|
||||
return size;
|
||||
return n;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -243,7 +243,7 @@ public:
|
|||
|
||||
bool MayHaveMouseEnterLeaveEventListener() { return mMayHaveMouseEnterLeaveEventListener; }
|
||||
|
||||
PRInt64 SizeOf() const;
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
void UnmarkGrayJSListeners();
|
||||
|
||||
|
|
|
@ -718,15 +718,8 @@ nsEncodingFormSubmission::nsEncodingFormSubmission(const nsACString& aCharset,
|
|||
charset.AssignLiteral("windows-1252");
|
||||
}
|
||||
|
||||
// use UTF-8 for UTF-16* (per WHATWG and existing practice of
|
||||
// MS IE/Opera).
|
||||
if (StringBeginsWith(charset, NS_LITERAL_CSTRING("UTF-16"))) {
|
||||
charset.AssignLiteral("UTF-8");
|
||||
}
|
||||
|
||||
if (!(charset.EqualsLiteral("UTF-8") || charset.EqualsLiteral("gb18030"))) {
|
||||
nsAutoString charsetUtf16;
|
||||
CopyUTF8toUTF16(charset, charsetUtf16);
|
||||
NS_ConvertUTF8toUTF16 charsetUtf16(charset);
|
||||
const PRUnichar* charsetPtr = charsetUtf16.get();
|
||||
SendJSWarning(aOriginatingElement ? aOriginatingElement->GetOwnerDocument()
|
||||
: nsnull,
|
||||
|
@ -869,6 +862,15 @@ GetSubmissionFromForm(nsGenericHTMLElement* aForm,
|
|||
nsCAutoString charset;
|
||||
GetSubmitCharset(aForm, charset);
|
||||
|
||||
// We now have a canonical charset name, so we only have to check it
|
||||
// against canonical names.
|
||||
|
||||
// use UTF-8 for UTF-16* (per WHATWG and existing practice of
|
||||
// MS IE/Opera).
|
||||
if (StringBeginsWith(charset, NS_LITERAL_CSTRING("UTF-16"))) {
|
||||
charset.AssignLiteral("UTF-8");
|
||||
}
|
||||
|
||||
// Choose encoder
|
||||
if (method == NS_FORM_METHOD_POST &&
|
||||
enctype == NS_FORM_ENCTYPE_MULTIPART) {
|
||||
|
|
|
@ -82,9 +82,6 @@ public:
|
|||
"Unexpected namespace");
|
||||
}
|
||||
|
||||
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsGenericHTMLElement,
|
||||
nsGenericHTMLElementBase)
|
||||
|
||||
/** Typesafe, non-refcounting cast from nsIContent. Cheaper than QI. **/
|
||||
static nsGenericHTMLElement* FromContent(nsIContent *aContent)
|
||||
{
|
||||
|
@ -874,9 +871,6 @@ public:
|
|||
nsGenericHTMLFormElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsGenericHTMLFormElement();
|
||||
|
||||
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsGenericHTMLFormElement,
|
||||
nsGenericHTMLElement)
|
||||
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
virtual bool IsNodeOfType(PRUint32 aFlags) const;
|
||||
|
|
|
@ -269,16 +269,6 @@ nsGenericHTMLFrameElement::IsHTMLFocusable(bool aWithMouse,
|
|||
return false;
|
||||
}
|
||||
|
||||
PRInt64
|
||||
nsGenericHTMLFrameElement::SizeOf() const
|
||||
{
|
||||
PRInt64 size = MemoryReporter::GetBasicSize<nsGenericHTMLFrameElement,
|
||||
nsGenericHTMLElement>(this);
|
||||
// TODO: need to implement SizeOf() in nsFrameLoader, bug 672539.
|
||||
size += mFrameLoader ? sizeof(*mFrameLoader.get()) : 0;
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLFrameElement::GetMozbrowser(bool *aValue)
|
||||
{
|
||||
|
|
|
@ -34,7 +34,6 @@ public:
|
|||
NS_DECL_NSIFRAMELOADEROWNER
|
||||
NS_DECL_NSIDOMMOZBROWSERFRAME
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_DOM_MEMORY_REPORTER_SIZEOF
|
||||
|
||||
// nsIContent
|
||||
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, PRInt32 *aTabIndex);
|
||||
|
|
|
@ -97,10 +97,8 @@ public:
|
|||
// nsIDOMHTMLAnchorElement
|
||||
NS_DECL_NSIDOMHTMLANCHORELEMENT
|
||||
|
||||
// TODO: we do not really count Link::mCachedURI but given that it's a
|
||||
// nsCOMPtr<nsIURI>, that would be required adding SizeOf() to the interface.
|
||||
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsHTMLAnchorElement,
|
||||
nsGenericHTMLElement)
|
||||
// TODO: nsHTMLAnchorElement::SizeOfAnchorElement should call
|
||||
// Link::SizeOfExcludingThis(). See bug 682431.
|
||||
|
||||
// nsILink
|
||||
NS_IMETHOD LinkAdded() { return NS_OK; }
|
||||
|
|
|
@ -61,6 +61,9 @@ public:
|
|||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// TODO: nsHTMLAreaElement::SizeOfAnchorElement should call
|
||||
// Link::SizeOfExcludingThis(). See bug 682431.
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
|
||||
|
||||
|
|
|
@ -69,9 +69,6 @@ public:
|
|||
// nsIDOMHTMLDivElement
|
||||
NS_DECL_NSIDOMHTMLDIVELEMENT
|
||||
|
||||
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsHTMLDivElement,
|
||||
nsGenericHTMLElement)
|
||||
|
||||
virtual bool ParseAttribute(PRInt32 aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
|
|
|
@ -84,6 +84,9 @@ public:
|
|||
// nsIDOMHTMLLinkElement
|
||||
NS_DECL_NSIDOMHTMLLINKELEMENT
|
||||
|
||||
// TODO: nsHTMLLinkElement::SizeOfAnchorElement should call
|
||||
// Link::SizeOfExcludingThis(). See bug 682431.
|
||||
|
||||
// nsILink
|
||||
NS_IMETHOD LinkAdded();
|
||||
NS_IMETHOD LinkRemoved();
|
||||
|
|
|
@ -62,9 +62,6 @@ public:
|
|||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
|
||||
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsHTMLSpanElement,
|
||||
nsGenericHTMLElement)
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
|
|
@ -272,6 +272,7 @@ _TEST_FILES = \
|
|||
test_bug674558.html \
|
||||
test_bug583533.html \
|
||||
test_restore_from_parser_fragment.html \
|
||||
test_bug615595.html \
|
||||
test_bug617528.html \
|
||||
test_bug660959-1.html \
|
||||
test_bug660959-2.html \
|
||||
|
|
|
@ -3449,3 +3449,22 @@ nsHTMLDocument::RemovedFromDocShell()
|
|||
mEditingState = eOff;
|
||||
nsDocument::RemovedFromDocShell();
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
nsHTMLDocument::DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
||||
{
|
||||
nsDocument::DocSizeOfExcludingThis(aWindowSizes);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mImages
|
||||
// - mApplets
|
||||
// - mEmbeds
|
||||
// - mLinks
|
||||
// - mAnchors
|
||||
// - mScripts
|
||||
// - mForms
|
||||
// - mFormControls
|
||||
// - mWyciwygChannel
|
||||
// - mMidasCommandManager
|
||||
}
|
||||
|
|
|
@ -204,6 +204,10 @@ public:
|
|||
}
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual void DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const;
|
||||
// DocSizeOfIncludingThis is inherited from nsIDocument.
|
||||
|
||||
protected:
|
||||
nsresult GetBodySize(PRInt32* aWidth,
|
||||
PRInt32* aHeight);
|
||||
|
|
|
@ -62,10 +62,6 @@ public:
|
|||
// nsIDOMText
|
||||
NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::)
|
||||
|
||||
// DOM Memory Reporter participant.
|
||||
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsXMLCDATASection,
|
||||
nsGenericDOMDataNode)
|
||||
|
||||
// nsIDOMCDATASection
|
||||
// Empty interface
|
||||
|
||||
|
|
|
@ -65,10 +65,6 @@ public:
|
|||
// nsIDOMProcessingInstruction
|
||||
NS_DECL_NSIDOMPROCESSINGINSTRUCTION
|
||||
|
||||
// DOM Memory Reporter participant.
|
||||
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsXMLProcessingInstruction,
|
||||
nsGenericDOMDataNode)
|
||||
|
||||
// nsINode
|
||||
virtual bool IsNodeOfType(PRUint32 aFlags) const;
|
||||
|
||||
|
|
|
@ -595,6 +595,12 @@ nsXMLDocument::EndLoad()
|
|||
}
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
nsXMLDocument::DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
||||
{
|
||||
nsDocument::DocSizeOfExcludingThis(aWindowSizes);
|
||||
}
|
||||
|
||||
// nsIDOMDocument interface
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -76,6 +76,10 @@ public:
|
|||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual void DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const;
|
||||
// DocSizeOfIncludingThis is inherited from nsIDocument.
|
||||
|
||||
protected:
|
||||
// mChannelIsPending indicates whether we're currently asynchronously loading
|
||||
// data from mChannel (via document.load() or normal load). It's set to true
|
||||
|
|
|
@ -1149,21 +1149,17 @@ Navigator::GetMozBluetooth(nsIDOMBluetoothAdapter** aBluetooth)
|
|||
}
|
||||
#endif //MOZ_B2G_BT
|
||||
|
||||
PRInt64
|
||||
Navigator::SizeOf() const
|
||||
size_t
|
||||
Navigator::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
PRInt64 size = sizeof(*this);
|
||||
size_t n = aMallocSizeOf(this);
|
||||
|
||||
// TODO: add SizeOf() to nsMimeTypeArray, bug 674113.
|
||||
size += mMimeTypes ? sizeof(*mMimeTypes.get()) : 0;
|
||||
// TODO: add SizeOf() to nsPluginArray, bug 674114.
|
||||
size += mPlugins ? sizeof(*mPlugins.get()) : 0;
|
||||
// TODO: add SizeOf() to nsGeolocation, bug 674115.
|
||||
size += mGeolocation ? sizeof(*mGeolocation.get()) : 0;
|
||||
// TODO: add SizeOf() to nsDesktopNotificationCenter, bug 674116.
|
||||
size += mNotification ? sizeof(*mNotification.get()) : 0;
|
||||
// TODO: add SizeOfIncludingThis() to nsMimeTypeArray, bug 674113.
|
||||
// TODO: add SizeOfIncludingThis() to nsPluginArray, bug 674114.
|
||||
// TODO: add SizeOfIncludingThis() to nsGeolocation, bug 674115.
|
||||
// TODO: add SizeOfIncludingThis() to nsDesktopNotificationCenter, bug 674116.
|
||||
|
||||
return size;
|
||||
return n;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -136,7 +136,7 @@ public:
|
|||
|
||||
static bool HasDesktopNotificationSupport();
|
||||
|
||||
PRInt64 SizeOf() const;
|
||||
size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
|
||||
/**
|
||||
* For use during document.write where our inner window changes.
|
||||
|
|