merge fx-team to mozilla-central

This commit is contained in:
Carsten "Tomcat" Book 2013-11-21 14:32:10 +01:00
commit c2ff3261b4
118 changed files with 1383 additions and 20134 deletions

View File

@ -659,9 +659,18 @@ pref("plugins.update.notifyUser", false);
pref("plugins.click_to_play", true);
// let all plugins except Flash default to click-to-play
#ifdef RELEASE_BUILD
// For now, plugins other than Java and Flash are enabled in beta/release
// and click-to-activate in earlier channels.
pref("plugin.default.state", 2);
#else
pref("plugin.default.state", 1);
#endif
// Flash is enabled by default, and Java is click-to-activate by default on
// all channels.
pref("plugin.state.flash", 2);
pref("plugin.state.java", 1);
// display door hanger if flash not installed
pref("plugins.notifyMissingFlash", true);
@ -1227,14 +1236,6 @@ pref("devtools.hud.loglimit.console", 200);
pref("devtools.editor.tabsize", 4);
pref("devtools.editor.expandtab", true);
// Tells which component you want to use for source editing in developer tools.
//
// Available components:
// "orion" - this is the Orion source code editor from the Eclipse project. It
// provides programmer-specific editor features such as syntax highlighting,
// indenting and bracket recognition.
pref("devtools.editor.component", "orion");
// Enable the Font Inspector
pref("devtools.fontinspector.enabled", true);

View File

@ -21,17 +21,22 @@ function init(aEvent)
distroIdField.value = distroId + " - " + distroVersion;
distroIdField.style.display = "block";
// This must be set last because it might not exist due to bug 895473.
var distroAbout = Services.prefs.getComplexValue("distribution.about",
Components.interfaces.nsISupportsString);
var distroField = document.getElementById("distribution");
distroField.value = distroAbout;
distroField.style.display = "block";
try {
// This is in its own try catch due to bug 895473 and bug 900925.
var distroAbout = Services.prefs.getComplexValue("distribution.about",
Components.interfaces.nsISupportsString);
var distroField = document.getElementById("distribution");
distroField.value = distroAbout;
distroField.style.display = "block";
}
catch (ex) {
// Pref is unset
Components.utils.reportError(ex);
}
}
}
catch (e) {
// Pref is unset
Components.utils.reportError(e);
}
// Include the build ID and display warning if this is an "a#" (nightly or aurora) build

View File

@ -1506,6 +1506,16 @@ let CustomizableUIInternal = {
}
gPalette.set(widget.id, widget);
// Clear our caches:
gGroupWrapperCache.delete(widget.id);
for (let [win, ] of gBuildWindows) {
let cache = gSingleWrapperCache.get(win);
if (cache) {
cache.delete(widget.id);
}
}
this.notifyListeners("onWidgetCreated", widget.id);
if (widget.defaultArea) {

View File

@ -36,4 +36,5 @@ skip-if = true
skip-if = os == "mac"
[browser_938980_navbar_collapsed.js]
[browser_941083_invalidate_wrapper_cache_createWidget.js]
[browser_panel_toggle.js]

View File

@ -114,14 +114,7 @@ let gTests = [
setup: startCustomizing,
run: function() {
otherWin = yield openAndLoadWindow(null, true);
// Open and close the panel to force its construction:
let shownPromise = promisePanelShown(otherWin);
otherWin.PanelUI.toggle({type: "command"});
yield shownPromise;
let hiddenPromise = promisePanelHidden(otherWin);
otherWin.PanelUI.toggle({type: "command"});
yield hiddenPromise;
yield otherWin.PanelUI.ensureReady();
ok(CustomizableUI.inDefaultState, "Should start in default state");
for (let widgetId of [kXULWidgetId, kAPIWidgetId]) {

View File

@ -0,0 +1,38 @@
/* 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/. */
// See https://bugzilla.mozilla.org/show_bug.cgi?id=941083
const kWidgetId = "test-invalidate-wrapper-cache";
let gTests = [
{
desc: "Check createWidget invalidates the widget cache",
run: function() {
let groupWrapper = CustomizableUI.getWidget(kWidgetId);
ok(groupWrapper, "Should get group wrapper.");
let singleWrapper = groupWrapper.forWindow(window);
ok(singleWrapper, "Should get single wrapper.");
CustomizableUI.createWidget({id: kWidgetId, label: "Test invalidating widgets caching"});
let newGroupWrapper = CustomizableUI.getWidget(kWidgetId);
ok(newGroupWrapper, "Should get a group wrapper again.");
isnot(newGroupWrapper, groupWrapper, "Wrappers shouldn't be the same.");
isnot(newGroupWrapper.provider, groupWrapper.provider, "Wrapper providers shouldn't be the same.");
let newSingleWrapper = newGroupWrapper.forWindow(window);
isnot(newSingleWrapper, singleWrapper, "Single wrappers shouldn't be the same.");
isnot(newSingleWrapper.provider, singleWrapper.provider, "Single wrapper providers shouldn't be the same.");
CustomizableUI.destroyWidget(kWidgetId);
ok(!CustomizableUI.getWidget(kWidgetId), "Shouldn't get a wrapper after destroying the widget.");
},
},
];
function test() {
waitForExplicitFinish();
runTests(gTests);
}

View File

@ -1398,12 +1398,36 @@ EventListeners.prototype = {
*/
scheduleEventListenersFetch: function() {
let getListeners = aCallback => gThreadClient.eventListeners(aResponse => {
this._onEventListeners(aResponse);
if (aResponse.error) {
let msg = "Error getting event listeners: " + aResponse.message;
DevToolsUtils.reportException("scheduleEventListenersFetch", msg);
return;
}
// Notify that event listeners were fetched and shown in the view,
// and callback to resume the active thread if necessary.
window.emit(EVENTS.EVENT_LISTENERS_FETCHED);
aCallback && aCallback();
promise.all(aResponse.listeners.map(listener => {
const deferred = promise.defer();
gThreadClient.pauseGrip(listener.function).getDefinitionSite(aResponse => {
if (aResponse.error) {
const msg = "Error getting function definition site: " + aResponse.message;
DevToolsUtils.reportException("scheduleEventListenersFetch", msg);
deferred.reject(msg);
return;
}
listener.function.url = aResponse.url;
deferred.resolve(listener);
});
return deferred.promise;
})).then(listeners => {
this._onEventListeners(listeners);
// Notify that event listeners were fetched and shown in the view,
// and callback to resume the active thread if necessary.
window.emit(EVENTS.EVENT_LISTENERS_FETCHED);
aCallback && aCallback();
});
});
// Make sure we're not sending a batch of closely repeated requests.
@ -1418,18 +1442,11 @@ EventListeners.prototype = {
},
/**
* Callback for the debugger's active thread eventListeners() method.
* Callback for a debugger's successful active thread eventListeners() call.
*/
_onEventListeners: function(aResponse) {
if (aResponse.error) {
let msg = "Error getting event listeners: " + aResponse.message;
Cu.reportError(msg);
dumpn(msg);
return;
}
_onEventListeners: function(aListeners) {
// Add all the listeners in the debugger view event linsteners container.
for (let listener of aResponse.listeners) {
for (let listener of aListeners) {
DebuggerView.EventListeners.addListener(listener, { staged: true });
}

View File

@ -60,55 +60,77 @@ function testEventListeners(aThreadClient) {
let deferred = promise.defer();
aThreadClient.eventListeners(aPacket => {
if (aPacket.error) {
let msg = "Error getting event listeners: " + aPacket.message;
ok(false, msg);
deferred.reject(msg);
return;
}
is(aPacket.listeners.length, 3,
"Found all event listeners.");
let types = [];
promise.all(aPacket.listeners.map(listener => {
const lDeferred = promise.defer();
aThreadClient.pauseGrip(listener.function).getDefinitionSite(aResponse => {
if (aResponse.error) {
const msg = "Error getting function definition site: " + aResponse.message;
ok(false, msg);
lDeferred.reject(msg);
return;
}
listener.function.url = aResponse.url;
lDeferred.resolve(listener);
});
return lDeferred.promise;
})).then(listeners => {
let types = [];
for (let l of aPacket.listeners) {
let node = l.node;
ok(node, "There is a node property.");
ok(node.object, "There is a node object property.");
ok(node.selector == "window" ||
content.document.querySelectorAll(node.selector).length == 1,
"The node property is a unique CSS selector.");
for (let l of listeners) {
let node = l.node;
ok(node, "There is a node property.");
ok(node.object, "There is a node object property.");
ok(node.selector == "window" ||
content.document.querySelectorAll(node.selector).length == 1,
"The node property is a unique CSS selector.");
let func = l.function;
ok(func, "There is a function property.");
is(func.type, "object", "The function form is of type 'object'.");
is(func.class, "Function", "The function form is of class 'Function'.");
is(func.url, TAB_URL, "The function url is correct.");
let func = l.function;
ok(func, "There is a function property.");
is(func.type, "object", "The function form is of type 'object'.");
is(func.class, "Function", "The function form is of class 'Function'.");
is(func.url, TAB_URL, "The function url is correct.");
is(l.allowsUntrusted, true,
"'allowsUntrusted' property has the right value.");
is(l.inSystemEventGroup, false,
"'inSystemEventGroup' property has the right value.");
is(l.allowsUntrusted, true,
"'allowsUntrusted' property has the right value.");
is(l.inSystemEventGroup, false,
"'inSystemEventGroup' property has the right value.");
types.push(l.type);
types.push(l.type);
if (l.type == "keyup") {
is(l.capturing, true,
"Capturing property has the right value.");
is(l.isEventHandler, false,
"'isEventHandler' property has the right value.");
} else if (l.type == "load") {
is(l.capturing, false,
"Capturing property has the right value.");
is(l.isEventHandler, false,
"'isEventHandler' property has the right value.");
} else {
is(l.capturing, false,
"Capturing property has the right value.");
is(l.isEventHandler, true,
"'isEventHandler' property has the right value.");
if (l.type == "keyup") {
is(l.capturing, true,
"Capturing property has the right value.");
is(l.isEventHandler, false,
"'isEventHandler' property has the right value.");
} else if (l.type == "load") {
is(l.capturing, false,
"Capturing property has the right value.");
is(l.isEventHandler, false,
"'isEventHandler' property has the right value.");
} else {
is(l.capturing, false,
"Capturing property has the right value.");
is(l.isEventHandler, true,
"'isEventHandler' property has the right value.");
}
}
}
ok(types.indexOf("click") != -1, "Found the click handler.");
ok(types.indexOf("change") != -1, "Found the change handler.");
ok(types.indexOf("keyup") != -1, "Found the keyup handler.");
ok(types.indexOf("click") != -1, "Found the click handler.");
ok(types.indexOf("change") != -1, "Found the change handler.");
ok(types.indexOf("keyup") != -1, "Found the keyup handler.");
aThreadClient.resume(deferred.resolve);
aThreadClient.resume(deferred.resolve);
});
});
return deferred.promise;

View File

@ -28,7 +28,6 @@ browser.jar:
content/browser/devtools/fontinspector/font-inspector.js (fontinspector/font-inspector.js)
content/browser/devtools/fontinspector/font-inspector.xhtml (fontinspector/font-inspector.xhtml)
content/browser/devtools/fontinspector/font-inspector.css (fontinspector/font-inspector.css)
content/browser/devtools/orion.js (sourceeditor/orion/orion.js)
content/browser/devtools/codemirror/codemirror.js (sourceeditor/codemirror/codemirror.js)
content/browser/devtools/codemirror/codemirror.css (sourceeditor/codemirror/codemirror.css)
content/browser/devtools/codemirror/javascript.js (sourceeditor/codemirror/javascript.js)
@ -45,7 +44,6 @@ browser.jar:
content/browser/devtools/codemirror/dialog.js (sourceeditor/codemirror/dialog/dialog.js)
content/browser/devtools/codemirror/dialog.css (sourceeditor/codemirror/dialog/dialog.css)
content/browser/devtools/codemirror/mozilla.css (sourceeditor/codemirror/mozilla.css)
* content/browser/devtools/source-editor-overlay.xul (sourceeditor/source-editor-overlay.xul)
content/browser/devtools/debugger.xul (debugger/debugger.xul)
content/browser/devtools/debugger.css (debugger/debugger.css)
content/browser/devtools/debugger-controller.js (debugger/debugger-controller.js)

View File

@ -67,7 +67,8 @@ function HTMLEditor(htmlDocument)
this.editorInner.addEventListener("click", stopPropagation, false);
this.editor = new Editor(config);
this.editor.appendTo(this.editorInner).then(() => {
let iframe = this.editorInner.ownerDocument.createElement("iframe");
this.editor.appendTo(this.editorInner, iframe).then(() => {
this.hide(false);
}).then(null, (err) => console.log(err.message));
}

View File

@ -24,6 +24,7 @@ const BUTTON_POSITION_SAVE = 0;
const BUTTON_POSITION_CANCEL = 1;
const BUTTON_POSITION_DONT_SAVE = 2;
const BUTTON_POSITION_REVERT = 0;
const EVAL_FUNCTION_TIMEOUT = 1000; // milliseconds
const SCRATCHPAD_L10N = "chrome://browser/locale/devtools/scratchpad.properties";
const DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";
@ -75,6 +76,9 @@ XPCOMUtils.defineLazyGetter(this, "REMOTE_TIMEOUT", () =>
XPCOMUtils.defineLazyModuleGetter(this, "ShortcutUtils",
"resource://gre/modules/ShortcutUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Reflect",
"resource://gre/modules/reflect.jsm");
// Because we have no constructor / destructor where we can log metrics we need
// to do so here.
let telemetry = new Telemetry();
@ -567,6 +571,168 @@ var Scratchpad = {
return deferred.promise;
},
/**
* Parse the text and return an AST. If we can't parse it, write an error
* comment and return false.
*/
_parseText: function SP__parseText(aText) {
try {
return Reflect.parse(aText);
} catch (e) {
this.writeAsErrorComment(DevToolsUtils.safeErrorString(e));
return false;
}
},
/**
* Determine if the given AST node location contains the given cursor
* position.
*
* @returns Boolean
*/
_containsCursor: function (aLoc, aCursorPos) {
// Our line numbers are 1-based, while CodeMirror's are 0-based.
const lineNumber = aCursorPos.line + 1;
const columnNumber = aCursorPos.ch;
if (aLoc.start.line <= lineNumber && aLoc.end.line >= lineNumber) {
if (aLoc.start.line === aLoc.end.line) {
return aLoc.start.column <= columnNumber
&& aLoc.end.column >= columnNumber;
}
if (aLoc.start.line == lineNumber) {
return columnNumber >= aLoc.start.column;
}
if (aLoc.end.line == lineNumber) {
return columnNumber <= aLoc.end.column;
}
return true;
}
return false;
},
/**
* Find the top level function AST node that the cursor is within.
*
* @returns Object|null
*/
_findTopLevelFunction: function SP__findTopLevelFunction(aAst, aCursorPos) {
for (let statement of aAst.body) {
switch (statement.type) {
case "FunctionDeclaration":
if (this._containsCursor(statement.loc, aCursorPos)) {
return statement;
}
break;
case "VariableDeclaration":
for (let decl of statement.declarations) {
if (!decl.init) {
continue;
}
if ((decl.init.type == "FunctionExpression"
|| decl.init.type == "ArrowExpression")
&& this._containsCursor(decl.loc, aCursorPos)) {
return decl;
}
}
break;
}
}
return null;
},
/**
* Get the source text associated with the given function statement.
*
* @param Object aFunction
* @param String aFullText
* @returns String
*/
_getFunctionText: function SP__getFunctionText(aFunction, aFullText) {
let functionText = "";
// Initially set to 0, but incremented first thing in the loop below because
// line numbers are 1 based, not 0 based.
let lineNumber = 0;
const { start, end } = aFunction.loc;
const singleLine = start.line === end.line;
for (let line of aFullText.split(/\n/g)) {
lineNumber++;
if (singleLine && start.line === lineNumber) {
functionText = line.slice(start.column, end.column);
break;
}
if (start.line === lineNumber) {
functionText += line.slice(start.column) + "\n";
continue;
}
if (end.line === lineNumber) {
functionText += line.slice(0, end.column);
break;
}
if (start.line < lineNumber && end.line > lineNumber) {
functionText += line + "\n";
}
}
return functionText;
},
/**
* Evaluate the top level function that the cursor is resting in.
*
* @returns Promise [text, error, result]
*/
evalTopLevelFunction: function SP_evalTopLevelFunction() {
const text = this.getText();
const ast = this._parseText(text);
if (!ast) {
return promise.resolve([text, undefined, undefined]);
}
const cursorPos = this.editor.getCursor();
const funcStatement = this._findTopLevelFunction(ast, cursorPos);
if (!funcStatement) {
return promise.resolve([text, undefined, undefined]);
}
let functionText = this._getFunctionText(funcStatement, text);
// TODO: This is a work around for bug 940086. It should be removed when
// that is fixed.
if (funcStatement.type == "FunctionDeclaration"
&& !functionText.startsWith("function ")) {
functionText = "function " + functionText;
funcStatement.loc.start.column -= 9;
}
// The decrement by one is because our line numbers are 1-based, while
// CodeMirror's are 0-based.
const from = {
line: funcStatement.loc.start.line - 1,
ch: funcStatement.loc.start.column
};
const to = {
line: funcStatement.loc.end.line - 1,
ch: funcStatement.loc.end.column
};
const marker = this.editor.markText(from, to, { className: "eval-text" });
setTimeout(() => marker.clear(), EVAL_FUNCTION_TIMEOUT);
return this.evaluate(functionText);
},
/**
* Writes out a primitive value as a comment. This handles values which are
* to be printed directly (number, string) as well as grips to values
@ -1516,7 +1682,7 @@ var Scratchpad = {
* Add an observer for Scratchpad events.
*
* The observer implements IScratchpadObserver := {
* onReady: Called when the Scratchpad and its SourceEditor are ready.
* onReady: Called when the Scratchpad and its Editor are ready.
* Arguments: (Scratchpad aScratchpad)
* }
*

View File

@ -63,6 +63,7 @@
<command id="sp-cmd-contentContext" oncommand="Scratchpad.setContentContext();"/>
<command id="sp-cmd-browserContext" oncommand="Scratchpad.setBrowserContext();" disabled="true"/>
<command id="sp-cmd-reloadAndRun" oncommand="Scratchpad.reloadAndRun();"/>
<command id="sp-cmd-evalFunction" oncommand="Scratchpad.evalTopLevelFunction();"/>
<command id="sp-cmd-errorConsole" oncommand="Scratchpad.openErrorConsole();" disabled="true"/>
<command id="sp-cmd-webConsole" oncommand="Scratchpad.openWebConsole();"/>
<command id="sp-cmd-documentationLink" oncommand="Scratchpad.openDocumentationPage();"/>
@ -108,6 +109,10 @@
key="&reloadAndRun.key;"
command="sp-cmd-reloadAndRun"
modifiers="accel,shift"/>
<key id="sp-key-evalFunction"
key="&evalFunction.key;"
command="sp-cmd-evalFunction"
modifiers="accel"/>
<key id="sp-key-errorConsole"
key="&errorConsoleCmd.commandkey;"
command="sp-cmd-errorConsole"
@ -213,6 +218,11 @@
key="sp-key-reloadAndRun"
accesskey="&reloadAndRun.accesskey;"
command="sp-cmd-reloadAndRun"/>
<menuitem id="sp-text-evalFunction"
label="&evalFunction.label;"
key="sp-key-evalFunction"
accesskey="&evalFunction.accesskey;"
command="sp-cmd-evalFunction"/>
</menupopup>
</menu>
@ -314,6 +324,11 @@
accesskey="&display.accesskey;"
key="sp-key-display"
command="sp-cmd-display"/>
<menuitem id="sp-text-evalFunction"
label="&evalFunction.label;"
key="sp-key-evalFunction"
accesskey="&evalFunction.accesskey;"
command="sp-cmd-evalFunction"/>
</menupopup>
</popupset>

View File

@ -4,6 +4,7 @@ support-files = head.js
[browser_scratchpad_browser_last_window_closing.js]
[browser_scratchpad_reset_undo.js]
[browser_scratchpad_display_outputs_errors.js]
[browser_scratchpad_eval_func.js]
[browser_scratchpad_goto_line_ui.js]
[browser_scratchpad_reload_and_run.js]
[browser_scratchpad_display_non_error_exceptions.js]

View File

@ -5,10 +5,6 @@
"use strict";
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
function test()
{
waitForExplicitFinish();

View File

@ -0,0 +1,86 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test()
{
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
openScratchpad(runTests);
}, true);
content.location = "data:text/html;charset=utf8,test Scratchpad eval function.";
}
function reportErrorAndQuit(error) {
DevToolsUtils.reportException("browser_scratchpad_eval_func.js", error);
ok(false);
finish();
}
function runTests(sw)
{
const sp = sw.Scratchpad;
let foo = "" + function main() { console.log(1); };
let bar = "var bar = " + (() => { console.log(2); });
const fullText =
foo + "\n" +
"\n" +
bar + "\n"
sp.setText(fullText);
// On the function declaration.
sp.editor.setCursor({ line: 0, ch: 18 });
sp.evalTopLevelFunction()
.then(([text, error, result]) => {
is(text, foo, "Should re-eval foo.");
ok(!error, "Should not have got an error.");
ok(result, "Should have got a result.");
})
// On the arrow function.
.then(() => {
sp.editor.setCursor({ line: 2, ch: 18 });
return sp.evalTopLevelFunction();
})
.then(([text, error, result]) => {
is(text, bar.replace("var ", ""), "Should re-eval bar.");
ok(!error, "Should not have got an error.");
ok(result, "Should have got a result.");
})
// On the empty line.
.then(() => {
sp.editor.setCursor({ line: 1, ch: 0 });
return sp.evalTopLevelFunction();
})
.then(([text, error, result]) => {
is(text, fullText,
"Should get full text back since we didn't find a specific function.");
ok(!error, "Should not have got an error.");
ok(!result, "Should not have got a result.");
})
// Syntax error.
.then(() => {
sp.setText("function {}");
sp.editor.setCursor({ line: 0, ch: 9 });
return sp.evalTopLevelFunction();
})
.then(([text, error, result]) => {
is(text, "function {}",
"Should get the full text back since there was a parse error.");
ok(!error, "Should not have got an error");
ok(!result, "Should not have got a result");
ok(sp.getText().contains("SyntaxError"),
"We should have written the syntax error to the scratchpad.");
})
.then(finish, reportErrorAndQuit);
}

View File

@ -10,7 +10,11 @@
} else {
dialog.className = "CodeMirror-dialog CodeMirror-dialog-top";
}
dialog.innerHTML = template;
if (typeof template == "string") {
dialog.innerHTML = template;
} else {
dialog.appendChild(template);
}
return dialog;
}

View File

@ -18,21 +18,21 @@
}
.error {
background-image: url("chrome://browser/skin/devtools/orion-error.png");
background-image: url("chrome://browser/skin/devtools/editor-error.png");
opacity: 0.75;
}
.breakpoint {
background-image: url("chrome://browser/skin/devtools/orion-breakpoint.png");
background-image: url("chrome://browser/skin/devtools/editor-breakpoint.png");
}
.debugLocation {
background-image: url("chrome://browser/skin/devtools/orion-debug-location.png");
background-image: url("chrome://browser/skin/devtools/editor-debug-location.png");
}
.breakpoint.debugLocation {
background-image: url("chrome://browser/skin/devtools/orion-debug-location.png"),
url("chrome://browser/skin/devtools/orion-breakpoint.png");
background-image: url("chrome://browser/skin/devtools/editor-debug-location.png"),
url("chrome://browser/skin/devtools/editor-breakpoint.png");
}
.error-line {
@ -54,3 +54,17 @@ selector in floating-scrollbar-light.css across all platforms. */
.CodeMirror-vscrollbar {
min-width: 10px;
}
/* This is to make CodeMirror's dialogs more DevTool-ey. */
.CodeMirror-dialog {
font: message-box;
padding: 5px 4px;
color: hsl(210,30%,85%);
background-image: url("chrome://browser/skin/devtools/background-noise-toolbar.png"),
linear-gradient(#3e4750, #3e4750);
}
.CodeMirror-dialog input {
font: message-box;
}

View File

@ -48,8 +48,17 @@
var queryDialog;
function doSearch(cm, rev) {
if (!queryDialog) {
queryDialog = cm.l10n('findCmd.promptMessage') +
' <input type="text" style="width: 10em"/>';
let doc = cm.getWrapperElement().ownerDocument;
let inp = doc.createElement("input");
let txt = doc.createTextNode(cm.l10n("findCmd.promptMessage"));
inp.type = "text";
inp.style.width = "10em";
inp.style.MozMarginStart = "1em";
queryDialog = doc.createElement("div");
queryDialog.appendChild(txt);
queryDialog.appendChild(inp);
}
var state = getSearchState(cm);

View File

@ -78,14 +78,10 @@ const CM_MAPPING = [
"clearHistory",
"openDialog",
"cursorCoords",
"markText",
"refresh"
];
const CM_JUMP_DIALOG = [
L10N.GetStringFromName("gotoLineCmd.promptTitle")
+ " <input type=text style='width: 10em'/>"
];
const { cssProperties, cssValues, cssColors } = getCSSKeywords();
const editors = new WeakMap();
@ -139,7 +135,7 @@ function Editor(config) {
};
// Additional shortcuts.
this.config.extraKeys[Editor.keyFor("jumpToLine")] = (cm) => this.jumpToLine();
this.config.extraKeys[Editor.keyFor("jumpToLine")] = (cm) => this.jumpToLine(cm);
this.config.extraKeys[Editor.keyFor("toggleComment")] = "toggleComment";
// Disable ctrl-[ and ctrl-] because toolbox uses those shortcuts.
@ -185,15 +181,19 @@ Editor.prototype = {
/**
* Appends the current Editor instance to the element specified by
* the only argument 'el'. This method actually creates and loads
* CodeMirror and all its dependencies.
* 'el'. You can also provide your won iframe to host the editor as
* an optional second parameter. This method actually creates and
* loads CodeMirror and all its dependencies.
*
* This method is asynchronous and returns a promise.
*/
appendTo: function (el) {
appendTo: function (el, env) {
let def = promise.defer();
let cm = editors.get(this);
let env = el.ownerDocument.createElement("iframe");
if (!env)
env = el.ownerDocument.createElementNS(XUL_NS, "iframe");
env.flex = 1;
if (cm)
@ -502,10 +502,11 @@ Editor.prototype = {
hasLineClass: function (line, className) {
let cm = editors.get(this);
let info = cm.lineInfo(line);
if (!info)
if (!info || !info.wrapClass)
return false;
return info.wrapClass == className;
return info.wrapClass.split(" ").indexOf(className) != -1;
},
/**
@ -619,9 +620,20 @@ Editor.prototype = {
* This method opens an in-editor dialog asking for a line to
* jump to. Once given, it changes cursor to that line.
*/
jumpToLine: function () {
this.openDialog(CM_JUMP_DIALOG, (line) =>
this.setCursor({ line: line - 1, ch: 0 }));
jumpToLine: function (cm) {
let doc = cm.getWrapperElement().ownerDocument;
let div = doc.createElement("div");
let inp = doc.createElement("input");
let txt = doc.createTextNode(L10N.GetStringFromName("gotoLineCmd.promptTitle"));
inp.type = "text";
inp.style.width = "10em";
inp.style.MozMarginStart = "1em";
div.appendChild(txt);
div.appendChild(inp);
this.openDialog(div, (line) => this.setCursor({ line: line - 1, ch: 0 }));
},
/**

View File

@ -10,9 +10,6 @@ JS_MODULES_PATH = 'modules/devtools/sourceeditor'
EXTRA_JS_MODULES += [
'debugger.js',
'editor.js',
'source-editor-orion.jsm',
'source-editor-ui.jsm',
'source-editor.jsm',
'editor.js'
]

View File

@ -1,29 +0,0 @@
Eclipse Distribution License - v 1.0
Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of the Eclipse Foundation, Inc. nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,56 +0,0 @@
#!/usr/bin/env node
/* vim:set ts=2 sw=2 sts=2 et tw=80:
* 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/. */
var copy = require('dryice').copy;
const ORION_EDITOR = "org.eclipse.orion.client.editor/web";
var js_src = copy.createDataObject();
copy({
source: [
ORION_EDITOR + "/orion/textview/global.js",
ORION_EDITOR + "/orion/textview/eventTarget.js",
ORION_EDITOR + "/orion/editor/regex.js",
ORION_EDITOR + "/orion/textview/keyBinding.js",
ORION_EDITOR + "/orion/textview/annotations.js",
ORION_EDITOR + "/orion/textview/rulers.js",
ORION_EDITOR + "/orion/textview/undoStack.js",
ORION_EDITOR + "/orion/textview/textModel.js",
ORION_EDITOR + "/orion/textview/projectionTextModel.js",
ORION_EDITOR + "/orion/textview/tooltip.js",
ORION_EDITOR + "/orion/textview/textView.js",
ORION_EDITOR + "/orion/textview/textDND.js",
ORION_EDITOR + "/orion/editor/htmlGrammar.js",
ORION_EDITOR + "/orion/editor/textMateStyler.js",
ORION_EDITOR + "/examples/textview/textStyler.js",
],
dest: js_src,
});
copy({
source: js_src,
dest: "orion.js",
});
var css_src = copy.createDataObject();
copy({
source: [
ORION_EDITOR + "/orion/textview/textview.css",
ORION_EDITOR + "/orion/textview/rulers.css",
ORION_EDITOR + "/orion/textview/annotations.css",
ORION_EDITOR + "/examples/textview/textstyler.css",
ORION_EDITOR + "/examples/editor/htmlStyles.css",
],
dest: css_src,
});
copy({
source: css_src,
dest: "orion.css",
});

View File

@ -1,43 +0,0 @@
# Introduction
This is the Orion editor packaged for Mozilla.
The Orion editor web site: http://www.eclipse.org/orion
# Upgrade
To upgrade Orion to a newer version see the UPGRADE file.
Orion version: git clone from 2012-01-26
commit hash 1d1150131dacecc9f4d9eb3cdda9103ea1819045
+ patch for Eclipse Bug 370584 - [Firefox] Edit menu items in context menus
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=137d5a8e9bbc0fa204caae74ebd25a7d9d4729bd
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=370584
+ patches for Eclipse Bug 370606 - Problems with UndoStack and deletions at
the beginning of the document
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=cec71bddaf32251c34d3728df5da13c130d14f33
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=3ce24b94f1d8103b16b9cf16f2f50a6302d43b18
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=27177e9a3dc70c20b4877e3eab3adfff1d56e342
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=370606
+ patch for Mozilla Bug 730532 - remove CSS2Properties aliases for MozOpacity
and MozOutline*
see https://bugzilla.mozilla.org/show_bug.cgi?id=730532#c3
# License
The following files are licensed according to the contents in the LICENSE
file:
orion.js
orion.css
# Theming
The syntax highlighting and the editor UI are themed using a style sheet. The
default theme file is browser/themes/*/devtools/orion.css - this is based on the
orion.css found in this folder.
Please note that the orion.css file from this folder is not used. It is kept
here only as reference.

View File

@ -1,20 +0,0 @@
Upgrade notes:
1. Get the Orion client source code from:
http://www.eclipse.org/orion
2. Install Dryice from:
https://github.com/mozilla/dryice
You also need nodejs for Dryice to run:
http://nodejs.org
3. Copy Makefile.dryice.js to:
org.eclipse.orion.client/bundles/
4. Execute Makefile.dryice.js. You should get orion.js and orion.css.
5. Copy the two files back here.
6. Make a new build of Firefox.

View File

@ -1,277 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
.view {
background-color: white;
}
.viewContainer {
background-color: #eeeeee;
font-family: monospace;
font-size: 10pt;
}
::-webkit-scrollbar-corner {
background-color: #eeeeee;
}
.viewContent {
}/* Styles for rulers */
.ruler {
background-color: white;
}
.ruler.annotations {
border-right: 1px solid lightgray;
width: 16px;
}
.ruler.folding {
border-right: 1px solid lightgray;
width: 14px;
}
.ruler.lines {
border-right: 1px solid lightgray;
text-align: right;
}
.ruler.overview {
border-left: 1px solid lightgray;
width: 14px;
}
/* Styles for the line number ruler */
.rulerLines {
}
.rulerLines.even
.rulerLines.odd {
}/* Styles for the annotation ruler (all lines) */
.annotation {
}
.annotation.error,
.annotation.warning
.annotation.task,
.annotation.bookmark,
.annotation.breakpoint,
.annotation.collapsed
.annotation.expanded {
}
/* Styles for the annotation ruler (first line) */
.annotationHTML {
cursor: pointer;
width: 16px;
height: 16px;
display: inline-block;
vertical-align: middle;
background-position: center;
background-repeat: no-repeat;
}
.annotationHTML.error {
/* images/error.gif */
background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAAPVvcvWHiPVucvRuc+ttcfV6f91KVN5LU99PV/FZY/JhaM4oN84pONE4Rd1ATfJLWutVYPRgbdxpcsgWKMgZKs4lNfE/UvE/U+artcpdSc5uXveimslHPuBhW/eJhfV5efaCgO2CgP+/v+PExP///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACUALAAAAAAQABAAAAZ+wJJwSCwaScgkySgkjTQZTkYzWhadnE5oE+pwqkSshwQqkzxfa4kkQXxEpA9J9EFI1KQGQQBAigYCBA14ExEWF0gXihETeA0QD3AkD5QQg0NsDnAJmwkOd5gYFSQKpXAFDBhqaxgLBwQBBAapq00YEg0UDRKqTGtKSL7Cw8JBADs=");
}
.annotationHTML.warning {
/* images/warning.gif */
background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAAP7bc//egf/ij/7ijv/jl/7kl//mnv7lnv/uwf7CTP7DTf7DT/7IW//Na/7Na//NbP7QdP/dmbltAIJNAF03AMSAJMSCLKqASa2DS6uBSquCSrGHTq6ETbCHT7WKUrKIUcCVXL+UXMOYX8GWXsSZYMiib6+ETbOIUcOXX86uhd3Muf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACsALAAAAAAQABAAAAZowJVwSCwaj0ihikRSJYcoBEL0XKlGkcjImQQhJBREKFnyICoThKeE/AAW6AXgdPyUAgrLJBEo0YsbAQyDhAEdRRwDDw8OaA4NDQImRBgFEJdglxAEGEQZKQcHBqOkKRpFF6mqq1WtrUEAOw==");
}
.annotationHTML.task {
/* images/task.gif */
background-image: url("data:image/gif;base64,R0lGODlhEAAQAMQAAN7s4uTy6ICvY423c2WdP2ugR3mqWYeza2ejOl6VNVqPM1aJMURsJ2GaOnKlT8PbsbPDqGmmO1OCLk98LEhxKGWfOWKaN0t2KkJoJf///////wAAAAAAAAAAAAAAAAAAACH5BAEAABoALAAAAAAQABAAAAVmoCaOZDk+UaquDxkNcCxHJHLceI6QleD/vkCmQrIYjkiDMGAhJRzQ6NKRICkKgYJ2qVWQFktCmEBYkCSNZSbQaDckpAl5TCZMSBdtAaDXX0gUUYJRFCQMSYgGDCQQGI6PkBAmkyUhADs=");
}
.annotationHTML.bookmark {
/* images/bookmark.gif */
background-image: url("data:image/gif;base64,R0lGODlhEAAQALMAAP7//+/VNPzZS/vifeumAPrBOOSlHOSuRP///wAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAgALAAAAAAQABAAAARLEMlJq5Xn3EvIrkenfRIhCB5pmKhRdbAJAGhssuc8n6eJoAKdkOaTAIdEQeWoA1oGsiZhYAnIcqiApVPjElyUbkFSgCkn5XElLYkAADs=");
}
.annotationHTML.breakpoint {
/* images/breakpoint.gif */
background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAAFheoFxkoFxnpmt0pmZxpnF7rYyWwmJwpnaFs3aDrWt8rXGBrYycwmZ3mXuNs42cu77F03GIs3aJrYGVu2J5oKCuxeDj6LK/03GLrYieu3aIoIygu6m4zcLN3MTM1m6Rs2aLriRgkSZilXGXtoGcs7LD0QBLhSZikihol3ScubrO2Yaqu5q4xpO0wpm7yabF0ZO9yaXI0r3X3tHj6P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAADQALAAAAAAQABAAAAafQJpwSCwWLYZBIDAwWIw0A+FFpW6aRUPCxe1yE4ahhdCCxWSzmSwGgxGeUceKpUqhUCkVa7UK0wgkJCUjJoUmIyWBBEIEGhoeJ4YmJx6OAUIADQ0QIZIhEJoAQgEUFBUgkiAVpZdRCxIPFx8iIh8XDw4FfhYHDhgZHB0dHBkYEwdwUQoTEc3OEwp+QwYHCBMMDBMIB9JESAJLAk5Q5EVBADs=");
}
.annotationHTML.collapsed {
/* images/collapsed.png */
width: 14px;
height: 14px;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWBJREFUeNpi/P//PwMlgImBQkCxASzoAp++fo+6de+Z+fXbD/Jev/nAICoiwKCpqrBBTUlqNR835zJ09YzIYfDxy7eo/cevLmXlYGNQUJAEahZieP3mHcODB08Zfv/4w+BoqR3Nz8O1DKcXzt94HPqXmZlBU1+LgZNfkMHazIOBA0hr6uswgMTP33gYijcMLlx/EMAnLs7w7sc/hg9AG0HgPZB+B8S84hJA+UcBeMPg+at3DJIMnAxZzt5wsUhnXzDdsmIVWB6vAcLCfAys3z4wzN64huEfkJ/uH8IwexOQDQymD2/fgeXxekFLRWHD51evGDhZGRi4WSFSnCwgNjB2Xr1m0AbK4zXAQkdhNdPf3wx3r91g+PruLcOqnasYvn54x3Dv2k0G5r+/GMyB8nijEQTefvoadeH6w9Cbtx8GvH//kUFQkJ9BQ1V+g76m/GphPu5lBA0YenmBYgMAAgwA34GIKjmLxOUAAAAASUVORK5CYII=");
}
.annotationHTML.expanded {
/* images/expanded.png */
width: 14px;
height: 14px;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAT5JREFUeNrUksFKw0AURW+mTWw67SSEiG209U90r4jddFO34l+5U0HdZCHiFwiCOz9AlMSmGEpMOqk1TWJSFGyFbATR2dyZd+Dw3mOENE3xkyP8PYHrBT3OX7uW43ZefA6FUaw1dJPSyrmu1k8KBYOh37Od4XFZLEPXFdRrFMGIw3U9TKMYqw1tb0VjcxLy9eEF425CCIxWE5JcxSQGxCyNloG87gXhwWIHc4J767lTZQw8ShFGSZbxRyaQmZJxd3NRUJ6ffwQNEi6PzG/L2tjdmvFCgcKqKL2F2Olu43MzggDka+IjPuOFI7Sbujn2fUglYKkkzFIi+R0I/QDrGS8UqDX5QkhiOHYfE84hkhSTkGNgOyDJFCzjhYLTq+vDtrG8r1LZtB6fcHtzB+uhD5VWzLx+lvF/8JV/XfAuwADsrJbMGG4l4AAAAABJRU5ErkJggg==");
}
.annotationHTML.multiple {
/* images/multiple.gif */
background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAAOdpa+yJiuFYXOFYXeBYXONwded8f+NwdmhwkHB4iPr7/ezx+fP2+2h4kOzy+Wh4iPr8/gCBwTaczjaXyjaYyjaXyTaYyfr8/QCMzQCMzACHxzao2jal2Dak1zag03iAgI/Ckn64fZrHmX+4fZLCianPopPCiarOoqbLlafLlbnXq7nWq6fLlMTcsoCIeJCQcIiIeKCYaJiQcO16ee16evGVlfGWlfahn/ahoPWhn/WhoPe1tP///////wAAAAAAACH5BAEAAD0ALAAAAAAQABAAAAaRwJ5wSCwaj8WYcslcDmObaDTGq1Zjzw4mk+FQIRcFTzaUeTRoj4zHaI+HL0lkLnnxFgsH7zWEWSoTFBMwVlUwQy6JMDCJjYwuQx8tk5MfOzk4OjcfkSssKCkqHzY0MzQ1nEIJJSYkJCcJAQCzAQlDDyIjISMiCQYEAgMGD0MNIMfHDQUHBc3EQgjR0tPSSNY9QQA7");
}
.annotationHTML.overlay {
/* images/plus.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJEAQvB2JVdrAAAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAAAD1JREFUCNdtjkESADAEAzemf69f66HMqGlOIhYiFRFRtSQBWAY7mzx+EDTL6sSgb1jTk7Q87rxyqe37fXsAa78gLyZnRgEAAAAASUVORK5CYII=");
background-position: right bottom;
position: relative;
top: -16px;
}
.annotationHTML.currentBracket {
/* images/currentBracket.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sLEBULCGQmEKAAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAnklEQVQ4y7VTsRHDIBATJg1HCUzAHEzFBExAzwZsRMkE9gifKhc72ODYibr/+xcnoQdugq0LAujEwmbn0UxQh4OxpjX1XgshwFqLnPM5PQTQGlprWpbl3RhJ/CSQUm7qPYLp7i8cEpRSoJT6ju0lIaVEQgiKMQ4lHHpQayVjzHWCn5jIOcc8z9dMBADvPZxz3SC1tzCI8vgWdvL+VzwB8JSj2GFTyxIAAAAASUVORK5CYII=");
}
.annotationHTML.matchingBracket {
/* images/matchingBracket.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sLEBUMAsuyb3kAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAoklEQVQ4y61TsQ3EIAw80DcI0USKGIApWIsB2IGGKbJPugxBR3VfvfRRCOSTvw7LPuPzGXgI8f0gwAsFu5rXIYMdDiEOIdnKW5YFzjnEGH+bhwA/KKVwmibu0BhRnpEZY1BrHTaVT7fQJZjnGeu63tOAJFNKVEox53yqQZfAWstt27oidgm01ve3UEqBaBjnspG89wgh3LiFgZXHt3Dh23/FGxKViehm0X85AAAAAElFTkSuQmCC");
}
.annotationHTML.currentLine {
/* images/currentLine.gif */
background-image: url("data:image/gif;base64,R0lGODlhEAAQAMQAALxe0bNWzbdZzrlb0KpPx61RybBTy6VLxadNxZGctIeUroyYsG92hHyMqIKRq2l9nmyAoHGDonaIpStXj6q80k1aXf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABYALAAAAAAQABAAAAVCoCWOZGmeKDql5ppOMGXBk/zOoltSNO6XrlXwxIPNYiMGq8SoLC2MaNPygEQkDYdikUg6LQcEoWAICAaA5HPNLoUAADs=");
}
/* Styles for the overview ruler */
.annotationOverview {
cursor: pointer;
border-radius: 2px;
left: 2px;
width: 8px;
}
.annotationOverview.task {
background-color: lightgreen;
border: 1px solid green;
}
.annotationOverview.breakpoint {
background-color: lightblue;
border: 1px solid blue;
}
.annotationOverview.bookmark {
background-color: yellow;
border: 1px solid orange;
}
.annotationOverview.error {
background-color: lightcoral;
border: 1px solid darkred;
}
.annotationOverview.warning {
background-color: Gold;
border: 1px solid black;
}
.annotationOverview.currentBracket {
background-color: lightgray;
border: 1px solid red;
}
.annotationOverview.matchingBracket {
background-color: lightgray;
border: 1px solid red;
}
.annotationOverview.currentLine {
background-color: #EAF2FE;
border: 1px solid black;
}
/* Styles for text range */
.annotationRange {
background-repeat: repeat-x;
background-position: left bottom;
}
.annotationRange.task {
/* images/squiggly_task.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sLDhEoIrb7JmcAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAGUlEQVQI12NggIH/DGdhDCM45z/DfyiBAADgdQjGhI/4DAAAAABJRU5ErkJggg==");
}
.annotationRange.breakpoint {
/* images/squiggly_breakpoint.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sLDhEqHTKradgAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAIklEQVQI11XJMQ0AMAzAMGMafwrFlD19+sUKIJTFo9k+B/kQ+Qr2bIVKOgAAAABJRU5ErkJggg==");
}
.annotationRange.bookmark {
/* images/squiggly_bookmark.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=");
}
.annotationRange.error {
/* images/squiggly_error.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==");
}
.annotationRange.warning {
/* images/squiggly_warning.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=");
}
.annotationRange.currentBracket {
}
.annotationRange.matchingBracket {
outline: 1px solid red;
}
/* Styles for lines of text */
.annotationLine {
}
.annotationLine.currentLine {
background-color: #EAF2FE;
}
.token_singleline_comment {
color: green;
}
.token_multiline_comment {
color: green;
}
.token_doc_comment {
color: #00008F;
}
.token_doc_html_markup {
color: #7F7F9F;
}
.token_doc_tag {
color: #7F9FBF;
}
.token_task_tag {
color: #7F9FBF;
}
.token_string {
color: blue;
}
.token_keyword {
color: darkred;
font-weight: bold;
}
.token_space {
/* images/white_space.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAIAAABv85FHAAAABnRSTlMA/wAAAACkwsAdAAAAIUlEQVR4nGP4z8CAC+GUIEXuABhgkTuABEiRw2cmae4EAH05X7xDolNRAAAAAElFTkSuQmCC");
background-repeat: no-repeat;
background-position: center center;
}
.token_tab {
/* images/white_tab.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAJCAIAAACJ2loDAAAABnRSTlMA/wD/AP83WBt9AAAAMklEQVR4nGP4TwRgoK6i52c3bz5w6zMSA6tJn28d2Lx589nnCAYu63AaSLxJRLoJPwAAeNk0aG4opfMAAAAASUVORK5CYII=");
background-repeat: no-repeat;
background-position: left center;
}
.line_caret {
background-color: #EAF2FE;
}
/* Styling for html syntax highlighting */
.entity-name-tag {
color: #3f7f7f;
}
.entity-other-attribute-name {
color: #7f007f;
}
.punctuation-definition-comment {
color: #3f5fbf;
}
.comment {
color: #3f5fbf
}
.string-quoted {
color: #2a00ff;
font-style: italic;
}
.invalid {
color: red;
font-weight: bold;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,204 +0,0 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE overlay [
<!ENTITY % editMenuStrings SYSTEM "chrome://global/locale/editMenuOverlay.dtd">
%editMenuStrings;
<!ENTITY % sourceEditorStrings SYSTEM "chrome://browser/locale/devtools/sourceeditor.dtd">
%sourceEditorStrings;
]>
<overlay id="sourceEditorOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- This Source Editor overlay requires the editMenuOverlay.xul to be loaded.
The globalOverlay.js script is also required in the XUL document where
the source-editor-overlay.xul is loaded. Do not use #editMenuKeys to
avoid conflicts! -->
<script type="application/javascript">
function goUpdateSourceEditorMenuItems()
{
goUpdateGlobalEditMenuItems();
let commands = ['se-cmd-undo', 'se-cmd-redo', 'se-cmd-cut', 'se-cmd-paste',
'se-cmd-delete'];
commands.forEach(goUpdateCommand);
}
</script>
<commandset id="sourceEditorCommands">
<command id="cmd_find" oncommand="goDoCommand('cmd_find')"/>
<command id="cmd_findAgain" oncommand="goDoCommand('cmd_findAgain')" disabled="true"/>
<command id="cmd_findPrevious" oncommand="goDoCommand('cmd_findPrevious')" disabled="true"/>
<command id="cmd_gotoLine" oncommand="goDoCommand('cmd_gotoLine')"/>
<command id="se-cmd-selectAll" oncommand="goDoCommand('se-cmd-selectAll')"/>
<command id="se-cmd-cut" oncommand="goDoCommand('se-cmd-cut')" disabled="true"/>
<command id="se-cmd-paste" oncommand="goDoCommand('se-cmd-paste')" disabled="true"/>
<command id="se-cmd-delete" oncommand="goDoCommand('se-cmd-delete')" disabled="true"/>
<command id="se-cmd-undo" oncommand="goDoCommand('se-cmd-undo')" disabled="true"/>
<command id="se-cmd-redo" oncommand="goDoCommand('se-cmd-redo')" disabled="true"/>
</commandset>
<keyset id="sourceEditorKeys">
<!-- Do not use both #sourceEditorKeys and #editMenuKeys in the same
document to avoid conflicts! -->
<key id="key_undo"
key="&undoCmd.key;"
modifiers="accel"
command="se-cmd-undo"/>
#ifdef XP_UNIX
<key id="key_redo"
key="&undoCmd.key;"
modifiers="accel,shift"
command="se-cmd-redo"/>
#else
<key id="key_redo"
key="&redoCmd.key;"
modifiers="accel"
command="se-cmd-redo"/>
#endif
<key id="key_cut"
key="&cutCmd.key;"
modifiers="accel"
command="se-cmd-cut"/>
<key id="key_copy"
key="&copyCmd.key;"
modifiers="accel"
command="cmd_copy"/>
<key id="key_paste"
key="&pasteCmd.key;"
modifiers="accel"
command="se-cmd-paste"/>
<key id="key_gotoLine"
key="&gotoLineCmd.key;"
command="cmd_gotoLine"
modifiers="accel"/>
<key id="key_delete"
keycode="VK_DELETE"
command="se-cmd-delete"/>
<key id="key_selectAll"
key="&selectAllCmd.key;"
modifiers="accel"
command="se-cmd-selectAll"/>
<key id="key_find"
key="&findCmd.key;"
modifiers="accel"
command="cmd_find"/>
<key id="key_findAgain"
key="&findAgainCmd.key;"
modifiers="accel"
command="cmd_findAgain"/>
<key id="key_findPrevious"
key="&findAgainCmd.key;"
modifiers="shift,accel"
command="cmd_findPrevious"/>
<key id="key_findAgain2"
keycode="&findAgainCmd.key2;"
command="cmd_findAgain"/>
<key id="key_findPrevious2"
keycode="&findAgainCmd.key2;"
modifiers="shift"
command="cmd_findPrevious"/>
</keyset>
<!-- Items for the Edit menu -->
<menuitem id="se-menu-undo"
label="&undoCmd.label;"
key="key_undo"
accesskey="&undoCmd.accesskey;"
command="se-cmd-undo"/>
<menuitem id="se-menu-redo"
label="&redoCmd.label;"
key="key_redo"
accesskey="&redoCmd.accesskey;"
command="se-cmd-redo"/>
<menuitem id="se-menu-cut"
label="&cutCmd.label;"
key="key_cut"
accesskey="&cutCmd.accesskey;"
command="se-cmd-cut"/>
<menuitem id="se-menu-copy"
label="&copyCmd.label;"
key="key_copy"
accesskey="&copyCmd.accesskey;"
command="cmd_copy"/>
<menuitem id="se-menu-paste"
label="&pasteCmd.label;"
key="key_paste"
accesskey="&pasteCmd.accesskey;"
command="se-cmd-paste"/>
<menuitem id="se-menu-delete"
label="&deleteCmd.label;"
key="key_delete"
accesskey="&deleteCmd.accesskey;"
command="se-cmd-delete"/>
<menuitem id="se-menu-selectAll"
label="&selectAllCmd.label;"
key="key_selectAll"
accesskey="&selectAllCmd.accesskey;"
command="se-cmd-selectAll"/>
<menuitem id="se-menu-find"
label="&findCmd.label;"
accesskey="&findCmd.accesskey;"
key="key_find"
command="cmd_find"/>
<menuitem id="se-menu-findAgain"
label="&findAgainCmd.label;"
accesskey="&findAgainCmd.accesskey;"
key="key_findAgain"
command="cmd_findAgain"/>
<menuitem id="se-menu-gotoLine"
label="&gotoLineCmd.label;"
accesskey="&gotoLineCmd.accesskey;"
key="key_gotoLine"
command="cmd_gotoLine"/>
<!-- Items for context menus -->
<menuitem id="se-cMenu-undo"
label="&undoCmd.label;"
key="key_undo"
accesskey="&undoCmd.accesskey;"
command="se-cmd-undo"/>
<menuitem id="se-cMenu-cut"
label="&cutCmd.label;"
key="key_cut"
accesskey="&cutCmd.accesskey;"
command="se-cmd-cut"/>
<menuitem id="se-cMenu-copy"
label="&copyCmd.label;"
key="key_copy"
accesskey="&copyCmd.accesskey;"
command="cmd_copy"/>
<menuitem id="se-cMenu-paste"
label="&pasteCmd.label;"
key="key_paste"
accesskey="&pasteCmd.accesskey;"
command="se-cmd-paste"/>
<menuitem id="se-cMenu-delete"
label="&deleteCmd.label;"
key="key_delete"
accesskey="&deleteCmd.accesskey;"
command="se-cmd-delete"/>
<menuitem id="se-cMenu-selectAll"
label="&selectAllCmd.label;"
key="key_selectAll"
accesskey="&selectAllCmd.accesskey;"
command="se-cmd-selectAll"/>
<menuitem id="se-cMenu-find"
label="&findCmd.label;"
accesskey="&findCmd.accesskey;"
key="key_find"
command="cmd_find"/>
<menuitem id="se-cMenu-findAgain"
label="&findAgainCmd.label;"
accesskey="&findAgainCmd.accesskey;"
key="key_findAgain"
command="cmd_findAgain"/>
<menuitem id="se-cMenu-gotoLine"
label="&gotoLineCmd.label;"
accesskey="&gotoLineCmd.accesskey;"
key="key_gotoLine"
command="cmd_gotoLine"/>
</overlay>

View File

@ -1,332 +0,0 @@
/* vim:set ts=2 sw=2 sts=2 et tw=80:
* 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/. */
"use strict";
const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
this.EXPORTED_SYMBOLS = ["SourceEditorUI"];
/**
* The Source Editor component user interface.
*/
this.SourceEditorUI = function SourceEditorUI(aEditor)
{
this.editor = aEditor;
this._onDirtyChanged = this._onDirtyChanged.bind(this);
}
SourceEditorUI.prototype = {
/**
* Initialize the user interface. This is called by the SourceEditor.init()
* method.
*/
init: function SEU_init()
{
this._ownerWindow = this.editor.parentElement.ownerDocument.defaultView;
},
/**
* The UI onReady function is executed once the Source Editor completes
* initialization and it is ready for usage. Currently this code sets up the
* nsIController.
*/
onReady: function SEU_onReady()
{
if (this._ownerWindow.controllers) {
this._controller = new SourceEditorController(this.editor);
this._ownerWindow.controllers.insertControllerAt(0, this._controller);
this.editor.addEventListener(this.editor.EVENTS.DIRTY_CHANGED,
this._onDirtyChanged);
}
},
/**
* The "go to line" command UI. This displays a prompt that allows the user to
* input the line number to jump to.
*/
gotoLine: function SEU_gotoLine()
{
let oldLine = this.editor.getCaretPosition ?
this.editor.getCaretPosition().line : null;
let newLine = {value: oldLine !== null ? oldLine + 1 : ""};
let result = Services.prompt.prompt(this._ownerWindow,
SourceEditorUI.strings.GetStringFromName("gotoLineCmd.promptTitle"),
SourceEditorUI.strings.GetStringFromName("gotoLineCmd.promptMessage"),
newLine, null, {});
newLine.value = parseInt(newLine.value);
if (result && !isNaN(newLine.value) && --newLine.value != oldLine) {
if (this.editor.getLineCount) {
let lines = this.editor.getLineCount() - 1;
this.editor.setCaretPosition(Math.max(0, Math.min(lines, newLine.value)));
} else {
this.editor.setCaretPosition(Math.max(0, newLine.value));
}
}
return true;
},
/**
* The "find" command UI. This displays a prompt that allows the user to input
* the string to search for in the code. By default the current selection is
* used as a search string, or the last search string.
*/
find: function SEU_find()
{
let str = {value: this.editor.getSelectedText()};
if (!str.value && this.editor.lastFind) {
str.value = this.editor.lastFind.str;
}
let result = Services.prompt.prompt(this._ownerWindow,
SourceEditorUI.strings.GetStringFromName("findCmd.promptTitle"),
SourceEditorUI.strings.GetStringFromName("findCmd.promptMessage"),
str, null, {});
if (result && str.value) {
let start = this.editor.getSelection().end;
let pos = this.editor.find(str.value, {ignoreCase: true, start: start});
if (pos == -1) {
this.editor.find(str.value, {ignoreCase: true});
}
this._onFind();
}
return true;
},
/**
* Find the next occurrence of the last search string.
*/
findNext: function SEU_findNext()
{
let lastFind = this.editor.lastFind;
if (lastFind) {
this.editor.findNext(true);
this._onFind();
}
return true;
},
/**
* Find the previous occurrence of the last search string.
*/
findPrevious: function SEU_findPrevious()
{
let lastFind = this.editor.lastFind;
if (lastFind) {
this.editor.findPrevious(true);
this._onFind();
}
return true;
},
/**
* This executed after each find/findNext/findPrevious operation.
* @private
*/
_onFind: function SEU__onFind()
{
let lastFind = this.editor.lastFind;
if (lastFind && lastFind.index > -1) {
this.editor.setSelection(lastFind.index, lastFind.index + lastFind.str.length);
}
if (this._ownerWindow.goUpdateCommand) {
this._ownerWindow.goUpdateCommand("cmd_findAgain");
this._ownerWindow.goUpdateCommand("cmd_findPrevious");
}
},
/**
* This is executed after each undo/redo operation.
* @private
*/
_onUndoRedo: function SEU__onUndoRedo()
{
if (this._ownerWindow.goUpdateCommand) {
this._ownerWindow.goUpdateCommand("se-cmd-undo");
this._ownerWindow.goUpdateCommand("se-cmd-redo");
}
},
/**
* The DirtyChanged event handler for the editor. This tracks the editor state
* changes to make sure the Source Editor overlay Undo/Redo commands are kept
* up to date.
* @private
*/
_onDirtyChanged: function SEU__onDirtyChanged()
{
this._onUndoRedo();
},
/**
* Destroy the SourceEditorUI instance. This is called by the
* SourceEditor.destroy() method.
*/
destroy: function SEU_destroy()
{
if (this._ownerWindow.controllers) {
this.editor.removeEventListener(this.editor.EVENTS.DIRTY_CHANGED,
this._onDirtyChanged);
}
this._ownerWindow = null;
this.editor = null;
this._controller = null;
},
};
/**
* The Source Editor nsIController implements features that need to be available
* from XUL commands.
*
* @constructor
* @param object aEditor
* SourceEditor object instance for which the controller is instanced.
*/
function SourceEditorController(aEditor)
{
this._editor = aEditor;
}
SourceEditorController.prototype = {
/**
* Check if a command is supported by the controller.
*
* @param string aCommand
* The command name you want to check support for.
* @return boolean
* True if the command is supported, false otherwise.
*/
supportsCommand: function SEC_supportsCommand(aCommand)
{
let result;
switch (aCommand) {
case "cmd_find":
case "cmd_findAgain":
case "cmd_findPrevious":
case "cmd_gotoLine":
case "se-cmd-undo":
case "se-cmd-redo":
case "se-cmd-cut":
case "se-cmd-paste":
case "se-cmd-delete":
case "se-cmd-selectAll":
result = true;
break;
default:
result = false;
break;
}
return result;
},
/**
* Check if a command is enabled or not.
*
* @param string aCommand
* The command name you want to check if it is enabled or not.
* @return boolean
* True if the command is enabled, false otherwise.
*/
isCommandEnabled: function SEC_isCommandEnabled(aCommand)
{
let result;
switch (aCommand) {
case "cmd_find":
case "cmd_gotoLine":
case "se-cmd-selectAll":
result = true;
break;
case "cmd_findAgain":
case "cmd_findPrevious":
result = this._editor.lastFind && this._editor.lastFind.lastFound != -1;
break;
case "se-cmd-undo":
result = this._editor.canUndo();
break;
case "se-cmd-redo":
result = this._editor.canRedo();
break;
case "se-cmd-cut":
case "se-cmd-delete": {
let selection = this._editor.getSelection();
result = selection.start != selection.end && !this._editor.readOnly;
break;
}
case "se-cmd-paste": {
let window = this._editor._view._frameWindow;
let controller = window.controllers.getControllerForCommand("cmd_paste");
result = !this._editor.readOnly &&
controller.isCommandEnabled("cmd_paste");
break;
}
default:
result = false;
break;
}
return result;
},
/**
* Perform a command.
*
* @param string aCommand
* The command name you want to execute.
* @return void
*/
doCommand: function SEC_doCommand(aCommand)
{
switch (aCommand) {
case "cmd_find":
this._editor.ui.find();
break;
case "cmd_findAgain":
this._editor.ui.findNext();
break;
case "cmd_findPrevious":
this._editor.ui.findPrevious();
break;
case "cmd_gotoLine":
this._editor.ui.gotoLine();
break;
case "se-cmd-selectAll":
this._editor._view.invokeAction("selectAll");
break;
case "se-cmd-undo":
this._editor.undo();
break;
case "se-cmd-redo":
this._editor.redo();
break;
case "se-cmd-cut":
this._editor.ui._ownerWindow.goDoCommand("cmd_cut");
break;
case "se-cmd-paste":
this._editor.ui._ownerWindow.goDoCommand("cmd_paste");
break;
case "se-cmd-delete": {
let selection = this._editor.getSelection();
this._editor.setText("", selection.start, selection.end);
break;
}
}
},
onEvent: function() { }
};

View File

@ -1,455 +0,0 @@
/* vim:set ts=2 sw=2 sts=2 et tw=80:
* 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/. */
"use strict";
const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/devtools/sourceeditor/source-editor-ui.jsm");
const PREF_EDITOR_COMPONENT = "devtools.editor.component";
const SOURCEEDITOR_L10N = "chrome://browser/locale/devtools/sourceeditor.properties";
var component = Services.prefs.getCharPref(PREF_EDITOR_COMPONENT);
var obj = {};
try {
if (component == "ui") {
throw new Error("The ui editor component is not available.");
}
Cu.import("resource:///modules/devtools/sourceeditor/source-editor-" + component + ".jsm", obj);
} catch (ex) {
Cu.reportError(ex);
Cu.reportError("SourceEditor component failed to load: " + component);
// If the component does not exist, clear the user pref back to the default.
Services.prefs.clearUserPref(PREF_EDITOR_COMPONENT);
// Load the default editor component.
component = Services.prefs.getCharPref(PREF_EDITOR_COMPONENT);
Cu.import("resource:///modules/devtools/sourceeditor/source-editor-" + component + ".jsm", obj);
}
// Export the SourceEditor.
this.SourceEditor = obj.SourceEditor;
this.EXPORTED_SYMBOLS = ["SourceEditor"];
// Add the constants used by all SourceEditors.
XPCOMUtils.defineLazyGetter(SourceEditorUI, "strings", function() {
return Services.strings.createBundle(SOURCEEDITOR_L10N);
});
/**
* Known SourceEditor preferences.
*/
SourceEditor.PREFS = {
TAB_SIZE: "devtools.editor.tabsize",
EXPAND_TAB: "devtools.editor.expandtab",
COMPONENT: PREF_EDITOR_COMPONENT,
};
/**
* Predefined source editor modes for JavaScript, CSS and other languages.
*/
SourceEditor.MODES = {
JAVASCRIPT: "js",
CSS: "css",
TEXT: "text",
HTML: "html",
XML: "xml",
};
/**
* Predefined themes for syntax highlighting.
*/
SourceEditor.THEMES = {
MOZILLA: "mozilla",
};
/**
* Source editor configuration defaults.
* @see SourceEditor.init
*/
SourceEditor.DEFAULTS = {
/**
* The text you want shown when the editor opens up.
* @type string
*/
initialText: "",
/**
* The editor mode, based on the file type you want to edit. You can use one of
* the predefined modes.
*
* @see SourceEditor.MODES
* @type string
*/
mode: SourceEditor.MODES.TEXT,
/**
* The syntax highlighting theme you want. You can use one of the predefined
* themes, or you can point to your CSS file.
*
* @see SourceEditor.THEMES.
* @type string
*/
theme: SourceEditor.THEMES.MOZILLA,
/**
* How many steps should the undo stack hold.
* @type number
*/
undoLimit: 200,
/**
* Define how many spaces to use for a tab character. This value is overridden
* by a user preference, see SourceEditor.PREFS.TAB_SIZE.
*
* @type number
*/
tabSize: 4,
/**
* Tells if you want tab characters to be expanded to spaces. This value is
* overridden by a user preference, see SourceEditor.PREFS.EXPAND_TAB.
* @type boolean
*/
expandTab: true,
/**
* Tells if you want the editor to be read only or not.
* @type boolean
*/
readOnly: false,
/**
* Display the line numbers gutter.
* @type boolean
*/
showLineNumbers: false,
/**
* Display the annotations gutter/ruler. This gutter currently supports
* annotations of breakpoint type.
* @type boolean
*/
showAnnotationRuler: false,
/**
* Display the overview gutter/ruler. This gutter presents an overview of the
* current annotations in the editor, for example the breakpoints.
* @type boolean
*/
showOverviewRuler: false,
/**
* Highlight the current line.
* @type boolean
*/
highlightCurrentLine: true,
/**
* An array of objects that allows you to define custom editor keyboard
* bindings. Each object can have:
* - action - name of the editor action to invoke.
* - code - keyCode for the shortcut.
* - accel - boolean for the Accel key (Cmd on Macs, Ctrl on Linux/Windows).
* - ctrl - boolean for the Control key
* - shift - boolean for the Shift key.
* - alt - boolean for the Alt key.
* - callback - optional function to invoke, if the action is not predefined
* in the editor.
* @type array
*/
keys: null,
/**
* The editor context menu you want to display when the user right-clicks
* within the editor. This property can be:
* - a string that tells the ID of the xul:menupopup you want. This needs to
* be available within the editor parentElement.ownerDocument.
* - an nsIDOMElement object reference pointing to the xul:menupopup you
* want to open when the contextmenu event is fired.
*
* Set this property to a falsey value to disable the default context menu.
*
* @see SourceEditor.EVENTS.CONTEXT_MENU for more control over the contextmenu
* event.
* @type string|nsIDOMElement
*/
contextMenu: "sourceEditorContextMenu",
};
/**
* Known editor events you can listen for.
*/
SourceEditor.EVENTS = {
/**
* The contextmenu event is fired when the editor context menu is invoked. The
* event object properties:
* - x - the pointer location on the x axis, relative to the document the
* user is editing.
* - y - the pointer location on the y axis, relative to the document the
* user is editing.
* - screenX - the pointer location on the x axis, relative to the screen.
* This value comes from the DOM contextmenu event.screenX property.
* - screenY - the pointer location on the y axis, relative to the screen.
* This value comes from the DOM contextmenu event.screenY property.
*
* @see SourceEditor.DEFAULTS.contextMenu
*/
CONTEXT_MENU: "ContextMenu",
/**
* The TextChanged event is fired when the editor content changes. The event
* object properties:
* - start - the character offset in the document where the change has
* occured.
* - removedCharCount - the number of characters removed from the document.
* - addedCharCount - the number of characters added to the document.
*/
TEXT_CHANGED: "TextChanged",
/**
* The Selection event is fired when the editor selection changes. The event
* object properties:
* - oldValue - the old selection range.
* - newValue - the new selection range.
* Both ranges are objects which hold two properties: start and end.
*/
SELECTION: "Selection",
/**
* The focus event is fired when the editor is focused.
*/
FOCUS: "Focus",
/**
* The blur event is fired when the editor goes out of focus.
*/
BLUR: "Blur",
/**
* The MouseMove event is sent when the user moves the mouse over a line.
* The event object properties:
* - event - the DOM mousemove event object.
* - x and y - the mouse coordinates relative to the document being edited.
*/
MOUSE_MOVE: "MouseMove",
/**
* The MouseOver event is sent when the mouse pointer enters a line.
* The event object properties:
* - event - the DOM mouseover event object.
* - x and y - the mouse coordinates relative to the document being edited.
*/
MOUSE_OVER: "MouseOver",
/**
* This MouseOut event is sent when the mouse pointer exits a line.
* The event object properties:
* - event - the DOM mouseout event object.
* - x and y - the mouse coordinates relative to the document being edited.
*/
MOUSE_OUT: "MouseOut",
/**
* The BreakpointChange event is fired when a new breakpoint is added or when
* a breakpoint is removed - either through API use or through the editor UI.
* Event object properties:
* - added - array that holds the new breakpoints.
* - removed - array that holds the breakpoints that have been removed.
* Each object in the added/removed arrays holds two properties: line and
* condition.
*/
BREAKPOINT_CHANGE: "BreakpointChange",
/**
* The DirtyChanged event is fired when the dirty state of the editor is
* changed. The dirty state of the editor tells if the are text changes that
* have not been saved yet. Event object properties: oldValue and newValue.
* Both are booleans telling the old dirty state and the new state,
* respectively.
*/
DIRTY_CHANGED: "DirtyChanged",
};
/**
* Allowed vertical alignment options for the line index
* when you call SourceEditor.setCaretPosition().
*/
SourceEditor.VERTICAL_ALIGN = {
TOP: 0,
CENTER: 1,
BOTTOM: 2,
};
/**
* Extend a destination object with properties from a source object.
*
* @param object aDestination
* @param object aSource
*/
function extend(aDestination, aSource)
{
for (let name in aSource) {
if (!aDestination.hasOwnProperty(name)) {
aDestination[name] = aSource[name];
}
}
}
/**
* Add methods common to all components.
*/
extend(SourceEditor.prototype, {
// Expose the static constants on the SourceEditor instances.
EVENTS: SourceEditor.EVENTS,
MODES: SourceEditor.MODES,
THEMES: SourceEditor.THEMES,
DEFAULTS: SourceEditor.DEFAULTS,
VERTICAL_ALIGN: SourceEditor.VERTICAL_ALIGN,
_lastFind: null,
/**
* Find a string in the editor.
*
* @param string aString
* The string you want to search for. If |aString| is not given the
* currently selected text is used.
* @param object [aOptions]
* Optional find options:
* - start: (integer) offset to start searching from. Default: 0 if
* backwards is false. If backwards is true then start = text.length.
* - ignoreCase: (boolean) tells if you want the search to be case
* insensitive or not. Default: false.
* - backwards: (boolean) tells if you want the search to go backwards
* from the given |start| offset. Default: false.
* @return integer
* The offset where the string was found.
*/
find: function SE_find(aString, aOptions)
{
if (typeof(aString) != "string") {
return -1;
}
aOptions = aOptions || {};
let str = aOptions.ignoreCase ? aString.toLowerCase() : aString;
let text = this.getText();
if (aOptions.ignoreCase) {
text = text.toLowerCase();
}
let index = aOptions.backwards ?
text.lastIndexOf(str, aOptions.start) :
text.indexOf(str, aOptions.start);
let lastFoundIndex = index;
if (index == -1 && this.lastFind && this.lastFind.index > -1 &&
this.lastFind.str === aString &&
this.lastFind.ignoreCase === !!aOptions.ignoreCase) {
lastFoundIndex = this.lastFind.index;
}
this._lastFind = {
str: aString,
index: index,
lastFound: lastFoundIndex,
ignoreCase: !!aOptions.ignoreCase,
};
return index;
},
/**
* Find the next occurrence of the last search operation.
*
* @param boolean aWrap
* Tells if you want to restart the search from the beginning of the
* document if the string is not found.
* @return integer
* The offset where the string was found.
*/
findNext: function SE_findNext(aWrap)
{
if (!this.lastFind && this.lastFind.lastFound == -1) {
return -1;
}
let options = {
start: this.lastFind.lastFound + this.lastFind.str.length,
ignoreCase: this.lastFind.ignoreCase,
};
let index = this.find(this.lastFind.str, options);
if (index == -1 && aWrap) {
options.start = 0;
index = this.find(this.lastFind.str, options);
}
return index;
},
/**
* Find the previous occurrence of the last search operation.
*
* @param boolean aWrap
* Tells if you want to restart the search from the end of the
* document if the string is not found.
* @return integer
* The offset where the string was found.
*/
findPrevious: function SE_findPrevious(aWrap)
{
if (!this.lastFind && this.lastFind.lastFound == -1) {
return -1;
}
let options = {
start: this.lastFind.lastFound - this.lastFind.str.length,
ignoreCase: this.lastFind.ignoreCase,
backwards: true,
};
let index;
if (options.start > 0) {
index = this.find(this.lastFind.str, options);
} else {
index = this._lastFind.index = -1;
}
if (index == -1 && aWrap) {
options.start = this.getCharCount() - 1;
index = this.find(this.lastFind.str, options);
}
return index;
},
});
/**
* Retrieve the last find operation result. This object holds the following
* properties:
* - str: the last search string.
* - index: stores the result of the most recent find operation. This is the
* index in the text where |str| was found or -1 otherwise.
* - lastFound: tracks the index where |str| was last found, throughout
* multiple find operations. This can be -1 if |str| was never found in the
* document.
* - ignoreCase: tells if the search was case insensitive or not.
* @type object
*/
Object.defineProperty(SourceEditor.prototype, "lastFind", {
get: function() { return this._lastFind; },
enumerable: true,
configurable: true,
});

View File

@ -9,25 +9,9 @@ support-files =
codemirror.html
head.js
[browser_bug650345_find.js]
[browser_bug684546_reset_undo.js]
[browser_bug684862_paste_html.js]
[browser_bug687160_line_api.js]
[browser_bug687568_pagescroll.js]
[browser_bug687573_vscroll.js]
[browser_bug687580_drag_and_drop.js]
[browser_bug695035_middle_click_paste.js]
[browser_bug700893_dirty_state.js]
[browser_bug703692_focus_blur.js]
[browser_bug707987_debugger_breakpoints.js]
[browser_bug712982_line_ruler_click.js]
[browser_bug725388_mouse_events.js]
[browser_bug725392_mouse_coords_char_offset.js]
[browser_bug725430_comment_uncomment.js]
[browser_bug725618_moveLines_shortcut.js]
[browser_bug729480_line_vertical_align.js]
[browser_bug729960_block_bracket_jump.js]
[browser_bug731721_debugger_stepping.js]
[browser_bug744021_next_prev_bracket_jump.js]
[browser_editor_basic.js]
[browser_editor_cursor.js]
[browser_editor_history.js]
[browser_editor_markers.js]
[browser_codemirror.js]
[browser_sourceeditor_initialization.js]
[browser_sourceeditor_initialization.js]

View File

@ -1,149 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
let testWin;
let editor;
function test()
{
waitForExplicitFinish();
const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 650345' width='600' height='500'><hbox flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
}
function initEditor()
{
let hbox = testWin.document.querySelector("hbox");
editor = new SourceEditor();
editor.init(hbox, {}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
let text = "foobar bug650345\nBug650345 bazbaz\nfoobar omg\ntest";
editor.setText(text);
let needle = "foobar";
is(editor.find(), -1, "find() works");
ok(!editor.lastFind, "no editor.lastFind yet");
is(editor.find(needle), 0, "find('" + needle + "') works");
is(editor.lastFind.str, needle, "lastFind.str is correct");
is(editor.lastFind.index, 0, "lastFind.index is correct");
is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");
is(editor.lastFind.ignoreCase, false, "lastFind.ignoreCase is correct");
let newIndex = text.indexOf(needle, needle.length);
is(editor.findNext(), newIndex, "findNext() works");
is(editor.lastFind.str, needle, "lastFind.str is correct");
is(editor.lastFind.index, newIndex, "lastFind.index is correct");
is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");
is(editor.lastFind.ignoreCase, false, "lastFind.ignoreCase is correct");
is(editor.findNext(), -1, "findNext() works again");
is(editor.lastFind.index, -1, "lastFind.index is correct");
is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");
is(editor.findPrevious(), 0, "findPrevious() works");
is(editor.lastFind.index, 0, "lastFind.index is correct");
is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");
is(editor.findPrevious(), -1, "findPrevious() works again");
is(editor.lastFind.index, -1, "lastFind.index is correct");
is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");
is(editor.findNext(), newIndex, "findNext() works");
is(editor.lastFind.index, newIndex, "lastFind.index is correct");
is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");
is(editor.findNext(true), 0, "findNext(true) works");
is(editor.lastFind.index, 0, "lastFind.index is correct");
is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");
is(editor.findNext(true), newIndex, "findNext(true) works again");
is(editor.lastFind.index, newIndex, "lastFind.index is correct");
is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");
is(editor.findPrevious(true), 0, "findPrevious(true) works");
is(editor.lastFind.index, 0, "lastFind.index is correct");
is(editor.lastFind.lastFound, 0, "lastFind.lastFound is correct");
is(editor.findPrevious(true), newIndex, "findPrevious(true) works again");
is(editor.lastFind.index, newIndex, "lastFind.index is correct");
is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");
needle = "error";
is(editor.find(needle), -1, "find('" + needle + "') works");
is(editor.lastFind.str, needle, "lastFind.str is correct");
is(editor.lastFind.index, -1, "lastFind.index is correct");
is(editor.lastFind.lastFound, -1, "lastFind.lastFound is correct");
is(editor.lastFind.ignoreCase, false, "lastFind.ignoreCase is correct");
is(editor.findNext(), -1, "findNext() works");
is(editor.lastFind.str, needle, "lastFind.str is correct");
is(editor.lastFind.index, -1, "lastFind.index is correct");
is(editor.lastFind.lastFound, -1, "lastFind.lastFound is correct");
is(editor.findNext(true), -1, "findNext(true) works");
is(editor.findPrevious(), -1, "findPrevious() works");
is(editor.findPrevious(true), -1, "findPrevious(true) works");
needle = "bug650345";
newIndex = text.indexOf(needle);
is(editor.find(needle), newIndex, "find('" + needle + "') works");
is(editor.findNext(), -1, "findNext() works");
is(editor.findNext(true), newIndex, "findNext(true) works");
is(editor.findPrevious(), -1, "findPrevious() works");
is(editor.findPrevious(true), newIndex, "findPrevious(true) works");
is(editor.lastFind.index, newIndex, "lastFind.index is correct");
is(editor.lastFind.lastFound, newIndex, "lastFind.lastFound is correct");
is(editor.find(needle, {ignoreCase: 1}), newIndex,
"find('" + needle + "', {ignoreCase: 1}) works");
is(editor.lastFind.ignoreCase, true, "lastFind.ignoreCase is correct");
let newIndex2 = text.toLowerCase().indexOf(needle, newIndex + needle.length);
is(editor.findNext(), newIndex2, "findNext() works");
is(editor.findNext(), -1, "findNext() works");
is(editor.lastFind.index, -1, "lastFind.index is correct");
is(editor.lastFind.lastFound, newIndex2, "lastFind.lastFound is correct");
is(editor.findNext(true), newIndex, "findNext(true) works");
is(editor.findPrevious(), -1, "findPrevious() works");
is(editor.findPrevious(true), newIndex2, "findPrevious(true) works");
is(editor.findPrevious(), newIndex, "findPrevious() works again");
needle = "foobar";
newIndex = text.indexOf(needle, 2);
is(editor.find(needle, {start: 2}), newIndex,
"find('" + needle + "', {start:2}) works");
is(editor.findNext(), -1, "findNext() works");
is(editor.findNext(true), 0, "findNext(true) works");
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
}

View File

@ -1,72 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
let testWin;
let editor;
function test()
{
waitForExplicitFinish();
const windowUrl = "data:application/vnd.mozilla.xul+xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 684546 - reset undo' width='300' height='500'>" +
"<box flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
}
function initEditor()
{
let box = testWin.document.querySelector("box");
editor = new SourceEditor();
editor.init(box, {}, editorLoaded);
}
function editorLoaded()
{
editor.setText("First");
editor.setText("Second", 5);
is(editor.getText(), "FirstSecond", "text set correctly.");
editor.undo();
is(editor.getText(), "First", "undo works.");
editor.redo();
is(editor.getText(), "FirstSecond", "redo works.");
editor.resetUndo();
ok(!editor.canUndo(), "canUndo() is correct");
ok(!editor.canRedo(), "canRedo() is correct");
editor.undo();
is(editor.getText(), "FirstSecond", "reset undo works correctly");
editor.setText("Third", 11);
is(editor.getText(), "FirstSecondThird", "text set correctly");
editor.undo();
is(editor.getText(), "FirstSecond", "undo works after reset");
editor.redo();
is(editor.getText(), "FirstSecondThird", "redo works after reset");
editor.resetUndo();
ok(!editor.canUndo(), "canUndo() is correct (again)");
ok(!editor.canRedo(), "canRedo() is correct (again)");
editor.undo();
is(editor.getText(), "FirstSecondThird", "reset undo still works correctly");
finish();
}
registerCleanupFunction(function() {
editor.destroy();
testWin.close();
testWin = editor = null;
});

View File

@ -1,119 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
let testWin;
let editor;
function test()
{
waitForExplicitFinish();
const pageUrl = "data:text/html,<ul><li>test<li>foobarBug684862";
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
waitForFocus(pageLoaded, content);
}, true);
content.location = pageUrl;
}
function pageLoaded()
{
const windowUrl = "data:application/vnd.mozilla.xul+xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 684862 - paste HTML' width='600' height='500'>" +
"<script type='application/javascript' src='chrome://global/content/globalOverlay.js'/>" +
"<box flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
let doCopy = function() {
gBrowser.selectedBrowser.focus();
EventUtils.synthesizeKey("a", {accelKey: true}, content);
EventUtils.synthesizeKey("c", {accelKey: true}, content);
};
let clipboardValidator = function(aData) aData.indexOf("foobarBug684862") > -1;
let onCopy = function() {
testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
};
waitForClipboard(clipboardValidator, doCopy, onCopy, testEnd);
}
function initEditor()
{
let box = testWin.document.querySelector("box");
editor = new SourceEditor();
editor.init(box, {}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
ok(!editor.getText(), "editor has no content");
is(editor.getCaretOffset(), 0, "caret location");
let onPaste = function() {
editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste);
let text = editor.getText();
ok(text, "editor has content after paste");
let pos = text.indexOf("foobarBug684862");
isnot(pos, -1, "editor content is correct");
// Test for bug 699541 - Pasted HTML shows twice in Orion.
is(text.lastIndexOf("foobarBug684862"), pos, "editor content is correct (no duplicate)");
executeSoon(function() {
editor.setCaretOffset(4);
EventUtils.synthesizeKey("a", {}, testWin);
EventUtils.synthesizeKey("VK_RIGHT", {}, testWin);
text = editor.getText();
is(text.indexOf("foobarBug684862"), pos + 1,
"editor content is correct after navigation");
is(editor.getCaretOffset(), 6, "caret location");
executeSoon(testEnd);
});
};
editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste);
// Do paste
executeSoon(function() {
testWin.goDoCommand("cmd_paste");
});
}
function testEnd()
{
if (editor) {
editor.destroy();
}
if (testWin) {
testWin.close();
}
testWin = editor = null;
gBrowser.removeCurrentTab();
waitForFocus(finish, window);
}

View File

@ -1,90 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
let testWin;
let editor;
function test()
{
waitForExplicitFinish();
const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 660784' width='600' height='500'><hbox flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
}
function initEditor()
{
let hbox = testWin.document.querySelector("hbox");
editor = new SourceEditor();
editor.init(hbox, {}, editorLoaded);
}
function editorLoaded()
{
let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
editor.focus();
editor.setText("line1\nline2\nline3");
if (component != "textarea") {
is(editor.getLineCount(), 3, "getLineCount() works");
}
editor.setCaretPosition(1);
is(editor.getCaretOffset(), 6, "setCaretPosition(line) works");
let pos;
if (component != "textarea") {
pos = editor.getCaretPosition();
ok(pos.line == 1 && pos.col == 0, "getCaretPosition() works");
}
editor.setCaretPosition(1, 3);
is(editor.getCaretOffset(), 9, "setCaretPosition(line, column) works");
if (component != "textarea") {
pos = editor.getCaretPosition();
ok(pos.line == 1 && pos.col == 3, "getCaretPosition() works");
}
editor.setCaretPosition(2);
is(editor.getCaretOffset(), 12, "setCaretLine() works, confirmed");
if (component != "textarea") {
pos = editor.getCaretPosition();
ok(pos.line == 2 && pos.col == 0, "setCaretPosition(line) works, again");
}
let offsetLine = editor.getLineAtOffset(0);
is(offsetLine, 0, "getLineAtOffset() is correct for offset 0");
let offsetLine = editor.getLineAtOffset(6);
is(offsetLine, 1, "getLineAtOffset() is correct for offset 6");
let offsetLine = editor.getLineAtOffset(12);
is(offsetLine, 2, "getLineAtOffset() is correct for offset 12");
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
}

View File

@ -1,89 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
let testWin;
let editor;
function test()
{
let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
if (component != "orion") {
ok(true, "skip test for bug 687568: only applicable for Orion");
return; // Testing for the fix requires direct Orion API access.
}
waitForExplicitFinish();
const windowUrl = "data:application/vnd.mozilla.xul+xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 687568 - page scroll' width='600' height='500'>" +
"<box flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
}
function initEditor()
{
let box = testWin.document.querySelector("box");
editor = new SourceEditor();
editor.init(box, { showLineNumbers: true }, editorLoaded);
}
function editorLoaded()
{
editor.focus();
let view = editor._view;
let model = editor._model;
let lineHeight = view.getLineHeight();
let editorHeight = view.getClientArea().height;
let linesPerPage = Math.floor(editorHeight / lineHeight);
let totalLines = 3 * linesPerPage;
let text = "";
for (let i = 0; i < totalLines; i++) {
text += "l" + i + "\n";
}
editor.setText(text);
editor.setCaretOffset(0);
EventUtils.synthesizeKey("VK_DOWN", {shiftKey: true}, testWin);
EventUtils.synthesizeKey("VK_DOWN", {shiftKey: true}, testWin);
EventUtils.synthesizeKey("VK_DOWN", {shiftKey: true}, testWin);
let bottomLine = view.getBottomIndex(true);
view.setTopIndex(bottomLine + 1);
executeSoon(function() {
EventUtils.synthesizeKey("VK_PAGE_DOWN", {shiftKey: true}, testWin);
executeSoon(function() {
let topLine = view.getTopIndex(true);
let topLineOffset = model.getLineStart(topLine);
let selection = editor.getSelection();
ok(selection.start < topLineOffset && topLineOffset < selection.end,
"top visible line is selected");
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
});
});
}

View File

@ -1,133 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
let testWin;
let editor;
function test()
{
let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
if (component == "textarea") {
ok(true, "skip test for bug 687573: not applicable for TEXTAREAs");
return; // TEXTAREAs have different behavior
}
waitForExplicitFinish();
const windowUrl = "data:application/vnd.mozilla.xul+xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 687573 - vertical scroll' width='300' height='500'>" +
"<box flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
}
function initEditor()
{
let box = testWin.document.querySelector("box");
let text = "abba\n" +
"\n" +
"abbaabbaabbaabbaabbaabbaabbaabbaabbaabba\n" +
"abbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabba\n" +
"abbaabbaabbaabbaabbaabbaabbaabbaabbaabba\n" +
"\n" +
"abba\n";
let config = {
showLineNumbers: true,
initialText: text,
};
editor = new SourceEditor();
editor.init(box, config, editorLoaded);
}
function editorLoaded()
{
let VK_LINE_END = "VK_END";
let VK_LINE_END_OPT = {};
let OS = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
if (OS == "Darwin") {
VK_LINE_END = "VK_RIGHT";
VK_LINE_END_OPT = {accelKey: true};
}
editor.focus();
editor.setCaretOffset(0);
is(editor.getCaretOffset(), 0, "caret location at start");
EventUtils.synthesizeKey("VK_DOWN", {}, testWin);
EventUtils.synthesizeKey("VK_DOWN", {}, testWin);
// line 3
is(editor.getCaretOffset(), 6, "caret location, keypress Down two times, line 3");
// line 3 end
EventUtils.synthesizeKey(VK_LINE_END, VK_LINE_END_OPT, testWin);
is(editor.getCaretOffset(), 46, "caret location, keypress End, line 3 end");
// line 4
EventUtils.synthesizeKey("VK_DOWN", {}, testWin);
is(editor.getCaretOffset(), 87, "caret location, keypress Down, line 4");
// line 4 end
EventUtils.synthesizeKey(VK_LINE_END, VK_LINE_END_OPT, testWin);
is(editor.getCaretOffset(), 135, "caret location, keypress End, line 4 end");
// line 5 end
EventUtils.synthesizeKey("VK_DOWN", {}, testWin);
is(editor.getCaretOffset(), 176, "caret location, keypress Down, line 5 end");
// line 6 end
EventUtils.synthesizeKey("VK_DOWN", {}, testWin);
is(editor.getCaretOffset(), 177, "caret location, keypress Down, line 6 end");
// The executeSoon() calls are needed to allow reflows...
EventUtils.synthesizeKey("VK_UP", {}, testWin);
executeSoon(function() {
// line 5 end
is(editor.getCaretOffset(), 176, "caret location, keypress Up, line 5 end");
EventUtils.synthesizeKey("VK_UP", {}, testWin);
executeSoon(function() {
// line 4 end
is(editor.getCaretOffset(), 135, "caret location, keypress Up, line 4 end");
// line 3 end
EventUtils.synthesizeKey("VK_UP", {}, testWin);
is(editor.getCaretOffset(), 46, "caret location, keypress Up, line 3 end");
// line 2 end
EventUtils.synthesizeKey("VK_UP", {}, testWin);
is(editor.getCaretOffset(), 5, "caret location, keypress Up, line 2 end");
// line 3 end
EventUtils.synthesizeKey("VK_DOWN", {}, testWin);
is(editor.getCaretOffset(), 46, "caret location, keypress Down, line 3 end");
// line 4 end
EventUtils.synthesizeKey("VK_DOWN", {}, testWin);
is(editor.getCaretOffset(), 135, "caret location, keypress Down, line 4 end");
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
});
});
}

View File

@ -1,162 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
let testWin;
let editor;
function test()
{
let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
if (component != "orion") {
ok(true, "skip test for bug 687580: only applicable for Orion");
return; // Testing for the fix requires direct Orion API access.
}
waitForExplicitFinish();
const windowUrl = "data:application/vnd.mozilla.xul+xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 687580 - drag and drop' width='600' height='500'>" +
"<box flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
}
function initEditor()
{
let box = testWin.document.querySelector("box");
editor = new SourceEditor();
editor.init(box, {}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
let view = editor._view;
let model = editor._model;
let lineHeight = view.getLineHeight();
let editorHeight = view.getClientArea().height;
let linesPerPage = Math.floor(editorHeight / lineHeight);
let totalLines = 2 * linesPerPage;
let text = "foobarBug687580-";
for (let i = 0; i < totalLines; i++) {
text += "l" + i + "\n";
}
editor.setText(text);
editor.setCaretOffset(0);
let bottomPixel = view.getBottomPixel();
EventUtils.synthesizeKey("VK_DOWN", {shiftKey: true}, testWin);
EventUtils.synthesizeKey("VK_DOWN", {shiftKey: true}, testWin);
EventUtils.synthesizeKey("VK_DOWN", {shiftKey: true}, testWin);
let initialSelection = editor.getSelection();
let ds = Cc["@mozilla.org/widget/dragservice;1"].
getService(Ci.nsIDragService);
let target = view._clientDiv;
let targetWin = target.ownerDocument.defaultView;
let dataTransfer = null;
let onDragStart = function(aEvent) {
target.removeEventListener("dragstart", onDragStart, false);
dataTransfer = aEvent.dataTransfer;
ok(dataTransfer, "dragstart event fired");
ok(dataTransfer.types.contains("text/plain"),
"dataTransfer text/plain available");
let text = dataTransfer.getData("text/plain");
isnot(text.indexOf("foobarBug687580"), -1, "text/plain data is correct");
dataTransfer.dropEffect = "move";
};
let onDrop = executeSoon.bind(null, function() {
target.removeEventListener("drop", onDrop, false);
let selection = editor.getSelection();
is(selection.end - selection.start,
initialSelection.end - initialSelection.start,
"selection is correct");
is(editor.getText(0, 2), "l3", "drag and drop worked");
let offset = editor.getCaretOffset();
ok(offset > initialSelection.end, "new caret location");
let initialLength = initialSelection.end - initialSelection.start;
let dropText = editor.getText(offset - initialLength, offset);
isnot(dropText.indexOf("foobarBug687580"), -1, "drop text is correct");
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
});
executeSoon(function() {
ds.startDragSession();
target.addEventListener("dragstart", onDragStart, false);
target.addEventListener("drop", onDrop, false);
EventUtils.synthesizeMouse(target, 10, 10, {type: "mousedown"}, targetWin);
EventUtils.synthesizeMouse(target, 11, bottomPixel - 25, {type: "mousemove"},
targetWin);
EventUtils.synthesizeMouse(target, 12, bottomPixel - 15, {type: "mousemove"},
targetWin);
let clientX = 5;
let clientY = bottomPixel - 10;
let event = targetWin.document.createEvent("DragEvents");
event.initDragEvent("dragenter", true, true, targetWin, 0, 0, 0, clientX,
clientY, false, false, false, false, 0, null,
dataTransfer);
target.dispatchEvent(event);
event = targetWin.document.createEvent("DragEvents");
event.initDragEvent("dragover", true, true, targetWin, 0, 0, 0, clientX + 1,
clientY + 2, false, false, false, false, 0, null,
dataTransfer);
target.dispatchEvent(event);
EventUtils.synthesizeMouse(target, clientX + 2, clientY + 1,
{type: "mouseup"}, targetWin);
event = targetWin.document.createEvent("DragEvents");
event.initDragEvent("drop", true, true, targetWin, 0, 0, 0, clientX + 2,
clientY + 3, false, false, false, false, 0, null,
dataTransfer);
target.dispatchEvent(event);
event = targetWin.document.createEvent("DragEvents");
event.initDragEvent("dragend", true, true, targetWin, 0, 0, 0, clientX + 3,
clientY + 2, false, false, false, false, 0, null,
dataTransfer);
target.dispatchEvent(event);
ds.endDragSession(true);
});
}

View File

@ -1,100 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
let testWin;
let editor;
function test()
{
if (Services.appinfo.OS != "Linux") {
ok(true, "this test only applies to Linux, skipping.")
return;
}
waitForExplicitFinish();
const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 695035' width='600' height='500'><hbox flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
}
function initEditor()
{
let hbox = testWin.document.querySelector("hbox");
editor = new SourceEditor();
editor.init(hbox, {}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
let initialText = "initial text!";
editor.setText(initialText);
let expectedString = "foobarBug695035-" + Date.now();
let doCopy = function() {
let clipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].
getService(Ci.nsIClipboardHelper);
clipboardHelper.copyStringToClipboard(expectedString,
Ci.nsIClipboard.kSelectionClipboard,
testWin.document);
};
let onCopy = function() {
editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste);
EventUtils.synthesizeMouse(editor.editorElement, 10, 10, {}, testWin);
EventUtils.synthesizeMouse(editor.editorElement, 11, 11, {button: 1}, testWin);
};
let onPaste = function() {
editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste);
let text = editor.getText();
isnot(text.indexOf(expectedString), -1, "middle-click paste works");
isnot(text, initialText, "middle-click paste works (confirmed)");
executeSoon(doTestBug695032);
};
let doTestBug695032 = function() {
info("test for bug 695032 - editor selection should be placed in the X11 primary selection buffer");
let text = "foobarBug695032 test me, test me!";
editor.setText(text);
waitForSelection(text, function() {
EventUtils.synthesizeKey("a", {accelKey: true}, testWin);
}, testEnd, testEnd);
};
waitForSelection(expectedString, doCopy, onCopy, testEnd);
}
function testEnd()
{
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
}

View File

@ -1,94 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test() {
let temp = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", temp);
let SourceEditor = temp.SourceEditor;
let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
if (component == "textarea") {
ok(true, "skip test for bug 700893: only applicable for non-textarea components");
return;
}
waitForExplicitFinish();
let editor;
const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 700893' width='600' height='500'><hbox flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
let testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
function initEditor()
{
let hbox = testWin.document.querySelector("hbox");
editor = new SourceEditor();
editor.init(hbox, {initialText: "foobar"}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
is(editor.dirty, false, "editory is not dirty");
let event = null;
let eventHandler = function(aEvent) {
event = aEvent;
};
editor.addEventListener(SourceEditor.EVENTS.DIRTY_CHANGED, eventHandler);
editor.setText("omg");
is(editor.dirty, true, "editor is dirty");
ok(event, "DirtyChanged event fired")
is(event.oldValue, false, "event.oldValue is correct");
is(event.newValue, true, "event.newValue is correct");
event = null;
editor.setText("foo 2");
ok(!event, "no DirtyChanged event fired");
editor.dirty = false;
is(editor.dirty, false, "editor marked as clean");
ok(event, "DirtyChanged event fired")
is(event.oldValue, true, "event.oldValue is correct");
is(event.newValue, false, "event.newValue is correct");
event = null;
editor.setText("foo 3");
is(editor.dirty, true, "editor is dirty after changes");
ok(event, "DirtyChanged event fired")
is(event.oldValue, false, "event.oldValue is correct");
is(event.newValue, true, "event.newValue is correct");
editor.undo();
is(editor.dirty, false, "editor is not dirty after undo");
ok(event, "DirtyChanged event fired")
is(event.oldValue, true, "event.oldValue is correct");
is(event.newValue, false, "event.newValue is correct");
editor.removeEventListener(SourceEditor.EVENTS.DIRTY_CHANGED, eventHandler);
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
}
}

View File

@ -1,71 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
let testWin;
let editor;
function test()
{
waitForExplicitFinish();
const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='Test for bug 703692' width='600' height='500'><hbox flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
}
function initEditor()
{
let hbox = testWin.document.querySelector("hbox");
editor = new SourceEditor();
editor.init(hbox, {}, editorLoaded);
}
function editorLoaded()
{
let focusHandler = function(aEvent) {
editor.removeEventListener(SourceEditor.EVENTS.FOCUS, focusHandler);
editor.addEventListener(SourceEditor.EVENTS.BLUR, blurHandler);
ok(aEvent, "Focus event fired");
window.focus();
};
let blurHandler = function(aEvent) {
editor.removeEventListener(SourceEditor.EVENTS.BLUR, blurHandler);
ok(aEvent, "Blur event fired");
executeSoon(testEnd);
}
editor.addEventListener(SourceEditor.EVENTS.FOCUS, focusHandler);
editor.focus();
}
function testEnd()
{
if (editor) {
editor.destroy();
}
if (testWin) {
testWin.close();
}
testWin = editor = null;
waitForFocus(finish, window);
}

View File

@ -1,169 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test() {
let temp = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", temp);
let SourceEditor = temp.SourceEditor;
let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
if (component == "textarea") {
ok(true, "skip test for bug 707987: only applicable for non-textarea components");
return;
}
waitForExplicitFinish();
let editor;
const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 707987' width='600' height='500'><hbox flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
let testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
function initEditor()
{
let hbox = testWin.document.querySelector("hbox");
editor = new SourceEditor();
editor.init(hbox, {showAnnotationRuler: true}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
editor.setText("line1\nline2\nline3\nline4");
is(editor.getBreakpoints().length, 0, "no breakpoints");
let event = null;
let eventHandler = function(aEvent) {
event = aEvent;
};
editor.addEventListener(SourceEditor.EVENTS.BREAKPOINT_CHANGE, eventHandler);
// Add breakpoint at line 0
editor.addBreakpoint(0);
let breakpoints = editor.getBreakpoints();
is(breakpoints.length, 1, "one breakpoint added");
is(breakpoints[0].line, 0, "breakpoint[0].line is correct");
ok(!breakpoints[0].condition, "breakpoint[0].condition is correct");
ok(event, "breakpoint event fired");
is(event.added.length, 1, "one breakpoint added (confirmed)");
is(event.removed.length, 0, "no breakpoint removed");
is(event.added[0].line, 0, "event added[0].line is correct");
ok(!event.added[0].condition, "event added[0].condition is correct");
// Add breakpoint at line 3
event = null;
editor.addBreakpoint(3, "foo == 'bar'");
breakpoints = editor.getBreakpoints();
is(breakpoints.length, 2, "another breakpoint added");
is(breakpoints[0].line, 0, "breakpoint[0].line is correct");
ok(!breakpoints[0].condition, "breakpoint[0].condition is correct");
is(breakpoints[1].line, 3, "breakpoint[1].line is correct");
is(breakpoints[1].condition, "foo == 'bar'",
"breakpoint[1].condition is correct");
ok(event, "breakpoint event fired");
is(event.added.length, 1, "another breakpoint added (confirmed)");
is(event.removed.length, 0, "no breakpoint removed");
is(event.added[0].line, 3, "event added[0].line is correct");
is(event.added[0].condition, "foo == 'bar'",
"event added[0].condition is correct");
// Try to add another breakpoint at line 0
event = null;
editor.addBreakpoint(0);
is(editor.getBreakpoints().length, 2, "no breakpoint added");
is(event, null, "no breakpoint event fired");
// Try to remove a breakpoint from line 1
is(editor.removeBreakpoint(1), false, "removeBreakpoint(1) returns false");
is(editor.getBreakpoints().length, 2, "no breakpoint removed");
is(event, null, "no breakpoint event fired");
// Remove the breakpoint from line 0
is(editor.removeBreakpoint(0), true, "removeBreakpoint(0) returns true");
breakpoints = editor.getBreakpoints();
is(breakpoints[0].line, 3, "breakpoint[0].line is correct");
is(breakpoints[0].condition, "foo == 'bar'",
"breakpoint[0].condition is correct");
ok(event, "breakpoint event fired");
is(event.added.length, 0, "no breakpoint added");
is(event.removed.length, 1, "one breakpoint removed");
is(event.removed[0].line, 0, "event removed[0].line is correct");
ok(!event.removed[0].condition, "event removed[0].condition is correct");
// Remove the breakpoint from line 3
event = null;
is(editor.removeBreakpoint(3), true, "removeBreakpoint(3) returns true");
is(editor.getBreakpoints().length, 0, "no breakpoints");
ok(event, "breakpoint event fired");
is(event.added.length, 0, "no breakpoint added");
is(event.removed.length, 1, "one breakpoint removed");
is(event.removed[0].line, 3, "event removed[0].line is correct");
is(event.removed[0].condition, "foo == 'bar'",
"event removed[0].condition is correct");
// Add a breakpoint with the mouse
event = null;
EventUtils.synthesizeMouse(editor.editorElement, 10, 10, {}, testWin);
breakpoints = editor.getBreakpoints();
is(breakpoints.length, 1, "one breakpoint added");
is(breakpoints[0].line, 0, "breakpoint[0].line is correct");
ok(!breakpoints[0].condition, "breakpoint[0].condition is correct");
ok(event, "breakpoint event fired");
is(event.added.length, 1, "one breakpoint added (confirmed)");
is(event.removed.length, 0, "no breakpoint removed");
is(event.added[0].line, 0, "event added[0].line is correct");
ok(!event.added[0].condition, "event added[0].condition is correct");
// Remove a breakpoint with the mouse
event = null;
EventUtils.synthesizeMouse(editor.editorElement, 10, 10, {}, testWin);
breakpoints = editor.getBreakpoints();
is(breakpoints.length, 0, "one breakpoint removed");
ok(event, "breakpoint event fired");
is(event.added.length, 0, "no breakpoint added");
is(event.removed.length, 1, "one breakpoint removed (confirmed)");
is(event.removed[0].line, 0, "event removed[0].line is correct");
ok(!event.removed[0].condition, "event removed[0].condition is correct");
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
}
}

View File

@ -1,74 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test() {
let temp = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", temp);
let SourceEditor = temp.SourceEditor;
let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
if (component == "textarea") {
ok(true, "skip test for bug 712982: only applicable for non-textarea components");
return;
}
waitForExplicitFinish();
let editor;
const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 712982' width='600' height='500'><hbox flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
let testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
function initEditor()
{
let hbox = testWin.document.querySelector("hbox");
editor = new SourceEditor();
editor.init(hbox, {showLineNumbers: true}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
editor.setText("line1\nline2\nline3\nline4");
editor.setCaretPosition(3);
let pos = editor.getCaretPosition();
ok(pos.line == 3 && pos.col == 0, "initial caret location is correct");
EventUtils.synthesizeMouse(editor.editorElement, 10, 10, {}, testWin);
is(editor.getCaretOffset(), 0, "click on line 0 worked");
editor.setCaretPosition(2);
EventUtils.synthesizeMouse(editor.editorElement, 11, 11,
{shiftKey: true}, testWin);
is(editor.getSelectedText().trim(), "line1\nline2", "shift+click works");
editor.setCaretOffset(0);
EventUtils.synthesizeMouse(editor.editorElement, 10, 10,
{clickCount: 2}, testWin);
is(editor.getSelectedText().trim(), "line1", "double click works");
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
}
}

View File

@ -1,107 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
let testWin;
let editor;
function test()
{
waitForExplicitFinish();
const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='Test for bug 725388' width='600' height='500'><hbox flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
}
function initEditor()
{
let hbox = testWin.document.querySelector("hbox");
editor = new SourceEditor();
editor.init(hbox, {}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
testWin.resizeBy(1, 2);
let text = "BrowserBug - 725388";
editor.setText(text);
let target = editor.editorElement;
let targetWin = target.ownerDocument.defaultView;
let eventsFired = 0;
let done = function() {
eventsFired++;
if (eventsFired == 3) {
executeSoon(testEnd);
}
};
let mMoveHandler = function(aEvent) {
editor.removeEventListener(SourceEditor.EVENTS.MOUSE_MOVE, mMoveHandler);
is(aEvent.event.type, "mousemove", "MouseMove event fired.");
executeSoon(done);
};
let mOverHandler = function(aEvent) {
editor.removeEventListener(SourceEditor.EVENTS.MOUSE_OVER, mOverHandler);
is(aEvent.event.type, "mouseover", "MouseOver event fired.");
executeSoon(done);
};
let mOutHandler = function(aEvent) {
editor.removeEventListener(SourceEditor.EVENTS.MOUSE_OUT, mOutHandler);
is(aEvent.event.type, "mouseout", "MouseOut event fired.");
executeSoon(done);
};
editor.addEventListener(SourceEditor.EVENTS.MOUSE_OVER, mOverHandler);
editor.addEventListener(SourceEditor.EVENTS.MOUSE_MOVE, mMoveHandler);
editor.addEventListener(SourceEditor.EVENTS.MOUSE_OUT, mOutHandler);
waitForFocus(function() {
EventUtils.synthesizeMouse(target, 10, 10, {type: "mouseover"},
targetWin);
EventUtils.synthesizeMouse(target, 15, 17, {type: "mousemove"},
targetWin);
EventUtils.synthesizeMouse(target, -10, -10, {type: "mouseout"},
targetWin);
}, targetWin);
}
function testEnd()
{
if (editor) {
editor.destroy();
}
if (testWin) {
testWin.close();
}
testWin = editor = null;
waitForFocus(finish, window);
}

View File

@ -1,160 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test()
{
let testWin;
let editor;
let mousePos = { x: 36, y: 4 };
let expectedOffset = 5;
let maxDiff = 10;
waitForExplicitFinish();
function editorLoaded(aEditor, aWindow)
{
editor = aEditor;
testWin = aWindow;
let text = fillEditor(editor, 3);
editor.setText(text);
editor.setCaretOffset(0);
doMouseMove(testPage1);
}
function doMouseMove(aCallback)
{
function mouseEventHandler(aEvent)
{
editor.removeEventListener(editor.EVENTS.MOUSE_OUT, mouseEventHandler);
editor.removeEventListener(editor.EVENTS.MOUSE_OVER, mouseEventHandler);
editor.removeEventListener(editor.EVENTS.MOUSE_MOVE, mouseEventHandler);
executeSoon(aCallback.bind(null, aEvent));
}
editor.addEventListener(editor.EVENTS.MOUSE_MOVE, mouseEventHandler);
editor.addEventListener(editor.EVENTS.MOUSE_OUT, mouseEventHandler);
editor.addEventListener(editor.EVENTS.MOUSE_OVER, mouseEventHandler);
let target = editor.editorElement;
let targetWin = testWin;
EventUtils.synthesizeMouse(target, mousePos.x, mousePos.y,
{type: "mousemove"}, targetWin);
EventUtils.synthesizeMouse(target, mousePos.x, mousePos.y,
{type: "mouseout"}, targetWin);
EventUtils.synthesizeMouse(target, mousePos.x, mousePos.y,
{type: "mouseover"}, targetWin);
}
function checkValue(aValue, aExpectedValue)
{
let result = Math.abs(aValue - aExpectedValue) <= maxDiff;
if (!result) {
info("checkValue() given " + aValue + " expected " + aExpectedValue);
}
return result;
}
function testPage1(aEvent)
{
let {event: { clientX: clientX, clientY: clientY }, x: x, y: y} = aEvent;
info("testPage1 " + aEvent.type +
" clientX " + clientX + " clientY " + clientY +
" x " + x + " y " + y);
// x and y are in document coordinates.
// clientX and clientY are in view coordinates.
// since we are scrolled at the top, both are expected to be approximately
// the same.
ok(checkValue(x, mousePos.x), "x is in range");
ok(checkValue(y, mousePos.y), "y is in range");
ok(checkValue(clientX, mousePos.x), "clientX is in range");
ok(checkValue(clientY, mousePos.y), "clientY is in range");
// we give document-relative coordinates here.
let offset = editor.getOffsetAtLocation(x, y);
ok(checkValue(offset, expectedOffset), "character offset is correct");
let rect = {x: x, y: y};
let viewCoords = editor.convertCoordinates(rect, "document", "view");
ok(checkValue(viewCoords.x, clientX), "viewCoords.x is in range");
ok(checkValue(viewCoords.y, clientY), "viewCoords.y is in range");
rect = {x: clientX, y: clientY};
let docCoords = editor.convertCoordinates(rect, "view", "document");
ok(checkValue(docCoords.x, x), "docCoords.x is in range");
ok(checkValue(docCoords.y, y), "docCoords.y is in range");
// we are given document-relative coordinates.
let offsetPos = editor.getLocationAtOffset(expectedOffset);
ok(checkValue(offsetPos.x, x), "offsetPos.x is in range");
ok(checkValue(offsetPos.y, y), "offsetPos.y is in range");
// Scroll the view and test again.
let topIndex = Math.round(editor.getLineCount() / 2);
editor.setTopIndex(topIndex);
expectedOffset += editor.getLineStart(topIndex);
executeSoon(doMouseMove.bind(null, testPage2));
}
function testPage2(aEvent)
{
let {event: { clientX: clientX, clientY: clientY }, x: x, y: y} = aEvent;
info("testPage2 " + aEvent.type +
" clientX " + clientX + " clientY " + clientY +
" x " + x + " y " + y);
// after page scroll document coordinates need to be different from view
// coordinates.
ok(checkValue(x, mousePos.x), "x is not different from clientX");
ok(!checkValue(y, mousePos.y), "y is different from clientY");
ok(checkValue(clientX, mousePos.x), "clientX is in range");
ok(checkValue(clientY, mousePos.y), "clientY is in range");
// we give document-relative coordinates here.
let offset = editor.getOffsetAtLocation(x, y);
ok(checkValue(offset, expectedOffset), "character offset is correct");
let rect = {x: x, y: y};
let viewCoords = editor.convertCoordinates(rect, "document", "view");
ok(checkValue(viewCoords.x, clientX), "viewCoords.x is in range");
ok(checkValue(viewCoords.y, clientY), "viewCoords.y is in range");
rect = {x: clientX, y: clientY};
let docCoords = editor.convertCoordinates(rect, "view", "document");
ok(checkValue(docCoords.x, x), "docCoords.x is in range");
ok(checkValue(docCoords.y, y), "docCoords.y is in range");
// we are given document-relative coordinates.
let offsetPos = editor.getLocationAtOffset(expectedOffset);
ok(checkValue(offsetPos.x, x), "offsetPos.x is in range");
ok(checkValue(offsetPos.y, y), "offsetPos.y is in range");
executeSoon(testEnd);
}
function testEnd()
{
if (editor) {
editor.destroy();
}
if (testWin) {
testWin.close();
}
waitForFocus(finish, window);
}
openSourceEditorWindow(editorLoaded);
}

View File

@ -1,151 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test() {
let temp = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", temp);
let SourceEditor = temp.SourceEditor;
waitForExplicitFinish();
let editor;
const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 725430' width='600' height='500'><hbox flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
let testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
function initEditor()
{
let hbox = testWin.document.querySelector("hbox");
editor = new SourceEditor();
editor.init(hbox, {showLineNumbers: true}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
let text = "firstline\nsecondline\nthirdline\nfourthline";
editor.setMode(SourceEditor.MODES.JAVASCRIPT);
editor.setText(text)
editor.setCaretPosition(0);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), "//" + text, "JS Single line Commenting Works");
editor.undo();
is(editor.getText(), text, "Undo Single Line Commenting action works");
editor.redo();
is(editor.getText(), "//" + text, "Redo works");
editor.setCaretPosition(0);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "JS Single Line Uncommenting works");
editor.setText(text);
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), "/*" + text + "*/", "JS Block Commenting works");
editor.undo();
is(editor.getText(), text, "Undo Block Commenting action works");
editor.redo();
is(editor.getText(), "/*" + text + "*/", "Redo works");
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "JS Block Uncommenting works");
editor.undo();
is(editor.getText(), "/*" + text + "*/", "Undo Block Uncommenting works");
editor.redo();
is(editor.getText(), text, "Redo works");
let regText = "//firstline\n // secondline\nthird//line\n//fourthline";
let expText = "firstline\n secondline\nthird//line\nfourthline";
editor.setText(regText);
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), expText, "JS Multiple Line Uncommenting works");
editor.undo();
is(editor.getText(), regText, "Undo Multiple Line Uncommenting works");
editor.redo();
is(editor.getText(), expText, "Redo works");
editor.setMode(SourceEditor.MODES.CSS);
editor.setText(text);
expText = "/*firstline*/\nsecondline\nthirdline\nfourthline";
editor.setCaretPosition(0);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), expText, "CSS Commenting without selection works");
editor.setCaretPosition(0);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "CSS Uncommenting without selection works");
editor.setText(text);
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), "/*" + text + "*/", "CSS Multiple Line Commenting works");
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "CSS Multiple Line Uncommenting works");
editor.setMode(SourceEditor.MODES.HTML);
editor.setText(text);
expText = "<!--firstline-->\nsecondline\nthirdline\nfourthline";
editor.setCaretPosition(0);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), expText, "HTML Commenting without selection works");
editor.setCaretPosition(0);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "HTML Uncommenting without selection works");
editor.setText(text);
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), "<!--" + text + "-->", "HTML Multiple Line Commenting works");
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "HTML Multiple Line Uncommenting works");
editor.setMode(SourceEditor.MODES.TEXT);
editor.setText(text);
editor.setCaretPosition(0);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "Commenting disabled in Text mode");
editor.setText(regText);
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), regText, "Uncommenting disabled in Text mode");
editor.setText(text);
editor.readOnly = true;
editor.setCaretPosition(0);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), text, "Commenting disabled in ReadOnly mode");
editor.setText(regText);
EventUtils.synthesizeKey("VK_A", {accelKey: true}, testWin);
EventUtils.synthesizeKey("/", {accelKey: true}, testWin);
is(editor.getText(), regText, "Uncommenting disabled in ReadOnly mode");
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
}
}

View File

@ -1,117 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
let editor;
let testWin;
function test()
{
waitForExplicitFinish();
const windowUrl = "data:application/vnd.mozilla.xul+xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 725618 - moveLines shortcut' width='300' height='500'>" +
"<box flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
}
function initEditor()
{
let box = testWin.document.querySelector("box");
let text = "target\nfoo\nbar"
let config = {
initialText: text,
};
editor = new SourceEditor();
editor.init(box, config, editorLoaded);
}
function editorLoaded()
{
editor.focus();
editor.setCaretOffset(0);
let modifiers = {altKey: true, ctrlKey: Services.appinfo.OS == "Darwin"};
EventUtils.synthesizeKey("VK_DOWN", modifiers, testWin);
is(editor.getText(), "foo\ntarget\nbar", "Move lines down works");
is(editor.getSelectedText(), "target\n", "selection is correct");
EventUtils.synthesizeKey("VK_DOWN", modifiers, testWin);
is(editor.getText(), "foo\nbar\ntarget", "Move lines down works");
is(editor.getSelectedText(), "target", "selection is correct");
EventUtils.synthesizeKey("VK_DOWN", modifiers, testWin);
is(editor.getText(), "foo\nbar\ntarget", "Check for bottom of editor works");
is(editor.getSelectedText(), "target", "selection is correct");
EventUtils.synthesizeKey("VK_UP", modifiers, testWin);
is(editor.getText(), "foo\ntarget\nbar", "Move lines up works");
is(editor.getSelectedText(), "target\n", "selection is correct");
EventUtils.synthesizeKey("VK_UP", modifiers, testWin);
is(editor.getText(), "target\nfoo\nbar", "Move lines up works");
is(editor.getSelectedText(), "target\n", "selection is correct");
EventUtils.synthesizeKey("VK_UP", modifiers, testWin);
is(editor.getText(), "target\nfoo\nbar", "Check for top of editor works");
is(editor.getSelectedText(), "target\n", "selection is correct");
editor.setSelection(0, 10);
info("text within selection =" + editor.getSelectedText());
EventUtils.synthesizeKey("VK_DOWN", modifiers, testWin);
is(editor.getText(), "bar\ntarget\nfoo", "Multiple line move down works");
is(editor.getSelectedText(), "target\nfoo", "selection is correct");
EventUtils.synthesizeKey("VK_DOWN", modifiers, testWin);
is(editor.getText(), "bar\ntarget\nfoo",
"Check for bottom of editor works with multiple line selection");
is(editor.getSelectedText(), "target\nfoo", "selection is correct");
EventUtils.synthesizeKey("VK_UP", modifiers, testWin);
is(editor.getText(), "target\nfoo\nbar", "Multiple line move up works");
is(editor.getSelectedText(), "target\nfoo\n", "selection is correct");
EventUtils.synthesizeKey("VK_UP", modifiers, testWin);
is(editor.getText(), "target\nfoo\nbar",
"Check for top of editor works with multiple line selection");
is(editor.getSelectedText(), "target\nfoo\n", "selection is correct");
editor.readOnly = true;
editor.setCaretOffset(0);
EventUtils.synthesizeKey("VK_UP", modifiers, testWin);
is(editor.getText(), "target\nfoo\nbar",
"Check for readOnly mode works with move lines up");
EventUtils.synthesizeKey("VK_DOWN", modifiers, testWin);
is(editor.getText(), "target\nfoo\nbar",
"Check for readOnly mode works with move lines down");
finish();
}
registerCleanupFunction(function()
{
editor.destroy();
testWin.close();
testWin = editor = null;
});

View File

@ -1,99 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
let testWin;
let editor;
const VERTICAL_OFFSET = 3;
function test()
{
waitForExplicitFinish();
const windowUrl = "data:application/vnd.mozilla.xul+xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 729480 - allow setCaretPosition align the target line" +
" vertically in view according to a third argument'" +
" width='300' height='300'><box flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,dialog=no";
testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
}
function initEditor()
{
let box = testWin.document.querySelector("box");
editor = new SourceEditor();
editor.init(box, {showLineNumbers: true}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
// setting 3 pages of lines containing the line number.
let view = editor._view;
let lineHeight = view.getLineHeight();
let editorHeight = view.getClientArea().height;
let linesPerPage = Math.floor(editorHeight / lineHeight);
let totalLines = 3 * linesPerPage;
let text = "";
for (let i = 0; i < totalLines; i++) {
text += "Line " + i + "\n";
}
editor.setText(text);
editor.setCaretOffset(0);
let offset = Math.min(Math.round(linesPerPage/2), VERTICAL_OFFSET);
// Building the iterator array.
// [line, alignment, topIndex_check]
let iterateOn = [
[0, "TOP", 0],
[25, "TOP", 25 - offset],
// Case when the target line is already in view.
[27, "TOP", 25 - offset],
[0, "BOTTOM", 0],
[5, "BOTTOM", 0],
[38, "BOTTOM", 38 - linesPerPage + offset],
[0, "CENTER", 0],
[4, "CENTER", 0],
[34, "CENTER", 34 - Math.round(linesPerPage/2)]
];
function testEnd() {
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
}
function testPosition(pos) {
is(editor.getTopIndex(), iterateOn[pos][2], "scroll is correct for test #" + pos);
iterator(++pos);
}
function iterator(i) {
if (i == iterateOn.length) {
testEnd();
} else {
editor.setCaretPosition(iterateOn[i][0], 0,
editor.VERTICAL_ALIGN[iterateOn[i][1]]);
executeSoon(testPosition.bind(this, i));
}
}
iterator(0);
}

View File

@ -1,164 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test() {
let temp = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", temp);
let SourceEditor = temp.SourceEditor;
waitForExplicitFinish();
let editor;
const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 729960' width='600' height='500'><hbox flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
let testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
function initEditor()
{
let hbox = testWin.document.querySelector("hbox");
editor = new SourceEditor();
editor.init(hbox, {showLineNumbers: true}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
let JSText = "function foo(aVar) {\n" +
" // Block Level 1\n\n" +
" function level2() {\n" +
" let baz = aVar;\n" +
" // Block Level 2\n" +
" function level3() {\n" +
" // Block Level 3\n" +
" }\n" +
" }\n" +
" // Block Level 1" +
" function bar() { /* Block Level 2 */ }\n" +
"}";
editor.setMode(SourceEditor.MODES.JAVASCRIPT);
editor.setText(JSText);
// Setting caret at Line 1 bracket start.
editor.setCaretOffset(19);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 220,
"JS : Jump to closing bracket of the code block when caret at block start");
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 20,
"JS : Jump to opening bracket of the code block when caret at block end");
// Setting caret at Line 10 start.
editor.setCaretOffset(161);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 20,
"JS : Jump to opening bracket of code block when inside the function");
editor.setCaretOffset(161);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 220,
"JS : Jump to closing bracket of code block when inside the function");
// Setting caret at Line 6 start.
editor.setCaretOffset(67);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 159,
"JS : Jump to closing bracket in a nested function with caret inside");
editor.setCaretOffset(67);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 62,
"JS : Jump to opening bracket in a nested function with caret inside");
let CSSText = "#object {\n" +
" property: value;\n" +
" /* comment */\n" +
"}";
editor.setMode(SourceEditor.MODES.CSS);
editor.setText(CSSText);
// Setting caret at Line 1 bracket start.
editor.setCaretOffset(8);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 45,
"CSS : Jump to closing bracket of the code block when caret at block start");
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 9,
"CSS : Jump to opening bracket of the code block when caret at block end");
// Setting caret at Line 3 start.
editor.setCaretOffset(28);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 9,
"CSS : Jump to opening bracket of code block when inside the function");
editor.setCaretOffset(28);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 45,
"CSS : Jump to closing bracket of code block when inside the function");
let HTMLText = "<html>\n" +
" <head>\n" +
" <title>Testing Block Jump</title>\n" +
" </head>\n" +
" <body></body>\n" +
"</html>";
editor.setMode(SourceEditor.MODES.HTML);
editor.setText(HTMLText);
// Setting caret at Line 1 end.
editor.setCaretOffset(6);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 6,
"HTML : Jump to block end : Nothing happens in html mode");
// Setting caret at Line 4 end.
editor.setCaretOffset(64);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 64,
"HTML : Jump to block start : Nothing happens in html mode");
let text = "line 1\n" +
"line 2\n" +
"line 3\n" +
"line 4\n";
editor.setMode(SourceEditor.MODES.TEXT);
editor.setText(text);
// Setting caret at Line 1 start.
editor.setCaretOffset(0);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 0,
"Text : Jump to block end : Nothing happens in text mode");
// Setting caret at Line 4 end.
editor.setCaretOffset(28);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 28,
"Text : Jump to block start : Nothing happens in text mode");
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
}
}

View File

@ -1,59 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test() {
let temp = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", temp);
let SourceEditor = temp.SourceEditor;
waitForExplicitFinish();
let editor;
const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 731721' width='600' height='500'><hbox flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
let testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
function initEditor()
{
let hbox = testWin.document.querySelector("hbox");
editor = new SourceEditor();
editor.init(hbox, {showAnnotationRuler: true}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
editor.setText("line1\nline2\nline3\nline4");
is(editor.getDebugLocation(), -1, "no debugger location");
editor.setDebugLocation(1);
is(editor.getDebugLocation(), 1, "set debugger location works");
editor.setDebugLocation(3);
is(editor.getDebugLocation(), 3, "change debugger location works");
editor.setDebugLocation(-1);
is(editor.getDebugLocation(), -1, "clear debugger location works");
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
}
}

View File

@ -1,104 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test() {
let temp = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", temp);
let SourceEditor = temp.SourceEditor;
waitForExplicitFinish();
let editor;
const windowUrl = "data:text/xml;charset=utf8,<?xml version='1.0'?><window " +
"xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' " +
"title='test for bug 744021' width='600' height='500'><hbox flex='1'/>" +
"</window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable," +
"dialog=no";
let testWin = Services.ww.openWindow(null, windowUrl, "_blank",
windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
function initEditor()
{
let hbox = testWin.document.querySelector("hbox");
editor = new SourceEditor();
editor.init(hbox, {showLineNumbers: true}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
let JSText = "function foo() {\n" +
" \n" +
" function level2() {\n" +
" \n" +
" function level3() {\n" +
" \n" +
" }\n" +
" }\n" +
" function bar() { /* Block Level 2 */ }\n" +
"}\n" +
"function baz() {\n" +
" \n" +
"}";
editor.setMode(SourceEditor.MODES.JAVASCRIPT);
editor.setText(JSText);
// Setting caret at end of line 11 (function baz() {).
editor.setCaretOffset(147);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 16,
"JS : Jump to opening bracket of previous sibling block when no parent");
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 129,
"JS : Jump to closing bracket of same code block");
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 151,
"JS : Jump to closing bracket of next sibling code block");
let CSSText = "#object1 {\n" +
" property: value;\n" +
" /* comment */\n" +
"}\n" +
".class1 {\n" +
" property: value;\n" +
"}";
editor.setMode(SourceEditor.MODES.CSS);
editor.setText(CSSText);
// Setting caret at Line 5 end (.class1 {).
editor.setCaretOffset(57);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 10,
"CSS : Jump to opening bracket of previous sibling code block");
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 46,
"CSS : Jump to closing bracket of same code block");
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 77,
"CSS : Jump to closing bracket of next sibling code block");
editor.destroy();
testWin.close();
testWin = editor = null;
waitForFocus(finish, window);
}
}

View File

@ -0,0 +1,51 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test() {
waitForExplicitFinish();
setup((ed, win) => {
// appendTo
let src = win.document.querySelector("iframe").getAttribute("src");
ok(~src.indexOf(".CodeMirror"), "correct iframe is there");
// Language modes
is(ed.getMode(), Editor.modes.text, "getMode");
ed.setMode(Editor.modes.js);
is(ed.getMode(), Editor.modes.js, "setMode");
// Content
is(ed.getText(), "Hello.", "getText");
ed.setText("Hi.\nHow are you?");
is(ed.getText(), "Hi.\nHow are you?", "setText");
is(ed.getText(1), "How are you?", "getText(num)");
is(ed.getText(5), "", "getText(num) when num is out of scope");
ed.replaceText("YOU", { line: 1, ch: 8 }, { line: 1, ch: 11 });
is(ed.getText(1), "How are YOU?", "replaceText(str, from, to)");
ed.replaceText("you?", { line: 1, ch: 8 });
is(ed.getText(1), "How are you?", "replaceText(str, from)");
ed.replaceText("Hello.");
is(ed.getText(), "Hello.", "replaceText(str)");
ed.insertText(", sir/madam", { line: 0, ch: 5});
is(ed.getText(), "Hello, sir/madam.", "insertText");
// Add-ons
ed.extend({ whoami: () => "Anton", whereami: () => "Mozilla" });
is(ed.whoami(), "Anton", "extend/1");
is(ed.whereami(), "Mozilla", "extend/2");
// Line classes
ed.setText("Hello!\nHow are you?");
ok(!ed.hasLineClass(0, "test"), "no test line class");
ed.addLineClass(0, "test");
ok(ed.hasLineClass(0, "test"), "test line class is there");
ed.removeLineClass(0, "test");
ok(!ed.hasLineClass(0, "test"), "test line class is gone");
teardown(ed, win);
});
}

View File

@ -0,0 +1,36 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test() {
waitForExplicitFinish();
setup((ed, win) => {
ch(ed.getCursor(), { line: 0, ch: 0 }, "default cursor position is ok");
ed.setText("Hello.\nHow are you?");
ed.setCursor({ line: 1, ch: 5 });
ch(ed.getCursor(), { line: 1, ch: 5 }, "setCursor({ line, ch })");
ch(ed.getPosition(7), { line: 1, ch: 0}, "getPosition(num)");
ch(ed.getPosition(7, 1)[0], { line: 1, ch: 0}, "getPosition(num, num)[0]");
ch(ed.getPosition(7, 1)[1], { line: 0, ch: 1}, "getPosition(num, num)[1]");
ch(ed.getOffset({ line: 1, ch: 0 }), 7, "getOffset(num)");
ch(ed.getOffset({ line: 1, ch: 0 }, { line: 0, ch: 1 })[0], 7, "getOffset(num, num)[0]");
ch(ed.getOffset({ line: 1, ch: 0 }, { line: 0, ch: 1 })[0], 2, "getOffset(num, num)[1]");
is(ed.getSelection(), "", "nothing is selected");
ed.setSelection({ line: 0, ch: 0 }, { line: 0, ch: 5 });
is(ed.getSelection(), "Hello", "setSelection");
ed.extendSelection({ start: 0, length: 5 });
is(ed.getSelection(), ".\nHow", "extendSelection");
ed.dropSelection();
is(ed.getSelection(), "", "dropSelection");
teardown(ed, win);
});
}

View File

@ -0,0 +1,32 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test() {
waitForExplicitFinish();
setup((ed, win) => {
ok(ed.isClean(), "default isClean");
ok(!ed.canUndo(), "default canUndo");
ok(!ed.canRedo(), "default canRedo");
ed.setText("Hello, World!");
ok(!ed.isClean(), "isClean");
ok(ed.canUndo(), "canUndo");
ok(!ed.canRedo(), "canRedo");
ed.undo();
ok(ed.isClean(), "isClean after undo");
ok(!ed.canUndo(), "canUndo after undo");
ok(ed.canRedo(), "canRedo after undo");
ed.setText("What's up?");
ed.setClean();
ok(ed.isClean(), "isClean after setClean");
ok(ed.canUndo(), "canUndo after setClean");
ok(!ed.canRedo(), "canRedo after setClean");
teardown(ed, win);
});
}

View File

@ -0,0 +1,39 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function test() {
waitForExplicitFinish();
setup((ed, win) => {
ok(!ed.hasMarker(0, "breakpoints", "test"), "default is ok");
ed.addMarker(0, "breakpoints", "test");
ed.addMarker(0, "breakpoints", "test2");
ok(ed.hasMarker(0, "breakpoints", "test"), "addMarker/1");
ok(ed.hasMarker(0, "breakpoints", "test2"), "addMarker/2");
ed.removeMarker(0, "breakpoints", "test");
ok(!ed.hasMarker(0, "breakpoints", "test"), "removeMarker/1");
ok(ed.hasMarker(0, "breakpoints", "test2"), "removeMarker/2");
ed.removeAllMarkers("breakpoints");
ok(!ed.hasMarker(0, "breakpoints", "test"), "removeAllMarkers/1");
ok(!ed.hasMarker(0, "breakpoints", "test2"), "removeAllMarkers/2");
ed.addMarker(0, "breakpoints", "breakpoint");
ed.setMarkerListeners(0, "breakpoints", "breakpoint", {
"click": (line, marker, param) => {
is(line, 0, "line is ok");
is(marker.className, "breakpoint", "marker is ok");
ok(param, "click is ok");
teardown(ed, win);
}
}, [ true ]);
const env = win.document.querySelector("iframe").contentWindow;
const div = env.document.querySelector("div.breakpoint");
div.click();
});
}

View File

@ -1,499 +0,0 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
let testWin;
let testDoc;
let editor;
function test()
{
waitForExplicitFinish();
const windowUrl = "data:text/xml,<?xml version='1.0'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='test for bug 660784' width='600' height='500'><hbox flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
testWin = Services.ww.openWindow(null, windowUrl, "_blank", windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
}, false);
}
function initEditor()
{
testDoc = testWin.document;
let hbox = testDoc.querySelector("hbox");
editor = new SourceEditor();
let config = {
showLineNumbers: true,
initialText: "foobarbaz",
tabSize: 7,
expandTab: true,
};
editor.init(hbox, config, editorLoaded);
}
function editorLoaded()
{
ok(editor.editorElement, "editor loaded");
is(editor.parentElement, testDoc.querySelector("hbox"),
"parentElement is correct");
editor.focus();
is(editor.getMode(), SourceEditor.DEFAULTS.mode, "default editor mode");
// Test general editing methods.
ok(!editor.canUndo(), "canUndo() works (nothing to undo), just loaded");
ok(!editor.readOnly, "editor is not read-only");
is(editor.getText(), "foobarbaz", "placeholderText works");
is(editor.getText().length, editor.getCharCount(),
"getCharCount() is correct");
is(editor.getText(3, 5), "ba", "getText() range works");
editor.setText("source-editor");
is(editor.getText(), "source-editor", "setText() works");
editor.setText("code", 0, 6);
is(editor.getText(), "code-editor", "setText() range works");
ok(editor.canUndo(), "canUndo() works (things to undo)");
ok(!editor.canRedo(), "canRedo() works (nothing to redo yet)");
editor.undo();
is(editor.getText(), "source-editor", "undo() works");
ok(editor.canRedo(), "canRedo() works (things to redo)");
editor.redo();
is(editor.getText(), "code-editor", "redo() works");
EventUtils.synthesizeKey("VK_Z", {accelKey: true}, testWin);
is(editor.getText(), "source-editor", "Ctrl-Z (undo) works");
EventUtils.synthesizeKey("VK_Z", {accelKey: true, shiftKey: true}, testWin);
is(editor.getText(), "code-editor", "Ctrl-Shift-Z (redo) works");
editor.undo();
EventUtils.synthesizeKey("VK_Y", {accelKey: true}, testWin);
if (Services.appinfo.OS == "WINNT" ||
Services.appinfo.OS == "Linux") {
is(editor.getText(), "code-editor",
"CTRL+Y does redo on Linux and Windows");
} else {
is(editor.getText(), "source-editor",
"CTRL+Y doesn't redo on machines other than Linux and Windows");
editor.setText("code-editor");
}
// Test selection methods.
editor.setSelection(0, 4);
is(editor.getSelectedText(), "code", "getSelectedText() works");
let selection = editor.getSelection();
ok(selection.start == 0 && selection.end == 4, "getSelection() works");
editor.dropSelection();
selection = editor.getSelection();
ok(selection.start == 4 && selection.end == 4, "dropSelection() works");
editor.setCaretOffset(7);
is(editor.getCaretOffset(), 7, "setCaretOffset() works");
// Test grouped changes.
editor.setText("foobar");
editor.startCompoundChange();
editor.setText("foo1");
editor.setText("foo2");
editor.setText("foo3");
editor.endCompoundChange();
is(editor.getText(), "foo3", "editor content is correct");
editor.undo();
is(editor.getText(), "foobar", "compound change undo() works");
editor.redo();
is(editor.getText(), "foo3", "compound change redo() works");
// Minimal keyboard usage tests.
ok(editor.hasFocus(), "editor has focus");
editor.setText("code-editor");
editor.setCaretOffset(7);
EventUtils.synthesizeKey(".", {}, testWin);
is(editor.getText(), "code-ed.itor", "focus() and typing works");
EventUtils.synthesizeKey("a", {}, testWin);
is(editor.getText(), "code-ed.aitor", "typing works");
is(editor.getCaretOffset(), 9, "caret moved");
EventUtils.synthesizeKey("VK_LEFT", {}, testWin);
is(editor.getCaretOffset(), 8, "caret moved to the left");
EventUtils.synthesizeKey(".", {}, testWin);
EventUtils.synthesizeKey("VK_TAB", {}, testWin);
is(editor.getText(), "code-ed.. aitor", "Tab works");
is(editor.getCaretOffset(), 14, "caret location is correct");
// Test the Tab key.
editor.setText("a\n b\n c");
editor.setCaretOffset(0);
EventUtils.synthesizeKey("VK_TAB", {}, testWin);
is(editor.getText(), " a\n b\n c", "Tab works");
// Code editor specific tests. These are not applicable when the textarea
// fallback is used.
let component = Services.prefs.getCharPref(SourceEditor.PREFS.COMPONENT);
if (component != "textarea") {
editor.setMode(SourceEditor.MODES.JAVASCRIPT);
is(editor.getMode(), SourceEditor.MODES.JAVASCRIPT, "setMode() works");
editor.setSelection(0, editor.getCharCount() - 1);
EventUtils.synthesizeKey("VK_TAB", {}, testWin);
is(editor.getText(), " a\n b\n c", "lines indented");
EventUtils.synthesizeKey("VK_TAB", {shiftKey: true}, testWin);
is(editor.getText(), " a\n b\n c", "lines outdented (shift-tab)");
testEclipseBug362107();
testBug687577();
testBackspaceKey();
testReturnKey();
}
// Test the read-only mode.
editor.setText("foofoo");
editor.readOnly = true;
EventUtils.synthesizeKey("b", {}, testWin);
is(editor.getText(), "foofoo", "editor is now read-only (keyboard)");
editor.setText("foobar");
is(editor.getText(), "foobar", "editor allows programmatic changes (setText)");
EventUtils.synthesizeKey("VK_RETURN", {}, testWin);
is(editor.getText(), "foobar", "Enter key does nothing");
EventUtils.synthesizeKey("VK_TAB", {}, testWin);
is(editor.getText(), "foobar", "Tab does nothing");
editor.setText(" foobar");
EventUtils.synthesizeKey("VK_TAB", {shiftKey: true}, testWin);
is(editor.getText(), " foobar", "Shift+Tab does nothing");
editor.readOnly = false;
editor.setCaretOffset(editor.getCharCount());
EventUtils.synthesizeKey("-", {}, testWin);
is(editor.getText(), " foobar-", "editor is now editable again");
// Test the Selection event.
editor.setText("foobarbaz");
editor.setSelection(1, 4);
let event = null;
let eventHandler = function(aEvent) {
event = aEvent;
};
editor.addEventListener(SourceEditor.EVENTS.SELECTION, eventHandler);
editor.setSelection(0, 3);
ok(event, "selection event fired");
ok(event.oldValue.start == 1 && event.oldValue.end == 4,
"event.oldValue is correct");
ok(event.newValue.start == 0 && event.newValue.end == 3,
"event.newValue is correct");
event = null;
editor.dropSelection();
ok(event, "selection dropped");
ok(event.oldValue.start == 0 && event.oldValue.end == 3,
"event.oldValue is correct");
ok(event.newValue.start == 3 && event.newValue.end == 3,
"event.newValue is correct");
event = null;
EventUtils.synthesizeKey("a", {accelKey: true}, testWin);
ok(event, "select all worked");
ok(event.oldValue.start == 3 && event.oldValue.end == 3,
"event.oldValue is correct");
ok(event.newValue.start == 0 && event.newValue.end == 9,
"event.newValue is correct");
event = null;
editor.removeEventListener(SourceEditor.EVENTS.SELECTION, eventHandler);
editor.dropSelection();
ok(!event, "selection event listener removed");
// Test the TextChanged event.
editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, eventHandler);
EventUtils.synthesizeKey(".", {}, testWin);
ok(event, "the TextChanged event fired after keypress");
is(event.start, 9, "event.start is correct");
is(event.removedCharCount, 0, "event.removedCharCount is correct");
is(event.addedCharCount, 1, "event.addedCharCount is correct");
editor.setText("line1\nline2\nline3");
let chars = editor.getText().length;
event = null;
editor.setText("a\nline4\nline5", chars);
ok(event, "the TextChanged event fired after setText()");
is(event.start, chars, "event.start is correct");
is(event.removedCharCount, 0, "event.removedCharCount is correct");
is(event.addedCharCount, 13, "event.addedCharCount is correct");
event = null;
editor.setText("line3b\nline4b\nfoo", 12, 24);
ok(event, "the TextChanged event fired after setText() again");
is(event.start, 12, "event.start is correct");
is(event.removedCharCount, 12, "event.removedCharCount is correct");
is(event.addedCharCount, 17, "event.addedCharCount is correct");
editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, eventHandler);
testClipboardEvents();
}
function testEnd()
{
editor.destroy();
ok(!editor.parentElement && !editor.editorElement, "destroy() works");
testWin.close();
testWin = testDoc = editor = null;
waitForFocus(finish, window);
}
function testBackspaceKey()
{
editor.setText(" a\n b\n c");
editor.setCaretOffset(7);
EventUtils.synthesizeKey("VK_BACK_SPACE", {}, testWin);
is(editor.getText(), "a\n b\n c", "line outdented (Backspace)");
editor.undo();
editor.setCaretOffset(6);
EventUtils.synthesizeKey("VK_BACK_SPACE", {}, testWin);
is(editor.getText(), " a\n b\n c", "backspace one char works");
}
function testReturnKey()
{
editor.setText(" a\n b\n c");
editor.setCaretOffset(8);
EventUtils.synthesizeKey("VK_RETURN", {}, testWin);
EventUtils.synthesizeKey("x", {}, testWin);
let lineDelimiter = editor.getLineDelimiter();
ok(lineDelimiter, "we have the line delimiter");
let indentationString = editor.getIndentationString();
is(" ", indentationString, "we have an indentation string of 7 spaces");
is(editor.getText(), " a" + lineDelimiter + " x\n b\n c",
"return maintains indentation");
editor.setCaretOffset(12 + lineDelimiter.length);
EventUtils.synthesizeKey("z", {}, testWin);
EventUtils.synthesizeKey("VK_RETURN", {}, testWin);
EventUtils.synthesizeKey("y", {}, testWin);
is(editor.getText(), " a" + lineDelimiter +
" z" + lineDelimiter + " yx\n b\n c",
"return maintains indentation (again)");
}
function testClipboardEvents()
{
editor.setText("foobar");
let doCut = function() {
EventUtils.synthesizeKey("a", {accelKey: true}, testWin);
is(editor.getSelectedText(), "foobar", "select all worked");
EventUtils.synthesizeKey("x", {accelKey: true}, testWin);
};
let onCut = function() {
ok(!editor.getText(), "cut works");
editor.setText("test--");
editor.setCaretOffset(5);
editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste1);
EventUtils.synthesizeKey("v", {accelKey: true}, testWin);
};
let onPaste1 = function() {
editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste1);
is(editor.getText(), "test-foobar-", "paste works");
executeSoon(waitForClipboard.bind(this, "test", doCopy, onCopy, testEnd));
};
let doCopy = function() {
editor.setSelection(0, 4);
EventUtils.synthesizeKey("c", {accelKey: true}, testWin);
};
let onCopy = function() {
editor.setSelection(5, 11);
editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste2);
EventUtils.synthesizeKey("v", {accelKey: true}, testWin);
};
let pasteTextChanges = 0;
let removedCharCount = 0;
let addedCharCount = 0;
let onPaste2 = function(aEvent) {
pasteTextChanges++;
ok(aEvent && (pasteTextChanges == 1 || pasteTextChanges == 2),
"event TEXT_CHANGED fired " + pasteTextChanges + " time(s)");
is(aEvent.start, 5, "event.start is correct");
if (aEvent.removedCharCount) {
removedCharCount = aEvent.removedCharCount;
}
if (aEvent.addedCharCount) {
addedCharCount = aEvent.addedCharCount;
}
if (pasteTextChanges == 2 || addedCharCount && removedCharCount) {
editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste2);
executeSoon(checkPaste2Result);
}
};
let checkPaste2Result = function() {
is(removedCharCount, 6, "event.removedCharCount is correct");
is(addedCharCount, 4, "event.addedCharCount is correct");
is(editor.getText(), "test-test-", "paste works after copy");
testEnd();
};
waitForClipboard("foobar", doCut, onCut, testEnd);
}
function testEclipseBug362107()
{
// Test for Eclipse Bug 362107:
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=362107
let OS = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
if (OS != "Linux") {
return;
}
editor.setText("line 1\nline 2\nline 3");
editor.setCaretOffset(16);
EventUtils.synthesizeKey("VK_UP", {ctrlKey: true}, testWin);
is(editor.getCaretOffset(), 9, "Ctrl-Up works");
EventUtils.synthesizeKey("VK_UP", {ctrlKey: true}, testWin);
is(editor.getCaretOffset(), 2, "Ctrl-Up works twice");
EventUtils.synthesizeKey("VK_DOWN", {ctrlKey: true}, testWin);
is(editor.getCaretOffset(), 9, "Ctrl-Down works");
EventUtils.synthesizeKey("VK_DOWN", {ctrlKey: true}, testWin);
is(editor.getCaretOffset(), 16, "Ctrl-Down works twice");
}
function testBug687577()
{
// Test for Mozilla Bug 687577:
// https://bugzilla.mozilla.org/show_bug.cgi?id=687577
let OS = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
if (OS != "Linux") {
return;
}
editor.setText("line foobar 1\nline foobar 2\nline foobar 3");
editor.setCaretOffset(39);
EventUtils.synthesizeKey("VK_LEFT", {ctrlKey: true, shiftKey: true}, testWin);
let selection = editor.getSelection();
is(selection.start, 33, "select.start after Ctrl-Shift-Left");
is(selection.end, 39, "select.end after Ctrl-Shift-Left");
EventUtils.synthesizeKey("VK_UP", {ctrlKey: true, shiftKey: true}, testWin);
selection = editor.getSelection();
is(selection.start, 14, "select.start after Ctrl-Shift-Up");
is(selection.end, 39, "select.end after Ctrl-Shift-Up");
EventUtils.synthesizeKey("VK_UP", {ctrlKey: true, shiftKey: true}, testWin);
selection = editor.getSelection();
is(selection.start, 0, "select.start after Ctrl-Shift-Up (again)");
is(selection.end, 39, "select.end after Ctrl-Shift-Up (again)");
EventUtils.synthesizeKey("VK_DOWN", {ctrlKey: true, shiftKey: true}, testWin);
selection = editor.getSelection();
is(selection.start, 27, "select.start after Ctrl-Shift-Down");
is(selection.end, 39, "select.end after Ctrl-Shift-Down");
EventUtils.synthesizeKey("VK_DOWN", {ctrlKey: true, shiftKey: true}, testWin);
selection = editor.getSelection();
is(selection.start, 39, "select.start after Ctrl-Shift-Down (again)");
is(selection.end, 41, "select.end after Ctrl-Shift-Down (again)");
}

View File

@ -4,179 +4,43 @@
"use strict";
function getLoadContext() {
return window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsILoadContext);
}
const require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
const Editor = require("devtools/sourceeditor/editor");
/*
* Polls the X11 primary selection buffer waiting for the expected value. A known
* value different than the expected value is put on the clipboard first (and
* also polled for) so we can be sure the value we get isn't just the expected
* value because it was already in the buffer.
*
* @param aExpectedStringOrValidatorFn
* The string value that is expected to be in the X11 primary selection buffer
* or a validator function getting clipboard data and returning a bool.
* @param aSetupFn
* A function responsible for setting the primary selection buffer to the
* expected value, called after the known value setting succeeds.
* @param aSuccessFn
* A function called when the expected value is found in the primary
* selection buffer.
* @param aFailureFn
* A function called if the expected value isn't found in the primary
* selection buffer within 5s. It can also be called if the known value
* can't be found.
* @param aFlavor [optional] The flavor to look for. Defaults to "text/unicode".
*/
function waitForSelection(aExpectedStringOrValidatorFn, aSetupFn,
aSuccessFn, aFailureFn, aFlavor) {
let requestedFlavor = aFlavor || "text/unicode";
// Build a default validator function for common string input.
var inputValidatorFn = typeof(aExpectedStringOrValidatorFn) == "string"
? function(aData) aData == aExpectedStringOrValidatorFn
: aExpectedStringOrValidatorFn;
let clipboard = Cc["@mozilla.org/widget/clipboard;1"].
getService(Ci.nsIClipboard);
// reset for the next use
function reset() {
waitForSelection._polls = 0;
}
function wait(validatorFn, successFn, failureFn, flavor) {
if (++waitForSelection._polls > 50) {
// Log the failure.
ok(false, "Timed out while polling the X11 primary selection buffer.");
reset();
failureFn();
return;
}
let transferable = Cc["@mozilla.org/widget/transferable;1"].
createInstance(Ci.nsITransferable);
transferable.init(getLoadContext());
transferable.addDataFlavor(requestedFlavor);
clipboard.getData(transferable, clipboard.kSelectionClipboard);
let str = {};
let strLength = {};
transferable.getTransferData(requestedFlavor, str, strLength);
let data = null;
if (str.value) {
let strValue = str.value.QueryInterface(Ci.nsISupportsString);
data = strValue.data.substring(0, strLength.value / 2);
}
if (validatorFn(data)) {
// Don't show the success message when waiting for preExpectedVal
if (preExpectedVal) {
preExpectedVal = null;
} else {
ok(true, "The X11 primary selection buffer has the correct value");
}
reset();
successFn();
} else {
setTimeout(function() wait(validatorFn, successFn, failureFn, flavor), 100);
}
}
// First we wait for a known value different from the expected one.
var preExpectedVal = waitForSelection._monotonicCounter +
"-waitForSelection-known-value";
let clipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].
getService(Ci.nsIClipboardHelper);
clipboardHelper.copyStringToClipboard(preExpectedVal,
Ci.nsIClipboard.kSelectionClipboard,
document);
wait(function(aData) aData == preExpectedVal,
function() {
// Call the original setup fn
aSetupFn();
wait(inputValidatorFn, aSuccessFn, aFailureFn, requestedFlavor);
}, aFailureFn, "text/unicode");
}
waitForSelection._polls = 0;
waitForSelection.__monotonicCounter = 0;
waitForSelection.__defineGetter__("_monotonicCounter", function () {
return waitForSelection.__monotonicCounter++;
});
/**
* Open a new window with a source editor inside.
*
* @param function aCallback
* The function you want invoked once the editor is loaded. The function
* is given two arguments: editor instance and the window object.
* @param object [aOptions]
* The options object to pass to the SourceEditor.init() method.
*/
function openSourceEditorWindow(aCallback, aOptions) {
const windowUrl = "data:text/xml;charset=UTF-8,<?xml version='1.0'?>" +
function setup(cb) {
const opt = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
const url = "data:text/xml;charset=UTF-8,<?xml version='1.0'?>" +
"<?xml-stylesheet href='chrome://global/skin/global.css'?>" +
"<window xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" title='Test for Source Editor' width='600' height='500'><box flex='1'/></window>";
const windowFeatures = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no";
" title='Editor' width='600' height='500'><box flex='1'/></window>";
let editor = null;
let testWin = Services.ww.openWindow(null, windowUrl, "_blank",
windowFeatures, null);
testWin.addEventListener("load", function onWindowLoad() {
testWin.removeEventListener("load", onWindowLoad, false);
waitForFocus(initEditor, testWin);
let win = Services.ww.openWindow(null, url, "_blank", opt, null);
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad, false);
waitForFocus(function () {
let box = win.document.querySelector("box");
let editor = new Editor({
value: "Hello.",
lineNumbers: true,
gutters: [ "breakpoints" ]
});
editor.appendTo(box)
.then(() => cb(editor, win))
.then(null, (err) => ok(false, err.message));
}, win);
}, false);
function initEditor()
{
let tempScope = {};
Cu.import("resource:///modules/devtools/sourceeditor/source-editor.jsm", tempScope);
let box = testWin.document.querySelector("box");
editor = new tempScope.SourceEditor();
editor.init(box, aOptions || {}, editorLoaded);
}
function editorLoaded()
{
editor.focus();
waitForFocus(aCallback.bind(null, editor, testWin), testWin);
}
}
/**
* Get text needed to fill the editor view.
*
* @param object aEditor
* The SourceEditor instance you work with.
* @param number aPages
* The number of pages you want filled with lines.
* @return string
* The string you can insert into the editor so you fill the desired
* number of pages.
*/
function fillEditor(aEditor, aPages) {
let view = aEditor._view;
let model = aEditor._model;
let lineHeight = view.getLineHeight();
let editorHeight = view.getClientArea().height;
let linesPerPage = Math.floor(editorHeight / lineHeight);
let totalLines = aPages * linesPerPage;
let text = "";
for (let i = 0; i < totalLines; i++) {
text += "l" + i + " lorem ipsum dolor sit amet. lipsum foobaris bazbaz,\n";
}
return text;
function ch(exp, act, label) {
is(exp.line, act.line, label + " (line)");
is(exp.ch, act.ch, label + " (ch)");
}
function teardown(ed, win) {
ed.destroy();
win.close();
finish();
}

View File

@ -210,7 +210,8 @@ StyleSheetEditor.prototype = {
mode: Editor.modes.css,
readOnly: this._state.readOnly,
autoCloseBrackets: "{}()[]",
extraKeys: this._getKeyBindings()
extraKeys: this._getKeyBindings(),
contextMenu: "sourceEditorContextMenu"
};
let sourceEditor = new Editor(config);
@ -380,8 +381,8 @@ StyleSheetEditor.prototype = {
},
/**
* Retrieve custom key bindings objects as expected by SourceEditor.
* SourceEditor action names are not displayed to the user.
* Retrieve custom key bindings objects as expected by Editor.
* Editor action names are not displayed to the user.
*
* @return {array} key binding objects for the source editor
*/

View File

@ -5,7 +5,12 @@
<!DOCTYPE window [
<!ENTITY % styleEditorDTD SYSTEM "chrome://browser/locale/devtools/styleeditor.dtd" >
%styleEditorDTD;
<!ENTITY % editMenuStrings SYSTEM "chrome://global/locale/editMenuOverlay.dtd">
%editMenuStrings;
<!ENTITY % sourceEditorStrings SYSTEM "chrome://browser/locale/devtools/sourceeditor.dtd">
%sourceEditorStrings;
]>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/devtools/splitview.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/devtools/common.css" type="text/css"?>
@ -13,7 +18,7 @@
<?xml-stylesheet href="chrome://browser/content/devtools/styleeditor.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/devtools/styleeditor.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
<?xul-overlay href="chrome://browser/content/devtools/source-editor-overlay.xul"?>
<xul:window xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns="http://www.w3.org/1999/xhtml"
id="style-editor-chrome-window">
@ -21,28 +26,46 @@
<script type="application/javascript;version=1.8"
src="chrome://browser/content/devtools/theme-switching.js"/>
<xul:script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
<xul:script type="application/javascript">
function goUpdateSourceEditorMenuItems() {
goUpdateGlobalEditMenuItems();
['cmd_undo', 'cmd_redo', 'cmd_cut', 'cmd_paste',
'cmd_delete', 'cmd_find', 'cmd_findAgain'].forEach(goUpdateCommand);
}
</xul:script>
<xul:popupset id="style-editor-popups">
<xul:menupopup id="sourceEditorContextMenu"
onpopupshowing="goUpdateSourceEditorMenuItems()">
<xul:menuitem id="se-cMenu-undo"/>
<xul:menuitem id="cMenu_undo"/>
<xul:menuseparator/>
<xul:menuitem id="se-cMenu-cut"/>
<xul:menuitem id="se-cMenu-copy"/>
<xul:menuitem id="se-cMenu-paste"/>
<xul:menuitem id="se-cMenu-delete"/>
<xul:menuitem id="cMenu_cut"/>
<xul:menuitem id="cMenu_copy"/>
<xul:menuitem id="cMenu_paste"/>
<xul:menuitem id="cMenu_delete"/>
<xul:menuseparator/>
<xul:menuitem id="se-cMenu-selectAll"/>
<xul:menuitem id="cMenu_selectAll"/>
<xul:menuseparator/>
<xul:menuitem id="se-cMenu-find"/>
<xul:menuitem id="se-cMenu-findAgain"/>
<xul:menuitem id="se-menu-find"
label="&findCmd.label;" accesskey="&findCmd.accesskey;" command="cmd_find"/>
<xul:menuitem id="cMenu_findAgain"/>
<xul:menuseparator/>
<xul:menuitem id="se-cMenu-gotoLine"/>
<xul:menuitem id="se-menu-gotoLine"
label="&gotoLineCmd.label;"
accesskey="&gotoLineCmd.accesskey;"
key="key_gotoLine"
command="cmd_gotoLine"/>
</xul:menupopup>
</xul:popupset>
<xul:commandset id="editMenuCommands"/>
<xul:commandset id="sourceEditorCommands"/>
<xul:commandset id="sourceEditorCommands">
<xul:command id="cmd_gotoLine" oncommand="goDoCommand('cmd_gotoLine')"/>
<xul:command id="cmd_find" oncommand="goDoCommand('cmd_find')"/>
<xul:command id="cmd_findAgain" oncommand="goDoCommand('cmd_findAgain')"/>
</xul:commandset>
<xul:keyset id="sourceEditorKeys"/>

View File

@ -44,7 +44,7 @@ function runTests(aUI)
executeSoon(function () {
is(aEditor.sourceEditor, originalSourceEditor,
"the editor still references the same SourceEditor instance");
"the editor still references the same Editor instance");
let editor = aEditor.sourceEditor;
is(editor.getOffset(editor.getCursor()), 4,
"the caret position has been preserved");

View File

@ -3,6 +3,21 @@
# 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/.
# Defining FunnelcakeVersion will append the value of FunnelcakeVersion to the
# stub data URL version using StubURLVersionAppend and an additional parameter
# to both URLStubDownload and URLManualDownload using URLParamAppend. The value
# should not be defined when it is not used and when it is defined its value
# should never be empty.
# !define FunnelcakeVersion "999"
!ifdef FunnelcakeVersion
!define URLParamAppend "&f=${FunnelcakeVersion}"
!define StubURLVersionAppend "-${FunnelcakeVersion}"
!else
!define URLParamAppend ""
!define StubURLVersionAppend ""
!endif
# These defines should match application.ini settings
!define AppName "Firefox"
!define AppVersion "@APP_VERSION@"

View File

@ -593,7 +593,7 @@ Function SendPing
!ifdef STUB_DEBUG
MessageBox MB_OK "${BaseURLStubPing} \
$\nStub URL Version = ${StubURLVersion} \
$\nStub URL Version = ${StubURLVersion}${StubURLVersionAppend} \
$\nBuild Channel = ${Channel} \
$\nUpdate Channel = ${UpdateChannel} \
$\nLocale = ${AB_CD} \
@ -632,7 +632,7 @@ Function SendPing
Call RelativeGotoPage
!else
${NSD_CreateTimer} OnPing ${DownloadIntervalMS}
InetBgDL::Get "${BaseURLStubPing}/${StubURLVersion}/${Channel}/${UpdateChannel}/${AB_CD}/$R0/$R1/$R2/$R3/$R4/$ExitCode/$FirefoxLaunchCode/$DownloadRetryCount/$DownloadedBytes/$IntroPhaseSeconds/$OptionsPhaseSeconds/$0/$1/$DownloadFirstTransferSeconds/$2/$3/$4/$IntroPageShownCount/$OptionsPageShownCount/$InitialInstallRequirementsCode/$OpenedDownloadPage/$ExistingProfile/$ExistingVersion/$ExistingBuildID/$R5/$R6/$R7/$R8/$DownloadServerIP" \
InetBgDL::Get "${BaseURLStubPing}/${StubURLVersion}${StubURLVersionAppend}/${Channel}/${UpdateChannel}/${AB_CD}/$R0/$R1/$R2/$R3/$R4/$ExitCode/$FirefoxLaunchCode/$DownloadRetryCount/$DownloadedBytes/$IntroPhaseSeconds/$OptionsPhaseSeconds/$0/$1/$DownloadFirstTransferSeconds/$2/$3/$4/$IntroPageShownCount/$OptionsPageShownCount/$InitialInstallRequirementsCode/$OpenedDownloadPage/$ExistingProfile/$ExistingVersion/$ExistingBuildID/$R5/$R6/$R7/$R8/$DownloadServerIP" \
"$PLUGINSDIR\_temp" /END
!endif
${Else}
@ -1219,7 +1219,7 @@ FunctionEnd
Function StartDownload
${NSD_KillTimer} StartDownload
InetBgDL::Get "${URLStubDownload}" "$PLUGINSDIR\download.exe" \
InetBgDL::Get "${URLStubDownload}${URLParamAppend}" "$PLUGINSDIR\download.exe" \
/CONNECTTIMEOUT 120 /RECEIVETIMEOUT 120 /END
StrCpy $4 ""
${NSD_CreateTimer} OnDownload ${DownloadIntervalMS}
@ -1870,7 +1870,7 @@ Function DisplayDownloadError
FunctionEnd
Function OpenManualDownloadURL
ExecShell "open" "${URLManualDownload}"
ExecShell "open" "${URLManualDownload}${URLParamAppend}"
FunctionEnd
Section

View File

@ -120,3 +120,10 @@
- the same name in browser.dtd.
-->
<!ENTITY errorConsoleCmd.commandkey "j">
<!-- LOCALIZATION NOTE (evalFunction.label): This command allows the developer
- to evaluate the top-level function that the cursor is currently at.
-->
<!ENTITY evalFunction.label "Evaluate Current Function">
<!ENTITY evalFunction.accesskey "v">
<!ENTITY evalFunction.key "e">

View File

@ -1,124 +0,0 @@
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
/* 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/. */
/**
* Responsible for zooming in to a given view rectangle
*/
const AnimatedZoom = {
startScale: null,
/** Starts an animated zoom to zoomRect. */
animateTo: function(aZoomRect) {
if (!aZoomRect)
return;
this.zoomTo = aZoomRect.clone();
if (this.animationDuration === undefined)
this.animationDuration = Services.prefs.getIntPref("browser.ui.zoom.animationDuration");
Browser.forceChromeReflow();
this.start();
// Check if zooming animations were occuring before.
if (!this.zoomRect) {
this.updateTo(this.zoomFrom);
mozRequestAnimationFrame(this);
let event = document.createEvent("Events");
event.initEvent("AnimatedZoomBegin", true, true);
window.dispatchEvent(event);
}
},
start: function start() {
this.tab = Browser.selectedTab;
this.browser = this.tab.browser;
this.bcr = this.browser.getBoundingClientRect();
this.zoomFrom = this.zoomRect || this.getStartRect();
this.startScale = this.browser.scale;
this.beginTime = mozAnimationStartTime;
},
/** Get the visible rect, in device pixels relative to the content origin. */
getStartRect: function getStartRect() {
let browser = this.browser;
let scroll = browser.getRootView().getPosition();
return new Rect(scroll.x, scroll.y, this.bcr.width, this.bcr.height);
},
/** Update the visible rect, in device pixels relative to the content origin. */
updateTo: function(nextRect) {
// Stop animating if the browser has been destroyed
if (typeof this.browser.fuzzyZoom !== "function") {
this.reset();
return false;
}
let zoomRatio = this.bcr.width / nextRect.width;
let scale = this.startScale * zoomRatio;
let scrollX = nextRect.left * zoomRatio;
let scrollY = nextRect.top * zoomRatio;
this.browser.fuzzyZoom(scale, scrollX, scrollY);
this.zoomRect = nextRect;
return true;
},
/** Stop animation, zoom to point, and clean up. */
finish: function() {
if (!this.updateTo(this.zoomTo || this.zoomRect))
return;
// Check whether the zoom limits have changed since the animation started.
let browser = this.browser;
let finalScale = this.tab.clampZoomLevel(browser.scale);
if (browser.scale != finalScale)
browser.scale = finalScale; // scale= calls finishFuzzyZoom.
else
browser.finishFuzzyZoom();
this.reset();
browser._updateCSSViewport();
},
reset: function reset() {
this.beginTime = null;
this.zoomTo = null;
this.zoomFrom = null;
this.zoomRect = null;
this.startScale = null;
let event = document.createEvent("Events");
event.initEvent("AnimatedZoomEnd", true, true);
window.dispatchEvent(event);
},
isZooming: function isZooming() {
return this.beginTime != null;
},
sample: function(aTimeStamp) {
try {
let tdiff = aTimeStamp - this.beginTime;
let counter = tdiff / this.animationDuration;
if (counter < 1) {
// update browser to interpolated rectangle
let rect = this.zoomFrom.blend(this.zoomTo, counter);
if (this.updateTo(rect))
mozRequestAnimationFrame(this);
} else {
// last cycle already rendered final scaled image, now clean up
this.finish();
}
} catch(e) {
this.finish();
throw e;
}
}
};

View File

@ -99,7 +99,7 @@ var ContentAreaObserver = {
Services.obs.addObserver(this, "metro_softkeyboard_hidden", false);
// setup initial values for browser form repositioning
this._shiftBrowserDeck(0);
this.shiftBrowserDeck(0);
// initialize our custom width and height styles
this._initStyles();
@ -226,7 +226,7 @@ var ContentAreaObserver = {
this.updateViewableArea();
if (!aNewState) {
this._shiftBrowserDeck(0);
this.shiftBrowserDeck(0);
return;
}
@ -241,10 +241,10 @@ var ContentAreaObserver = {
_onRepositionResponse: function _onRepositionResponse(aJsonMsg) {
if (!aJsonMsg.reposition || !this.isKeyboardOpened) {
this._shiftBrowserDeck(0);
this.shiftBrowserDeck(0);
return;
}
this._shiftBrowserDeck(aJsonMsg.raiseContent);
this.shiftBrowserDeck(aJsonMsg.raiseContent);
},
observe: function cao_observe(aSubject, aTopic, aData) {
@ -300,7 +300,7 @@ var ContentAreaObserver = {
}
},
_shiftBrowserDeck: function _shiftBrowserDeck(aAmount) {
shiftBrowserDeck: function (aAmount) {
if (aAmount == 0) {
this._deckTransitioning = false;
this._dispatchWindowEvent("KeyboardChanged", this.isKeyboardOpened);

View File

@ -292,6 +292,19 @@
</body>
</method>
<property name="scale">
<getter><![CDATA[
let cwu = this.contentDocument
.defaultView
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
let resx = {}, resy = {};
cwu.getResolution(resx, resy);
// Resolution set by the apzc and is symmetric.
return resx.value;
]]></getter>
</property>
<field name="_messageListenerLocal"><![CDATA[
({
self: this,
@ -609,11 +622,6 @@
take it into account. This is useless for non-remote browser -->
<field name="_contentDocumentLeft">0</field>
<!-- The ratio of device pixels to CSS pixels -->
<property name="scale"
onget="return 1;"
onset="return 1;"/>
<!-- These counters are used to update the cached viewport after they reach a certain
threshold when scrolling -->
<field name="_cacheRatioWidth">1</field>
@ -760,24 +768,6 @@
this.docShellIsActive = this._active;
]]></setter>
</property>
<!-- Transform the viewport without updating the displayport. -->
<method name="fuzzyZoom">
<parameter name="scale"/>
<parameter name="x"/>
<parameter name="y"/>
<body><![CDATA[
this.getRootView().scrollTo(x, y);
]]></body>
</method>
<!-- After fuzzy zoom, sync the displayport with the new viewport. -->
<method name="finishFuzzyZoom">
<body><![CDATA[
return;
]]></body>
</method>
</implementation>
</binding>
@ -1150,34 +1140,6 @@
]]>
</field>
<!-- Transform the viewport without updating the displayport. -->
<method name="fuzzyZoom">
<parameter name="scale"/>
<parameter name="x"/>
<parameter name="y"/>
<body><![CDATA[
let rootView = this.getRootView();
rootView._setScale(scale);
if ("_contentView" in rootView)
rootView._contentView.scrollTo(x, y);
]]></body>
</method>
<!-- After fuzzy zoom, sync the displayport with the new viewport. -->
<method name="finishFuzzyZoom">
<body><![CDATA[
let view = this.getRootView();
// ensure that we are scrolled within the page's viewable area
view.scrollBy(0,0);
view._updateCacheViewport();
let event = document.createEvent("Events");
event.initEvent("ZoomChanged", true, false);
this.dispatchEvent(event);
]]></body>
</method>
<!-- The ratio of CSS pixels to device pixels. -->
<property name="scale">
<getter><![CDATA[
@ -1189,7 +1151,6 @@
let rootView = this.getRootView();
rootView._setScale(val);
this.finishFuzzyZoom();
return val;
]]></setter>

View File

@ -102,7 +102,6 @@ let ScriptContexts = {};
["SelectionHelperUI", "chrome://browser/content/helperui/SelectionHelperUI.js"],
["SelectionPrototype", "chrome://browser/content/library/SelectionPrototype.js"],
["ChromeSelectionHandler", "chrome://browser/content/helperui/ChromeSelectionHandler.js"],
["AnimatedZoom", "chrome://browser/content/AnimatedZoom.js"],
["CommandUpdater", "chrome://browser/content/commandUtil.js"],
["ContextCommands", "chrome://browser/content/ContextCommands.js"],
["Bookmarks", "chrome://browser/content/bookmarks.js"],
@ -152,9 +151,3 @@ XPCOMUtils.defineLazyGetter(this, "ContentAreaUtils", function() {
Services.scriptloader.loadSubScript("chrome://global/content/contentAreaUtils.js", ContentAreaUtils);
return ContentAreaUtils;
});
XPCOMUtils.defineLazyGetter(this, "ZoomManager", function() {
let sandbox = {};
Services.scriptloader.loadSubScript("chrome://global/content/viewZoomOverlay.js", sandbox);
return sandbox.ZoomManager;
});

View File

@ -781,33 +781,6 @@ var Browser = {
Bookmarks.isURIBookmarked(uri, callback);
},
/** Rect should be in browser coordinates. */
_getZoomLevelForRect: function _getZoomLevelForRect(rect) {
const margin = 15;
return this.selectedTab.clampZoomLevel(ContentAreaObserver.width / (rect.width + margin * 2));
},
/**
* Find a good zoom rectangle for point that is specified in browser coordinates.
* @return Rect in viewport coordinates
*/
_getZoomRectForPoint: function _getZoomRectForPoint(x, y, zoomLevel) {
let browser = getBrowser();
x = x * browser.scale;
y = y * browser.scale;
zoomLevel = Math.min(ZoomManager.MAX, zoomLevel);
let oldScale = browser.scale;
let zoomRatio = zoomLevel / oldScale;
let browserRect = browser.getBoundingClientRect();
let newVisW = browserRect.width / zoomRatio, newVisH = browserRect.height / zoomRatio;
let result = new Rect(x - newVisW / 2, y - newVisH / 2, newVisW, newVisH);
// Make sure rectangle doesn't poke out of viewport
return result.translateInside(new Rect(0, 0, browser.contentDocumentWidth * oldScale,
browser.contentDocumentHeight * oldScale));
},
/**
* Convenience function for getting the scrollbox position off of a
* scrollBoxObject interface. Returns the actual values instead of the
@ -1496,14 +1469,6 @@ Tab.prototype = {
}
},
/**
* Takes a scale and restricts it based on this tab's zoom limits.
* @param aScale The original scale.
*/
clampZoomLevel: function clampZoomLevel(aScale) {
return Util.clamp(aScale, ZoomManager.MIN, ZoomManager.MAX);
},
updateThumbnail: function updateThumbnail() {
PageThumbs.captureToCanvas(this.browser.contentWindow, this._chromeTab.thumbnailCanvas);
},

View File

@ -36,7 +36,7 @@ var FindHandler = {
}
if (findResult == Ci.nsITypeAheadFind.FIND_NOTFOUND) {
sendAsyncMessage("FindAssist:Show", { rect: null , result: findResult });
sendAsyncMessage("FindAssist:Show", { rect: null, result: findResult });
return;
}
@ -57,30 +57,28 @@ var FindHandler = {
}
}
let scroll = ContentScroll.getScrollOffset(content);
// Return the bounding selection rect in content coordinates
// including the scroll offset.
let offset = ContentScroll.getScrollOffset(content);
for (let frame = this._fastFind.currentWindow; frame != content; frame = frame.parent) {
let rect = frame.frameElement.getBoundingClientRect();
let left = frame.getComputedStyle(frame.frameElement, "").borderLeftWidth;
let top = frame.getComputedStyle(frame.frameElement, "").borderTopWidth;
scroll.add(rect.left + parseInt(left), rect.top + parseInt(top));
offset.add(rect.left + parseInt(left), rect.top + parseInt(top));
}
let rangeRect = selection.getRangeAt(0).getBoundingClientRect();
let rect = new Rect(scroll.x + rangeRect.left, scroll.y + rangeRect.top, rangeRect.width, rangeRect.height);
let aNewViewHeight = content.innerHeight - Services.metro.keyboardHeight;
let position = Util.centerElementInView(aNewViewHeight, rangeRect);
if (position !== undefined) {
sendAsyncMessage("Content:RepositionInfoResponse", {
reposition: true,
raiseContent: position,
});
}
let rect = new Rect(offset.x + rangeRect.left, offset.y + rangeRect.top,
rangeRect.width, rangeRect.height);
// Ensure the potential "scroll" event fired during a search as already fired
let timer = new Util.Timeout(function() {
sendAsyncMessage("FindAssist:Show", { rect: rect.isEmpty() ? null: rect , result: findResult });
sendAsyncMessage("FindAssist:Show", {
rect: rect.isEmpty() ? null: rect,
contentHeight: content.document.documentElement.scrollHeight,
result: findResult
});
});
timer.once(0);
}

View File

@ -66,8 +66,10 @@ var FindHelperUI = {
case "FindAssist:Show":
ContextUI.dismiss();
this.status = json.result;
if (json.rect)
this._zoom(Rect.fromRect(json.rect));
// null rect implies nothing found
if (json.rect) {
this._zoom(Rect.fromRect(json.rect), json.contentHeight);
}
break;
case "FindAssist:Hide":
@ -118,9 +120,7 @@ var FindHelperUI = {
let findbar = this._container;
setTimeout(() => {
Elements.browsers.setAttribute("findbar", true);
findbar.show();
this.search(this._textbox.value);
this._textbox.select();
this._textbox.focus();
@ -136,6 +136,8 @@ var FindHelperUI = {
if (!this._open)
return;
ContentAreaObserver.shiftBrowserDeck(0);
let onTransitionEnd = () => {
this._container.removeEventListener("transitionend", onTransitionEnd, true);
this._textbox.value = "";
@ -149,7 +151,6 @@ var FindHelperUI = {
this._textbox.blur();
this._container.addEventListener("transitionend", onTransitionEnd, true);
this._container.dismiss();
Elements.browsers.removeAttribute("findbar");
},
goToPrevious: function findHelperGoToPrevious() {
@ -172,27 +173,33 @@ var FindHelperUI = {
this._cmdNext.setAttribute("disabled", disabled);
},
_zoom: function _findHelperZoom(aElementRect) {
let autozoomEnabled = Services.prefs.getBoolPref("findhelper.autozoom");
if (!aElementRect || !autozoomEnabled)
return;
_zoom: function _findHelperZoom(aElementRect, aContentHeight) {
// The rect we get here is the content rect including scroll offset
// in the page.
if (Browser.selectedTab.allowZoom) {
let zoomLevel = Browser._getZoomLevelForRect(aElementRect);
// Clamp the zoom level relatively to the default zoom level of the page
let defaultZoomLevel = Browser.selectedTab.getDefaultZoomLevel();
zoomLevel = Util.clamp(zoomLevel, (defaultZoomLevel * kBrowserFindZoomLevelMin),
(defaultZoomLevel * kBrowserFindZoomLevelMax));
zoomLevel = Browser.selectedTab.clampZoomLevel(zoomLevel);
let zoomRect = Browser._getZoomRectForPoint(aElementRect.center().x, aElementRect.y, zoomLevel);
AnimatedZoom.animateTo(zoomRect);
} else {
// Even if zooming is disabled we could need to reposition the view in
// order to keep the element on-screen
let zoomRect = Browser._getZoomRectForPoint(aElementRect.center().x, aElementRect.y, getBrowser().scale);
AnimatedZoom.animateTo(zoomRect);
// If the text falls below the find bar and keyboard shift content up.
let browserShift = 0;
// aElementRect.y is the top left origin of the selection rect.
if ((aElementRect.y + aElementRect.height) >
(aContentHeight - this._container.boxObject.height)) {
browserShift += this._container.boxObject.height;
}
browserShift += Services.metro.keyboardHeight;
ContentAreaObserver.shiftBrowserDeck(browserShift);
// Adjust for keyboad display and position the text selection rect in
// the middle of the viewable area.
let xPos = aElementRect.x;
let yPos = aElementRect.y;
let scrollAdjust = ((ContentAreaObserver.height - Services.metro.keyboardHeight) * .5) +
Services.metro.keyboardHeight;
yPos -= scrollAdjust;
if (yPos < 0) {
yPos = 0;
}
// TODO zoom via apzc, right now all we support is scroll
// positioning.
Browser.selectedBrowser.contentWindow.scrollTo(xPos, yPos);
}
};

View File

@ -587,7 +587,6 @@ var SelectionHelperUI = {
Elements.browsers.addEventListener("URLChanged", this, true);
Elements.browsers.addEventListener("SizeChanged", this, true);
Elements.browsers.addEventListener("ZoomChanged", this, true);
Elements.navbar.addEventListener("transitionend", this, true);
Elements.navbar.addEventListener("MozAppbarDismissing", this, true);
@ -615,7 +614,6 @@ var SelectionHelperUI = {
Elements.browsers.removeEventListener("URLChanged", this, true);
Elements.browsers.removeEventListener("SizeChanged", this, true);
Elements.browsers.removeEventListener("ZoomChanged", this, true);
Elements.navbar.removeEventListener("transitionend", this, true);
Elements.navbar.removeEventListener("MozAppbarDismissing", this, true);
@ -1080,7 +1078,6 @@ var SelectionHelperUI = {
this._shutdown();
break;
case "ZoomChanged":
case "MozPrecisePointer":
this.closeEditSession(true);
break;

View File

@ -80,7 +80,6 @@ chrome.jar:
content/Site.js (content/Site.js)
content/TopSites.js (content/TopSites.js)
content/console.js (content/console.js)
content/AnimatedZoom.js (content/AnimatedZoom.js)
content/dbg-metro-actors.js (content/dbg-metro-actors.js)
#ifdef MOZ_SERVICES_SYNC
content/flyoutpanels/SyncFlyoutPanel.js (content/flyoutpanels/SyncFlyoutPanel.js)

View File

@ -27,10 +27,10 @@ gTests.push({
window.addEventListener("MozAfterPaint", onPaint, true);
stopwatch.start();
let promise = waitForEvent(window, "MozDeckOffsetChanged");
ContentAreaObserver._shiftBrowserDeck(300);
ContentAreaObserver.shiftBrowserDeck(300);
yield promise;
promise = waitForEvent(window, "MozDeckOffsetChanged");
ContentAreaObserver._shiftBrowserDeck(0);
ContentAreaObserver.shiftBrowserDeck(0);
yield promise;
stopwatch.stop();
yield waitForMs(500);

View File

@ -193,9 +193,6 @@ pref("browser.helperApps.deleteTempFileOnExit", false);
/* password manager */
pref("signon.rememberSignons", true);
/* find helper */
pref("findhelper.autozoom", true);
// this will automatically enable inline spellchecking (if it is available) for
// editable elements in HTML
// 0 = spellcheck nothing

View File

@ -252,11 +252,6 @@ documenttab[selected] .documenttab-selection {
transition-delay: 0s;
transition-property: padding-bottom;
}
#browsers[findbar] browser {
/* delay setting padding-bottom until the findbar has transitioned in */
transition-delay: @metro_animation_duration@;
padding-bottom: @findbar_height@;
}
/* Selection overlay and monocles */
#page,
.selection-overlay {

View File

Before

Width:  |  Height:  |  Size: 577 B

After

Width:  |  Height:  |  Size: 577 B

View File

Before

Width:  |  Height:  |  Size: 308 B

After

Width:  |  Height:  |  Size: 308 B

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -1,39 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
.viewTooltip {
display: none; /* TODO: add tooltips support, see bug 721752 */
font-family: monospace;
font-size: 13px;
background-color: InfoBackground;
color: InfoText;
padding: 2px;
border-radius: 4px;
border: 1px solid black;
z-index: 100;
position: fixed;
overflow: hidden;
white-space: pre;
}
.viewTooltip em {
font-style: normal;
font-weight: bold;
}
.annotationHTML {
cursor: pointer;
width: 16px;
height: 16px;
display: inline-block;
vertical-align: middle;
background-position: center;
background-repeat: no-repeat;
}
.annotationHTML.task {
background-image: url("chrome://browser/skin/devtools/orion-task.png");
}
.annotationHTML.breakpoint {
background-image: url("chrome://browser/skin/devtools/orion-breakpoint.png");
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 413 B

View File

@ -1,199 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
.viewContainer {
background: hsl(0,0%,89%); /* This will be seen as the continuation of the ruler */
font-family: monospace;
font-size: inherit; /* inherit browser's default monospace font size */
}
.view {
color: black; /* Default text color */
background: white; /* Background of the editor */
padding-left: 4px;
}
.readonly > .view {
background: #fdfefd; /* super light green */
}
.ruler {
background: hsl(0,0%,89%);
color: hsl(0,0%,55%);
}
.ruler.annotations {
width: 16px;
padding-left: 4px;
}
.ruler.lines {
border-right: 1px solid #b4c4d3;
min-width: 1.4em;
padding-left: 4px;
padding-right: 4px;
text-align: end;
}
.ruler.linesWithAnnotations {
min-width: 0;
padding-left: 0;
}
.ruler.overview {
border-left: 1px solid #b4c4d3;
width: 14px;
text-align: start;
}
/* Styles for the annotation ruler (first line) */
.annotationHTML {
cursor: pointer;
width: 16px;
height: 16px;
display: inline-block;
vertical-align: middle;
background-position: center;
background-repeat: no-repeat;
}
.annotation.task .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-task.png");
}
.annotation.breakpoint .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-breakpoint.png");
}
.annotation.debugLocation .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-debug-location.png");
}
.annotation.breakpoint.debugLocation .annotationHTML,
.annotation.task.debugLocation .annotationHTML {
background-position: center, center;
background-repeat: no-repeat, no-repeat;
background-size: 75%, 100%;
}
.annotation.breakpoint.debugLocation .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-debug-location.png"),
url("chrome://browser/skin/devtools/orion-breakpoint.png");
}
.annotation.task.debugLocation .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-debug-location.png"),
url("chrome://browser/skin/devtools/orion-task.png");
}
/* Styles for the overview ruler */
.annotationOverview {
cursor: pointer;
border-radius: 2px;
left: 2px;
width: 8px;
}
.annotationOverview.task {
background-color: lightgreen;
border: 1px solid green;
}
.annotationOverview.breakpoint {
background-color: lightblue;
border: 1px solid blue;
}
.annotationOverview.debugLocation {
background-color: white;
border: 1px solid green;
}
.annotationOverview.currentBracket {
background-color: lightgray;
border: 1px solid red;
}
.annotationOverview.matchingBracket {
background-color: lightgray;
border: 1px solid red;
}
/* Styles for text range */
.annotationRange {
background-repeat: repeat-x;
background-position: left bottom;
}
.annotationRange.task {
outline: 1px dashed rgba(0, 255, 0, 0.5);
}
.annotationRange.matchingBracket {
outline: 1px solid grey;
}
.token_singleline_comment,
.token_multiline_comment,
.token_doc_comment {
color: hsl(90,2%,50%); /* grey */
}
.token_doc_html_markup {
color: #dd0058; /* purple */
}
.token_doc_tag {
color: #dd0058; /* purple */
}
.token_task_tag { /* "TODO" */
color: black;
background: yellow;
}
.token_string {
color: hsl(72,100%,27%); /* green */
font-style: italic;
}
.token_keyword {
color: hsl(276,44%,45%); /* purple */
}
.token_space {
/* images/white_space.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAIAAABv85FHAAAABnRSTlMA/wAAAACkwsAdAAAAIUlEQVR4nGP4z8CAC+GUIEXuABhgkTuABEiRw2cmae4EAH05X7xDolNRAAAAAElFTkSuQmCC");
background-repeat: no-repeat;
background-position: center center;
}
.token_tab {
/* images/white_tab.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAJCAIAAACJ2loDAAAABnRSTlMA/wD/AP83WBt9AAAAMklEQVR4nGP4TwRgoK6i52c3bz5w6zMSA6tJn28d2Lx589nnCAYu63AaSLxJRLoJPwAAeNk0aG4opfMAAAAASUVORK5CYII=");
background-repeat: no-repeat;
background-position: left center;
}
.line_caret,
.annotationLine.currentLine { /* Current line */
background: hsl(208, 93%, 94%);
}
.readonly .line_caret,
.readonly .annotationLine.currentLine {
background: hsl(208, 80%, 90%);
}
/* Styling for html syntax highlighting */
.entity-name-tag {
color: hsl(208,48%,40%); /* blue */
}
.entity-other-attribute-name {
color: hsl(208,48%,40%); /* blue */
}
.punctuation-definition-comment {
color: hsl(90,2%,50%); /* grey */
}
.comment {
color: hsl(90,2%,50%); /* grey */
}
.string-quoted {
color: hsl(24,85%,39%); /* orange */
}
.invalid {
color: red;
font-weight: bold;
}

View File

@ -163,12 +163,9 @@ browser.jar:
skin/classic/browser/devtools/webconsole.png (devtools/webconsole.png)
skin/classic/browser/devtools/commandline.css (devtools/commandline.css)
skin/classic/browser/devtools/markup-view.css (../shared/devtools/markup-view.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)
skin/classic/browser/devtools/orion-error.png (devtools/orion-error.png)
skin/classic/browser/devtools/orion-breakpoint.png (devtools/orion-breakpoint.png)
skin/classic/browser/devtools/orion-debug-location.png (devtools/orion-debug-location.png)
skin/classic/browser/devtools/editor-error.png (devtools/editor-error.png)
skin/classic/browser/devtools/editor-breakpoint.png (devtools/editor-breakpoint.png)
skin/classic/browser/devtools/editor-debug-location.png (devtools/editor-debug-location.png)
skin/classic/browser/devtools/breadcrumbs-scrollbutton.png (devtools/breadcrumbs-scrollbutton.png)
skin/classic/browser/devtools/breadcrumbs/ltr-end-pressed.png (devtools/breadcrumbs/ltr-end-pressed.png)
skin/classic/browser/devtools/breadcrumbs/ltr-end-selected-pressed.png (devtools/breadcrumbs/ltr-end-selected-pressed.png)

View File

Before

Width:  |  Height:  |  Size: 577 B

After

Width:  |  Height:  |  Size: 577 B

View File

Before

Width:  |  Height:  |  Size: 308 B

After

Width:  |  Height:  |  Size: 308 B

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -1,39 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
.viewTooltip {
display: none; /* TODO: add tooltips support, see bug 721752 */
font-family: monospace;
font-size: 13px;
background-color: InfoBackground;
color: InfoText;
padding: 2px;
border-radius: 4px;
border: 1px solid black;
z-index: 100;
position: fixed;
overflow: hidden;
white-space: pre;
}
.viewTooltip em {
font-style: normal;
font-weight: bold;
}
.annotationHTML {
cursor: pointer;
width: 16px;
height: 16px;
display: inline-block;
vertical-align: middle;
background-position: center;
background-repeat: no-repeat;
}
.annotationHTML.task {
background-image: url("chrome://browser/skin/devtools/orion-task.png");
}
.annotationHTML.breakpoint {
background-image: url("chrome://browser/skin/devtools/orion-breakpoint.png");
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 413 B

View File

@ -1,199 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
.viewContainer {
background: hsl(0,0%,89%); /* This will be seen as the continuation of the ruler */
font-family: monospace;
font-size: inherit; /* inherit browser's default monospace font size */
}
.view {
color: black; /* Default text color */
background: white; /* Background of the editor */
padding-left: 4px;
}
.readonly > .view {
background: #fdfefd; /* super light green */
}
.ruler {
background: hsl(0,0%,89%);
color: hsl(0,0%,55%);
}
.ruler.annotations {
width: 16px;
padding-left: 4px;
}
.ruler.lines {
border-right: 1px solid #b4c4d3;
min-width: 1.4em;
padding-left: 4px;
padding-right: 4px;
text-align: end;
}
.ruler.linesWithAnnotations {
min-width: 0;
padding-left: 0;
}
.ruler.overview {
border-left: 1px solid #b4c4d3;
width: 14px;
text-align: start;
}
/* Styles for the annotation ruler (first line) */
.annotationHTML {
cursor: pointer;
width: 16px;
height: 16px;
display: inline-block;
vertical-align: middle;
background-position: center;
background-repeat: no-repeat;
}
.annotation.task .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-task.png");
}
.annotation.breakpoint .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-breakpoint.png");
}
.annotation.debugLocation .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-debug-location.png");
}
.annotation.breakpoint.debugLocation .annotationHTML,
.annotation.task.debugLocation .annotationHTML {
background-position: center, center;
background-repeat: no-repeat, no-repeat;
background-size: 75%, 100%;
}
.annotation.breakpoint.debugLocation .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-debug-location.png"),
url("chrome://browser/skin/devtools/orion-breakpoint.png");
}
.annotation.task.debugLocation .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-debug-location.png"),
url("chrome://browser/skin/devtools/orion-task.png");
}
/* Styles for the overview ruler */
.annotationOverview {
cursor: pointer;
border-radius: 2px;
left: 2px;
width: 8px;
}
.annotationOverview.task {
background-color: lightgreen;
border: 1px solid green;
}
.annotationOverview.breakpoint {
background-color: lightblue;
border: 1px solid blue;
}
.annotationOverview.debugLocation {
background-color: white;
border: 1px solid green;
}
.annotationOverview.currentBracket {
background-color: lightgray;
border: 1px solid red;
}
.annotationOverview.matchingBracket {
background-color: lightgray;
border: 1px solid red;
}
/* Styles for text range */
.annotationRange {
background-repeat: repeat-x;
background-position: left bottom;
}
.annotationRange.task {
outline: 1px dashed rgba(0, 255, 0, 0.5);
}
.annotationRange.matchingBracket {
outline: 1px solid grey;
}
.token_singleline_comment,
.token_multiline_comment,
.token_doc_comment {
color: hsl(90,2%,50%); /* grey */
}
.token_doc_html_markup {
color: #dd0058; /* purple */
}
.token_doc_tag {
color: #dd0058; /* purple */
}
.token_task_tag { /* "TODO" */
color: black;
background: yellow;
}
.token_string {
color: hsl(72,100%,27%); /* green */
font-style: italic;
}
.token_keyword {
color: hsl(276,44%,45%); /* purple */
}
.token_space {
/* images/white_space.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAIAAABv85FHAAAABnRSTlMA/wAAAACkwsAdAAAAIUlEQVR4nGP4z8CAC+GUIEXuABhgkTuABEiRw2cmae4EAH05X7xDolNRAAAAAElFTkSuQmCC");
background-repeat: no-repeat;
background-position: center center;
}
.token_tab {
/* images/white_tab.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAJCAIAAACJ2loDAAAABnRSTlMA/wD/AP83WBt9AAAAMklEQVR4nGP4TwRgoK6i52c3bz5w6zMSA6tJn28d2Lx589nnCAYu63AaSLxJRLoJPwAAeNk0aG4opfMAAAAASUVORK5CYII=");
background-repeat: no-repeat;
background-position: left center;
}
.line_caret,
.annotationLine.currentLine { /* Current line */
background: hsl(208, 93%, 94%);
}
.readonly .line_caret,
.readonly .annotationLine.currentLine {
background: hsl(208, 80%, 90%);
}
/* Styling for html syntax highlighting */
.entity-name-tag {
color: hsl(208,48%,40%); /* blue */
}
.entity-other-attribute-name {
color: hsl(208,48%,40%); /* blue */
}
.punctuation-definition-comment {
color: hsl(90,2%,50%); /* grey */
}
.comment {
color: hsl(90,2%,50%); /* grey */
}
.string-quoted {
color: hsl(24,85%,39%); /* orange */
}
.invalid {
color: red;
font-weight: bold;
}

View File

@ -262,12 +262,9 @@ browser.jar:
skin/classic/browser/devtools/ruleview.css (devtools/ruleview.css)
skin/classic/browser/devtools/commandline.css (devtools/commandline.css)
skin/classic/browser/devtools/markup-view.css (../shared/devtools/markup-view.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)
skin/classic/browser/devtools/orion-error.png (devtools/orion-error.png)
skin/classic/browser/devtools/orion-breakpoint.png (devtools/orion-breakpoint.png)
skin/classic/browser/devtools/orion-debug-location.png (devtools/orion-debug-location.png)
skin/classic/browser/devtools/editor-error.png (devtools/editor-error.png)
skin/classic/browser/devtools/editor-breakpoint.png (devtools/editor-breakpoint.png)
skin/classic/browser/devtools/editor-debug-location.png (devtools/editor-debug-location.png)
* 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)

View File

@ -189,6 +189,11 @@ div.cm-s-mozilla span.CodeMirror-matchingbracket { /* highlight brackets */
color: white;
}
/* Highlight for evaluating current statement. */
div.CodeMirror span.eval-text {
background-color: #556;
}
.cm-s-mozilla .CodeMirror-linenumber { /* line number text */
color: #5f7387;
}

View File

@ -188,6 +188,11 @@ div.cm-s-mozilla span.CodeMirror-matchingbracket { /* highlight brackets */
color: black;
}
/* Highlight for evaluating current statement. */
div.CodeMirror span.eval-text {
background-color: #ccd;
}
.cm-s-mozilla .CodeMirror-linenumber { /* line number text */
color: #667380;
}

View File

Before

Width:  |  Height:  |  Size: 577 B

After

Width:  |  Height:  |  Size: 577 B

View File

Before

Width:  |  Height:  |  Size: 308 B

After

Width:  |  Height:  |  Size: 308 B

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -1,39 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
.viewTooltip {
display: none; /* TODO: add tooltips support, see bug 721752 */
font-family: monospace;
font-size: 13px;
background-color: InfoBackground;
color: InfoText;
padding: 2px;
border-radius: 4px;
border: 1px solid black;
z-index: 100;
position: fixed;
overflow: hidden;
white-space: pre;
}
.viewTooltip em {
font-style: normal;
font-weight: bold;
}
.annotationHTML {
cursor: pointer;
width: 16px;
height: 16px;
display: inline-block;
vertical-align: middle;
background-position: center;
background-repeat: no-repeat;
}
.annotationHTML.task {
background-image: url("chrome://browser/skin/devtools/orion-task.png");
}
.annotationHTML.breakpoint {
background-image: url("chrome://browser/skin/devtools/orion-breakpoint.png");
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 413 B

View File

@ -1,199 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
.viewContainer {
background: hsl(0,0%,89%); /* This will be seen as the continuation of the ruler */
font-family: monospace;
font-size: inherit; /* inherit browser's default monospace font size */
}
.view {
color: black; /* Default text color */
background: white; /* Background of the editor */
padding-left: 4px;
}
.readonly > .view {
background: #fdfefd; /* super light green */
}
.ruler {
background: hsl(0,0%,89%);
color: hsl(0,0%,55%);
}
.ruler.annotations {
width: 16px;
padding-left: 4px;
}
.ruler.lines {
border-right: 1px solid #b4c4d3;
min-width: 1.4em;
padding-left: 4px;
padding-right: 4px;
text-align: end;
}
.ruler.linesWithAnnotations {
min-width: 0;
padding-left: 0;
}
.ruler.overview {
border-left: 1px solid #b4c4d3;
width: 14px;
text-align: start;
}
/* Styles for the annotation ruler (first line) */
.annotationHTML {
cursor: pointer;
width: 16px;
height: 16px;
display: inline-block;
vertical-align: middle;
background-position: center;
background-repeat: no-repeat;
}
.annotation.task .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-task.png");
}
.annotation.breakpoint .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-breakpoint.png");
}
.annotation.debugLocation .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-debug-location.png");
}
.annotation.breakpoint.debugLocation .annotationHTML,
.annotation.task.debugLocation .annotationHTML {
background-position: center, center;
background-repeat: no-repeat, no-repeat;
background-size: 75%, 100%;
}
.annotation.breakpoint.debugLocation .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-debug-location.png"),
url("chrome://browser/skin/devtools/orion-breakpoint.png");
}
.annotation.task.debugLocation .annotationHTML {
background-image: url("chrome://browser/skin/devtools/orion-debug-location.png"),
url("chrome://browser/skin/devtools/orion-task.png");
}
/* Styles for the overview ruler */
.annotationOverview {
cursor: pointer;
border-radius: 2px;
left: 2px;
width: 8px;
}
.annotationOverview.task {
background-color: lightgreen;
border: 1px solid green;
}
.annotationOverview.breakpoint {
background-color: lightblue;
border: 1px solid blue;
}
.annotationOverview.debugLocation {
background-color: white;
border: 1px solid green;
}
.annotationOverview.currentBracket {
background-color: lightgray;
border: 1px solid red;
}
.annotationOverview.matchingBracket {
background-color: lightgray;
border: 1px solid red;
}
/* Styles for text range */
.annotationRange {
background-repeat: repeat-x;
background-position: left bottom;
}
.annotationRange.task {
outline: 1px dashed rgba(0, 255, 0, 0.5);
}
.annotationRange.matchingBracket {
outline: 1px solid grey;
}
.token_singleline_comment,
.token_multiline_comment,
.token_doc_comment {
color: hsl(90,2%,50%); /* grey */
}
.token_doc_html_markup {
color: #dd0058; /* purple */
}
.token_doc_tag {
color: #dd0058; /* purple */
}
.token_task_tag { /* "TODO" */
color: black;
background: yellow;
}
.token_string {
color: hsl(72,100%,27%); /* green */
font-style: italic;
}
.token_keyword {
color: hsl(276,44%,45%); /* purple */
}
.token_space {
/* images/white_space.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAIAAABv85FHAAAABnRSTlMA/wAAAACkwsAdAAAAIUlEQVR4nGP4z8CAC+GUIEXuABhgkTuABEiRw2cmae4EAH05X7xDolNRAAAAAElFTkSuQmCC");
background-repeat: no-repeat;
background-position: center center;
}
.token_tab {
/* images/white_tab.png */
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAJCAIAAACJ2loDAAAABnRSTlMA/wD/AP83WBt9AAAAMklEQVR4nGP4TwRgoK6i52c3bz5w6zMSA6tJn28d2Lx589nnCAYu63AaSLxJRLoJPwAAeNk0aG4opfMAAAAASUVORK5CYII=");
background-repeat: no-repeat;
background-position: left center;
}
.line_caret,
.annotationLine.currentLine { /* Current line */
background: hsl(208, 93%, 94%);
}
.readonly .line_caret,
.readonly .annotationLine.currentLine {
background: hsl(208, 80%, 90%);
}
/* Styling for html syntax highlighting */
.entity-name-tag {
color: hsl(208,48%,40%); /* blue */
}
.entity-other-attribute-name {
color: hsl(208,48%,40%); /* blue */
}
.punctuation-definition-comment {
color: hsl(90,2%,50%); /* grey */
}
.comment {
color: hsl(90,2%,50%); /* grey */
}
.string-quoted {
color: hsl(24,85%,39%); /* orange */
}
.invalid {
color: red;
font-weight: bold;
}

View File

@ -184,12 +184,9 @@ browser.jar:
skin/classic/browser/devtools/command-scratchpad.png (devtools/command-scratchpad.png)
skin/classic/browser/devtools/command-tilt.png (devtools/command-tilt.png)
skin/classic/browser/devtools/markup-view.css (../shared/devtools/markup-view.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)
skin/classic/browser/devtools/orion-error.png (devtools/orion-error.png)
skin/classic/browser/devtools/orion-breakpoint.png (devtools/orion-breakpoint.png)
skin/classic/browser/devtools/orion-debug-location.png (devtools/orion-debug-location.png)
skin/classic/browser/devtools/editor-error.png (devtools/editor-error.png)
skin/classic/browser/devtools/editor-breakpoint.png (devtools/editor-breakpoint.png)
skin/classic/browser/devtools/editor-debug-location.png (devtools/editor-debug-location.png)
* 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)
@ -480,12 +477,9 @@ browser.jar:
skin/classic/aero/browser/devtools/ruleview.css (devtools/ruleview.css)
skin/classic/aero/browser/devtools/commandline.css (devtools/commandline.css)
skin/classic/aero/browser/devtools/markup-view.css (../shared/devtools/markup-view.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)
skin/classic/aero/browser/devtools/orion-error.png (devtools/orion-error.png)
skin/classic/aero/browser/devtools/orion-breakpoint.png (devtools/orion-breakpoint.png)
skin/classic/aero/browser/devtools/orion-debug-location.png (devtools/orion-debug-location.png)
skin/classic/aero/browser/devtools/editor-error.png (devtools/editor-error.png)
skin/classic/aero/browser/devtools/editor-breakpoint.png (devtools/editor-breakpoint.png)
skin/classic/aero/browser/devtools/editor-debug-location.png (devtools/editor-debug-location.png)
* skin/classic/aero/browser/devtools/webconsole.css (devtools/webconsole.css)
skin/classic/aero/browser/devtools/webconsole_networkpanel.css (devtools/webconsole_networkpanel.css)
skin/classic/aero/browser/devtools/webconsole.png (devtools/webconsole.png)

View File

@ -3990,6 +3990,26 @@ nsDocument::SetStyleSheetApplicableState(nsIStyleSheet* aSheet,
"StyleSheetApplicableStateChanged",
aApplicable);
}
if (!mSSApplicableStateNotificationPending) {
nsRefPtr<nsIRunnable> notification = NS_NewRunnableMethod(this,
&nsDocument::NotifyStyleSheetApplicableStateChanged);
mSSApplicableStateNotificationPending =
NS_SUCCEEDED(NS_DispatchToCurrentThread(notification));
}
}
void
nsDocument::NotifyStyleSheetApplicableStateChanged()
{
mSSApplicableStateNotificationPending = false;
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (observerService) {
observerService->NotifyObservers(static_cast<nsIDocument*>(this),
"style-sheet-applicable-state-changed",
nullptr);
}
}
// These three functions are a lot like the implementation of the

View File

@ -1156,6 +1156,8 @@ protected:
void EnsureOnloadBlocker();
void NotifyStyleSheetApplicableStateChanged();
nsTArray<nsIObserver*> mCharSetObservers;
PLDHashTable *mSubDocuments;
@ -1279,6 +1281,10 @@ protected:
bool mAsyncFullscreenPending:1;
// Keeps track of whether we have a pending
// 'style-sheet-applicable-state-changed' notification.
bool mSSApplicableStateNotificationPending:1;
uint32_t mCancelledPointerLockRequests;
uint8_t mXMLDeclarationBits;

Some files were not shown because too many files have changed in this diff Show More