зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to b2g-inbound
This commit is contained in:
Коммит
590e345383
2
CLOBBER
2
CLOBBER
|
@ -22,4 +22,4 @@
|
|||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Clobber to work around bug 959928 / bug 1020776.
|
||||
Clobber for bug 1022262.
|
||||
|
|
|
@ -27,18 +27,6 @@ let sanitizeId = function(id){
|
|||
|
||||
const PSEUDOURI = "indexeddb://" + sanitizeId(id) // https://bugzilla.mozilla.org/show_bug.cgi?id=779197
|
||||
|
||||
// Firefox 26 and earlier releases don't support `indexedDB` in sandboxes
|
||||
// automatically, so we need to inject `indexedDB` to `this` scope ourselves.
|
||||
if (typeof(indexedDB) === "undefined") {
|
||||
Cc["@mozilla.org/dom/indexeddb/manager;1"].
|
||||
getService(Ci.nsIIndexedDatabaseManager).
|
||||
initWindowless(this);
|
||||
|
||||
// Firefox 14 gets this with a prefix
|
||||
if (typeof(indexedDB) === "undefined")
|
||||
this.indexedDB = mozIndexedDB;
|
||||
}
|
||||
|
||||
// Use XPCOM because `require("./url").URL` doesn't expose the raw uri object.
|
||||
let principaluri = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService).
|
||||
|
@ -50,8 +38,9 @@ let principal = Cc["@mozilla.org/scriptsecuritymanager;1"].
|
|||
|
||||
exports.indexedDB = Object.freeze({
|
||||
open: indexedDB.openForPrincipal.bind(indexedDB, principal),
|
||||
openForPrincipal: indexedDB.openForPrincipal.bind(indexedDB),
|
||||
deleteDatabase: indexedDB.deleteForPrincipal.bind(indexedDB, principal),
|
||||
cmp: indexedDB.cmp
|
||||
cmp: indexedDB.cmp.bind(indexedDB)
|
||||
});
|
||||
|
||||
exports.IDBKeyRange = IDBKeyRange;
|
||||
|
|
|
@ -188,7 +188,6 @@
|
|||
#endif
|
||||
@BINPATH@/components/dom_notification.xpt
|
||||
@BINPATH@/components/dom_html.xpt
|
||||
@BINPATH@/components/dom_indexeddb.xpt
|
||||
@BINPATH@/components/dom_offline.xpt
|
||||
@BINPATH@/components/dom_payment.xpt
|
||||
@BINPATH@/components/dom_json.xpt
|
||||
|
|
|
@ -238,8 +238,5 @@ let gPage = {
|
|||
let shownCount = Math.min(10, count);
|
||||
Services.telemetry.getHistogramById(shownId).add(shownCount);
|
||||
}
|
||||
|
||||
// Set up initial search state.
|
||||
gSearch.setUpInitialState();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,9 +15,6 @@ let gSearch = {
|
|||
}
|
||||
|
||||
window.addEventListener("ContentSearchService", this);
|
||||
},
|
||||
|
||||
setUpInitialState: function () {
|
||||
this._send("GetState");
|
||||
},
|
||||
|
||||
|
@ -59,13 +56,23 @@ let gSearch = {
|
|||
},
|
||||
|
||||
onState: function (data) {
|
||||
this._makePanel(data.engines);
|
||||
this._newEngines = data.engines;
|
||||
this._setCurrentEngine(data.currentEngine);
|
||||
this._initWhenInitalStateReceived();
|
||||
},
|
||||
|
||||
onCurrentState: function (data) {
|
||||
if (this._initialStateReceived) {
|
||||
this._newEngines = data.engines;
|
||||
this._setCurrentEngine(data.currentEngine);
|
||||
}
|
||||
},
|
||||
|
||||
onCurrentEngine: function (engineName) {
|
||||
this._setCurrentEngine(engineName);
|
||||
if (this._initialStateReceived) {
|
||||
this._nodes.panel.hidePopup();
|
||||
this._setCurrentEngine(engineName);
|
||||
}
|
||||
},
|
||||
|
||||
_nodeIDSuffixes: [
|
||||
|
@ -82,6 +89,8 @@ let gSearch = {
|
|||
this._nodes.form.addEventListener("submit", e => this.search(e));
|
||||
this._nodes.logo.addEventListener("click", e => this.showPanel());
|
||||
this._nodes.manage.addEventListener("click", e => this.manageEngines());
|
||||
this._nodes.panel.addEventListener("popupshowing", e => this._setUpPanel());
|
||||
this._initialStateReceived = true;
|
||||
this._initWhenInitalStateReceived = function () {};
|
||||
},
|
||||
|
||||
|
@ -94,7 +103,26 @@ let gSearch = {
|
|||
}));
|
||||
},
|
||||
|
||||
_makePanel: function (engines) {
|
||||
_setUpPanel: function () {
|
||||
// Build the panel if necessary.
|
||||
if (this._newEngines) {
|
||||
this._buildPanel(this._newEngines);
|
||||
delete this._newEngines;
|
||||
}
|
||||
|
||||
// Set the selected states of the engines.
|
||||
let panel = this._nodes.panel;
|
||||
for (let box of panel.childNodes) {
|
||||
if (box.getAttribute("engine") == this.currentEngineName) {
|
||||
box.setAttribute("selected", "true");
|
||||
}
|
||||
else {
|
||||
box.removeAttribute("selected");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_buildPanel: function (engines) {
|
||||
let panel = this._nodes.panel;
|
||||
|
||||
// Empty the panel except for the Manage Engines row.
|
||||
|
@ -128,8 +156,9 @@ let gSearch = {
|
|||
});
|
||||
|
||||
let image = document.createElementNS(XUL_NAMESPACE, "image");
|
||||
if (engine.iconURI) {
|
||||
image.setAttribute("src", engine.iconURI);
|
||||
if (engine.iconBuffer) {
|
||||
let blob = new Blob([engine.iconBuffer]);
|
||||
image.setAttribute("src", URL.createObjectURL(blob));
|
||||
}
|
||||
box.appendChild(image);
|
||||
|
||||
|
@ -144,26 +173,17 @@ let gSearch = {
|
|||
this.currentEngineName = engine.name;
|
||||
|
||||
// Set the logo.
|
||||
let logoURI = window.devicePixelRatio == 2 ? engine.logo2xURI :
|
||||
engine.logoURI || engine.logo2xURI;
|
||||
if (logoURI) {
|
||||
let logoBuf = window.devicePixelRatio == 2 ? engine.logo2xBuffer :
|
||||
engine.logoBuffer || engine.logo2xBuffer;
|
||||
if (logoBuf) {
|
||||
this._nodes.logo.hidden = false;
|
||||
this._nodes.logo.style.backgroundImage = "url(" + logoURI + ")";
|
||||
let uri = URL.createObjectURL(new Blob([logoBuf]));
|
||||
this._nodes.logo.style.backgroundImage = "url(" + uri + ")";
|
||||
this._nodes.text.placeholder = "";
|
||||
}
|
||||
else {
|
||||
this._nodes.logo.hidden = true;
|
||||
this._nodes.text.placeholder = engine.name;
|
||||
}
|
||||
|
||||
// Set the selected state of all the engines in the panel.
|
||||
for (let box of this._nodes.panel.childNodes) {
|
||||
if (box.getAttribute("engine") == engine.name) {
|
||||
box.setAttribute("selected", "true");
|
||||
}
|
||||
else {
|
||||
box.removeAttribute("selected");
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -2273,6 +2273,8 @@
|
|||
// Give others a chance to swap state.
|
||||
let event = new CustomEvent("SwapDocShells", {"detail": aOtherBrowser});
|
||||
ourBrowser.dispatchEvent(event);
|
||||
event = new CustomEvent("SwapDocShells", {"detail": ourBrowser});
|
||||
aOtherBrowser.dispatchEvent(event);
|
||||
|
||||
// Swap the docshells
|
||||
ourBrowser.swapDocShells(aOtherBrowser);
|
||||
|
|
|
@ -30,7 +30,6 @@ function runTests() {
|
|||
let oldCurrentEngine = Services.search.currentEngine;
|
||||
|
||||
yield addNewTabPageTab();
|
||||
yield whenSearchInitDone();
|
||||
|
||||
// The tab is removed at the end of the test, so there's no need to remove
|
||||
// this listener at the end of the test.
|
||||
|
@ -56,7 +55,7 @@ function runTests() {
|
|||
"Sanity check: engine should not have 2x logo");
|
||||
Services.search.currentEngine = noLogoEngine;
|
||||
yield promiseSearchEvents(["CurrentEngine"]).then(TestRunner.next);
|
||||
checkCurrentEngine(ENGINE_NO_LOGO, false, false);
|
||||
yield checkCurrentEngine(ENGINE_NO_LOGO, false, false);
|
||||
|
||||
// Add the engine with a 1x-DPI logo and switch to it.
|
||||
let logo1xEngine = null;
|
||||
|
@ -70,7 +69,7 @@ function runTests() {
|
|||
"Sanity check: engine should not have 2x logo");
|
||||
Services.search.currentEngine = logo1xEngine;
|
||||
yield promiseSearchEvents(["CurrentEngine"]).then(TestRunner.next);
|
||||
checkCurrentEngine(ENGINE_1X_LOGO, true, false);
|
||||
yield checkCurrentEngine(ENGINE_1X_LOGO, true, false);
|
||||
|
||||
// Add the engine with a 2x-DPI logo and switch to it.
|
||||
let logo2xEngine = null;
|
||||
|
@ -84,7 +83,7 @@ function runTests() {
|
|||
"Sanity check: engine should have 2x logo");
|
||||
Services.search.currentEngine = logo2xEngine;
|
||||
yield promiseSearchEvents(["CurrentEngine"]).then(TestRunner.next);
|
||||
checkCurrentEngine(ENGINE_2X_LOGO, false, true);
|
||||
yield checkCurrentEngine(ENGINE_2X_LOGO, false, true);
|
||||
|
||||
// Add the engine with 1x- and 2x-DPI logos and switch to it.
|
||||
let logo1x2xEngine = null;
|
||||
|
@ -98,7 +97,7 @@ function runTests() {
|
|||
"Sanity check: engine should have 2x logo");
|
||||
Services.search.currentEngine = logo1x2xEngine;
|
||||
yield promiseSearchEvents(["CurrentEngine"]).then(TestRunner.next);
|
||||
checkCurrentEngine(ENGINE_1X_2X_LOGO, true, true);
|
||||
yield checkCurrentEngine(ENGINE_1X_2X_LOGO, true, true);
|
||||
|
||||
// Click the logo to open the search panel.
|
||||
yield Promise.all([
|
||||
|
@ -121,12 +120,12 @@ function runTests() {
|
|||
promiseClick(noLogoBox),
|
||||
]).then(TestRunner.next);
|
||||
|
||||
checkCurrentEngine(ENGINE_NO_LOGO, false, false);
|
||||
yield checkCurrentEngine(ENGINE_NO_LOGO, false, false);
|
||||
|
||||
// Switch back to the 1x-and-2x logo engine.
|
||||
Services.search.currentEngine = logo1x2xEngine;
|
||||
yield promiseSearchEvents(["CurrentEngine"]).then(TestRunner.next);
|
||||
checkCurrentEngine(ENGINE_1X_2X_LOGO, true, true);
|
||||
yield checkCurrentEngine(ENGINE_1X_2X_LOGO, true, true);
|
||||
|
||||
// Open the panel again.
|
||||
yield Promise.all([
|
||||
|
@ -149,7 +148,7 @@ function runTests() {
|
|||
let events = [];
|
||||
for (let engine of gNewEngines) {
|
||||
Services.search.removeEngine(engine);
|
||||
events.push("State");
|
||||
events.push("CurrentState");
|
||||
}
|
||||
yield promiseSearchEvents(events).then(TestRunner.next);
|
||||
}
|
||||
|
@ -194,10 +193,10 @@ function promiseNewSearchEngine(basename, numLogos) {
|
|||
|
||||
// Wait for the search events triggered by adding the new engine.
|
||||
// engine-added engine-loaded
|
||||
let expectedSearchEvents = ["State", "State"];
|
||||
let expectedSearchEvents = ["CurrentState", "CurrentState"];
|
||||
// engine-changed for each of the logos
|
||||
for (let i = 0; i < numLogos; i++) {
|
||||
expectedSearchEvents.push("State");
|
||||
expectedSearchEvents.push("CurrentState");
|
||||
}
|
||||
let eventPromise = promiseSearchEvents(expectedSearchEvents);
|
||||
|
||||
|
@ -260,24 +259,31 @@ function checkCurrentEngine(basename, has1xLogo, has2xLogo) {
|
|||
is(logo.hidden, !logoURI,
|
||||
"Logo should be visible iff engine has a logo: " + engine.name);
|
||||
if (logoURI) {
|
||||
is(logo.style.backgroundImage, 'url("' + logoURI + '")', "Logo URI");
|
||||
// The URLs of blobs created with the same ArrayBuffer are different, so
|
||||
// just check that the URI is a blob URI.
|
||||
ok(/^url\("blob:/.test(logo.style.backgroundImage), "Logo URI"); //"
|
||||
}
|
||||
|
||||
// "selected" attributes of engines in the panel
|
||||
let panel = searchPanel();
|
||||
for (let engineBox of panel.childNodes) {
|
||||
let engineName = engineBox.getAttribute("engine");
|
||||
if (engineName == engine.name) {
|
||||
is(engineBox.getAttribute("selected"), "true",
|
||||
"Engine box's selected attribute should be true for " +
|
||||
"selected engine: " + engineName);
|
||||
promisePanelShown(panel).then(() => {
|
||||
panel.hidePopup();
|
||||
for (let engineBox of panel.childNodes) {
|
||||
let engineName = engineBox.getAttribute("engine");
|
||||
if (engineName == engine.name) {
|
||||
is(engineBox.getAttribute("selected"), "true",
|
||||
"Engine box's selected attribute should be true for " +
|
||||
"selected engine: " + engineName);
|
||||
}
|
||||
else {
|
||||
ok(!engineBox.hasAttribute("selected"),
|
||||
"Engine box's selected attribute should be absent for " +
|
||||
"non-selected engine: " + engineName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ok(!engineBox.hasAttribute("selected"),
|
||||
"Engine box's selected attribute should be absent for " +
|
||||
"non-selected engine: " + engineName);
|
||||
}
|
||||
}
|
||||
TestRunner.next();
|
||||
});
|
||||
panel.openPopup(logoImg());
|
||||
}
|
||||
|
||||
function promisePanelShown(panel) {
|
||||
|
|
|
@ -5,10 +5,6 @@ function runTests() {
|
|||
yield setLinks("0");
|
||||
yield addNewTabPageTab();
|
||||
|
||||
// When gSearch modifies the DOM as it sets itself up, it can prevent the
|
||||
// popup from opening, depending on the timing. Wait until that's done.
|
||||
yield whenSearchInitDone();
|
||||
|
||||
let site = getCell(0).node.querySelector(".newtab-site");
|
||||
site.setAttribute("type", "sponsored");
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ function addNewTabPageTab() {
|
|||
if (NewTabUtils.allPages.enabled) {
|
||||
// Continue when the link cache has been populated.
|
||||
NewTabUtils.links.populateCache(function () {
|
||||
executeSoon(TestRunner.next);
|
||||
whenSearchInitDone();
|
||||
});
|
||||
} else {
|
||||
// It's important that we call next() asynchronously.
|
||||
|
@ -606,33 +606,18 @@ function whenPagesUpdated(aCallback, aOnlyIfHidden=false) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Waits a small amount of time for search events to stop occurring in the
|
||||
* newtab page.
|
||||
*
|
||||
* newtab pages receive some search events around load time that are difficult
|
||||
* to predict. There are two categories of such events: (1) "State" events
|
||||
* triggered by engine notifications like engine-changed, due to the search
|
||||
* service initializing itself on app startup. This can happen when a test is
|
||||
* the first test to run. (2) "State" events triggered by the newtab page
|
||||
* itself when gSearch first sets itself up. newtab preloading makes these a
|
||||
* pain to predict.
|
||||
* Waits for the response to the page's initial search state request.
|
||||
*/
|
||||
function whenSearchInitDone() {
|
||||
info("Waiting for initial search events...");
|
||||
let numTicks = 0;
|
||||
function reset(event) {
|
||||
info("Got initial search event " + event.detail.type +
|
||||
", waiting for more...");
|
||||
numTicks = 0;
|
||||
if (getContentWindow().gSearch._initialStateReceived) {
|
||||
executeSoon(TestRunner.next);
|
||||
return;
|
||||
}
|
||||
let eventName = "ContentSearchService";
|
||||
getContentWindow().addEventListener(eventName, reset);
|
||||
let interval = window.setInterval(() => {
|
||||
if (++numTicks >= 100) {
|
||||
info("Done waiting for initial search events");
|
||||
window.clearInterval(interval);
|
||||
getContentWindow().removeEventListener(eventName, reset);
|
||||
getContentWindow().addEventListener(eventName, function onEvent(event) {
|
||||
if (event.detail.type == "State") {
|
||||
getContentWindow().removeEventListener(eventName, onEvent);
|
||||
TestRunner.next();
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@
|
|||
this.inputField.removeEventListener("underflow", this, false);
|
||||
]]></destructor>
|
||||
|
||||
<field name="_value"></field>
|
||||
<field name="_value">""</field>
|
||||
|
||||
<!--
|
||||
onBeforeValueGet is called by the base-binding's .value getter.
|
||||
|
|
|
@ -5,6 +5,7 @@ const promise = require("devtools/toolkit/deprecated-sync-thenables");
|
|||
const {EventEmitter} = Cu.import("resource://gre/modules/devtools/event-emitter.js");
|
||||
const {generateUUID} = Cc['@mozilla.org/uuid-generator;1'].getService(Ci.nsIUUIDGenerator);
|
||||
const {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
const { indexedDB } = require("sdk/indexed-db");
|
||||
|
||||
/**
|
||||
* IndexedDB wrapper that just save project objects
|
||||
|
@ -20,10 +21,6 @@ const IDB = {
|
|||
open: function () {
|
||||
let deferred = promise.defer();
|
||||
|
||||
var idbManager = Cc["@mozilla.org/dom/indexeddb/manager;1"]
|
||||
.getService(Ci.nsIIndexedDatabaseManager);
|
||||
idbManager.initWindowless(global);
|
||||
|
||||
let request = global.indexedDB.open("AppProjects", 5);
|
||||
request.onerror = function(event) {
|
||||
deferred.reject("Unable to open AppProjects indexedDB. " +
|
||||
|
|
|
@ -16,6 +16,8 @@ const promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;
|
|||
const EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
const {Tooltip} = require("devtools/shared/widgets/Tooltip");
|
||||
const Editor = require("devtools/sourceeditor/editor");
|
||||
const Telemetry = require("devtools/shared/telemetry");
|
||||
const telemetry = new Telemetry();
|
||||
|
||||
// The panel's window global is an EventEmitter firing the following events:
|
||||
const EVENTS = {
|
||||
|
@ -83,6 +85,7 @@ let EventsHandler = {
|
|||
* Listen for events emitted by the current tab target.
|
||||
*/
|
||||
initialize: function() {
|
||||
telemetry.toolOpened("shadereditor");
|
||||
this._onHostChanged = this._onHostChanged.bind(this);
|
||||
this._onTabNavigated = this._onTabNavigated.bind(this);
|
||||
this._onProgramLinked = this._onProgramLinked.bind(this);
|
||||
|
@ -98,6 +101,7 @@ let EventsHandler = {
|
|||
* Remove events emitted by the current tab target.
|
||||
*/
|
||||
destroy: function() {
|
||||
telemetry.toolClosed("shadereditor");
|
||||
gToolbox.off("host-changed", this._onHostChanged);
|
||||
gTarget.off("will-navigate", this._onTabNavigated);
|
||||
gTarget.off("navigate", this._onTabNavigated);
|
||||
|
|
|
@ -31,20 +31,25 @@ support-files =
|
|||
[browser_observableobject.js]
|
||||
[browser_outputparser.js]
|
||||
[browser_require_basic.js]
|
||||
[browser_spectrum.js]
|
||||
[browser_tableWidget_basic.js]
|
||||
[browser_tableWidget_keyboard_interaction.js]
|
||||
[browser_tableWidget_mouse_interaction.js]
|
||||
[browser_telemetry_button_paintflashing.js]
|
||||
[browser_telemetry_button_responsive.js]
|
||||
[browser_telemetry_button_scratchpad.js]
|
||||
[browser_telemetry_button_tilt.js]
|
||||
[browser_telemetry_sidebar.js]
|
||||
[browser_telemetry_toolbox.js]
|
||||
[browser_telemetry_toolboxtabs_inspector.js]
|
||||
[browser_telemetry_toolboxtabs_webaudioeditor.js]
|
||||
[browser_telemetry_toolboxtabs_canvasdebugger.js]
|
||||
[browser_telemetry_toolboxtabs_inspector.js]
|
||||
[browser_telemetry_toolboxtabs_jsdebugger.js]
|
||||
[browser_telemetry_toolboxtabs_jsprofiler.js]
|
||||
[browser_telemetry_toolboxtabs_netmonitor.js]
|
||||
[browser_telemetry_toolboxtabs_options.js]
|
||||
[browser_telemetry_toolboxtabs_shadereditor.js]
|
||||
[browser_telemetry_toolboxtabs_styleeditor.js]
|
||||
[browser_telemetry_toolboxtabs_webaudioeditor.js]
|
||||
[browser_telemetry_toolboxtabs_webconsole.js]
|
||||
[browser_templater_basic.js]
|
||||
[browser_toolbar_basic.js]
|
||||
|
@ -53,7 +58,3 @@ support-files =
|
|||
[browser_treeWidget_basic.js]
|
||||
[browser_treeWidget_keyboard_interaction.js]
|
||||
[browser_treeWidget_mouse_interaction.js]
|
||||
[browser_tableWidget_basic.js]
|
||||
[browser_tableWidget_keyboard_interaction.js]
|
||||
[browser_tableWidget_mouse_interaction.js]
|
||||
[browser_spectrum.js]
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,<p>browser_telemetry_toolboxtabs_shadereditor.js</p>";
|
||||
|
||||
// Because we need to gather stats for the period of time that a tool has been
|
||||
// opened we make use of setTimeout() to create tool active times.
|
||||
const TOOL_DELAY = 200;
|
||||
|
||||
let {Promise: promise} = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js", {});
|
||||
let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
|
||||
let require = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
|
||||
let Telemetry = require("devtools/shared/telemetry");
|
||||
let originalPref = Services.prefs.getBoolPref("devtools.shadereditor.enabled");
|
||||
Services.prefs.setBoolPref("devtools.shadereditor.enabled", true);
|
||||
|
||||
function init() {
|
||||
Telemetry.prototype.telemetryInfo = {};
|
||||
Telemetry.prototype._oldlog = Telemetry.prototype.log;
|
||||
Telemetry.prototype.log = function(histogramId, value) {
|
||||
if (!this.telemetryInfo) {
|
||||
// Can be removed when Bug 992911 lands (see Bug 1011652 Comment 10)
|
||||
return;
|
||||
}
|
||||
if (histogramId) {
|
||||
if (!this.telemetryInfo[histogramId]) {
|
||||
this.telemetryInfo[histogramId] = [];
|
||||
}
|
||||
|
||||
this.telemetryInfo[histogramId].push(value);
|
||||
}
|
||||
}
|
||||
|
||||
openToolboxTabTwice("shadereditor", false);
|
||||
}
|
||||
|
||||
function openToolboxTabTwice(id, secondPass) {
|
||||
let target = TargetFactory.forTab(gBrowser.selectedTab);
|
||||
|
||||
gDevTools.showToolbox(target, id).then(function(toolbox) {
|
||||
info("Toolbox tab " + id + " opened");
|
||||
|
||||
toolbox.once("destroyed", function() {
|
||||
if (secondPass) {
|
||||
checkResults();
|
||||
} else {
|
||||
openToolboxTabTwice(id, true);
|
||||
}
|
||||
});
|
||||
// We use a timeout to check the tools active time
|
||||
setTimeout(function() {
|
||||
gDevTools.closeToolbox(target);
|
||||
}, TOOL_DELAY);
|
||||
}).then(null, reportError);
|
||||
}
|
||||
|
||||
function checkResults() {
|
||||
let result = Telemetry.prototype.telemetryInfo;
|
||||
|
||||
for (let [histId, value] of Iterator(result)) {
|
||||
if (histId.endsWith("OPENED_PER_USER_FLAG")) {
|
||||
ok(value.length === 1 && value[0] === true,
|
||||
"Per user value " + histId + " has a single value of true");
|
||||
} else if (histId.endsWith("OPENED_BOOLEAN")) {
|
||||
ok(value.length > 1, histId + " has more than one entry");
|
||||
|
||||
let okay = value.every(function(element) {
|
||||
return element === true;
|
||||
});
|
||||
|
||||
ok(okay, "All " + histId + " entries are === true");
|
||||
} else if (histId.endsWith("TIME_ACTIVE_SECONDS")) {
|
||||
ok(value.length > 1, histId + " has more than one entry");
|
||||
|
||||
let okay = value.every(function(element) {
|
||||
return element > 0;
|
||||
});
|
||||
|
||||
ok(okay, "All " + histId + " entries have time > 0");
|
||||
}
|
||||
}
|
||||
|
||||
finishUp();
|
||||
}
|
||||
|
||||
function reportError(error) {
|
||||
let stack = " " + error.stack.replace(/\n?.*?@/g, "\n JS frame :: ");
|
||||
|
||||
ok(false, "ERROR: " + error + " at " + error.fileName + ":" +
|
||||
error.lineNumber + "\n\nStack trace:" + stack);
|
||||
finishUp();
|
||||
}
|
||||
|
||||
function finishUp() {
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
Telemetry.prototype.log = Telemetry.prototype._oldlog;
|
||||
delete Telemetry.prototype._oldlog;
|
||||
delete Telemetry.prototype.telemetryInfo;
|
||||
Services.prefs.setBoolPref("devtools.shadereditor.enabled", originalPref);
|
||||
|
||||
TargetFactory = Services = promise = require = null;
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
waitForFocus(init, content);
|
||||
}, true);
|
||||
|
||||
content.location = TEST_URI;
|
||||
}
|
|
@ -202,7 +202,6 @@
|
|||
@BINPATH@/components/dom_network.xpt
|
||||
@BINPATH@/components/dom_notification.xpt
|
||||
@BINPATH@/components/dom_html.xpt
|
||||
@BINPATH@/components/dom_indexeddb.xpt
|
||||
@BINPATH@/components/dom_offline.xpt
|
||||
@BINPATH@/components/dom_json.xpt
|
||||
@BINPATH@/components/dom_power.xpt
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
<Description>Realtime Twitter Search</Description>
|
||||
<InputEncoding>UTF-8</InputEncoding>
|
||||
<Image width="16" height="16">data:image/x-icon;base64,AAABAAIAEBAAAAAAAAALAgAAJgAAACAgAAAAAAAAQQQAADECAACJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAHSSURBVDjLfVO/axRREP6SS0ihlv4FQpoYWxHyHxgCsUxhmToBS4tF7NLZWaiIEHLv7d5dJNEQ0tgYEAmIjeAfYC57++7MGbzLjxu/Nxt27zZrBoadnZnvm3kz7wEqMpZqmdAfBBMIZBzGVGCkorbXq4kFp/yPtBgPZCJzZvYQuNZ+jKhVo75G2LyHVz9uoeFmc6bILaHaepv9v/w6iRcypXbonmNPBB9OBbv82tYfmPgn7NHTnKAaP8E+g8Ztot68k/nXDm8ooNEVhHEP1vXROBbUf/M/Wc0Jwl8zsEkHOxcMtE6Y+A42nodpLtLfR9QWRMmA9jm2eh78aXQY4eF9VvjCgKDWEewM2PIZQc4nD9Sf6hk+sohNqorzW0kN91BBdYKtO9dE/00JZITA50XxsxTHlWarqMYBh/O3UPGqrednx7ox3o+UhbIRT7O1BO9PfIsXI5V9J34WvrqN94buwFi+b3N0k0nrCjAFAp1+Nz1Czd3N2y8Tm6ywYk9JTHKqk/cD9cM17YW89WExbo6Ja1zhvgK3+4Itql+rt8PkO1f6oBysBN3brLrMVhs84wHJvpHoMwnf8CI9ygZd3nbJgymrMvxeSoLjmlCsIJf+a17lP6juZmUWkMzvAAAAAElFTkSuQmCCiVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAECElEQVRYw+1XS2gTURS9ia0/EMSCCC4siCIKrly4UVwIrgRR3KgbXQmCCiIiCha7EQRR6cIupHShSeZjf6lttdWFgqBRBPGDKIqF1mQ+1Wp/SZvnvXfmTWfMpJ3U0pUPHplJ3rv33HO/Afi/5nPViTjuKm8rYlFlAoSI8a500R1SGLYUZRH+Hvee6+qqygvxW1KJ1XLd+74aUuY+0OzjoHw/BElj4zQQHxv0HDBUvjR9WQlNYmnJhSjK9dxFUC0LOsYE3M8LSI8LUKw8AmoG5ecqPtP8vgZ04zKeO+jqjUtBDi2qWY+71xPaKKpnpF0uzUpCnxDQOixQ+BSo9iR/3vsh4CF+r5of8D3F75r9udQAKUwx++AJXkhZCe9QBkGEuUSC1swTjhK0VrUmEYzw7SKCyUPrLwEP8IxufQN9aCfKPwCJwdq/lCPluvUG2n4jhQW8bD6Hu+amABvSd/LOTbEENOMjdIyicLuA1om/ADhbMqIZn/DMOMq+7iqPBanUzWfQOUGUjUFnnj5H0WdnQOlfFoxssdix3tjGgnWbrCuGKvdA4LmuSQJ6s9SN0zFwg6lS7Qmms+WngK4pEvAVg+w83MltCAAhAHSGFMwEgGQRq2quwZe2cShJkaYvtey39hEHMfsQL7cjxd1F4dBnPWUKVeMwaLmTkRggGd1oiJI9GxLcLg2NA8s5DTXzCKePbjtBJAVoVoGjmFxEwsgiCi5tFuoDDFinHcb9xWg6CBcjpS9ReReCeF9GOL5TsCEYhRkSs26HmSLXh2R2f8DlJS7Q7BZOwyhWzeZ3P2hijtJRG9wSXuQkIj27m1OKKKPUiQIiCv1ptF4x33rUh/Yb+aVqN8BjIf07HwDy0EPFzU2/ck0rgCpln8MgtOcBgOOiFizRSWt7aQCWA0GHdesSBuOAm+fFOQIoOFXVeBRqaGnvlsGIed5LwWiO/LP11KASg7tmt97fnRoz1Xj5NXc4WQP0Sliw6d4EN6mUdStyew8cbB6uQWGdXL+pPHMrjQLCVe40tHdo1NJoQ47X5XBnfKUykduBQ0U9+jEbKR5IOTc0IwfJb+tnjvwoq+3DCmxEV1iwvzyHtlzbSTnVHMRKuTm6crK8AcelDrGc/a/0r4WUsRcF3ebWzC4YCqt8Rbdo5XmO4IZj9IGSW+PFUuSVyu7BeeABIrdZMNFIfiSrCQQFouwDNHxQLyBQdK6nSPOfgftUSXWtaOlD67BkXkCLXrFV1IYJBAUifcpnspQHFjyjmi+4y8nBs6KIL1cJuRZkt6K1xzCYrvFAqdtptDCNz3dxX8V91Gsufqvn8r/CByJemd/kvJiprui/RAQkMaZR/r1i4W6a0rP/N/gXi6OvmDvBLoiyBV1/AN29Cs9hVFoUAAAAAElFTkSuQmCC</Image>
|
||||
<Image width="65" height="26">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEEAAAAaCAYAAADovjFxAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NDkxMSwgMjAxMy8xMC8yOS0xMTo0NzoxNiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjQ0MDYxRTY0QjUyNTExRTNCNzdEOTU4N0NCMjI3MEFDIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjQ0MDYxRTY1QjUyNTExRTNCNzdEOTU4N0NCMjI3MEFDIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MDcyQzJENkJCNTI1MTFFM0I3N0Q5NTg3Q0IyMjcwQUMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MDcyQzJENkNCNTI1MTFFM0I3N0Q5NTg3Q0IyMjcwQUMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4/Os9TAAADvUlEQVR42uyYWWxNURSGz723OiotMbU1N25jKNImIhENfSAh8SDxQgQP7QPxQhAVU1DihYjxwRBCCAktaohZE6EkNIqUmtJWq0LV2On6V/OfZNnO6RXJfXJW8uXuffc9Z5/9r7XX2uf6QqGQ9b+bzxPBE8ETwRPBE+F3i8q+bwXxuRhcAmciJTbYBmaDXWA16AMKwGOw1+GaANgAosEK0BKxSMgqC73G5wD200B1BOYZCcqNBR4Ds9ifAEqNa5aBLWyvA2sjJYJfCSA2MELz1IPPbIsYsgcz1Phwh2v0dxmR3A4iQpPql0dQhCSQCzIpQkCNP3W45rtqv4poTjD6a8Bb7mGhDZSASi5gDjgMrqprZoJp3Otl6vuFIIv7ugqMAWPBG/Cc97Ytj2MBjp8yRJjIvCXjX8Ah0MyxrmAuyGb+qAHF4JbDehPAFNCf95J7nJScIGGa2IlQX8EwcIVh2Qh6chF9QS1/9wKksx1U3j0OFvA+Yh9AbwqZ4zLndD7obpfx62ASf3OXz2HaAc5r21RwkAlZW7X/L6IlgaHcyn40sbgY2+JUu59qy297qb54LsbwtGmDwoyn8LNECVABzoF37M8HK1VOKXEQQCzV3A5lzBE+9kNUVCbooSLDPlw0GxFj20/V/qEEtBjOZk6o4MP7uR33cGvaJiH+jOPfQD631wiO17H8vuTWPMI1SEXZBJYb67zJSG6XuaKMvJCrsrhleDOG7TYuzFxsi4sIfiWqLazPEEEWddvF2xbDuMAYX6TaySyx8RTZnq8LGKWqizhtslmO/cqrYuNcwq+dN7Q4kVMG7+YiQpQxh5+CaWEyHebU0TPapbLpw1i82m62Sb5oUFum1uE80vGAD8F49o+CreCTqhAVDJ8aLlSS6D6wHyxR90pjCF8G69X3ku3fq34sF1jB5Ca2mXmjjp6UcL7ICLEY4jLnA14rz3kBLFUleAZ4Qof5+Gk7IynciVEuPh0mOQ7l4aX4H8pwOhfXpLaTbK3BLL1OJiVwHj3nlPmreN9HPI2K3WNOa2GUtPI4XkknJPM0nOYkgsVElN/JQlaBjSxNOS7bxanS7GB9DxoHokR6XB+Nnd43gi4HKV2Z6jt5bkmUQyhIgJER+8dLSkpex5H8LPjIZBRHNZtJJcO7gQmqO70jW0neOwopYAyv9/EwVKgyfCM9IKVvJzjP70vp1RSW4lZGjIh+h2cKealLZUiHuJAicIL3LWJJtsft5/5O596g6JIct4Nr3qu093+CJ4IngieCJ0J4+yXAANopCw9hh0hVAAAAAElFTkSuQmCC</Image>
|
||||
<Image width="130" height="52">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAAA0CAYAAABGkOCVAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NDkxMSwgMjAxMy8xMC8yOS0xMTo0NzoxNiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjg5QzlEREI0QjUyNjExRTNCNzdEOTU4N0NCMjI3MEFDIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjg5QzlEREI1QjUyNjExRTNCNzdEOTU4N0NCMjI3MEFDIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6ODlDOUREQjJCNTI2MTFFM0I3N0Q5NTg3Q0IyMjcwQUMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6ODlDOUREQjNCNTI2MTFFM0I3N0Q5NTg3Q0IyMjcwQUMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5Ln/UEAAAHKElEQVR42uxca2wVRRTe2wdULUVARDQIkqCmARGKhQBqeBsCKkiImmiML0xUFEs0BImIaDQSH2gQlB9iQlQQUAHFF5QWQbDiI4oIiBCgIE9BaAv03us59rsyjjOzO7s3mC3zJV/a7szszsx+c+acswOJdDrtOTjkuClwcEJwcEJwcEJwcEJwcEJwcEJwcEJwcEJwcEJwcEJwcEJwiIC8Ht/883tXYhFxPfFYzMc1jXgXsY44g/iUok47YgfiVuKukM8pJeYS1zQWi7CI+B2xAhNzTYzHNI9YRjyXeAFxikIIz2GcPN7fiJMtn3EhcS24mriZ2CnOQkiUVKV5kh6Xrh/HYA/GbDy9iV8qrqdh7Y4SRxPfVdQZRlwa8DlfE3tI17YRLyWejKtFeERxvSlxUAzHc5lO8BAC43ZNnTsDPqOjQgQetpnucd4a8jVlBTEcT6Xm+l7iHvye0tTJD/iMFoayc+IshDpNWRxN3BbiWMX1ewQB6MZVH/AZpnon4yqEvEYYCb1C3EQcSkwS5wf06s/oM3smIeyL8bg+AW1Qk4Xn7mmMQigh7kacrHPAThA3aNpmnK85xHU+/RhCHEE8QJyNkM4EzhH0JP5MfFFR3o84Cqb6LeRG/NCW2FkaL4+xlvhLwPnsC0c7V2ifgkD2+rRl/+Jq9KE98Ty04WjkJ+KqCGLlCLAl3nda6FsNrOff4eMR+tksgpi24sWUCy91mUVoxnH+JCl0LcHgVVgKsy+GcgOJR/D3/cRXpTbDiUvw+wLiSMsxcr7gerwY7luVZftaCHaioqw15mAUXr7JQi8kPk3cEeCZFxPHEQcjrNUteg63R2RDCB4sQ3M4nvwCi6XyzeiMjPZQvIz3YSFkDCB+rrg+gfgs8RIIUxU1tMXqDCOEjOBKEaJuDDlPY4ivC39fjgXUxuIeRyHsckOdkbCEQaOYZdn61tAEpprRSlHeSrPFFBvUrEIXn/xBqab8fJ/VFgRXeQ3Zyh0R7iHmKgohrjaW9+B2K4h9NOUTIXabUPa6bH50+lMwgzLqLEOxGsvw7Dh+Jg0RQW4WxlgP0YfFMcnqFUa41xfY90X0J04Nca9UtoSwUXDI0hahWcoylEv5XE8aylMRx/gmzHK7CPd4RnAqB2jq8NZ3I7bSbsSHsfXKYKf0SenaeyH7Nd0UNfC+etjgZCSwQtejs3HHMURJORhbZoxszT4lPoRrpgxkNaxZriRqjhqexypm6NLcy73/pvb5Y+BK4reK+nyf8bCIN3vmrOdOjCVXiog+JpaZhMADf+cMyqksg+fuh6ShbLSn/uglo6fmOvtSr3mnvotknqfbEovgN1Xh2brt9DYk1lKmPELC4J02RiR8/Aw/5ATwk0xoanCGu4I2aI2fnTXlg2BRfAeVb+hwGORonKykxeSfsHxZORH751k4kyZf46yAQmiSRWFvF6yDjF+DiCAzKbqM161ZXHGtNNfzDOGejThTFv2q1ZT3Cji+Q4ayawP6Itmytuw3bDBsWYeC3ohfxDqNJ8xJiXulBEgQ7FOYvkI4S+Ol62WGfEE/xMsi7tPU3+1j9sUVr0sGcXJruqf+eik7XXs1YuUMKZ9YWuXjY+zUtGdnkjOgzX3GwthGfFsYmyrSyrcRAocrN2nKZ6FsJQaQUEzufoQtBwSVlijuVYY9dC5MIx+IGWbo22dew+fjSkwaHy+7QlN3taVTOFlT9qDXkJKdj1WbiSC2o98Z61OpmbNClC2EA5fCHNfheuabC5d111i2l/4Xx6mkKl2EMDEKDsIT3gLzWH4ax8AvqSMmka3YAs0q5BWfOaTKH7U6WD7ne6/hm8Z+WKvlIfo6FVajm6f/ELYJQvwR7yUhLcAErO5aaUHyPFyk6POVQX0E/tbwRMSXwRmumfidrccPp1EID4RIFt0d4jnszU/D7ys0gvMDnw0thtVcpKnDiaSJMPsfeQ0f2ZYIXEz8Cu3PztYkZjzoKV6wT7Um9BX24RGnSQSLvVNfFRkFBv8gT9qLJ4V43kDhd845/B7iHjcIPlh1hLFz9nGCjz/QxFYIjP4BkyE6HBFW5lZ0tN6ive1BmDUKwe2y8PbZTM+wfOYf0t99QrzMaqn9zghz3kPY+vKjhNVixcNY1bNCduplyXP9AE7jlgBtK7DPDw8Y8vBhl96KkKnCUx9Lm+2dOq8ggs8uPOoFP/DxgiJOZwc26Gmoo3AkRc+/i2d/mioDsd08RflcG2dRdb0UeYReeEEFPpaAH/iYQWzs/Q/FPttSCPnWIuL4UKjfQqjP/2ikGSzLdtSf45nPIBagzhC044kf45nPJPI/hLkDbTopkjN7IIKZPtvGLRB/O2mF1iOyGW8IX/thzkvR3pT+r4EPMU6KAN+AlUzinYwNLAT3/yw6WO0hDk4IDk4IDk4IDk4IDk4IDk4IDk4IDk4IbgocnBAcnBAc/o2/BBgAWu+TFRGzndoAAAAASUVORK5CYII=</Image>
|
||||
<SearchForm>https://twitter.com/search/</SearchForm>
|
||||
<Url type="text/html" method="GET" template="https://twitter.com/search">
|
||||
<Param name="q" value="{searchTerms}"/>
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
<Description>Wikipedia, the free encyclopedia</Description>
|
||||
<InputEncoding>UTF-8</InputEncoding>
|
||||
<Image width="16" height="16">data:image/x-icon;base64,AAABAAIAEBAAAAAAAAA4AQAAJgAAACAgAAAAAAAAJAMAAGQBAACJUE5HDQoaCgAAAA1JSERSAAAAEAAAABAIBgAAAB/z/2EAAAEFSURBVDjLxZPRDYJAEESJoQjpgBoM/9IBtoAl4KcUQQlSAjYgJWAH0gPmyNtkzEEuxkQTPzawc3Ozc3MQTc/JfVPR/wW6a+eKQ+Hyfe54B2wvrfXVqXLDfTCMd3j0VHksrTcH9bl2aZq+BCgEwCCPj9E4TdPYGj0C9CYAKdkmBrIIxiIYbvpbb2sSl8AiA+ywAbJE5YLpCImLU/WRDyIAWRgu4k1s4v50ODru4haYSCk4ntkuM0wcMAINXiPKTJQ9CfgB40phBr8DyFjGKkKEhYhCY4iCDgpAYAM2EZBlhJnsZxQUYBNkSkfBvjDd0ttPeR0mxREQ+OhfYOJ6EmL+l/qzn2kGli9cAF3BOfkAAAAASUVORK5CYIKJUE5HDQoaCgAAAA1JSERSAAAAIAAAACAIBgAAAHN6evQAAAIKSURBVFjD7ZdBSgNRDIYLguAB7FLwAkXwBl0JgiDYjQcY8ARduBJKu3I5C0EoWDxAT9AL9AK9QBeCIHQlCM/3DZOSmeZNZ2r1bQyEGV7yXv7kJZlJq6XIOXfs+crzwPPTnvnR863n05ZFufDD/T595Q4eauM37u/pWYwfeX53cegcABcuHg0AkEQE8AKAu4gAXv8BrAEMh0PXbrddt9t1vV4v406nk62laeqm02n2LjKYIuK5WCyyfeiLDF32yLn6TJ5mBFarlev3+9nBMMqsabkYhmezWcEd2ctTE/tYBwhgt14BhtmAV2VaLpdrAHioCW+VdwWy9IMAUBQjJcQFTwGqvcTD+Xy+oc8askZJyAYrnKEokCeWLpQkSSZvBIANYgSDVVEQQJaeyHQu1QIgiQNb6AmrTtaQ9+RFSLa1D4iXgfsrVITloeSFFZlaAEjAUMaXo2DJWQtVRe1OKF5aJUkf0NdglXO5VzQGoI2USwwD3LEl590CtdO3QBoT5WSFV+Q63Oha17ITgMlkslGSGBWPdeNiDR2SL1B6zQFINmOAkFOW5eTSURCdvX6OdUlapaWjsKX0dgOg26/VWHSUKhrPz35ISKwq76R9Wx+kKgC1f0o5mISsypUG3kPj2L/lDzKYvEUwzoh2JtPRdQQAo1jD6afne88H1oTMeH6ZK+x7PB/lQ/CJtvkNEgDh1dr/bVYAAAAASUVORK5CYII=</Image>
|
||||
<Image width="65" height="26">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEEAAAAaCAYAAADovjFxAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NDkxMSwgMjAxMy8xMC8yOS0xMTo0NzoxNiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjA3MkMyRDY5QjUyNTExRTNCNzdEOTU4N0NCMjI3MEFDIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjA3MkMyRDZBQjUyNTExRTNCNzdEOTU4N0NCMjI3MEFDIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MDcyQzJENjdCNTI1MTFFM0I3N0Q5NTg3Q0IyMjcwQUMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MDcyQzJENjhCNTI1MTFFM0I3N0Q5NTg3Q0IyMjcwQUMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7lkNGzAAAELklEQVR42uyYa4hUZRjHn3Nm13X2Mu6urtqutrTeVjRUQikoKUoQLIy8hybiBcVMRdFASPwgQTczsCiMvFYGffBDeANFUDEydc31viheat2dyVndmdmdy57+7/I/+HCcKaX1Q3Re+LHnOe9z3sv/PM/znlnLcRz5vzdb/OaL4Ivgi3C/WV01UCAQkNraWqmpGSCVVVWSl5cnZaXl4jgZaWpugp0viURcwpGIJJMpSba1SY+yUlmy5B3ZuGGDXGlokJKSYkmn0pJOp6UDBbsl2iJFRYVi25bEYjFpwzOtra3S3t4umUxGuqqo53WVCGZR9fX1nZgWDAaxgWIJhUpASGyIFLBtSWKDhcFCScTjuE5JXV2dhMNhSaVS2Kwt0WgUYiU6hTCiRSLNGM2BnYF4yccWCWPB6yAC9oGzYC2Iga/pNx/kg/fBs2AcSICvQOMjT2pZD7xFE0kFBd0lHo89zsiv5d8L3o4nwW+dcotUMDo+p11Jn3YKY/qeY9900P0/lv5hUJ+rswc3Nlnd6wDvgmHgR3V/GfgyS0RZf1NrrEeoR/ZD1rDAPzzrHX8wuEYhcr68E6BV2W9RGJMiI9T9wxzwFfAd+AyUgeFgK/iG9ovgAMcpAIvB92AVNzCJ9hoKu4LjjwabmYrGdwtYyb45nPM98DbYyHW4bSr7Pwb9PPszqTwGnGdUZ22DuekX1L074JSy3wC7eV1C/53clFHXVLEz7Hc3UsG38gz9x7O/F+25oC+vPzI1FVwGN0FP8Dz4gmO4fvPYN5X2LI5ZSvsTT9F/iveEgkZyhc8lTrxd3TPhM1LZ08C3vL7HxRplM6AN/AqOgVGgjhts5sKugyi4qvKzhaKZ4voHGMKCe5oF2qHfIj7TyDGucSM/sH5tY7/p+x1cBGm17vmMgikUsxw8kSv/ZoBqqjiCm7zLsBQ+vMuTl/nKbuTJcdIjpmnduIBuKmfNmfcy570BlrMvzpSap+Z2GG2WZ869nr3Ynn7TngZ7wACKbIRdl+s74QgddlPphVzgh6A/c1g8xbND2b24qD/BLVDk8XWUv8MIKuTCTNinVFjfBh+oY82mv+OZs1SNJ1n6ZzLi1nvWsgksyFUbXuVAO5RQjppENxNynyq7AfzE6xsMyyDtfhxDF1mHkZCtSJ9T9mLWIPeZibzuyejb5hlztVr7ZaaBtzlu5GU7Zi7xW8BU0CaqZt7wfnBI+b0GhvIb4iBD7SWOuYfKr+Px+zN4k3loJj/KojYIFINfmALu6TCW0dGbp0gNj+nZLHI203YCOA6WqtNhEF/OWc45ki/kHOuWzW+cgYyyK//mw8MtLEU8AkMqbIMeP5OjfWj3oU9flUL63C5XZ7zZaJXq66+eGajmdJvrG2LkuHNUco1uLapWdarC8v+z5P+U9kXwRfBF8EXwRfBFyNH+EmAA/FQ613UCCjYAAAAASUVORK5CYII=</Image>
|
||||
<Image width="130" height="52">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAAA0CAYAAABGkOCVAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDIxIDc5LjE1NDkxMSwgMjAxMy8xMC8yOS0xMTo0NzoxNiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjg5QzlEREIwQjUyNjExRTNCNzdEOTU4N0NCMjI3MEFDIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjg5QzlEREIxQjUyNjExRTNCNzdEOTU4N0NCMjI3MEFDIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6ODlDOUREQUVCNTI2MTFFM0I3N0Q5NTg3Q0IyMjcwQUMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6ODlDOUREQUZCNTI2MTFFM0I3N0Q5NTg3Q0IyMjcwQUMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz41D9uwAAAJWElEQVR42uxcCWxURRj+t3t029IiVCyXLSpo0ERFLVAvNJ4oBRUVL7Se4IUXeOIVjaKmgkHxthweiKJGY/HAKxqwaiwYBBESwQtpgdCWtns//6nfi7/je7v72kI0mS/5s7vvn5n3Zuab/3pNfZZlkYFBjlkCA0MEA0MEA0MEA0MEA0MEA0MEA0MEA0MEA0MEA0MEg87B919+OL/fT4FAgELBIF0zZQqVl5dTSZ8SWr1mHY2oqKBYtIWSiSSlLB81bN5EkUiU4ok4BYMBSqZ8FItEqCmVoBhf6xvOJx+PY6VSRHi/krJS5PP5OiTB4+SFcymVTFI797N4TFJ6foatjVsoNxyi3sW7U3t7hOKxCB+hHGppbqFgfh7ts+cgamlvofy8fIrHk+Tj4ROxKK1Y+S21trbRgvnz+NkilOSxU+r+hghdw+DBg6msbBDV1X1FY8ZUUmtbS8fG+nw5VFVVRUWFPamppYlCoSAlkooI7dTMmxlnMvTzSAS1oe1trdSjqIiJsJWJEKRevYs7iBCLMhH8OfwZo2Zus7R2CcWYHIq0hw4fQX5+nveX1FJ9/bfGIuxqDBgwgPLy8ngD4x0bq7baSllUstcgGj9hAoWjfJ03yrIkESwQgU9wIkXh3FAHESLRKBUV7UZlpaW0dt2PFGlro8WLX6eGhoaOE93xxpb7qL7qpDfydRuKDIlkgsi81P0PBkI53kOhIUOG0LRptzAhijrV//8YIwxluZMlxtJCf3HZz1LM8hbLQpYDWe5gaWJhu0ghliBLNctqlqksB7NsYwmz9GCZw/IFy0Uso9E3ylLIkg/dbEPTnY5TWTawfJ+p4R4sN7GsAgmUtLHczXKYaDNb6JVMB1kUjmd5R+hU2z2hG8HyIMa09U+hj8HOhdo3FZ2+7qVTL5bN2KiVLm1mQd/OMlDTjYPuXpe+86EfZvZnl+EWcbD7e+l4jzi1Zzjo+7I0Ql+j6epYfoFbcSKZcjsLzN7sMoQ0Kz/FS+dSllZ0/MSlzf3Qq3b74dpxuHaOS5/roD/Q7M8uwyU4nPZ+feN1gGfRMc5S4WIVtqPNQ7imXMkacq9UbmJZJgLUXBcGO323ERTfA3rtSViioIM+IPr7tbFshNOsScDlmdImK2nmEfRwqp36+7PoW4cAvzcCfLVfI9NNUMfTLBfiIa5kWa7p/0AwOB2s246TPgaBiY7TQZ7r8VtZkWcwmQQ+fSDTVWgzE1lICqI2aS0yELUQL7H0YymCy1Exy40s37FczTIeYybFfdS8XmE5gOVhlgKM7cMixbR4Rrox5SavweYmsW5JCIHYPVmWIINSGAT3aY+fg+dox3xS+P0uywuwsDqRVFZ2CO5jZ3Mq87qV5es0JBjOUs5yLjK5z1hOhMX+0gub38ON1U33colGG4X/eSPNWJ/hYWzkY5NrRP8rVOou03g8tK1fxLK/sCiVQnctAtACu7bEMoplI/Q/sBzK0gd61e4gkMkeYxzIfBRMqLr2srBcfbCwddD9zjKR5TSWsSw3i+vSwgwDqe37TMJ91PzPxLqp6+vgXvXUfjDLWaL/QvQtzLB/i7DuNiah/88gbNY4Udx8hkub6aLNyS5t9oX+dgfdKOh+cnEVhBOu2hytXVfj/cpSlmYOj2vuS8dY6Fdo13uKOOlUlyj8SZf5qHx9d+36kejzmyCrbjHtTKw8wzqcksXe9YO1kfGaSvObMcZYNz/mhA+ECbkUfkbHAuEK3HzPZfic46ArEM9Q5KCXfl+eAHUSb8MmbczCv7qRLE/cR6JJFF+GuMQRuS6Wb6bDXDLN8024gDDis5DLWtjWNBOuByFfFde2ilrC+V6IQKLqpxhe5aAfIPpPhrvQF2AyxtnexQg4IU7X04gDVu7k1IsQf6R7HsIhuRzfH4OF84q5+FQu69guPHcAcdRH9O+3HfPxWYm9y5oIb7OsFz5GN2vVqBsov1iCTZc4Dye5O8rIO2B1aumvcvj8btx0PcBVzzwU35elKb6Voah2l2aGO/O66Xe4OoVjujCX0dgLZS3fRwngUwSxDwhLeK4XIuxAdG/7+tOErhIbczFMG+GUFos2KnVZikCoq3gB2UthmvpGZ1GAoEwFhHsjiAyhuLbGpc8RMOM1qJH80cVniCCGIK8VQA1Xw/o+D/em4p96ZFy1SALIiQiZoMz9ZoeCRD0iUBkMKZmGa8dmEdycgjYbRUSv+8Xv0eZhTE59X410NBOeQftZLvoJ0Dchyp6LhVqG9NkJd4vovT9M7HQtQtdxEvpsQiDnBBVzfI52zzvo7XU4M819hqLNJWnaVIhUtMIrGarFRg9DXqs/1MdiU1Xa8yICFuomItjvJz7E7+UZCkBeiLAClmyYS6rsRIRntYh8YheJ0EPM9Z5OEuEJkLogQ5HLTo8fzdY1yKDRLrY8CllF/3yjNVOUqFWGcAJOcXfBfsE1Hq5mJAKz7oAfUXW9h0DPr0XkC8R6FnbiGQpFhrK0k+7tKtQ+WjPEQ2+LtezphQgb4DftQGYU/L/EhyKKn4xCVE2WmUBKVOgkZOUuis9mpD9tKEJNTTN+Uvt003sJ7uLap44bHNxKMsM8CUWjIAI7pwDVcshW9JRR4bks5rAQNYtSFNA8YTgmYptlp9L0JOFCbs5izLPRdrtD6mlHt5vQZoKmu0Dc64I01TULgaYTqqBf72Ed5qBPrYPucJYGnDSJcaJKW+pQPZwI/VqntA6HdQPaOKXx+4EgjR7mUY/xvszgShzxCTpXuujzUUqO07//VkGiP8z6L2Izl+OE24tzKU6GJchyB/3zZc0XQl8rgh/lkxcLnYrI54miVxnihs2izTLc3+1vOEeCWAm0Vyf7LQSYNUjPLByWElF/mYENlvO8DylwNSzpr3AtJQ4EqBLxl4XsZBbWdyCqp1uEfgkOYaGL+1AW6zURMFqoWt4X8EAE9VJH1ezfcdG3IS3JFTmxW8CyDRNqwuIP1MxtApOai8XtiwmHRLtb8TxRBJs+4b9XIZJvBUF3E1YsgFStGic4DIsUyfDM67GQTfjdQyxmLsj0IwhmP4edgm/D8/Whv1+0qXavYKM3uNzT/nOARZh3Ma4HMZ6axyNYmyDIF3ex2DlYq3qszQ6sZzE5vyw0MDAwMDAwMDAwQKpm/uGmgZ1SGBgYIhgYIhgYIhgYIhgYIhgYIhgYIhgYIhgYIhh4w58CDAAL8AVXFSeKUgAAAABJRU5ErkJggg==</Image>
|
||||
<Url type="application/x-suggestions+json" method="GET" template="http://en.wikipedia.org/w/api.php">
|
||||
<Param name="action" value="opensearch"/>
|
||||
<Param name="search" value="{searchTerms}"/>
|
||||
|
|
|
@ -35,6 +35,8 @@ const TOPIC_TIMER_CALLBACK = "timer-callback";
|
|||
const TOPIC_DELAYED_STARTUP = "browser-delayed-startup-finished";
|
||||
const TOPIC_XUL_WINDOW_CLOSED = "xul-window-destroyed";
|
||||
|
||||
const BROWSER_CONTENT_SCRIPT = "chrome://browser/content/content.js";
|
||||
|
||||
function createTimer(obj, delay) {
|
||||
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
timer.init(obj, delay, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
|
@ -321,9 +323,14 @@ HiddenBrowser.prototype = {
|
|||
tabbrowser.swapNewTabWithBrowser(aTab, this._browser);
|
||||
|
||||
// Load all delayed frame scripts attached to the "browers" message manager.
|
||||
// The browser content script was already loaded, so don't load it again.
|
||||
let mm = aTab.linkedBrowser.messageManager;
|
||||
let scripts = win.getGroupMessageManager("browsers").getDelayedFrameScripts();
|
||||
Array.forEach(scripts, ([script, runGlobal]) => mm.loadFrameScript(script, true, runGlobal));
|
||||
Array.forEach(scripts, ([script, runGlobal]) => {
|
||||
if (script != BROWSER_CONTENT_SCRIPT) {
|
||||
mm.loadFrameScript(script, true, runGlobal);
|
||||
}
|
||||
});
|
||||
|
||||
// Remove the browser, it will be recreated by a timer.
|
||||
this._removeBrowser();
|
||||
|
@ -371,6 +378,9 @@ HiddenBrowser.prototype = {
|
|||
|
||||
// Let the docShell be inactive so that document.hidden=true.
|
||||
this._browser.docShell.isActive = false;
|
||||
|
||||
this._browser.messageManager.loadFrameScript(BROWSER_CONTENT_SCRIPT,
|
||||
true);
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -10,12 +10,9 @@ this.EXPORTED_SYMBOLS = [
|
|||
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
"resource://gre/modules/Promise.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
|
||||
const INBOUND_MESSAGE = "ContentSearch";
|
||||
const OUTBOUND_MESSAGE = INBOUND_MESSAGE;
|
||||
|
@ -47,13 +44,22 @@ const OUTBOUND_MESSAGE = INBOUND_MESSAGE;
|
|||
* CurrentEngine
|
||||
* Sent when the current engine changes.
|
||||
* data: see _currentEngineObj
|
||||
* CurrentState
|
||||
* Sent when the current search state changes.
|
||||
* data: see _currentStateObj
|
||||
* State
|
||||
* Sent in reply to GetState and when the state changes.
|
||||
* Sent in reply to GetState.
|
||||
* data: see _currentStateObj
|
||||
*/
|
||||
|
||||
this.ContentSearch = {
|
||||
|
||||
// Inbound events are queued and processed in FIFO order instead of handling
|
||||
// them immediately, which would result in non-FIFO responses due to the
|
||||
// asynchrononicity added by converting image data URIs to ArrayBuffers.
|
||||
_eventQueue: [],
|
||||
_currentEvent: null,
|
||||
|
||||
init: function () {
|
||||
Cc["@mozilla.org/globalmessagemanager;1"].
|
||||
getService(Ci.nsIMessageListenerManager).
|
||||
|
@ -62,19 +68,64 @@ this.ContentSearch = {
|
|||
},
|
||||
|
||||
receiveMessage: function (msg) {
|
||||
let methodName = "on" + msg.data.type;
|
||||
if (methodName in this) {
|
||||
this._initService().then(() => {
|
||||
this[methodName](msg, msg.data.data);
|
||||
// Add a temporary event handler that exists only while the message is in
|
||||
// the event queue. If the message's source docshell changes browsers in
|
||||
// the meantime, then we need to update msg.target. event.detail will be
|
||||
// the docshell's new parent <xul:browser> element.
|
||||
msg.handleEvent = function (event) {
|
||||
this.target = event.detail;
|
||||
};
|
||||
msg.target.addEventListener("SwapDocShells", msg, true);
|
||||
|
||||
this._eventQueue.push({
|
||||
type: "Message",
|
||||
data: msg,
|
||||
});
|
||||
this._processEventQueue();
|
||||
},
|
||||
|
||||
observe: function (subj, topic, data) {
|
||||
switch (topic) {
|
||||
case "browser-search-engine-modified":
|
||||
this._eventQueue.push({
|
||||
type: "Observe",
|
||||
data: data,
|
||||
});
|
||||
this._processEventQueue();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
onGetState: function (msg, data) {
|
||||
this._reply(msg, "State", this._currentStateObj());
|
||||
_processEventQueue: Task.async(function* () {
|
||||
if (this._currentEvent || !this._eventQueue.length) {
|
||||
return;
|
||||
}
|
||||
this._currentEvent = this._eventQueue.shift();
|
||||
try {
|
||||
yield this["_on" + this._currentEvent.type](this._currentEvent.data);
|
||||
}
|
||||
finally {
|
||||
this._currentEvent = null;
|
||||
this._processEventQueue();
|
||||
}
|
||||
}),
|
||||
|
||||
_onMessage: Task.async(function* (msg) {
|
||||
let methodName = "_onMessage" + msg.data.type;
|
||||
if (methodName in this) {
|
||||
yield this._initService();
|
||||
yield this[methodName](msg, msg.data.data);
|
||||
msg.target.removeEventListener("SwapDocShells", msg, true);
|
||||
}
|
||||
}),
|
||||
|
||||
_onMessageGetState: function (msg, data) {
|
||||
return this._currentStateObj().then(state => {
|
||||
this._reply(msg, "State", state);
|
||||
});
|
||||
},
|
||||
|
||||
onSearch: function (msg, data) {
|
||||
_onMessageSearch: function (msg, data) {
|
||||
let expectedDataProps = [
|
||||
"engineName",
|
||||
"searchString",
|
||||
|
@ -83,7 +134,7 @@ this.ContentSearch = {
|
|||
for (let prop of expectedDataProps) {
|
||||
if (!(prop in data)) {
|
||||
Cu.reportError("Message data missing required property: " + prop);
|
||||
return;
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
let browserWin = msg.target.ownerDocument.defaultView;
|
||||
|
@ -91,38 +142,36 @@ this.ContentSearch = {
|
|||
browserWin.BrowserSearch.recordSearchInHealthReport(engine, data.whence);
|
||||
let submission = engine.getSubmission(data.searchString, "", data.whence);
|
||||
browserWin.loadURI(submission.uri.spec, null, submission.postData);
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
onSetCurrentEngine: function (msg, data) {
|
||||
_onMessageSetCurrentEngine: function (msg, data) {
|
||||
Services.search.currentEngine = Services.search.getEngineByName(data);
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
onManageEngines: function (msg, data) {
|
||||
_onMessageManageEngines: function (msg, data) {
|
||||
let browserWin = msg.target.ownerDocument.defaultView;
|
||||
browserWin.BrowserSearch.searchBar.openManager(null);
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
||||
observe: function (subj, topic, data) {
|
||||
this._initService().then(() => {
|
||||
switch (topic) {
|
||||
case "browser-search-engine-modified":
|
||||
if (data == "engine-current") {
|
||||
this._broadcast("CurrentEngine", this._currentEngineObj());
|
||||
}
|
||||
else if (data != "engine-default") {
|
||||
// engine-default is always sent with engine-current and isn't
|
||||
// otherwise relevant to content searches.
|
||||
this._broadcast("State", this._currentStateObj());
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
},
|
||||
_onObserve: Task.async(function* (data) {
|
||||
if (data == "engine-current") {
|
||||
let engine = yield this._currentEngineObj();
|
||||
this._broadcast("CurrentEngine", engine);
|
||||
}
|
||||
else if (data != "engine-default") {
|
||||
// engine-default is always sent with engine-current and isn't otherwise
|
||||
// relevant to content searches.
|
||||
let state = yield this._currentStateObj();
|
||||
this._broadcast("CurrentState", state);
|
||||
}
|
||||
}),
|
||||
|
||||
_reply: function (msg, type, data) {
|
||||
// Due to _initService, we reply asyncly to messages, and by the time we
|
||||
// reply the browser we're responding to may have been destroyed. In that
|
||||
// case messageManager is null.
|
||||
// We reply asyncly to messages, and by the time we reply the browser we're
|
||||
// responding to may have been destroyed. messageManager is null then.
|
||||
if (msg.target.messageManager) {
|
||||
msg.target.messageManager.sendAsyncMessage(...this._msgArgs(type, data));
|
||||
}
|
||||
|
@ -141,24 +190,47 @@ this.ContentSearch = {
|
|||
}];
|
||||
},
|
||||
|
||||
_currentStateObj: function () {
|
||||
return {
|
||||
engines: Services.search.getVisibleEngines().map(engine => {
|
||||
return {
|
||||
name: engine.name,
|
||||
iconURI: engine.getIconURLBySize(16, 16),
|
||||
};
|
||||
}),
|
||||
currentEngine: this._currentEngineObj(),
|
||||
_currentStateObj: Task.async(function* () {
|
||||
let state = {
|
||||
engines: [],
|
||||
currentEngine: yield this._currentEngineObj(),
|
||||
};
|
||||
},
|
||||
for (let engine of Services.search.getVisibleEngines()) {
|
||||
let uri = engine.getIconURLBySize(16, 16);
|
||||
state.engines.push({
|
||||
name: engine.name,
|
||||
iconBuffer: yield this._arrayBufferFromDataURI(uri),
|
||||
});
|
||||
}
|
||||
return state;
|
||||
}),
|
||||
|
||||
_currentEngineObj: function () {
|
||||
return {
|
||||
name: Services.search.currentEngine.name,
|
||||
logoURI: Services.search.currentEngine.getIconURLBySize(65, 26),
|
||||
logo2xURI: Services.search.currentEngine.getIconURLBySize(130, 52),
|
||||
_currentEngineObj: Task.async(function* () {
|
||||
let engine = Services.search.currentEngine;
|
||||
let uri1x = engine.getIconURLBySize(65, 26);
|
||||
let uri2x = engine.getIconURLBySize(130, 52);
|
||||
let obj = {
|
||||
name: engine.name,
|
||||
logoBuffer: yield this._arrayBufferFromDataURI(uri1x),
|
||||
logo2xBuffer: yield this._arrayBufferFromDataURI(uri2x),
|
||||
};
|
||||
return obj;
|
||||
}),
|
||||
|
||||
_arrayBufferFromDataURI: function (uri) {
|
||||
if (!uri) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
let deferred = Promise.defer();
|
||||
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
|
||||
createInstance(Ci.nsIXMLHttpRequest);
|
||||
xhr.open("GET", uri, true);
|
||||
xhr.responseType = "arraybuffer";
|
||||
xhr.onloadend = () => {
|
||||
deferred.resolve(xhr.response);
|
||||
};
|
||||
xhr.send();
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
_initService: function () {
|
||||
|
|
|
@ -6,55 +6,22 @@ const TEST_MSG = "ContentSearchTest";
|
|||
const CONTENT_SEARCH_MSG = "ContentSearch";
|
||||
const TEST_CONTENT_SCRIPT_BASENAME = "contentSearch.js";
|
||||
|
||||
function generatorTest() {
|
||||
// nextStep() drives the iterator returned by this function. This function's
|
||||
// iterator in turn drives the iterator of each test below.
|
||||
let currentTestIter = yield startNextTest();
|
||||
let arg = undefined;
|
||||
while (currentTestIter) {
|
||||
try {
|
||||
currentTestIter.send(arg);
|
||||
arg = yield null;
|
||||
}
|
||||
catch (err if err instanceof StopIteration) {
|
||||
currentTestIter = yield startNextTest();
|
||||
arg = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function startNextTest() {
|
||||
if (!gTests.length) {
|
||||
setTimeout(() => nextStep(null), 0);
|
||||
return;
|
||||
}
|
||||
let nextTestGen = gTests.shift();
|
||||
let nextTestIter = nextTestGen();
|
||||
addTab(() => {
|
||||
info("Starting test " + nextTestGen.name);
|
||||
nextStep(nextTestIter);
|
||||
});
|
||||
}
|
||||
|
||||
function addTest(testGen) {
|
||||
gTests.push(testGen);
|
||||
}
|
||||
|
||||
var gTests = [];
|
||||
var gMsgMan;
|
||||
|
||||
addTest(function GetState() {
|
||||
add_task(function* GetState() {
|
||||
yield addTab();
|
||||
gMsgMan.sendAsyncMessage(TEST_MSG, {
|
||||
type: "GetState",
|
||||
});
|
||||
let msg = yield waitForTestMsg("State");
|
||||
checkMsg(msg, {
|
||||
type: "State",
|
||||
data: currentStateObj(),
|
||||
data: yield currentStateObj(),
|
||||
});
|
||||
});
|
||||
|
||||
addTest(function SetCurrentEngine() {
|
||||
add_task(function* SetCurrentEngine() {
|
||||
yield addTab();
|
||||
let newCurrentEngine = null;
|
||||
let oldCurrentEngine = Services.search.currentEngine;
|
||||
let engines = Services.search.getVisibleEngines();
|
||||
|
@ -73,39 +40,38 @@ addTest(function SetCurrentEngine() {
|
|||
type: "SetCurrentEngine",
|
||||
data: newCurrentEngine.name,
|
||||
});
|
||||
let deferred = Promise.defer();
|
||||
Services.obs.addObserver(function obs(subj, topic, data) {
|
||||
info("Test observed " + data);
|
||||
if (data == "engine-current") {
|
||||
ok(true, "Test observed engine-current");
|
||||
Services.obs.removeObserver(obs, "browser-search-engine-modified", false);
|
||||
nextStep();
|
||||
deferred.resolve();
|
||||
}
|
||||
}, "browser-search-engine-modified", false);
|
||||
let searchPromise = waitForTestMsg("CurrentEngine");
|
||||
info("Waiting for test to observe engine-current...");
|
||||
waitForTestMsg("CurrentEngine");
|
||||
let maybeMsg1 = yield null;
|
||||
let maybeMsg2 = yield null;
|
||||
let msg = maybeMsg1 || maybeMsg2;
|
||||
ok(!!msg,
|
||||
"Sanity check: One of the yields is for waitForTestMsg and should have " +
|
||||
"therefore produced a message object");
|
||||
yield deferred.promise;
|
||||
let msg = yield searchPromise;
|
||||
checkMsg(msg, {
|
||||
type: "CurrentEngine",
|
||||
data: currentEngineObj(newCurrentEngine),
|
||||
data: yield currentEngineObj(newCurrentEngine),
|
||||
});
|
||||
|
||||
Services.search.currentEngine = oldCurrentEngine;
|
||||
let msg = yield waitForTestMsg("CurrentEngine");
|
||||
checkMsg(msg, {
|
||||
type: "CurrentEngine",
|
||||
data: currentEngineObj(oldCurrentEngine),
|
||||
data: yield currentEngineObj(oldCurrentEngine),
|
||||
});
|
||||
});
|
||||
|
||||
addTest(function ManageEngines() {
|
||||
add_task(function* ManageEngines() {
|
||||
yield addTab();
|
||||
gMsgMan.sendAsyncMessage(TEST_MSG, {
|
||||
type: "ManageEngines",
|
||||
});
|
||||
let deferred = Promise.defer();
|
||||
let winWatcher = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
||||
getService(Ci.nsIWindowWatcher);
|
||||
winWatcher.registerNotification(function onOpen(subj, topic, data) {
|
||||
|
@ -119,33 +85,35 @@ addTest(function ManageEngines() {
|
|||
is(subj.opener, window,
|
||||
"Search engine manager opener should be this chrome window");
|
||||
subj.close();
|
||||
nextStep();
|
||||
deferred.resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
info("Waiting for search engine manager window to open...");
|
||||
yield null;
|
||||
yield deferred.promise;
|
||||
});
|
||||
|
||||
addTest(function modifyEngine() {
|
||||
add_task(function* modifyEngine() {
|
||||
yield addTab();
|
||||
let engine = Services.search.currentEngine;
|
||||
let oldAlias = engine.alias;
|
||||
engine.alias = "ContentSearchTest";
|
||||
let msg = yield waitForTestMsg("State");
|
||||
let msg = yield waitForTestMsg("CurrentState");
|
||||
checkMsg(msg, {
|
||||
type: "State",
|
||||
data: currentStateObj(),
|
||||
type: "CurrentState",
|
||||
data: yield currentStateObj(),
|
||||
});
|
||||
engine.alias = oldAlias;
|
||||
msg = yield waitForTestMsg("State");
|
||||
msg = yield waitForTestMsg("CurrentState");
|
||||
checkMsg(msg, {
|
||||
type: "State",
|
||||
data: currentStateObj(),
|
||||
type: "CurrentState",
|
||||
data: yield currentStateObj(),
|
||||
});
|
||||
});
|
||||
|
||||
addTest(function search() {
|
||||
add_task(function* search() {
|
||||
yield addTab();
|
||||
let engine = Services.search.currentEngine;
|
||||
let data = {
|
||||
engineName: engine.name,
|
||||
|
@ -158,6 +126,7 @@ addTest(function search() {
|
|||
});
|
||||
let submissionURL =
|
||||
engine.getSubmission(data.searchString, "", data.whence).uri.spec;
|
||||
let deferred = Promise.defer();
|
||||
let listener = {
|
||||
onStateChange: function (webProg, req, flags, status) {
|
||||
let url = req.originalURI.spec;
|
||||
|
@ -168,35 +137,38 @@ addTest(function search() {
|
|||
gBrowser.removeProgressListener(listener);
|
||||
ok(true, "Search URL loaded");
|
||||
req.cancel(Components.results.NS_ERROR_FAILURE);
|
||||
nextStep();
|
||||
deferred.resolve();
|
||||
}
|
||||
}
|
||||
};
|
||||
gBrowser.addProgressListener(listener);
|
||||
info("Waiting for search URL to load: " + submissionURL);
|
||||
yield null;
|
||||
yield deferred.promise;
|
||||
});
|
||||
|
||||
function checkMsg(actualMsg, expectedMsgData) {
|
||||
SimpleTest.isDeeply(actualMsg.data, expectedMsgData, "Checking message");
|
||||
}
|
||||
|
||||
function waitForMsg(name, type, callback) {
|
||||
function waitForMsg(name, type) {
|
||||
let deferred = Promise.defer();
|
||||
info("Waiting for " + name + " message " + type + "...");
|
||||
gMsgMan.addMessageListener(name, function onMsg(msg) {
|
||||
info("Received " + name + " message " + msg.data.type + "\n");
|
||||
if (msg.data.type == type) {
|
||||
gMsgMan.removeMessageListener(name, onMsg);
|
||||
(callback || nextStep)(msg);
|
||||
deferred.resolve(msg);
|
||||
}
|
||||
});
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function waitForTestMsg(type, callback) {
|
||||
waitForMsg(TEST_MSG, type, callback);
|
||||
function waitForTestMsg(type) {
|
||||
return waitForMsg(TEST_MSG, type);
|
||||
}
|
||||
|
||||
function addTab(onLoad) {
|
||||
function addTab() {
|
||||
let deferred = Promise.defer();
|
||||
let tab = gBrowser.addTab();
|
||||
gBrowser.selectedTab = tab;
|
||||
tab.linkedBrowser.addEventListener("load", function load() {
|
||||
|
@ -207,34 +179,57 @@ function addTab(onLoad) {
|
|||
type: "AddToWhitelist",
|
||||
data: ["about:blank"],
|
||||
});
|
||||
waitForMsg(CONTENT_SEARCH_MSG, "AddToWhitelistAck", () => {
|
||||
waitForMsg(CONTENT_SEARCH_MSG, "AddToWhitelistAck").then(() => {
|
||||
gMsgMan.loadFrameScript(url, false);
|
||||
onLoad();
|
||||
deferred.resolve();
|
||||
});
|
||||
}, true);
|
||||
registerCleanupFunction(() => gBrowser.removeTab(tab));
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function currentStateObj() {
|
||||
return {
|
||||
engines: Services.search.getVisibleEngines().map(engine => {
|
||||
return {
|
||||
return Task.spawn(function* () {
|
||||
let state = {
|
||||
engines: [],
|
||||
currentEngine: yield currentEngineObj(),
|
||||
};
|
||||
for (let engine of Services.search.getVisibleEngines()) {
|
||||
let uri = engine.getIconURLBySize(16, 16);
|
||||
state.engines.push({
|
||||
name: engine.name,
|
||||
iconURI: engine.getIconURLBySize(16, 16),
|
||||
};
|
||||
}),
|
||||
currentEngine: currentEngineObj(),
|
||||
};
|
||||
iconBuffer: yield arrayBufferFromDataURI(uri),
|
||||
});
|
||||
}
|
||||
return state;
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
function currentEngineObj(expectedCurrentEngine) {
|
||||
if (expectedCurrentEngine) {
|
||||
is(Services.search.currentEngine.name, expectedCurrentEngine.name,
|
||||
"Sanity check: expected current engine");
|
||||
}
|
||||
return {
|
||||
name: Services.search.currentEngine.name,
|
||||
logoURI: Services.search.currentEngine.getIconURLBySize(65, 26),
|
||||
logo2xURI: Services.search.currentEngine.getIconURLBySize(130, 52),
|
||||
};
|
||||
function currentEngineObj() {
|
||||
return Task.spawn(function* () {
|
||||
let engine = Services.search.currentEngine;
|
||||
let uri1x = engine.getIconURLBySize(65, 26);
|
||||
let uri2x = engine.getIconURLBySize(130, 52);
|
||||
return {
|
||||
name: engine.name,
|
||||
logoBuffer: yield arrayBufferFromDataURI(uri1x),
|
||||
logo2xBuffer: yield arrayBufferFromDataURI(uri2x),
|
||||
};
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
function arrayBufferFromDataURI(uri) {
|
||||
if (!uri) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
let deferred = Promise.defer();
|
||||
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
|
||||
createInstance(Ci.nsIXMLHttpRequest);
|
||||
xhr.open("GET", uri, true);
|
||||
xhr.responseType = "arraybuffer";
|
||||
xhr.onloadend = () => {
|
||||
deferred.resolve(xhr.response);
|
||||
};
|
||||
xhr.send();
|
||||
return deferred.promise;
|
||||
}
|
||||
|
|
|
@ -1945,8 +1945,8 @@ GK_ATOM(onratechange, "onratechange")
|
|||
GK_ATOM(ondurationchange, "ondurationchange")
|
||||
GK_ATOM(onvolumechange, "onvolumechange")
|
||||
GK_ATOM(onaddtrack, "onaddtrack")
|
||||
GK_ATOM(oncontrollerchange, "oncontrollerchange")
|
||||
GK_ATOM(oncuechange, "oncuechange")
|
||||
GK_ATOM(oncurrentchange, "oncurrentchange")
|
||||
GK_ATOM(onenter, "onenter")
|
||||
GK_ATOM(onexit, "onexit")
|
||||
GK_ATOM(onneedkey, "onneedkey")
|
||||
|
|
|
@ -40,7 +40,7 @@ SVGMatrix::SetA(float aA, ErrorResult& rv)
|
|||
}
|
||||
|
||||
gfxMatrix mx = GetMatrix();
|
||||
mx.xx = aA;
|
||||
mx._11 = aA;
|
||||
SetMatrix(mx);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ SVGMatrix::SetB(float aB, ErrorResult& rv)
|
|||
}
|
||||
|
||||
gfxMatrix mx = GetMatrix();
|
||||
mx.yx = aB;
|
||||
mx._12 = aB;
|
||||
SetMatrix(mx);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ SVGMatrix::SetC(float aC, ErrorResult& rv)
|
|||
}
|
||||
|
||||
gfxMatrix mx = GetMatrix();
|
||||
mx.xy = aC;
|
||||
mx._21 = aC;
|
||||
SetMatrix(mx);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ SVGMatrix::SetD(float aD, ErrorResult& rv)
|
|||
}
|
||||
|
||||
gfxMatrix mx = GetMatrix();
|
||||
mx.yy = aD;
|
||||
mx._22 = aD;
|
||||
SetMatrix(mx);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ SVGMatrix::SetE(float aE, ErrorResult& rv)
|
|||
}
|
||||
|
||||
gfxMatrix mx = GetMatrix();
|
||||
mx.x0 = aE;
|
||||
mx._31 = aE;
|
||||
SetMatrix(mx);
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ SVGMatrix::SetF(float aF, ErrorResult& rv)
|
|||
}
|
||||
|
||||
gfxMatrix mx = GetMatrix();
|
||||
mx.y0 = aF;
|
||||
mx._32 = aF;
|
||||
SetMatrix(mx);
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ SVGMatrix::FlipX()
|
|||
{
|
||||
const gfxMatrix& mx = GetMatrix();
|
||||
nsRefPtr<SVGMatrix> matrix =
|
||||
new SVGMatrix(gfxMatrix(-mx.xx, -mx.yx, mx.xy, mx.yy, mx.x0, mx.y0));
|
||||
new SVGMatrix(gfxMatrix(-mx._11, -mx._12, mx._21, mx._22, mx._31, mx._32));
|
||||
return matrix.forget();
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ SVGMatrix::FlipY()
|
|||
{
|
||||
const gfxMatrix& mx = GetMatrix();
|
||||
nsRefPtr<SVGMatrix> matrix =
|
||||
new SVGMatrix(gfxMatrix(mx.xx, mx.yx, -mx.xy, -mx.yy, mx.x0, mx.y0));
|
||||
new SVGMatrix(gfxMatrix(mx._11, mx._12, -mx._21, -mx._22, mx._31, mx._32));
|
||||
return matrix.forget();
|
||||
}
|
||||
|
||||
|
@ -199,9 +199,9 @@ SVGMatrix::SkewX(float angle, ErrorResult& rv)
|
|||
}
|
||||
|
||||
const gfxMatrix& mx = GetMatrix();
|
||||
gfxMatrix skewMx(mx.xx, mx.yx,
|
||||
(float) (mx.xy + mx.xx*ta), (float) (mx.yy + mx.yx*ta),
|
||||
mx.x0, mx.y0);
|
||||
gfxMatrix skewMx(mx._11, mx._12,
|
||||
(float) (mx._21 + mx._11*ta), (float) (mx._22 + mx._12*ta),
|
||||
mx._31, mx._32);
|
||||
nsRefPtr<SVGMatrix> matrix = new SVGMatrix(skewMx);
|
||||
return matrix.forget();
|
||||
}
|
||||
|
@ -216,9 +216,9 @@ SVGMatrix::SkewY(float angle, ErrorResult& rv)
|
|||
}
|
||||
|
||||
const gfxMatrix& mx = GetMatrix();
|
||||
gfxMatrix skewMx((float) (mx.xx + mx.xy*ta), (float) (mx.yx + mx.yy*ta),
|
||||
mx.xy, mx.yy,
|
||||
mx.x0, mx.y0);
|
||||
gfxMatrix skewMx((float) (mx._11 + mx._21*ta), (float) (mx._12 + mx._22*ta),
|
||||
mx._21, mx._22,
|
||||
mx._31, mx._32);
|
||||
|
||||
nsRefPtr<SVGMatrix> matrix = new SVGMatrix(skewMx);
|
||||
return matrix.forget();
|
||||
|
|
|
@ -83,17 +83,17 @@ public:
|
|||
SVGTransform* GetParentObject() const;
|
||||
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
||||
float A() const { return static_cast<float>(GetMatrix().xx); }
|
||||
float A() const { return static_cast<float>(GetMatrix()._11); }
|
||||
void SetA(float aA, ErrorResult& rv);
|
||||
float B() const { return static_cast<float>(GetMatrix().yx); }
|
||||
float B() const { return static_cast<float>(GetMatrix()._12); }
|
||||
void SetB(float aB, ErrorResult& rv);
|
||||
float C() const { return static_cast<float>(GetMatrix().xy); }
|
||||
float C() const { return static_cast<float>(GetMatrix()._21); }
|
||||
void SetC(float aC, ErrorResult& rv);
|
||||
float D() const { return static_cast<float>(GetMatrix().yy); }
|
||||
float D() const { return static_cast<float>(GetMatrix()._22); }
|
||||
void SetD(float aD, ErrorResult& rv);
|
||||
float E() const { return static_cast<float>(GetMatrix().x0); }
|
||||
float E() const { return static_cast<float>(GetMatrix()._31); }
|
||||
void SetE(float aE, ErrorResult& rv);
|
||||
float F() const { return static_cast<float>(GetMatrix().y0); }
|
||||
float F() const { return static_cast<float>(GetMatrix()._32); }
|
||||
void SetF(float aF, ErrorResult& rv);
|
||||
already_AddRefed<SVGMatrix> Multiply(SVGMatrix& aMatrix);
|
||||
already_AddRefed<SVGMatrix> Inverse(ErrorResult& aRv);
|
||||
|
|
|
@ -206,7 +206,7 @@ SVGTransform::SetTranslate(float tx, float ty, ErrorResult& rv)
|
|||
}
|
||||
|
||||
if (Transform().Type() == SVG_TRANSFORM_TRANSLATE &&
|
||||
Matrixgfx().x0 == tx && Matrixgfx().y0 == ty) {
|
||||
Matrixgfx()._31 == tx && Matrixgfx()._32 == ty) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ SVGTransform::SetScale(float sx, float sy, ErrorResult& rv)
|
|||
}
|
||||
|
||||
if (Transform().Type() == SVG_TRANSFORM_SCALE &&
|
||||
Matrixgfx().xx == sx && Matrixgfx().yy == sy) {
|
||||
Matrixgfx()._11 == sx && Matrixgfx()._22 == sy) {
|
||||
return;
|
||||
}
|
||||
AutoChangeTransformNotifier notifier(this);
|
||||
|
|
|
@ -23,14 +23,14 @@ nsSVGTransform::GetValueAsString(nsAString& aValue) const
|
|||
switch (mType) {
|
||||
case SVG_TRANSFORM_TRANSLATE:
|
||||
// The spec say that if Y is not provided, it is assumed to be zero.
|
||||
if (mMatrix.y0 != 0)
|
||||
if (mMatrix._32 != 0)
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
|
||||
MOZ_UTF16("translate(%g, %g)"),
|
||||
mMatrix.x0, mMatrix.y0);
|
||||
mMatrix._31, mMatrix._32);
|
||||
else
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
|
||||
MOZ_UTF16("translate(%g)"),
|
||||
mMatrix.x0);
|
||||
mMatrix._31);
|
||||
break;
|
||||
case SVG_TRANSFORM_ROTATE:
|
||||
if (mOriginX != 0.0f || mOriginY != 0.0f)
|
||||
|
@ -42,12 +42,12 @@ nsSVGTransform::GetValueAsString(nsAString& aValue) const
|
|||
MOZ_UTF16("rotate(%g)"), mAngle);
|
||||
break;
|
||||
case SVG_TRANSFORM_SCALE:
|
||||
if (mMatrix.xx != mMatrix.yy)
|
||||
if (mMatrix._11 != mMatrix._22)
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
|
||||
MOZ_UTF16("scale(%g, %g)"), mMatrix.xx, mMatrix.yy);
|
||||
MOZ_UTF16("scale(%g, %g)"), mMatrix._11, mMatrix._22);
|
||||
else
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
|
||||
MOZ_UTF16("scale(%g)"), mMatrix.xx);
|
||||
MOZ_UTF16("scale(%g)"), mMatrix._11);
|
||||
break;
|
||||
case SVG_TRANSFORM_SKEWX:
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
|
||||
|
@ -60,9 +60,9 @@ nsSVGTransform::GetValueAsString(nsAString& aValue) const
|
|||
case SVG_TRANSFORM_MATRIX:
|
||||
nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(char16_t),
|
||||
MOZ_UTF16("matrix(%g, %g, %g, %g, %g, %g)"),
|
||||
mMatrix.xx, mMatrix.yx,
|
||||
mMatrix.xy, mMatrix.yy,
|
||||
mMatrix.x0, mMatrix.y0);
|
||||
mMatrix._11, mMatrix._12,
|
||||
mMatrix._21, mMatrix._22,
|
||||
mMatrix._31, mMatrix._32);
|
||||
break;
|
||||
default:
|
||||
buf[0] = '\0';
|
||||
|
@ -90,8 +90,8 @@ nsSVGTransform::SetTranslate(float aTx, float aTy)
|
|||
{
|
||||
mType = SVG_TRANSFORM_TRANSLATE;
|
||||
mMatrix.Reset();
|
||||
mMatrix.x0 = aTx;
|
||||
mMatrix.y0 = aTy;
|
||||
mMatrix._31 = aTx;
|
||||
mMatrix._32 = aTy;
|
||||
mAngle = 0.f;
|
||||
mOriginX = 0.f;
|
||||
mOriginY = 0.f;
|
||||
|
@ -102,8 +102,8 @@ nsSVGTransform::SetScale(float aSx, float aSy)
|
|||
{
|
||||
mType = SVG_TRANSFORM_SCALE;
|
||||
mMatrix.Reset();
|
||||
mMatrix.xx = aSx;
|
||||
mMatrix.yy = aSy;
|
||||
mMatrix._11 = aSx;
|
||||
mMatrix._22 = aSy;
|
||||
mAngle = 0.f;
|
||||
mOriginX = 0.f;
|
||||
mOriginY = 0.f;
|
||||
|
@ -130,7 +130,7 @@ nsSVGTransform::SetSkewX(float aAngle)
|
|||
|
||||
mType = SVG_TRANSFORM_SKEWX;
|
||||
mMatrix.Reset();
|
||||
mMatrix.xy = ta;
|
||||
mMatrix._21 = ta;
|
||||
mAngle = aAngle;
|
||||
mOriginX = 0.f;
|
||||
mOriginY = 0.f;
|
||||
|
@ -145,7 +145,7 @@ nsSVGTransform::SetSkewY(float aAngle)
|
|||
|
||||
mType = SVG_TRANSFORM_SKEWY;
|
||||
mMatrix.Reset();
|
||||
mMatrix.yx = ta;
|
||||
mMatrix._12 = ta;
|
||||
mAngle = aAngle;
|
||||
mOriginX = 0.f;
|
||||
mOriginY = 0.f;
|
||||
|
@ -167,24 +167,24 @@ SVGTransformSMILData::SVGTransformSMILData(const nsSVGTransform& aTransform)
|
|||
switch (mTransformType) {
|
||||
case SVG_TRANSFORM_MATRIX: {
|
||||
const gfxMatrix& mx = aTransform.GetMatrix();
|
||||
mParams[0] = static_cast<float>(mx.xx);
|
||||
mParams[1] = static_cast<float>(mx.yx);
|
||||
mParams[2] = static_cast<float>(mx.xy);
|
||||
mParams[3] = static_cast<float>(mx.yy);
|
||||
mParams[4] = static_cast<float>(mx.x0);
|
||||
mParams[5] = static_cast<float>(mx.y0);
|
||||
mParams[0] = static_cast<float>(mx._11);
|
||||
mParams[1] = static_cast<float>(mx._12);
|
||||
mParams[2] = static_cast<float>(mx._21);
|
||||
mParams[3] = static_cast<float>(mx._22);
|
||||
mParams[4] = static_cast<float>(mx._31);
|
||||
mParams[5] = static_cast<float>(mx._32);
|
||||
break;
|
||||
}
|
||||
case SVG_TRANSFORM_TRANSLATE: {
|
||||
const gfxMatrix& mx = aTransform.GetMatrix();
|
||||
mParams[0] = static_cast<float>(mx.x0);
|
||||
mParams[1] = static_cast<float>(mx.y0);
|
||||
mParams[0] = static_cast<float>(mx._31);
|
||||
mParams[1] = static_cast<float>(mx._32);
|
||||
break;
|
||||
}
|
||||
case SVG_TRANSFORM_SCALE: {
|
||||
const gfxMatrix& mx = aTransform.GetMatrix();
|
||||
mParams[0] = static_cast<float>(mx.xx);
|
||||
mParams[1] = static_cast<float>(mx.yy);
|
||||
mParams[0] = static_cast<float>(mx._11);
|
||||
mParams[1] = static_cast<float>(mx._22);
|
||||
break;
|
||||
}
|
||||
case SVG_TRANSFORM_ROTATE:
|
||||
|
|
|
@ -75,12 +75,12 @@ public:
|
|||
|
||||
static bool MatricesEqual(const gfxMatrix& a, const gfxMatrix& b)
|
||||
{
|
||||
return a.xx == b.xx &&
|
||||
a.yx == b.yx &&
|
||||
a.xy == b.xy &&
|
||||
a.yy == b.yy &&
|
||||
a.x0 == b.x0 &&
|
||||
a.y0 == b.y0;
|
||||
return a._11 == b._11 &&
|
||||
a._12 == b._12 &&
|
||||
a._21 == b._21 &&
|
||||
a._22 == b._22 &&
|
||||
a._31 == b._31 &&
|
||||
a._32 == b._32;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -114,7 +114,7 @@ this.DataStoreChangeNotifier = {
|
|||
this.children[i].windows.splice(pos, 1);
|
||||
}
|
||||
|
||||
if (this.children[i].window.length) {
|
||||
if (this.children[i].windows.length) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -252,17 +252,6 @@ IndexedDatabaseManager::Get()
|
|||
return gDBManager;
|
||||
}
|
||||
|
||||
// static
|
||||
IndexedDatabaseManager*
|
||||
IndexedDatabaseManager::FactoryCreate()
|
||||
{
|
||||
// Returns a raw pointer that carries an owning reference! Lame, but the
|
||||
// singleton factory macros force this.
|
||||
IndexedDatabaseManager* mgr = GetOrCreate();
|
||||
NS_IF_ADDREF(mgr);
|
||||
return mgr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
IndexedDatabaseManager::Init()
|
||||
{
|
||||
|
@ -646,36 +635,7 @@ IndexedDatabaseManager::BlockAndGetFileReferences(
|
|||
|
||||
NS_IMPL_ADDREF(IndexedDatabaseManager)
|
||||
NS_IMPL_RELEASE_WITH_DESTROY(IndexedDatabaseManager, Destroy())
|
||||
NS_IMPL_QUERY_INTERFACE(IndexedDatabaseManager, nsIIndexedDatabaseManager,
|
||||
nsIObserver)
|
||||
|
||||
NS_IMETHODIMP
|
||||
IndexedDatabaseManager::InitWindowless(JS::Handle<JS::Value> aGlobal, JSContext* aCx)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
JS::Rooted<JSObject*> global(aCx, aGlobal.toObjectOrNull());
|
||||
if (!(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL)) {
|
||||
NS_WARNING("Passed object is not a global object!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
bool hasIndexedDB;
|
||||
if (!JS_HasProperty(aCx, global, IDB_STR, &hasIndexedDB)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (hasIndexedDB) {
|
||||
NS_WARNING("Passed object already has an 'indexedDB' property!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!DefineIndexedDB(aCx, global)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMPL_QUERY_INTERFACE(IndexedDatabaseManager, nsIObserver)
|
||||
|
||||
NS_IMETHODIMP
|
||||
IndexedDatabaseManager::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "mozilla/dom/indexedDB/IndexedDatabase.h"
|
||||
|
||||
#include "nsIIndexedDatabaseManager.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
#include "js/TypeDecls.h"
|
||||
|
@ -19,8 +18,6 @@
|
|||
#include "nsClassHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
|
||||
#define INDEXEDDB_MANAGER_CONTRACTID "@mozilla.org/dom/indexeddb/manager;1"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -38,15 +35,13 @@ BEGIN_INDEXEDDB_NAMESPACE
|
|||
class FileManager;
|
||||
class FileManagerInfo;
|
||||
|
||||
class IndexedDatabaseManager MOZ_FINAL : public nsIIndexedDatabaseManager,
|
||||
public nsIObserver
|
||||
class IndexedDatabaseManager MOZ_FINAL : public nsIObserver
|
||||
{
|
||||
typedef mozilla::dom::quota::OriginOrPatternString OriginOrPatternString;
|
||||
typedef mozilla::dom::quota::PersistenceType PersistenceType;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIINDEXEDDATABASEMANAGER
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
// Returns a non-owning reference.
|
||||
|
@ -57,10 +52,6 @@ public:
|
|||
static IndexedDatabaseManager*
|
||||
Get();
|
||||
|
||||
// Returns an owning reference! No one should call this but the factory.
|
||||
static IndexedDatabaseManager*
|
||||
FactoryCreate();
|
||||
|
||||
static bool
|
||||
IsClosed();
|
||||
|
||||
|
|
|
@ -7,12 +7,6 @@
|
|||
DIRS += ['ipc']
|
||||
TEST_DIRS += ['test']
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIIndexedDatabaseManager.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'dom_indexeddb'
|
||||
|
||||
EXPORTS.mozilla.dom.indexedDB += [
|
||||
'Client.h',
|
||||
'DatabaseInfo.h',
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, builtinclass, uuid(538d1085-517e-405a-a0f0-eb575cb0b8e5)]
|
||||
interface nsIIndexedDatabaseManager : nsISupports
|
||||
{
|
||||
/**
|
||||
* Defines indexedDB and IDBKeyRange with its static functions on aGlobal.
|
||||
*
|
||||
* This method might go away some time in the future, indexedDB and
|
||||
* IDBKeyRange should now be defined in all the spots (content windows,
|
||||
* chrome windows, xpcshell, JS modules, JS components, JS sandboxes,
|
||||
* ipcshell, bootstrapped extensions and Jetpack)
|
||||
*
|
||||
* @param aGlobal
|
||||
* The global object, indexedDB and IDBKeyRange should be defined on.
|
||||
*/
|
||||
[implicit_jscontext]
|
||||
void initWindowless(in jsval aGlobal);
|
||||
};
|
|
@ -30,12 +30,10 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|||
|
||||
PromiseCallback::PromiseCallback()
|
||||
{
|
||||
MOZ_COUNT_CTOR(PromiseCallback);
|
||||
}
|
||||
|
||||
PromiseCallback::~PromiseCallback()
|
||||
{
|
||||
MOZ_COUNT_DTOR(PromiseCallback);
|
||||
}
|
||||
|
||||
// ResolvePromiseCallback
|
||||
|
@ -71,13 +69,11 @@ ResolvePromiseCallback::ResolvePromiseCallback(Promise* aPromise,
|
|||
{
|
||||
MOZ_ASSERT(aPromise);
|
||||
MOZ_ASSERT(aGlobal);
|
||||
MOZ_COUNT_CTOR(ResolvePromiseCallback);
|
||||
HoldJSObjects(this);
|
||||
}
|
||||
|
||||
ResolvePromiseCallback::~ResolvePromiseCallback()
|
||||
{
|
||||
MOZ_COUNT_DTOR(ResolvePromiseCallback);
|
||||
DropJSObjects(this);
|
||||
}
|
||||
|
||||
|
@ -131,13 +127,11 @@ RejectPromiseCallback::RejectPromiseCallback(Promise* aPromise,
|
|||
{
|
||||
MOZ_ASSERT(aPromise);
|
||||
MOZ_ASSERT(mGlobal);
|
||||
MOZ_COUNT_CTOR(RejectPromiseCallback);
|
||||
HoldJSObjects(this);
|
||||
}
|
||||
|
||||
RejectPromiseCallback::~RejectPromiseCallback()
|
||||
{
|
||||
MOZ_COUNT_DTOR(RejectPromiseCallback);
|
||||
DropJSObjects(this);
|
||||
}
|
||||
|
||||
|
@ -194,13 +188,11 @@ WrapperPromiseCallback::WrapperPromiseCallback(Promise* aNextPromise,
|
|||
{
|
||||
MOZ_ASSERT(aNextPromise);
|
||||
MOZ_ASSERT(aGlobal);
|
||||
MOZ_COUNT_CTOR(WrapperPromiseCallback);
|
||||
HoldJSObjects(this);
|
||||
}
|
||||
|
||||
WrapperPromiseCallback::~WrapperPromiseCallback()
|
||||
{
|
||||
MOZ_COUNT_DTOR(WrapperPromiseCallback);
|
||||
DropJSObjects(this);
|
||||
}
|
||||
|
||||
|
@ -325,12 +317,10 @@ NativePromiseCallback::NativePromiseCallback(PromiseNativeHandler* aHandler,
|
|||
, mState(aState)
|
||||
{
|
||||
MOZ_ASSERT(aHandler);
|
||||
MOZ_COUNT_CTOR(NativePromiseCallback);
|
||||
}
|
||||
|
||||
NativePromiseCallback::~NativePromiseCallback()
|
||||
{
|
||||
MOZ_COUNT_DTOR(NativePromiseCallback);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -21,6 +21,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=741267
|
|||
<![CDATA[
|
||||
|
||||
/** Test for Bug 741267 **/
|
||||
const Cu = Components.utils;
|
||||
function isXrayWrapper(x) {
|
||||
return Components.utils.isXrayWrapper(x);
|
||||
}
|
||||
|
@ -163,16 +164,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=741267
|
|||
for (var i = 0; i < data.data.length; ++i) {
|
||||
// Watch out for premultiplied bits... just set all the alphas to 255
|
||||
if (i % 4 == 3) {
|
||||
data.data[i] = 255;
|
||||
// Note - We need to waive Xrays here because indexed access on Typed
|
||||
// Arrays is forbidden over Xrays for performance reasons.
|
||||
Cu.waiveXrays(data.data)[i] = 255;
|
||||
} else {
|
||||
data.data[i] = i;
|
||||
Cu.waiveXrays(data.data)[i] = i;
|
||||
}
|
||||
}
|
||||
ctx.putImageData(data, 0, 0);
|
||||
var data2 = ctx.getImageData(0, 0, 1, 1);
|
||||
is(data2.data.length, data.data.length, "Lengths must match");
|
||||
for (i = 0; i < data.data.length; ++i)
|
||||
is(data.data[i], data2.data[i], "Data at " + i + " should match");
|
||||
is(Cu.waiveXrays(data.data)[i], Cu.waiveXrays(data2.data)[i], "Data at " + i + " should match");
|
||||
} catch (e) {
|
||||
ok(false, "Imagedata manipulation via an Xray shouldn't throw " + e);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ interface ServiceWorker : EventTarget {
|
|||
ServiceWorker implements AbstractWorker;
|
||||
|
||||
enum ServiceWorkerState {
|
||||
"parsed",
|
||||
"installing",
|
||||
"installed",
|
||||
"activating",
|
||||
|
|
|
@ -15,23 +15,26 @@ interface ServiceWorkerContainer {
|
|||
// and discussion at https://etherpad.mozilla.org/serviceworker07apr
|
||||
[Unforgeable] readonly attribute ServiceWorker? installing;
|
||||
[Unforgeable] readonly attribute ServiceWorker? waiting;
|
||||
[Unforgeable] readonly attribute ServiceWorker? current;
|
||||
[Unforgeable] readonly attribute ServiceWorker? active;
|
||||
[Unforgeable] readonly attribute ServiceWorker? controller;
|
||||
|
||||
// Promise<ServiceWorker>
|
||||
readonly attribute Promise ready;
|
||||
|
||||
// Promise<sequence<ServiceWorker>?>
|
||||
[Throws]
|
||||
Promise getAll();
|
||||
|
||||
// Promise<ServiceWorker>
|
||||
[Throws]
|
||||
Promise register(DOMString url, optional RegistrationOptionList options);
|
||||
|
||||
// Promise<any>
|
||||
[Throws]
|
||||
Promise unregister(DOMString? scope);
|
||||
|
||||
// Promise<ServiceWorker>
|
||||
[Throws]
|
||||
Promise whenReady();
|
||||
|
||||
attribute EventHandler onupdatefound;
|
||||
attribute EventHandler oncurrentchange;
|
||||
attribute EventHandler oncontrollerchange;
|
||||
attribute EventHandler onreloadpage;
|
||||
attribute EventHandler onerror;
|
||||
};
|
||||
|
@ -46,5 +49,5 @@ partial interface ServiceWorkerContainer {
|
|||
};
|
||||
|
||||
dictionary RegistrationOptionList {
|
||||
DOMString scope = "*";
|
||||
DOMString scope = "/*";
|
||||
};
|
||||
|
|
|
@ -2100,9 +2100,6 @@ RuntimeService::CreateServiceWorker(const GlobalObject& aGlobal,
|
|||
nsRefPtr<ServiceWorker> serviceWorker =
|
||||
new ServiceWorker(window, sharedWorker);
|
||||
|
||||
// While it hasn't been parsed, the intention is to only expose ServiceWorkers
|
||||
// to content after it has indeed been parsed.
|
||||
serviceWorker->mState = ServiceWorkerState::Parsed;
|
||||
serviceWorker->mURL = aScriptURL;
|
||||
serviceWorker->mScope = NS_ConvertUTF8toUTF16(aScope);
|
||||
|
||||
|
|
|
@ -97,7 +97,14 @@ ServiceWorkerContainer::GetWaiting()
|
|||
}
|
||||
|
||||
already_AddRefed<workers::ServiceWorker>
|
||||
ServiceWorkerContainer::GetCurrent()
|
||||
ServiceWorkerContainer::GetActive()
|
||||
{
|
||||
// FIXME(nsm): Bug 1002570
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<workers::ServiceWorker>
|
||||
ServiceWorkerContainer::GetController()
|
||||
{
|
||||
// FIXME(nsm): Bug 1002570
|
||||
return nullptr;
|
||||
|
@ -112,11 +119,12 @@ ServiceWorkerContainer::GetAll(ErrorResult& aRv)
|
|||
}
|
||||
|
||||
already_AddRefed<Promise>
|
||||
ServiceWorkerContainer::WhenReady(ErrorResult& aRv)
|
||||
ServiceWorkerContainer::Ready()
|
||||
{
|
||||
// FIXME(nsm): Bug 984048
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return nullptr;
|
||||
// FIXME(nsm): Bug 1025077
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(mWindow);
|
||||
nsRefPtr<Promise> promise = new Promise(global);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
// Testing only.
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServiceWorkerContainer, DOMEventTargetHelper)
|
||||
|
||||
IMPL_EVENT_HANDLER(updatefound)
|
||||
IMPL_EVENT_HANDLER(currentchange)
|
||||
IMPL_EVENT_HANDLER(controllerchange)
|
||||
IMPL_EVENT_HANDLER(reloadpage)
|
||||
IMPL_EVENT_HANDLER(error)
|
||||
|
||||
|
@ -64,13 +64,16 @@ public:
|
|||
GetWaiting();
|
||||
|
||||
already_AddRefed<ServiceWorker>
|
||||
GetCurrent();
|
||||
GetActive();
|
||||
|
||||
already_AddRefed<ServiceWorker>
|
||||
GetController();
|
||||
|
||||
already_AddRefed<Promise>
|
||||
GetAll(ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<Promise>
|
||||
WhenReady(ErrorResult& aRv);
|
||||
Ready();
|
||||
|
||||
// Testing only.
|
||||
already_AddRefed<Promise>
|
||||
|
|
|
@ -227,7 +227,7 @@ ServiceWorkerManager::Register(nsIDOMWindow* aWindow, const nsAString& aScope,
|
|||
}
|
||||
|
||||
nsCString cleanedScope;
|
||||
rv = scopeURI->GetSpec(cleanedScope);
|
||||
rv = scopeURI->GetSpecIgnoringRef(cleanedScope);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -20,10 +20,11 @@
|
|||
ok(typeof navigator.serviceWorker.register === "function", "navigator.serviceWorker.register() should be a function.");
|
||||
ok(typeof navigator.serviceWorker.unregister === "function", "navigator.serviceWorker.unregister() should be a function.");
|
||||
ok(typeof navigator.serviceWorker.getAll === "function", "navigator.serviceWorker.getAll() should be a function.");
|
||||
ok(typeof navigator.serviceWorker.whenReady === "function", "navigator.serviceWorker.whenReady() should be a function.");
|
||||
ok(navigator.serviceWorker.installing === null, "There should be no installing worker for an uncontrolled document.");
|
||||
ok(navigator.serviceWorker.waiting === null, "There should be no waiting worker for an uncontrolled document.");
|
||||
ok(navigator.serviceWorker.current === null, "There should be no current worker for an uncontrolled document.");
|
||||
ok(navigator.serviceWorker.ready instanceof Promise, "navigator.serviceWorker.ready should be a Promise.");
|
||||
ok(navigator.serviceWorker.installing === null, "There should be no installing worker for an uncontrolled scope.");
|
||||
ok(navigator.serviceWorker.waiting === null, "There should be no waiting worker for an uncontrolled scope.");
|
||||
ok(navigator.serviceWorker.active === null, "There should be no active worker for an uncontrolled scope.");
|
||||
ok(navigator.serviceWorker.controller === null, "There should be no active worker for an uncontrolled document.");
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
@ -0,0 +1,182 @@
|
|||
About Hunspell
|
||||
--------------
|
||||
|
||||
Hunspell is a spell checker and morphological analyzer library and program
|
||||
designed for languages with rich morphology and complex word compounding or
|
||||
character encoding. Hunspell interfaces: Ispell-like terminal interface
|
||||
using Curses library, Ispell pipe interface, OpenOffice.org UNO module.
|
||||
|
||||
Hunspell's code base comes from the OpenOffice.org MySpell
|
||||
(http://lingucomponent.openoffice.org/MySpell-3.zip). See README.MYSPELL,
|
||||
AUTHORS.MYSPELL and license.myspell files.
|
||||
Hunspell is designed to eventually replace Myspell in OpenOffice.org.
|
||||
|
||||
Main features of Hunspell spell checker and morphological analyzer:
|
||||
|
||||
- Unicode support (affix rules work only with the first 65535 Unicode characters)
|
||||
|
||||
- Morphological analysis (in custom item and arrangement style) and stemming
|
||||
|
||||
- Max. 65535 affix classes and twofold affix stripping (for agglutinative
|
||||
languages, like Azeri, Basque, Estonian, Finnish, Hungarian, Turkish, etc.)
|
||||
|
||||
- Support complex compoundings (for example, Hungarian and German)
|
||||
|
||||
- Support language specific features (for example, special casing of
|
||||
Azeri and Turkish dotted i, or German sharp s)
|
||||
|
||||
- Handle conditional affixes, circumfixes, fogemorphemes,
|
||||
forbidden words, pseudoroots and homonyms.
|
||||
|
||||
- Free software (LGPL, GPL, MPL tri-license)
|
||||
|
||||
Compiling on Unix/Linux
|
||||
-----------------------
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
For dictionary development, use the --with-warnings option of configure.
|
||||
|
||||
For interactive user interface of Hunspell executable, use the --with-ui option.
|
||||
|
||||
The developer packages you need to compile Hunspell's interface:
|
||||
|
||||
glibc-devel
|
||||
|
||||
optional developer packages:
|
||||
|
||||
ncurses (need for --with-ui), eg. libncursesw5 for UTF-8
|
||||
readline (for fancy input line editing,
|
||||
configure parameter: --with-readline)
|
||||
locale and gettext (but you can also use the
|
||||
--with-included-gettext configure parameter)
|
||||
|
||||
Hunspell distribution uses new Autoconf (2.59) and Automake (1.9).
|
||||
|
||||
Compiling on Windows
|
||||
--------------------
|
||||
|
||||
1. Compiling with Windows SDK
|
||||
|
||||
Download the free Windows SDK of Microsoft, open a command prompt
|
||||
window and cd into hunspell/src/win_api. Use the following command
|
||||
to compile hunspell:
|
||||
|
||||
vcbuild
|
||||
|
||||
2. Compiling in Cygwin environment
|
||||
|
||||
Download and install Cygwin environment for Windows with the following
|
||||
extra packages:
|
||||
|
||||
make
|
||||
gcc-g++ development package
|
||||
mingw development package (for cygwin.dll free native Windows compilation)
|
||||
ncurses, readline (for user interface)
|
||||
iconv (character conversion)
|
||||
|
||||
2.1. Cygwin1.dll dependent compiling
|
||||
|
||||
Open a Cygwin shell, cd into the hunspell root directory:
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
For dictionary development, use the --with-warnings option of configure.
|
||||
|
||||
For interactive user interface of Hunspell executable, use the --with-ui option.
|
||||
|
||||
readline configure parameter: --with-readline (for fancy input line editing)
|
||||
|
||||
1.2. Cygwin1.dll free compiling
|
||||
|
||||
Open a Cygwin shell, cd into the hunspell/src/win_api and
|
||||
|
||||
make -f Makefile.cygwin
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
Testing Hunspell (see tests in tests/ subdirectory):
|
||||
|
||||
make check
|
||||
|
||||
or with Valgrind debugger:
|
||||
|
||||
make check
|
||||
VALGRIND=[Valgrind_tool] make check
|
||||
|
||||
For example:
|
||||
|
||||
make check
|
||||
VALGRIND=memcheck make check
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
features and dictionary format:
|
||||
man 5 hunspell
|
||||
|
||||
man hunspell
|
||||
hunspell -h
|
||||
http://hunspell.sourceforge.net
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
The src/tools dictionary contains ten executables after compiling
|
||||
(or some of them are in the src/win_api):
|
||||
|
||||
affixcompress: dictionary generation from large (millions of words) vocabularies
|
||||
analyze: example of spell checking, stemming and morphological analysis
|
||||
chmorph: example of automatic morphological generation and conversion
|
||||
example: example of spell checking and suggestion
|
||||
hunspell: main program for spell checking and others (see manual)
|
||||
hunzip: decompressor of hzip format
|
||||
hzip: compressor of hzip format
|
||||
makealias: alias compression (Hunspell only, not back compatible with MySpell)
|
||||
munch: dictionary generation from vocabularies (it needs an affix file, too).
|
||||
unmunch: list all recognized words of a MySpell dictionary
|
||||
wordforms: word generation (Hunspell version of unmunch)
|
||||
|
||||
After compiling and installing (see INSTALL) you can
|
||||
run the Hunspell spell checker (compiled with user interface)
|
||||
with a Hunspell or Myspell dictionary:
|
||||
|
||||
hunspell -d en_US text.txt
|
||||
|
||||
or without interface:
|
||||
|
||||
hunspell
|
||||
hunspell -d en_UK -l <text.txt
|
||||
|
||||
Dictionaries consist of an affix and dictionary file, see tests/
|
||||
or http://wiki.services.openoffice.org/wiki/Dictionaries.
|
||||
|
||||
Using Hunspell library with GCC
|
||||
-------------------------------
|
||||
|
||||
Including in your program:
|
||||
#include <hunspell.hxx>
|
||||
|
||||
Linking with Hunspell static library:
|
||||
g++ -lhunspell example.cxx
|
||||
|
||||
Dictionaries
|
||||
------------
|
||||
|
||||
Myspell & Hunspell dictionaries:
|
||||
http://extensions.libreoffice.org
|
||||
http://cgit.freedesktop.org/libreoffice/dictionaries
|
||||
http://extensions.openoffice.org
|
||||
http://wiki.services.openoffice.org/wiki/Dictionaries
|
||||
|
||||
Aspell dictionaries (need some conversion):
|
||||
ftp://ftp.gnu.org/gnu/aspell/dict
|
||||
Conversion steps: see relevant feature request at http://hunspell.sf.net.
|
||||
|
||||
László Németh
|
||||
nemeth at numbertext org
|
|
@ -1,61 +0,0 @@
|
|||
******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Ryan VanderMeulen (ryanvm@gmail.com)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******
|
||||
|
||||
Hunspell Version: 1.3.2
|
||||
Additional Patches: 694002, 710967, 710940, 784776
|
||||
|
||||
Hunspell Author: László Németh
|
||||
MySpell Author: Kevin Hendricks & David Einstein
|
||||
|
||||
Hunspell is a spell checker and morphological analyser library. Hunspell
|
||||
is based on OpenOffice.org's Myspell. Documentation, tests, and examples
|
||||
are available at http://hunspell.sourceforge.net.
|
||||
|
||||
A special thanks and credit goes to Geoff Kuenning, the creator of Ispell.
|
||||
MySpell's affix algorithms were based on those of Ispell, which should be
|
||||
noted is copyright Geoff Kuenning et al and now available under a BSD-style
|
||||
license. For more information on Ispell and affix compression in general,
|
||||
please see: http://lasr.cs.ucla.edu/geoff/ispell.html (Ispell homepage)
|
||||
|
||||
An almost complete rewrite of MySpell for use by the Mozilla project was
|
||||
developed by David Einstein. David was a significant help in improving MySpell.
|
||||
|
||||
Special thanks also goes to László Németh, who is the author of the Hungarian
|
||||
dictionary and who developed and contributed the code to support compound words
|
||||
in MySpell and fixed numerous problems with the encoding case conversion tables
|
||||
along with rewriting MySpell as Hunspell and ensuring compatibility with the
|
||||
Mozilla codebase.
|
|
@ -0,0 +1,2 @@
|
|||
Hunspell Version: 1.3.3
|
||||
Additional Patches: See patches directory.
|
|
@ -1,59 +1,5 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -63,13 +9,17 @@
|
|||
#include "affentry.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
||||
#define MAXTEMPWORDLEN (MAXWORDUTF8LEN + 4)
|
||||
|
||||
PfxEntry::PfxEntry(AffixMgr* pmgr, affentry* dp)
|
||||
// register affix manager
|
||||
: pmyMgr(pmgr)
|
||||
, next(NULL)
|
||||
, nexteq(NULL)
|
||||
, nextne(NULL)
|
||||
, flgnxt(NULL)
|
||||
{
|
||||
// register affix manager
|
||||
pmyMgr = pmgr;
|
||||
|
||||
// set up its initial values
|
||||
|
||||
aflag = dp->aflag; // flag
|
||||
strip = dp->strip; // string to strip
|
||||
appnd = dp->appnd; // string to append
|
||||
|
@ -82,9 +32,6 @@ PfxEntry::PfxEntry(AffixMgr* pmgr, affentry* dp)
|
|||
memcpy(c.conds, dp->c.l.conds1, MAXCONDLEN_1);
|
||||
c.l.conds2 = dp->c.l.conds2;
|
||||
} else memcpy(c.conds, dp->c.conds, MAXCONDLEN);
|
||||
next = NULL;
|
||||
nextne = NULL;
|
||||
nexteq = NULL;
|
||||
morphcode = dp->morphcode;
|
||||
contclass = dp->contclass;
|
||||
contclasslen = dp->contclasslen;
|
||||
|
@ -107,16 +54,17 @@ PfxEntry::~PfxEntry()
|
|||
// add prefix to this word assuming conditions hold
|
||||
char * PfxEntry::add(const char * word, int len)
|
||||
{
|
||||
char tword[MAXWORDUTF8LEN + 4];
|
||||
char tword[MAXTEMPWORDLEN];
|
||||
|
||||
if ((len > stripl || (len == 0 && pmyMgr->get_fullstrip())) &&
|
||||
(len >= numconds) && test_condition(word) &&
|
||||
(!stripl || (strncmp(word, strip, stripl) == 0)) &&
|
||||
((MAXWORDUTF8LEN + 4) > (len + appndl - stripl))) {
|
||||
((MAXTEMPWORDLEN) > (len + appndl - stripl))) {
|
||||
/* we have a match so add prefix */
|
||||
char * pp = tword;
|
||||
if (appndl) {
|
||||
strcpy(tword,appnd);
|
||||
strncpy(tword, appnd, MAXTEMPWORDLEN-1);
|
||||
tword[MAXTEMPWORDLEN-1] = '\0';
|
||||
pp += appndl;
|
||||
}
|
||||
strcpy(pp, (word + stripl));
|
||||
|
@ -164,13 +112,15 @@ inline int PfxEntry::test_condition(const char * st)
|
|||
if (*st == '\0' && p) return 0; // word <= condition
|
||||
break;
|
||||
}
|
||||
case '.': if (!pos) { // dots are not metacharacters in groups: [.]
|
||||
case '.':
|
||||
if (!pos) { // dots are not metacharacters in groups: [.]
|
||||
p = nextchar(p);
|
||||
// skip the next character
|
||||
for (st++; (opts & aeUTF8) && (*st & 0xc0) == 0x80; st++);
|
||||
if (*st == '\0' && p) return 0; // word <= condition
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
default: {
|
||||
if (*st == *p) {
|
||||
st++;
|
||||
|
@ -187,11 +137,11 @@ inline int PfxEntry::test_condition(const char * st)
|
|||
}
|
||||
if (pos && st != pos) {
|
||||
ingroup = true;
|
||||
while (p && *p != ']' && (p = nextchar(p)));
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
}
|
||||
} else if (pos) {
|
||||
ingroup = true;
|
||||
while (p && *p != ']' && (p = nextchar(p)));
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
}
|
||||
} else if (pos) { // group
|
||||
p = nextchar(p);
|
||||
|
@ -207,7 +157,7 @@ struct hentry * PfxEntry::checkword(const char * word, int len, char in_compound
|
|||
{
|
||||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry of root word or NULL
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
|
||||
// on entry prefix is 0 length or already matches the beginning of the word.
|
||||
// So if the remaining root word has positive length
|
||||
|
@ -221,7 +171,10 @@ struct hentry * PfxEntry::checkword(const char * word, int len, char in_compound
|
|||
// generate new root word by removing prefix and adding
|
||||
// back any characters that would have been stripped
|
||||
|
||||
if (stripl) strcpy (tmpword, strip);
|
||||
if (stripl) {
|
||||
strncpy(tmpword, strip, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
}
|
||||
strcpy ((tmpword + stripl), (word + appndl));
|
||||
|
||||
// now make sure all of the conditions on characters
|
||||
|
@ -268,7 +221,7 @@ struct hentry * PfxEntry::check_twosfx(const char * word, int len,
|
|||
{
|
||||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry of root word or NULL
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
|
||||
// on entry prefix is 0 length or already matches the beginning of the word.
|
||||
// So if the remaining root word has positive length
|
||||
|
@ -283,7 +236,10 @@ struct hentry * PfxEntry::check_twosfx(const char * word, int len,
|
|||
// generate new root word by removing prefix and adding
|
||||
// back any characters that would have been stripped
|
||||
|
||||
if (stripl) strcpy (tmpword, strip);
|
||||
if (stripl) {
|
||||
strncpy(tmpword, strip, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
}
|
||||
strcpy ((tmpword + stripl), (word + appndl));
|
||||
|
||||
// now make sure all of the conditions on characters
|
||||
|
@ -315,7 +271,7 @@ char * PfxEntry::check_twosfx_morph(const char * word, int len,
|
|||
char in_compound, const FLAG needflag)
|
||||
{
|
||||
int tmpl; // length of tmpword
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
|
||||
// on entry prefix is 0 length or already matches the beginning of the word.
|
||||
// So if the remaining root word has positive length
|
||||
|
@ -330,7 +286,10 @@ char * PfxEntry::check_twosfx_morph(const char * word, int len,
|
|||
// generate new root word by removing prefix and adding
|
||||
// back any characters that would have been stripped
|
||||
|
||||
if (stripl) strcpy (tmpword, strip);
|
||||
if (stripl) {
|
||||
strncpy(tmpword, strip, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
}
|
||||
strcpy ((tmpword + stripl), (word + appndl));
|
||||
|
||||
// now make sure all of the conditions on characters
|
||||
|
@ -362,7 +321,7 @@ char * PfxEntry::check_morph(const char * word, int len, char in_compound, const
|
|||
{
|
||||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry of root word or NULL
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
char result[MAXLNLEN];
|
||||
char * st;
|
||||
|
||||
|
@ -381,7 +340,10 @@ char * PfxEntry::check_morph(const char * word, int len, char in_compound, const
|
|||
// generate new root word by removing prefix and adding
|
||||
// back any characters that would have been stripped
|
||||
|
||||
if (stripl) strcpy (tmpword, strip);
|
||||
if (stripl) {
|
||||
strncpy(tmpword, strip, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
}
|
||||
strcpy ((tmpword + stripl), (word + appndl));
|
||||
|
||||
// now make sure all of the conditions on characters
|
||||
|
@ -449,10 +411,15 @@ char * PfxEntry::check_morph(const char * word, int len, char in_compound, const
|
|||
}
|
||||
|
||||
SfxEntry::SfxEntry(AffixMgr * pmgr, affentry* dp)
|
||||
: pmyMgr(pmgr) // register affix manager
|
||||
, next(NULL)
|
||||
, nexteq(NULL)
|
||||
, nextne(NULL)
|
||||
, flgnxt(NULL)
|
||||
, l_morph(NULL)
|
||||
, r_morph(NULL)
|
||||
, eq_morph(NULL)
|
||||
{
|
||||
// register affix manager
|
||||
pmyMgr = pmgr;
|
||||
|
||||
// set up its initial values
|
||||
aflag = dp->aflag; // char flag
|
||||
strip = dp->strip; // string to strip
|
||||
|
@ -467,9 +434,6 @@ SfxEntry::SfxEntry(AffixMgr * pmgr, affentry* dp)
|
|||
memcpy(c.l.conds1, dp->c.l.conds1, MAXCONDLEN_1);
|
||||
c.l.conds2 = dp->c.l.conds2;
|
||||
} else memcpy(c.conds, dp->c.conds, MAXCONDLEN);
|
||||
next = NULL;
|
||||
nextne = NULL;
|
||||
nexteq = NULL;
|
||||
rappnd = myrevstrdup(appnd);
|
||||
morphcode = dp->morphcode;
|
||||
contclass = dp->contclass;
|
||||
|
@ -494,15 +458,16 @@ SfxEntry::~SfxEntry()
|
|||
// add suffix to this word assuming conditions hold
|
||||
char * SfxEntry::add(const char * word, int len)
|
||||
{
|
||||
char tword[MAXWORDUTF8LEN + 4];
|
||||
char tword[MAXTEMPWORDLEN];
|
||||
|
||||
/* make sure all conditions match */
|
||||
if ((len > stripl || (len == 0 && pmyMgr->get_fullstrip())) &&
|
||||
(len >= numconds) && test_condition(word + len, word) &&
|
||||
(!stripl || (strcmp(word + len - stripl, strip) == 0)) &&
|
||||
((MAXWORDUTF8LEN + 4) > (len + appndl - stripl))) {
|
||||
((MAXTEMPWORDLEN) > (len + appndl - stripl))) {
|
||||
/* we have a match so add suffix */
|
||||
strcpy(tword,word);
|
||||
strncpy(tword, word, MAXTEMPWORDLEN-1);
|
||||
tword[MAXTEMPWORDLEN-1] = '\0';
|
||||
if (appndl) {
|
||||
strcpy(tword + len - stripl, appnd);
|
||||
} else {
|
||||
|
@ -537,24 +502,37 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
|
|||
int i = 1;
|
||||
while (1) {
|
||||
switch (*p) {
|
||||
case '\0': return 1;
|
||||
case '[': { p = nextchar(p); pos = st; break; }
|
||||
case '^': { p = nextchar(p); neg = true; break; }
|
||||
case ']': { if (!neg && !ingroup) return 0;
|
||||
i++;
|
||||
// skip the next character
|
||||
if (!ingroup) {
|
||||
for (; (opts & aeUTF8) && (st >= beg) && (*st & 0xc0) == 0x80; st--);
|
||||
st--;
|
||||
}
|
||||
pos = NULL;
|
||||
neg = false;
|
||||
ingroup = false;
|
||||
p = nextchar(p);
|
||||
if (st < beg && p) return 0; // word <= condition
|
||||
break;
|
||||
}
|
||||
case '.': if (!pos) { // dots are not metacharacters in groups: [.]
|
||||
case '\0':
|
||||
return 1;
|
||||
case '[':
|
||||
p = nextchar(p);
|
||||
pos = st;
|
||||
break;
|
||||
case '^':
|
||||
p = nextchar(p);
|
||||
neg = true;
|
||||
break;
|
||||
case ']':
|
||||
if (!neg && !ingroup)
|
||||
return 0;
|
||||
i++;
|
||||
// skip the next character
|
||||
if (!ingroup)
|
||||
{
|
||||
for (; (opts & aeUTF8) && (st >= beg) && (*st & 0xc0) == 0x80; st--);
|
||||
st--;
|
||||
}
|
||||
pos = NULL;
|
||||
neg = false;
|
||||
ingroup = false;
|
||||
p = nextchar(p);
|
||||
if (st < beg && p)
|
||||
return 0; // word <= condition
|
||||
break;
|
||||
case '.':
|
||||
if (!pos)
|
||||
{
|
||||
// dots are not metacharacters in groups: [.]
|
||||
p = nextchar(p);
|
||||
// skip the next character
|
||||
for (st--; (opts & aeUTF8) && (st >= beg) && (*st & 0xc0) == 0x80; st--);
|
||||
|
@ -569,6 +547,7 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
|
|||
}
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
default: {
|
||||
if (*st == *p) {
|
||||
p = nextchar(p);
|
||||
|
@ -589,7 +568,7 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
|
|||
if (neg) return 0;
|
||||
else if (i == numconds) return 1;
|
||||
ingroup = true;
|
||||
while (p && *p != ']' && (p = nextchar(p)));
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
st--;
|
||||
}
|
||||
if (p && *p != ']') p = nextchar(p);
|
||||
|
@ -597,8 +576,8 @@ inline int SfxEntry::test_condition(const char * st, const char * beg)
|
|||
if (neg) return 0;
|
||||
else if (i == numconds) return 1;
|
||||
ingroup = true;
|
||||
while (p && *p != ']' && (p = nextchar(p)))
|
||||
;
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL))
|
||||
;
|
||||
// if (p && *p != ']') p = nextchar(p);
|
||||
st--;
|
||||
}
|
||||
|
@ -624,7 +603,7 @@ struct hentry * SfxEntry::checkword(const char * word, int len, int optflags,
|
|||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry pointer
|
||||
unsigned char * cp;
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
PfxEntry* ep = ppfx;
|
||||
|
||||
// if this suffix is being cross checked with a prefix
|
||||
|
@ -649,7 +628,8 @@ struct hentry * SfxEntry::checkword(const char * word, int len, int optflags,
|
|||
// back any characters that would have been stripped or
|
||||
// or null terminating the shorter string
|
||||
|
||||
strcpy (tmpword, word);
|
||||
strncpy (tmpword, word, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
cp = (unsigned char *)(tmpword + tmpl);
|
||||
if (stripl) {
|
||||
strcpy ((char *)cp, strip);
|
||||
|
@ -702,7 +682,10 @@ struct hentry * SfxEntry::checkword(const char * word, int len, int optflags,
|
|||
} else if (wlst && (*ns < maxSug)) {
|
||||
int cwrd = 1;
|
||||
for (int k=0; k < *ns; k++)
|
||||
if (strcmp(tmpword, wlst[k]) == 0) cwrd = 0;
|
||||
if (strcmp(tmpword, wlst[k]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
if (cwrd) {
|
||||
wlst[*ns] = mystrdup(tmpword);
|
||||
if (wlst[*ns] == NULL) {
|
||||
|
@ -725,7 +708,7 @@ struct hentry * SfxEntry::check_twosfx(const char * word, int len, int optflags,
|
|||
int tmpl; // length of tmpword
|
||||
struct hentry * he; // hash entry pointer
|
||||
unsigned char * cp;
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
PfxEntry* ep = ppfx;
|
||||
|
||||
|
||||
|
@ -749,7 +732,8 @@ struct hentry * SfxEntry::check_twosfx(const char * word, int len, int optflags,
|
|||
// back any characters that would have been stripped or
|
||||
// or null terminating the shorter string
|
||||
|
||||
strcpy (tmpword, word);
|
||||
strncpy(tmpword, word, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
cp = (unsigned char *)(tmpword + tmpl);
|
||||
if (stripl) {
|
||||
strcpy ((char *)cp, strip);
|
||||
|
@ -786,7 +770,7 @@ char * SfxEntry::check_twosfx_morph(const char * word, int len, int optflags,
|
|||
{
|
||||
int tmpl; // length of tmpword
|
||||
unsigned char * cp;
|
||||
char tmpword[MAXWORDUTF8LEN + 4];
|
||||
char tmpword[MAXTEMPWORDLEN];
|
||||
PfxEntry* ep = ppfx;
|
||||
char * st;
|
||||
|
||||
|
@ -814,7 +798,8 @@ char * SfxEntry::check_twosfx_morph(const char * word, int len, int optflags,
|
|||
// back any characters that would have been stripped or
|
||||
// or null terminating the shorter string
|
||||
|
||||
strcpy (tmpword, word);
|
||||
strncpy(tmpword, word, MAXTEMPWORDLEN-1);
|
||||
tmpword[MAXTEMPWORDLEN-1] = '\0';
|
||||
cp = (unsigned char *)(tmpword + tmpl);
|
||||
if (stripl) {
|
||||
strcpy ((char *)cp, strip);
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _AFFIX_HXX_
|
||||
#define _AFFIX_HXX_
|
||||
|
||||
|
@ -68,6 +11,10 @@
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED PfxEntry : protected AffEntry
|
||||
{
|
||||
private:
|
||||
PfxEntry(const PfxEntry&);
|
||||
PfxEntry& operator = (const PfxEntry&);
|
||||
private:
|
||||
AffixMgr* pmyMgr;
|
||||
|
||||
PfxEntry * next;
|
||||
|
@ -124,6 +71,10 @@ public:
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED SfxEntry : protected AffEntry
|
||||
{
|
||||
private:
|
||||
SfxEntry(const SfxEntry&);
|
||||
SfxEntry& operator = (const SfxEntry&);
|
||||
private:
|
||||
AffixMgr* pmyMgr;
|
||||
char * rappnd;
|
||||
|
||||
|
|
|
@ -1,59 +1,5 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -102,6 +48,7 @@ AffixMgr::AffixMgr(const char * affpath, HashMgr** ptr, int * md, const char * k
|
|||
compoundroot = FLAG_NULL; // compound word signing flag
|
||||
compoundpermitflag = FLAG_NULL; // compound permitting flag for suffixed word
|
||||
compoundforbidflag = FLAG_NULL; // compound fordidden flag for suffixed word
|
||||
compoundmoresuffixes = 0; // allow more suffixes within compound words
|
||||
checkcompounddup = 0; // forbid double words in compounds
|
||||
checkcompoundrep = 0; // forbid bad compounds (may be non compound word with a REP substitution)
|
||||
checkcompoundcase = 0; // forbid upper and lowercase combinations at word bounds
|
||||
|
@ -307,6 +254,14 @@ AffixMgr::~AffixMgr()
|
|||
#endif
|
||||
}
|
||||
|
||||
void AffixMgr::finishFileMgr(FileMgr *afflst)
|
||||
{
|
||||
delete afflst;
|
||||
|
||||
// convert affix trees to sorted list
|
||||
process_pfx_tree_to_list();
|
||||
process_sfx_tree_to_list();
|
||||
}
|
||||
|
||||
// read in aff file and build up prefix and suffix entry objects
|
||||
int AffixMgr::parse_file(const char * affpath, const char * key)
|
||||
|
@ -333,7 +288,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
|
||||
// read in each line ignoring any that do not
|
||||
// start with a known line type indicator
|
||||
while ((line = afflst->getline())) {
|
||||
while ((line = afflst->getline()) != NULL) {
|
||||
mychomp(line);
|
||||
|
||||
/* remove byte order mark */
|
||||
|
@ -348,7 +303,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the keyboard string */
|
||||
if (strncmp(line,"KEY",3) == 0) {
|
||||
if (parse_string(line, &keystring, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -356,7 +311,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the try string */
|
||||
if (strncmp(line,"TRY",3) == 0) {
|
||||
if (parse_string(line, &trystring, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -364,7 +319,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the name of the character set used by the .dict and .aff */
|
||||
if (strncmp(line,"SET",3) == 0) {
|
||||
if (parse_string(line, &encoding, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(encoding, "UTF-8") == 0) {
|
||||
|
@ -384,7 +339,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by the controlled compound words */
|
||||
if (strncmp(line,"COMPOUNDFLAG",12) == 0) {
|
||||
if (parse_flag(line, &compoundflag, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -393,12 +348,12 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
if (strncmp(line,"COMPOUNDBEGIN",13) == 0) {
|
||||
if (complexprefixes) {
|
||||
if (parse_flag(line, &compoundend, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (parse_flag(line, &compoundbegin, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -407,7 +362,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by compound words */
|
||||
if (strncmp(line,"COMPOUNDMIDDLE",14) == 0) {
|
||||
if (parse_flag(line, &compoundmiddle, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -415,12 +370,12 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
if (strncmp(line,"COMPOUNDEND",11) == 0) {
|
||||
if (complexprefixes) {
|
||||
if (parse_flag(line, &compoundbegin, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (parse_flag(line, &compoundend, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -429,7 +384,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the data used by compound_check() method */
|
||||
if (strncmp(line,"COMPOUNDWORDMAX",15) == 0) {
|
||||
if (parse_num(line, &cpdwordmax, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -437,7 +392,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag sign compounds in dictionary */
|
||||
if (strncmp(line,"COMPOUNDROOT",12) == 0) {
|
||||
if (parse_flag(line, &compoundroot, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -445,7 +400,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by compound_check() method */
|
||||
if (strncmp(line,"COMPOUNDPERMITFLAG",18) == 0) {
|
||||
if (parse_flag(line, &compoundpermitflag, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -453,11 +408,15 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by compound_check() method */
|
||||
if (strncmp(line,"COMPOUNDFORBIDFLAG",18) == 0) {
|
||||
if (parse_flag(line, &compoundforbidflag, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (strncmp(line,"COMPOUNDMORESUFFIXES",20) == 0) {
|
||||
compoundmoresuffixes = 1;
|
||||
}
|
||||
|
||||
if (strncmp(line,"CHECKCOMPOUNDDUP",16) == 0) {
|
||||
checkcompounddup = 1;
|
||||
}
|
||||
|
@ -480,14 +439,14 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
|
||||
if (strncmp(line,"NOSUGGEST",9) == 0) {
|
||||
if (parse_flag(line, &nosuggest, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (strncmp(line,"NONGRAMSUGGEST",14) == 0) {
|
||||
if (parse_flag(line, &nongramsuggest, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -495,7 +454,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by forbidden words */
|
||||
if (strncmp(line,"FORBIDDENWORD",13) == 0) {
|
||||
if (parse_flag(line, &forbiddenword, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -503,7 +462,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by forbidden words */
|
||||
if (strncmp(line,"LEMMA_PRESENT",13) == 0) {
|
||||
if (parse_flag(line, &lemma_present, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -511,7 +470,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by circumfixes */
|
||||
if (strncmp(line,"CIRCUMFIX",9) == 0) {
|
||||
if (parse_flag(line, &circumfix, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -519,7 +478,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by fogemorphemes */
|
||||
if (strncmp(line,"ONLYINCOMPOUND",14) == 0) {
|
||||
if (parse_flag(line, &onlyincompound, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -527,7 +486,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by `needaffixs' */
|
||||
if (strncmp(line,"PSEUDOROOT",10) == 0) {
|
||||
if (parse_flag(line, &needaffix, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -535,7 +494,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by `needaffixs' */
|
||||
if (strncmp(line,"NEEDAFFIX",9) == 0) {
|
||||
if (parse_flag(line, &needaffix, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -543,7 +502,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the minimal length for words in compounds */
|
||||
if (strncmp(line,"COMPOUNDMIN",11) == 0) {
|
||||
if (parse_num(line, &cpdmin, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
if (cpdmin < 1) cpdmin = 1;
|
||||
|
@ -552,7 +511,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the max. words and syllables in compounds */
|
||||
if (strncmp(line,"COMPOUNDSYLLABLE",16) == 0) {
|
||||
if (parse_cpdsyllable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -560,7 +519,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by compound_check() method */
|
||||
if (strncmp(line,"SYLLABLENUM",11) == 0) {
|
||||
if (parse_string(line, &cpdsyllablenum, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -573,7 +532,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the extra word characters */
|
||||
if (strncmp(line,"WORDCHARS",9) == 0) {
|
||||
if (parse_array(line, &wordchars, &wordchars_utf16, &wordchars_utf16_len, utf8, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -581,7 +540,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the ignored characters (for example, Arabic optional diacretics charachters */
|
||||
if (strncmp(line,"IGNORE",6) == 0) {
|
||||
if (parse_array(line, &ignorechars, &ignorechars_utf16, &ignorechars_utf16_len, utf8, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -589,7 +548,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the typical fault correcting table */
|
||||
if (strncmp(line,"REP",3) == 0) {
|
||||
if (parse_reptable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -597,7 +556,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the input conversion table */
|
||||
if (strncmp(line,"ICONV",5) == 0) {
|
||||
if (parse_convtable(line, afflst, &iconvtable, "ICONV")) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -605,7 +564,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the input conversion table */
|
||||
if (strncmp(line,"OCONV",5) == 0) {
|
||||
if (parse_convtable(line, afflst, &oconvtable, "OCONV")) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -613,7 +572,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the phonetic translation table */
|
||||
if (strncmp(line,"PHONE",5) == 0) {
|
||||
if (parse_phonetable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -621,7 +580,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the checkcompoundpattern table */
|
||||
if (strncmp(line,"CHECKCOMPOUNDPATTERN",20) == 0) {
|
||||
if (parse_checkcpdtable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -629,7 +588,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the defcompound table */
|
||||
if (strncmp(line,"COMPOUNDRULE",12) == 0) {
|
||||
if (parse_defcpdtable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -637,7 +596,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the related character map table */
|
||||
if (strncmp(line,"MAP",3) == 0) {
|
||||
if (parse_maptable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -645,7 +604,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the word breakpoints table */
|
||||
if (strncmp(line,"BREAK",5) == 0) {
|
||||
if (parse_breaktable(line, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -653,7 +612,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the language for language specific codes */
|
||||
if (strncmp(line,"LANG",4) == 0) {
|
||||
if (parse_string(line, &lang, afflst->getlinenum())) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
langnum = get_lang_num(lang);
|
||||
|
@ -666,7 +625,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
|
||||
if (strncmp(line,"MAXNGRAMSUGS",12) == 0) {
|
||||
if (parse_num(line, &maxngramsugs, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -676,14 +635,14 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
|
||||
if (strncmp(line,"MAXDIFF",7) == 0) {
|
||||
if (parse_num(line, &maxdiff, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (strncmp(line,"MAXCPDSUGS",10) == 0) {
|
||||
if (parse_num(line, &maxcpdsugs, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -703,7 +662,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by forbidden words */
|
||||
if (strncmp(line,"KEEPCASE",8) == 0) {
|
||||
if (parse_flag(line, &keepcase, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -711,7 +670,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by `forceucase' */
|
||||
if (strncmp(line,"FORCEUCASE",10) == 0) {
|
||||
if (parse_flag(line, &forceucase, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -719,7 +678,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by `warn' */
|
||||
if (strncmp(line,"WARN",4) == 0) {
|
||||
if (parse_flag(line, &warn, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -731,7 +690,7 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
/* parse in the flag used by the affix generator */
|
||||
if (strncmp(line,"SUBSTANDARD",11) == 0) {
|
||||
if (parse_flag(line, &substandard, afflst)) {
|
||||
delete afflst;
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -750,19 +709,14 @@ int AffixMgr::parse_file(const char * affpath, const char * key)
|
|||
dupflags_ini = 0;
|
||||
}
|
||||
if (parse_affix(line, ft, afflst, dupflags)) {
|
||||
delete afflst;
|
||||
process_pfx_tree_to_list();
|
||||
process_sfx_tree_to_list();
|
||||
finishFileMgr(afflst);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
delete afflst;
|
||||
|
||||
// convert affix trees to sorted list
|
||||
process_pfx_tree_to_list();
|
||||
process_sfx_tree_to_list();
|
||||
finishFileMgr(afflst);
|
||||
// affix trees are sorted now
|
||||
|
||||
// now we can speed up performance greatly taking advantage of the
|
||||
// relationship between the affixes and the idea of "subsets".
|
||||
|
@ -1373,7 +1327,7 @@ int AffixMgr::cpdrep_check(const char * word, int wl)
|
|||
}
|
||||
|
||||
// forbid compoundings when there are special patterns at word bound
|
||||
int AffixMgr::cpdpat_check(const char * word, int pos, hentry * r1, hentry * r2, const char affixed)
|
||||
int AffixMgr::cpdpat_check(const char * word, int pos, hentry * r1, hentry * r2, const char /*affixed*/)
|
||||
{
|
||||
int len;
|
||||
for (int i = 0; i < numcheckcpd; i++) {
|
||||
|
@ -1386,7 +1340,7 @@ int AffixMgr::cpdpat_check(const char * word, int pos, hentry * r1, hentry * r2,
|
|||
// zero pattern (0/flag) => unmodified stem (zero affixes allowed)
|
||||
(!*(checkcpdtable[i].pattern) || (
|
||||
(*(checkcpdtable[i].pattern)=='0' && r1->blen <= pos && strncmp(word + pos - r1->blen, r1->word, r1->blen) == 0) ||
|
||||
(*(checkcpdtable[i].pattern)!='0' && (len = strlen(checkcpdtable[i].pattern)) &&
|
||||
(*(checkcpdtable[i].pattern)!='0' && ((len = strlen(checkcpdtable[i].pattern)) != 0) &&
|
||||
strncmp(word + pos - len, checkcpdtable[i].pattern, len) == 0)))) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -1447,7 +1401,10 @@ int AffixMgr::defcpd_check(hentry *** words, short wnum, hentry * rv, hentry **
|
|||
for (i = 0; i < numdefcpd; i++) {
|
||||
for (j = 0; j < defcpdtable[i].len; j++) {
|
||||
if (defcpdtable[i].def[j] != '*' && defcpdtable[i].def[j] != '?' &&
|
||||
TESTAFF(rv->astr, defcpdtable[i].def[j], rv->alen)) ok = 1;
|
||||
TESTAFF(rv->astr, defcpdtable[i].def[j], rv->alen)) {
|
||||
ok = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ok == 0) {
|
||||
|
@ -1598,7 +1555,7 @@ struct hentry * AffixMgr::compound_check(const char * word, int len,
|
|||
int oldlen = 0;
|
||||
int checkedstriple = 0;
|
||||
int onlycpdrule;
|
||||
int affixed = 0;
|
||||
char affixed = 0;
|
||||
hentry ** oldwords = words;
|
||||
|
||||
int checked_prefix;
|
||||
|
@ -1680,8 +1637,9 @@ struct hentry * AffixMgr::compound_check(const char * word, int len,
|
|||
if (onlycpdrule) break;
|
||||
if (compoundflag &&
|
||||
!(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundflag))) {
|
||||
if ((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
|
||||
FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) && !hu_mov_rule &&
|
||||
if (((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
|
||||
FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundflag)))) && !hu_mov_rule &&
|
||||
sfx->getCont() &&
|
||||
((compoundforbidflag && TESTAFF(sfx->getCont(), compoundforbidflag,
|
||||
sfx->getContLen())) || (compoundend &&
|
||||
|
@ -1694,9 +1652,11 @@ struct hentry * AffixMgr::compound_check(const char * word, int len,
|
|||
if (rv ||
|
||||
(((wordnum == 0) && compoundbegin &&
|
||||
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundbegin, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundbegin))) || // twofold suffixes + compound
|
||||
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundbegin)))) ||
|
||||
((wordnum > 0) && compoundmiddle &&
|
||||
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundmiddle, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundmiddle))) || // twofold suffixes + compound
|
||||
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundmiddle)))))
|
||||
) checked_prefix = 1;
|
||||
// else check forbiddenwords and needaffix
|
||||
|
@ -2099,7 +2059,7 @@ int AffixMgr::compound_check_morph(const char * word, int len,
|
|||
int cmax;
|
||||
|
||||
int onlycpdrule;
|
||||
int affixed = 0;
|
||||
char affixed = 0;
|
||||
hentry ** oldwords = words;
|
||||
|
||||
setcminmax(&cmin, &cmax, word, len);
|
||||
|
@ -2169,11 +2129,12 @@ int AffixMgr::compound_check_morph(const char * word, int len,
|
|||
}
|
||||
|
||||
if (!rv) {
|
||||
if (onlycpdrule) break;
|
||||
if (onlycpdrule && strlen(*result) > MAXLNLEN/10) break;
|
||||
if (compoundflag &&
|
||||
!(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundflag))) {
|
||||
if ((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
|
||||
FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) && !hu_mov_rule &&
|
||||
if (((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL,
|
||||
FLAG_NULL, compoundflag, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundflag)))) && !hu_mov_rule &&
|
||||
sfx->getCont() &&
|
||||
((compoundforbidflag && TESTAFF(sfx->getCont(), compoundforbidflag,
|
||||
sfx->getContLen())) || (compoundend &&
|
||||
|
@ -2186,9 +2147,11 @@ int AffixMgr::compound_check_morph(const char * word, int len,
|
|||
if (rv ||
|
||||
(((wordnum == 0) && compoundbegin &&
|
||||
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundbegin, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundbegin))) || // twofold suffix+compound
|
||||
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundbegin)))) ||
|
||||
((wordnum > 0) && compoundmiddle &&
|
||||
((rv = suffix_check(st, i, 0, NULL, NULL, 0, NULL, FLAG_NULL, compoundmiddle, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN)) ||
|
||||
(compoundmoresuffixes && (rv = suffix_check_twosfx(st, i, 0, NULL, compoundmiddle))) || // twofold suffix+compound
|
||||
(rv = prefix_check(st, i, hu_mov_rule ? IN_CPD_OTHER : IN_CPD_BEGIN, compoundmiddle)))))
|
||||
) {
|
||||
// char * p = prefix_check_morph(st, i, 0, compound);
|
||||
|
@ -3608,7 +3571,7 @@ int AffixMgr::parse_reptable(char * line, FileMgr * af)
|
|||
/* now parse the numrep lines to read in the remainder of the table */
|
||||
char * nl;
|
||||
for (int j=0; j < numrep; j++) {
|
||||
if (!(nl = af->getline())) return 1;
|
||||
if ((nl = af->getline()) == NULL) return 1;
|
||||
mychomp(nl);
|
||||
tp = nl;
|
||||
i = 0;
|
||||
|
@ -4312,7 +4275,7 @@ int AffixMgr::parse_affix(char * line, const char at, FileMgr * af, char * dupf
|
|||
std::vector<affentry>::iterator start = affentries.begin();
|
||||
std::vector<affentry>::iterator end = affentries.end();
|
||||
for (std::vector<affentry>::iterator entry = start; entry != end; ++entry) {
|
||||
if (!(nl = af->getline())) return 1;
|
||||
if ((nl = af->getline()) == NULL) return 1;
|
||||
mychomp(nl);
|
||||
tp = nl;
|
||||
i = 0;
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _AFFIXMGR_HXX_
|
||||
#define _AFFIXMGR_HXX_
|
||||
|
||||
|
@ -98,6 +41,7 @@ class LIBHUNSPELL_DLL_EXPORTED AffixMgr
|
|||
FLAG compoundroot;
|
||||
FLAG compoundforbidflag;
|
||||
FLAG compoundpermitflag;
|
||||
int compoundmoresuffixes;
|
||||
int checkcompounddup;
|
||||
int checkcompoundrep;
|
||||
int checkcompoundcase;
|
||||
|
@ -301,6 +245,7 @@ private:
|
|||
int process_sfx_tree_to_list();
|
||||
int redundant_condition(char, char * strip, int stripl,
|
||||
const char * cond, int);
|
||||
void finishFileMgr(FileMgr *afflst);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _ATYPES_HXX_
|
||||
#define _ATYPES_HXX_
|
||||
|
||||
|
@ -114,7 +57,7 @@ static inline void HUNSPELL_WARNING(FILE *, const char *, ...) {}
|
|||
#define FLAG_NULL 0x00
|
||||
#define FREE_FLAG(a) a = 0
|
||||
|
||||
#define TESTAFF( a, b , c ) flag_bsearch((unsigned short *) a, (unsigned short) b, c)
|
||||
#define TESTAFF( a, b , c ) (flag_bsearch((unsigned short *) a, (unsigned short) b, c))
|
||||
|
||||
struct affentry
|
||||
{
|
||||
|
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _BASEAFF_HXX_
|
||||
#define _BASEAFF_HXX_
|
||||
|
||||
|
@ -62,7 +5,11 @@
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED AffEntry
|
||||
{
|
||||
private:
|
||||
AffEntry(const AffEntry&);
|
||||
AffEntry& operator = (const AffEntry&);
|
||||
protected:
|
||||
AffEntry() {}
|
||||
char * appnd;
|
||||
char * strip;
|
||||
unsigned char appndl;
|
||||
|
|
|
@ -1,60 +1,5 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* L. David Baron (dbaron@dbaron.org)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -72,6 +17,11 @@ struct unicode_info {
|
|||
unsigned short clower;
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#ifdef OPENOFFICEORG
|
||||
# include <unicode/uchar.h>
|
||||
#else
|
||||
|
@ -100,6 +50,21 @@ struct unicode_info2 {
|
|||
static struct unicode_info2 * utf_tbl = NULL;
|
||||
static int utf_tbl_count = 0; // utf_tbl can be used by multiple Hunspell instances
|
||||
|
||||
FILE * myfopen(const char * path, const char * mode) {
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LONG_PATH_PREFIX "\\\\?\\"
|
||||
if (strncmp(path, WIN32_LONG_PATH_PREFIX, 4) == 0) {
|
||||
int len = MultiByteToWideChar(CP_UTF8, 0, path, -1, NULL, 0);
|
||||
wchar_t *buff = (wchar_t *) malloc(len * sizeof(wchar_t));
|
||||
MultiByteToWideChar(CP_UTF8, 0, path, -1, buff, len);
|
||||
FILE * f = _wfopen(buff, (strcmp(mode, "r") == 0) ? L"r" : L"rb");
|
||||
free(buff);
|
||||
return f;
|
||||
}
|
||||
#endif
|
||||
return fopen(path, mode);
|
||||
}
|
||||
|
||||
/* only UTF-16 (BMP) implementation */
|
||||
char * u16_u8(char * dest, int size, const w_char * src, int srclen) {
|
||||
signed char * u8 = (signed char *)dest;
|
||||
|
@ -396,7 +361,10 @@ char * line_uniq(char * text, char breakchar) {
|
|||
for ( i = 1; i < linenum; i++ ) {
|
||||
int dup = 0;
|
||||
for (int j = 0; j < i; j++) {
|
||||
if (strcmp(lines[i], lines[j]) == 0) dup = 1;
|
||||
if (strcmp(lines[i], lines[j]) == 0) {
|
||||
dup = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!dup) {
|
||||
if ((i > 1) || (*(lines[0]) != '\0')) {
|
||||
|
@ -5531,6 +5499,7 @@ struct cs_info * get_current_cs(const char * es) {
|
|||
ccs[i].cupper = i;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIUnicodeEncoder> encoder;
|
||||
nsCOMPtr<nsIUnicodeDecoder> decoder;
|
||||
|
||||
|
@ -5707,7 +5676,7 @@ unsigned short unicodetoupper(unsigned short c, int langnum)
|
|||
if (c == 0x0069 && ((langnum == LANG_az) || (langnum == LANG_tr)))
|
||||
return 0x0130;
|
||||
#ifdef OPENOFFICEORG
|
||||
return u_toupper(c);
|
||||
return static_cast<unsigned short>(u_toupper(c));
|
||||
#else
|
||||
#ifdef MOZILLA_CLIENT
|
||||
return ToUpperCase((char16_t) c);
|
||||
|
@ -5725,7 +5694,7 @@ unsigned short unicodetolower(unsigned short c, int langnum)
|
|||
if (c == 0x0049 && ((langnum == LANG_az) || (langnum == LANG_tr)))
|
||||
return 0x0131;
|
||||
#ifdef OPENOFFICEORG
|
||||
return u_tolower(c);
|
||||
return static_cast<unsigned short>(u_tolower(c));
|
||||
#else
|
||||
#ifdef MOZILLA_CLIENT
|
||||
return ToLowerCase((char16_t) c);
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef __CSUTILHXX__
|
||||
#define __CSUTILHXX__
|
||||
|
||||
|
@ -109,6 +52,9 @@
|
|||
#define FORBIDDENWORD 65510
|
||||
#define ONLYUPCASEFLAG 65511
|
||||
|
||||
// fopen or optional _wfopen to fix long pathname problem of WIN32
|
||||
LIBHUNSPELL_DLL_EXPORTED FILE * myfopen(const char * path, const char * mode);
|
||||
|
||||
// convert UTF-16 characters to UTF-8
|
||||
LIBHUNSPELL_DLL_EXPORTED char * u16_u8(char * dest, int size, const w_char * src, int srclen);
|
||||
|
||||
|
|
|
@ -1,36 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -38,6 +5,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "dictmgr.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
||||
DictMgr::DictMgr(const char * dictpath, const char * etype) : numdict(0)
|
||||
{
|
||||
|
@ -90,7 +58,7 @@ int DictMgr::parse_file(const char * dictpath, const char * etype)
|
|||
|
||||
// open the dictionary list file
|
||||
FILE * dictlst;
|
||||
dictlst = fopen(dictpath,"r");
|
||||
dictlst = myfopen(dictpath,"r");
|
||||
if (!dictlst) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -133,7 +101,8 @@ int DictMgr::parse_file(const char * dictpath, const char * etype)
|
|||
case 3:
|
||||
free(pdict->region);
|
||||
pdict->region=NULL;
|
||||
case 2: //deliberate fallthrough
|
||||
/* FALLTHROUGH */
|
||||
case 2:
|
||||
free(pdict->lang);
|
||||
pdict->lang=NULL;
|
||||
default:
|
|
@ -1,37 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _DICTMGR_HXX_
|
||||
#define _DICTMGR_HXX_
|
||||
|
||||
|
@ -49,7 +15,10 @@ struct dictentry {
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED DictMgr
|
||||
{
|
||||
|
||||
private:
|
||||
DictMgr(const DictMgr&);
|
||||
DictMgr& operator = (const DictMgr&);
|
||||
private:
|
||||
int numdict;
|
||||
dictentry * pdentry;
|
||||
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "filemgr.hxx"
|
||||
|
||||
int FileMgr::fail(const char * err, const char * par) {
|
||||
fprintf(stderr, err, par);
|
||||
return -1;
|
||||
}
|
||||
|
||||
FileMgr::FileMgr(const char * file, const char * key) {
|
||||
linenum = 0;
|
||||
hin = NULL;
|
||||
fin = fopen(file, "r");
|
||||
if (!fin) {
|
||||
// check hzipped file
|
||||
char * st = (char *) malloc(strlen(file) + strlen(HZIP_EXTENSION) + 1);
|
||||
if (st) {
|
||||
strcpy(st, file);
|
||||
strcat(st, HZIP_EXTENSION);
|
||||
hin = new Hunzip(st, key);
|
||||
free(st);
|
||||
}
|
||||
}
|
||||
if (!fin && !hin) fail(MSG_OPEN, file);
|
||||
}
|
||||
|
||||
FileMgr::~FileMgr()
|
||||
{
|
||||
if (fin) fclose(fin);
|
||||
if (hin) delete hin;
|
||||
}
|
||||
|
||||
char * FileMgr::getline() {
|
||||
const char * l;
|
||||
linenum++;
|
||||
if (fin) return fgets(in, BUFSIZE - 1, fin);
|
||||
if (hin && (l = hin->getline())) return strcpy(in, l);
|
||||
linenum--;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int FileMgr::getlinenum() {
|
||||
return linenum;
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "filemgr.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
||||
int FileMgr::fail(const char * err, const char * par) {
|
||||
fprintf(stderr, err, par);
|
||||
return -1;
|
||||
}
|
||||
|
||||
FileMgr::FileMgr(const char * file, const char * key)
|
||||
: hin(NULL)
|
||||
, linenum(0)
|
||||
{
|
||||
in[0] = '\0';
|
||||
|
||||
fin = myfopen(file, "r");
|
||||
if (!fin) {
|
||||
// check hzipped file
|
||||
char * st = (char *) malloc(strlen(file) + strlen(HZIP_EXTENSION) + 1);
|
||||
if (st) {
|
||||
strcpy(st, file);
|
||||
strcat(st, HZIP_EXTENSION);
|
||||
hin = new Hunzip(st, key);
|
||||
free(st);
|
||||
}
|
||||
}
|
||||
if (!fin && !hin) fail(MSG_OPEN, file);
|
||||
}
|
||||
|
||||
FileMgr::~FileMgr()
|
||||
{
|
||||
if (fin) fclose(fin);
|
||||
if (hin) delete hin;
|
||||
}
|
||||
|
||||
char * FileMgr::getline() {
|
||||
const char * l;
|
||||
linenum++;
|
||||
if (fin) return fgets(in, BUFSIZE - 1, fin);
|
||||
if (hin && ((l = hin->getline()) != NULL)) return strcpy(in, l);
|
||||
linenum--;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int FileMgr::getlinenum() {
|
||||
return linenum;
|
||||
}
|
|
@ -1,37 +1,4 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
/* file manager class - read lines of files [filename] OR [filename.hz] */
|
||||
#ifndef _FILEMGR_HXX_
|
||||
#define _FILEMGR_HXX_
|
||||
|
||||
|
@ -42,6 +9,9 @@
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED FileMgr
|
||||
{
|
||||
private:
|
||||
FileMgr(const FileMgr&);
|
||||
FileMgr& operator = (const FileMgr&);
|
||||
protected:
|
||||
FILE * fin;
|
||||
Hunzip * hin;
|
||||
|
|
|
@ -1,64 +1,11 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <limits>
|
||||
|
||||
#include "hashmgr.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
@ -67,12 +14,19 @@
|
|||
// build a hash table from a munched word list
|
||||
|
||||
HashMgr::HashMgr(const char * tpath, const char * apath, const char * key)
|
||||
: tablesize(0)
|
||||
, tableptr(NULL)
|
||||
, userword(0)
|
||||
, flag_mode(FLAG_CHAR)
|
||||
, complexprefixes(0)
|
||||
, utf8(0)
|
||||
, forbiddenword(FORBIDDENWORD) // forbidden word signing flag
|
||||
, numaliasf(0)
|
||||
, aliasf(NULL)
|
||||
, aliasflen(0)
|
||||
, numaliasm(0)
|
||||
, aliasm(NULL)
|
||||
{
|
||||
tablesize = 0;
|
||||
tableptr = NULL;
|
||||
flag_mode = FLAG_CHAR;
|
||||
complexprefixes = 0;
|
||||
utf8 = 0;
|
||||
langnum = 0;
|
||||
lang = NULL;
|
||||
enc = NULL;
|
||||
|
@ -80,11 +34,6 @@ HashMgr::HashMgr(const char * tpath, const char * apath, const char * key)
|
|||
ignorechars = NULL;
|
||||
ignorechars_utf16 = NULL;
|
||||
ignorechars_utf16_len = 0;
|
||||
numaliasf = 0;
|
||||
aliasf = NULL;
|
||||
numaliasm = 0;
|
||||
aliasm = NULL;
|
||||
forbiddenword = FORBIDDENWORD; // forbidden word signing flag
|
||||
load_config(apath, key);
|
||||
int ec = load_tables(tpath, key);
|
||||
if (ec) {
|
||||
|
@ -170,7 +119,7 @@ int HashMgr::add_word(const char * word, int wbl, int wcl, unsigned short * aff,
|
|||
int al, const char * desc, bool onlyupcase)
|
||||
{
|
||||
bool upcasehomonym = false;
|
||||
int descl = desc ? (aliasm ? sizeof(short) : strlen(desc) + 1) : 0;
|
||||
int descl = desc ? (aliasm ? sizeof(char *) : strlen(desc) + 1) : 0;
|
||||
// variable-length hash record with word and optional fields
|
||||
struct hentry* hp =
|
||||
(struct hentry *) malloc (sizeof(struct hentry) + wbl + descl);
|
||||
|
@ -264,18 +213,21 @@ int HashMgr::add_word(const char * word, int wbl, int wcl, unsigned short * aff,
|
|||
}
|
||||
|
||||
int HashMgr::add_hidden_capitalized_word(char * word, int wbl, int wcl,
|
||||
unsigned short * flags, int al, char * dp, int captype)
|
||||
unsigned short * flags, int flagslen, char * dp, int captype)
|
||||
{
|
||||
if (flags == NULL)
|
||||
flagslen = 0;
|
||||
|
||||
// add inner capitalized forms to handle the following allcap forms:
|
||||
// Mixed caps: OpenOffice.org -> OPENOFFICE.ORG
|
||||
// Allcaps with suffixes: CIA's -> CIA'S
|
||||
if (((captype == HUHCAP) || (captype == HUHINITCAP) ||
|
||||
((captype == ALLCAP) && (flags != NULL))) &&
|
||||
!((flags != NULL) && TESTAFF(flags, forbiddenword, al))) {
|
||||
unsigned short * flags2 = (unsigned short *) malloc (sizeof(unsigned short) * (al+1));
|
||||
((captype == ALLCAP) && (flagslen != 0))) &&
|
||||
!((flagslen != 0) && TESTAFF(flags, forbiddenword, flagslen))) {
|
||||
unsigned short * flags2 = (unsigned short *) malloc (sizeof(unsigned short) * (flagslen+1));
|
||||
if (!flags2) return 1;
|
||||
if (al) memcpy(flags2, flags, al * sizeof(unsigned short));
|
||||
flags2[al] = ONLYUPCASEFLAG;
|
||||
if (flagslen) memcpy(flags2, flags, flagslen * sizeof(unsigned short));
|
||||
flags2[flagslen] = ONLYUPCASEFLAG;
|
||||
if (utf8) {
|
||||
char st[BUFSIZE];
|
||||
w_char w[BUFSIZE];
|
||||
|
@ -283,11 +235,11 @@ int HashMgr::add_hidden_capitalized_word(char * word, int wbl, int wcl,
|
|||
mkallsmall_utf(w, wlen, langnum);
|
||||
mkallcap_utf(w, 1, langnum);
|
||||
u16_u8(st, BUFSIZE, w, wlen);
|
||||
return add_word(st,wbl,wcl,flags2,al+1,dp, true);
|
||||
return add_word(st,wbl,wcl,flags2,flagslen+1,dp, true);
|
||||
} else {
|
||||
mkallsmall(word, csconv);
|
||||
mkinitcap(word, csconv);
|
||||
return add_word(word,wbl,wcl,flags2,al+1,dp, true);
|
||||
return add_word(word,wbl,wcl,flags2,flagslen+1,dp, true);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -417,8 +369,8 @@ int HashMgr::load_tables(const char * tpath, const char * key)
|
|||
if (dict == NULL) return 1;
|
||||
|
||||
// first read the first line of file to get hash table size */
|
||||
if (!(ts = dict->getline())) {
|
||||
HUNSPELL_WARNING(stderr, "error: empty dic file\n");
|
||||
if ((ts = dict->getline()) == NULL) {
|
||||
HUNSPELL_WARNING(stderr, "error: empty dic file %s\n", tpath);
|
||||
delete dict;
|
||||
return 2;
|
||||
}
|
||||
|
@ -431,30 +383,32 @@ int HashMgr::load_tables(const char * tpath, const char * key)
|
|||
}
|
||||
|
||||
tablesize = atoi(ts);
|
||||
if (tablesize == 0) {
|
||||
|
||||
int nExtra = 5 + USERWORD;
|
||||
|
||||
if (tablesize <= 0 || (tablesize >= (std::numeric_limits<int>::max() - 1 - nExtra) / int(sizeof(struct hentry *)))) {
|
||||
HUNSPELL_WARNING(stderr, "error: line 1: missing or bad word count in the dic file\n");
|
||||
delete dict;
|
||||
return 4;
|
||||
}
|
||||
tablesize = tablesize + 5 + USERWORD;
|
||||
if ((tablesize %2) == 0) tablesize++;
|
||||
tablesize += nExtra;
|
||||
if ((tablesize % 2) == 0) tablesize++;
|
||||
|
||||
// allocate the hash table
|
||||
tableptr = (struct hentry **) malloc(tablesize * sizeof(struct hentry *));
|
||||
tableptr = (struct hentry **) calloc(tablesize, sizeof(struct hentry *));
|
||||
if (! tableptr) {
|
||||
delete dict;
|
||||
return 3;
|
||||
}
|
||||
for (int i=0; i<tablesize; i++) tableptr[i] = NULL;
|
||||
|
||||
// loop through all words on much list and add to hash
|
||||
// table and create word and affix strings
|
||||
|
||||
while ((ts = dict->getline())) {
|
||||
while ((ts = dict->getline()) != NULL) {
|
||||
mychomp(ts);
|
||||
// split each line into word and morphological description
|
||||
dp = ts;
|
||||
while ((dp = strchr(dp, ':'))) {
|
||||
while ((dp = strchr(dp, ':')) != NULL) {
|
||||
if ((dp > ts + 3) && (*(dp - 3) == ' ' || *(dp - 3) == '\t')) {
|
||||
for (dp -= 4; dp >= ts && (*dp == ' ' || *dp == '\t'); dp--);
|
||||
if (dp < ts) { // missing word
|
||||
|
@ -670,7 +624,7 @@ int HashMgr::load_config(const char * affpath, const char * key)
|
|||
// read in each line ignoring any that do not
|
||||
// start with a known line type indicator
|
||||
|
||||
while ((line = afflst->getline())) {
|
||||
while ((line = afflst->getline()) != NULL) {
|
||||
mychomp(line);
|
||||
|
||||
/* remove byte order mark */
|
||||
|
@ -810,7 +764,7 @@ int HashMgr::parse_aliasf(char * line, FileMgr * af)
|
|||
/* now parse the numaliasf lines to read in the remainder of the table */
|
||||
char * nl;
|
||||
for (int j=0; j < numaliasf; j++) {
|
||||
if (!(nl = af->getline())) return 1;
|
||||
if ((nl = af->getline()) == NULL) return 1;
|
||||
mychomp(nl);
|
||||
tp = nl;
|
||||
i = 0;
|
||||
|
@ -917,7 +871,7 @@ int HashMgr::parse_aliasm(char * line, FileMgr * af)
|
|||
/* now parse the numaliasm lines to read in the remainder of the table */
|
||||
char * nl = line;
|
||||
for (int j=0; j < numaliasm; j++) {
|
||||
if (!(nl = af->getline())) return 1;
|
||||
if ((nl = af->getline()) == NULL) return 1;
|
||||
mychomp(nl);
|
||||
tp = nl;
|
||||
i = 0;
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _HASHMGR_HXX_
|
||||
#define _HASHMGR_HXX_
|
||||
|
||||
|
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _HTYPES_HXX_
|
||||
#define _HTYPES_HXX_
|
||||
|
||||
|
|
|
@ -1,59 +1,5 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -66,6 +12,8 @@
|
|||
#endif
|
||||
#include "csutil.hxx"
|
||||
|
||||
#include <string>
|
||||
|
||||
Hunspell::Hunspell(const char * affpath, const char * dpath, const char * key)
|
||||
{
|
||||
encoding = NULL;
|
||||
|
@ -382,6 +330,10 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
|||
char cw[MAXWORDUTF8LEN];
|
||||
char wspace[MAXWORDUTF8LEN];
|
||||
w_char unicw[MAXWORDLEN];
|
||||
|
||||
int info2 = 0;
|
||||
if (!info) info = &info2; else *info = 0;
|
||||
|
||||
// Hunspell supports XML input of the simplified API (see manual)
|
||||
if (strcmp(word, SPELL_XML) == 0) return 1;
|
||||
int nc = strlen(word);
|
||||
|
@ -400,7 +352,6 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
|||
if (rl && rl->conv(word, wspace)) wl = cleanword2(cw, wspace, unicw, &nc, &captype, &abbv);
|
||||
else wl = cleanword2(cw, word, unicw, &nc, &captype, &abbv);
|
||||
|
||||
int info2 = 0;
|
||||
if (wl == 0 || maxdic == 0) return 1;
|
||||
if (root) *root = NULL;
|
||||
|
||||
|
@ -418,13 +369,14 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
|||
} else break;
|
||||
}
|
||||
if ((i == wl) && (nstate == NNUM)) return 1;
|
||||
if (!info) info = &info2; else *info = 0;
|
||||
|
||||
switch(captype) {
|
||||
case HUHCAP:
|
||||
/* FALLTHROUGH */
|
||||
case HUHINITCAP:
|
||||
*info += SPELL_ORIGCAP;
|
||||
case NOCAP: {
|
||||
/* FALLTHROUGH */
|
||||
case NOCAP:
|
||||
rv = checkword(cw, info, root);
|
||||
if ((abbv) && !(rv)) {
|
||||
memcpy(wspace,cw,wl);
|
||||
|
@ -433,7 +385,6 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
|||
rv = checkword(wspace, info, root);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ALLCAP: {
|
||||
*info += SPELL_ORIGCAP;
|
||||
rv = checkword(cw, info, root);
|
||||
|
@ -457,7 +408,7 @@ int Hunspell::spell(const char * word, int * info, char ** root)
|
|||
*apostrophe = '\0';
|
||||
wl2 = u8_u16(tmpword, MAXWORDLEN, cw);
|
||||
*apostrophe = '\'';
|
||||
if (wl2 < nc) {
|
||||
if (wl2 >= 0 && wl2 < nc) {
|
||||
mkinitcap2(apostrophe + 1, unicw + wl2 + 1, nc - wl2 - 1);
|
||||
rv = checkword(cw, info, root);
|
||||
if (rv) break;
|
||||
|
@ -804,19 +755,28 @@ int Hunspell::suggest(char*** slst, const char * word)
|
|||
char * dot = strchr(cw, '.');
|
||||
if (dot && (dot > cw)) {
|
||||
int captype_;
|
||||
if (utf8) {
|
||||
if (utf8)
|
||||
{
|
||||
w_char w_[MAXWORDLEN];
|
||||
int wl_ = u8_u16(w_, MAXWORDLEN, dot + 1);
|
||||
captype_ = get_captype_utf8(w_, wl_, langnum);
|
||||
} else captype_ = get_captype(dot+1, strlen(dot+1), csconv);
|
||||
if (captype_ == INITCAP) {
|
||||
if (captype_ == INITCAP)
|
||||
{
|
||||
char * st = mystrdup(cw);
|
||||
if (st) st = (char *) realloc(st, wl + 2);
|
||||
if (st) {
|
||||
st[(dot - cw) + 1] = ' ';
|
||||
strcpy(st + (dot - cw) + 2, dot + 1);
|
||||
ns = insert_sug(slst, st, ns);
|
||||
free(st);
|
||||
if (st)
|
||||
{
|
||||
char *newst = (char *) realloc(st, wl + 2);
|
||||
if (newst == NULL)
|
||||
free(st);
|
||||
st = newst;
|
||||
}
|
||||
if (st)
|
||||
{
|
||||
st[(dot - cw) + 1] = ' ';
|
||||
strcpy(st + (dot - cw) + 2, dot + 1);
|
||||
ns = insert_sug(slst, st, ns);
|
||||
free(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -902,7 +862,7 @@ int Hunspell::suggest(char*** slst, const char * word)
|
|||
*pos = '\0';
|
||||
strcpy(w, (*slst)[j]);
|
||||
strcat(w, pos + 1);
|
||||
spell(w, &info, NULL);
|
||||
(void)spell(w, &info, NULL);
|
||||
if ((info & SPELL_COMPOUND) && (info & SPELL_FORBIDDEN)) {
|
||||
*pos = ' ';
|
||||
} else *pos = '-';
|
||||
|
@ -1724,6 +1684,13 @@ int Hunspell::get_langnum() const
|
|||
return langnum;
|
||||
}
|
||||
|
||||
int Hunspell::input_conv(const char * word, char * dest)
|
||||
{
|
||||
RepList * rl = (pAMgr) ? pAMgr->get_iconvtable() : NULL;
|
||||
return (rl && rl->conv(word, dest));
|
||||
}
|
||||
|
||||
|
||||
// return the beginning of the element (attr == NULL) or the attribute
|
||||
const char * Hunspell::get_xml_pos(const char * s, const char * attr)
|
||||
{
|
||||
|
@ -1748,11 +1715,11 @@ int Hunspell::get_xml_list(char ***slst, char * list, const char * tag) {
|
|||
int n = 0;
|
||||
char * p;
|
||||
if (!list) return 0;
|
||||
for (p = list; (p = strstr(p, tag)); p++) n++;
|
||||
for (p = list; ((p = strstr(p, tag)) != NULL); p++) n++;
|
||||
if (n == 0) return 0;
|
||||
*slst = (char **) malloc(sizeof(char *) * n);
|
||||
if (!*slst) return 0;
|
||||
for (p = list, n = 0; (p = strstr(p, tag)); p++, n++) {
|
||||
for (p = list, n = 0; ((p = strstr(p, tag)) != NULL); p++, n++) {
|
||||
int l = strlen(p);
|
||||
(*slst)[n] = (char *) malloc(l + 1);
|
||||
if (!(*slst)[n]) return n;
|
||||
|
@ -1764,6 +1731,19 @@ int Hunspell::get_xml_list(char ***slst, char * list, const char * tag) {
|
|||
return n;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
void myrep(std::string& str, const std::string& search, const std::string& replace)
|
||||
{
|
||||
size_t pos = 0;
|
||||
while ((pos = str.find(search, pos)) != std::string::npos)
|
||||
{
|
||||
str.replace(pos, search.length(), replace);
|
||||
pos += replace.length();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Hunspell::spellml(char*** slst, const char * word)
|
||||
{
|
||||
char *q, *q2;
|
||||
|
@ -1775,26 +1755,26 @@ int Hunspell::spellml(char*** slst, const char * word)
|
|||
q2 = strstr(q2, "<word");
|
||||
if (!q2) return 0; // bad XML input
|
||||
if (check_xml_par(q, "type=", "analyze")) {
|
||||
int n = 0, s = 0;
|
||||
int n = 0;
|
||||
if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 10)) n = analyze(slst, cw);
|
||||
if (n == 0) return 0;
|
||||
// convert the result to <code><a>ana1</a><a>ana2</a></code> format
|
||||
for (int i = 0; i < n; i++) s+= strlen((*slst)[i]);
|
||||
char * r = (char *) malloc(6 + 5 * s + 7 * n + 7 + 1); // XXX 5*s->&->&
|
||||
if (!r) return 0;
|
||||
strcpy(r, "<code>");
|
||||
std::string r;
|
||||
r.append("<code>");
|
||||
for (int i = 0; i < n; i++) {
|
||||
int l = strlen(r);
|
||||
strcpy(r + l, "<a>");
|
||||
strcpy(r + l + 3, (*slst)[i]);
|
||||
mystrrep(r + l + 3, "\t", " ");
|
||||
mystrrep(r + l + 3, "<", "<");
|
||||
mystrrep(r + l + 3, "&", "&");
|
||||
strcat(r, "</a>");
|
||||
r.append("<a>");
|
||||
|
||||
std::string entry((*slst)[i]);
|
||||
free((*slst)[i]);
|
||||
myrep(entry, "\t", " ");
|
||||
myrep(entry, "&", "&");
|
||||
myrep(entry, "<", "<");
|
||||
r.append(entry);
|
||||
|
||||
r.append("</a>");
|
||||
}
|
||||
strcat(r, "</code>");
|
||||
(*slst)[0] = r;
|
||||
r.append("</code>");
|
||||
(*slst)[0] = mystrdup(r.c_str());
|
||||
return 1;
|
||||
} else if (check_xml_par(q, "type=", "stem")) {
|
||||
if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 1)) return stem(slst, cw);
|
||||
|
@ -1807,9 +1787,9 @@ int Hunspell::spellml(char*** slst, const char * word)
|
|||
return generate(slst, cw, cw2);
|
||||
}
|
||||
} else {
|
||||
if ((q2 = strstr(q2 + 1, "<code"))) {
|
||||
if ((q2 = strstr(q2 + 1, "<code")) != NULL) {
|
||||
char ** slst2;
|
||||
if ((n = get_xml_list(&slst2, strchr(q2, '>'), "<a>"))) {
|
||||
if ((n = get_xml_list(&slst2, strchr(q2, '>'), "<a>")) != 0) {
|
||||
int n2 = generate(slst, cw, slst2, n);
|
||||
freelist(&slst2, n);
|
||||
return uniqlist(*slst, n2);
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _MYSPELLMGR_H_
|
||||
#define _MYSPELLMGR_H_
|
||||
|
||||
|
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#include "hunvisapi.h"
|
||||
|
||||
#include "hashmgr.hxx"
|
||||
|
@ -76,6 +19,10 @@
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED Hunspell
|
||||
{
|
||||
private:
|
||||
Hunspell(const Hunspell&);
|
||||
Hunspell& operator = (const Hunspell&);
|
||||
private:
|
||||
AffixMgr* pAMgr;
|
||||
HashMgr* pHMgr[MAXDIC];
|
||||
int maxdic;
|
||||
|
@ -92,6 +39,11 @@ public:
|
|||
|
||||
/* Hunspell(aff, dic) - constructor of Hunspell class
|
||||
* input: path of affix file and dictionary file
|
||||
*
|
||||
* In WIN32 environment, use UTF-8 encoded paths started with the long path
|
||||
* prefix \\\\?\\ to handle system-independent character encoding and very
|
||||
* long path names (without the long path prefix Hunspell will use fopen()
|
||||
* with system-dependent character encoding instead of _wfopen()).
|
||||
*/
|
||||
|
||||
Hunspell(const char * affpath, const char * dpath, const char * key = NULL);
|
||||
|
@ -188,6 +140,9 @@ public:
|
|||
const char * get_version();
|
||||
|
||||
int get_langnum() const;
|
||||
|
||||
/* need for putdic */
|
||||
int input_conv(const char * word, char * dest);
|
||||
|
||||
/* experimental and deprecated functions */
|
||||
|
||||
|
|
|
@ -1,36 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code is Caolan McNamara.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010 the
|
||||
* Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _HUNSPELL_VISIBILITY_H_
|
||||
#define _HUNSPELL_VISIBILITY_H_
|
||||
|
||||
|
@ -42,7 +9,7 @@
|
|||
# else
|
||||
# define LIBHUNSPELL_DLL_EXPORTED __declspec(dllimport)
|
||||
# endif
|
||||
#elif BUILDING_LIBHUNSPELL && 1
|
||||
#elif defined(BUILDING_LIBHUNSPELL) && 1
|
||||
# define LIBHUNSPELL_DLL_EXPORTED __attribute__((__visibility__("default")))
|
||||
#else
|
||||
# define LIBHUNSPELL_DLL_EXPORTED
|
||||
|
|
|
@ -1,42 +1,9 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "hunzip.hxx"
|
||||
#include "csutil.hxx"
|
||||
|
||||
#define CODELEN 65536
|
||||
#define BASEBITREC 5000
|
||||
|
@ -51,15 +18,17 @@ int Hunzip::fail(const char * err, const char * par) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
Hunzip::Hunzip(const char * file, const char * key) {
|
||||
bufsiz = 0;
|
||||
lastbit = 0;
|
||||
inc = 0;
|
||||
outc = 0;
|
||||
dec = NULL;
|
||||
fin = NULL;
|
||||
filename = (char *) malloc(strlen(file) + 1);
|
||||
if (filename) strcpy(filename, file);
|
||||
Hunzip::Hunzip(const char * file, const char * key)
|
||||
: fin(NULL)
|
||||
, bufsiz(0)
|
||||
, lastbit(0)
|
||||
, inc(0)
|
||||
, inbits(0)
|
||||
, outc(0)
|
||||
, dec(NULL)
|
||||
{
|
||||
in[0] = out[0] = line[0] = '\0';
|
||||
filename = mystrdup(file);
|
||||
if (getcode(key) == -1) bufsiz = -1;
|
||||
else bufsiz = getbuf();
|
||||
}
|
||||
|
@ -72,7 +41,7 @@ int Hunzip::getcode(const char * key) {
|
|||
|
||||
if (!filename) return -1;
|
||||
|
||||
fin = fopen(filename, "rb");
|
||||
fin = myfopen(filename, "rb");
|
||||
if (!fin) return -1;
|
||||
|
||||
// read magic number
|
|
@ -1,36 +1,5 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
/* hunzip: file decompression for sorted dictionaries with optional encryption,
|
||||
* algorithm: prefix-suffix encoding and 16-bit Huffman encoding */
|
||||
|
||||
#ifndef _HUNZIP_HXX_
|
||||
#define _HUNZIP_HXX_
|
||||
|
@ -54,7 +23,9 @@ struct bit {
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED Hunzip
|
||||
{
|
||||
|
||||
private:
|
||||
Hunzip(const Hunzip&);
|
||||
Hunzip& operator = (const Hunzip&);
|
||||
protected:
|
||||
char * filename;
|
||||
FILE * fin;
|
||||
|
|
|
@ -1,59 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _LANGNUM_HXX_
|
||||
#define _LANGNUM_HXX_
|
||||
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Hunspell, based on MySpell.
|
||||
*
|
||||
* The Initial Developers of the Original Code are
|
||||
* Kevin Hendricks (MySpell) and Laszlo Nemeth (Hunspell).
|
||||
* Portions created by the Initial Developers are Copyright (C) 2002-2005
|
||||
* the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Einstein
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef MOZILLA_CLIENT
|
||||
# include "config.h"
|
||||
#endif
|
|
@ -11,17 +11,17 @@ UNIFIED_SOURCES += [
|
|||
|
||||
if not CONFIG['MOZ_NATIVE_HUNSPELL']:
|
||||
SOURCES += [
|
||||
'affentry.cpp',
|
||||
'affixmgr.cpp',
|
||||
'csutil.cpp',
|
||||
'dictmgr.cpp',
|
||||
'filemgr.cpp',
|
||||
'hashmgr.cpp',
|
||||
'hunspell.cpp',
|
||||
'hunzip.cpp',
|
||||
'phonet.cpp',
|
||||
'replist.cpp',
|
||||
'suggestmgr.cpp',
|
||||
'affentry.cxx',
|
||||
'affixmgr.cxx',
|
||||
'csutil.cxx',
|
||||
'dictmgr.cxx',
|
||||
'filemgr.cxx',
|
||||
'hashmgr.cxx',
|
||||
'hunspell.cxx',
|
||||
'hunzip.cxx',
|
||||
'phonet.cxx',
|
||||
'replist.cxx',
|
||||
'suggestmgr.cxx',
|
||||
]
|
||||
# This variable is referenced in configure.in. Make sure to change that file
|
||||
# too if you need to change this variable.
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
Bug 675553 - Switch from PRBool to bool.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5517,17 +5517,17 @@ struct cs_info * get_current_cs(const ch
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
decoder->SetInputErrorBehavior(decoder->kOnError_Signal);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
|
||||
for (unsigned int i = 0; i <= 0xff; ++i) {
|
||||
- PRBool success = PR_FALSE;
|
||||
+ bool success = false;
|
||||
// We want to find the upper/lowercase equivalents of each byte
|
||||
// in this 1-byte character encoding. Call our encoding/decoding
|
||||
// APIs separately for each byte since they may reject some of the
|
||||
// bytes, and we want to handle errors separately for each byte.
|
||||
char lower, upper;
|
||||
do {
|
||||
if (i == 0)
|
||||
break;
|
|
@ -0,0 +1,24 @@
|
|||
Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5549,17 +5549,17 @@ struct cs_info * get_current_cs(const ch
|
||||
|
||||
uniCased = ToUpperCase(uni);
|
||||
rv = encoder->Convert(&uniCased, &uniLength, &upper, &charLength);
|
||||
// Explicitly check NS_OK because we don't want to allow
|
||||
// NS_OK_UDEC_MOREOUTPUT or NS_OK_UDEC_MOREINPUT.
|
||||
if (rv != NS_OK || charLength != 1 || uniLength != 1)
|
||||
break;
|
||||
|
||||
- success = PR_TRUE;
|
||||
+ success = true;
|
||||
} while (0);
|
||||
|
||||
if (success) {
|
||||
ccs[i].cupper = upper;
|
||||
ccs[i].clower = lower;
|
||||
} else {
|
||||
ccs[i].cupper = i;
|
||||
ccs[i].clower = i;
|
|
@ -0,0 +1,25 @@
|
|||
Silence the warning about empty while body loop in clang.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/affentry.cxx b/extensions/spellcheck/hunspell/src/affentry.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/affentry.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/affentry.cxx
|
||||
@@ -571,17 +571,18 @@ inline int SfxEntry::test_condition(cons
|
||||
while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
st--;
|
||||
}
|
||||
if (p && *p != ']') p = nextchar(p);
|
||||
} else if (pos) {
|
||||
if (neg) return 0;
|
||||
else if (i == numconds) return 1;
|
||||
ingroup = true;
|
||||
- while (p && *p != ']' && ((p = nextchar(p)) != NULL));
|
||||
+ while (p && *p != ']' && ((p = nextchar(p)) != NULL))
|
||||
+ ;
|
||||
// if (p && *p != ']') p = nextchar(p);
|
||||
st--;
|
||||
}
|
||||
if (!pos) {
|
||||
i++;
|
||||
st--;
|
||||
}
|
||||
if (st < beg && p && *p != ']') return 0; // word <= condition
|
|
@ -0,0 +1,24 @@
|
|||
Bug 777292 - Change nsnull to nullptr.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5507,17 +5507,17 @@ struct cs_info * get_current_cs(const ch
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICharsetConverterManager> ccm = do_GetService(kCharsetConverterManagerCID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
|
||||
rv = ccm->GetUnicodeEncoder(es, getter_AddRefs(encoder));
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
- encoder->SetOutputErrorBehavior(encoder->kOnError_Signal, nsnull, '?');
|
||||
+ encoder->SetOutputErrorBehavior(encoder->kOnError_Signal, nullptr, '?');
|
||||
rv = ccm->GetUnicodeDecoder(es, getter_AddRefs(decoder));
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
decoder->SetInputErrorBehavior(decoder->kOnError_Signal);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return ccs;
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
Bug 579517 - Convert NSPR numeric types to stdint types.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5528,17 +5528,17 @@ struct cs_info * get_current_cs(const ch
|
||||
// APIs separately for each byte since they may reject some of the
|
||||
// bytes, and we want to handle errors separately for each byte.
|
||||
char lower, upper;
|
||||
do {
|
||||
if (i == 0)
|
||||
break;
|
||||
const char source = char(i);
|
||||
PRUnichar uni, uniCased;
|
||||
- PRInt32 charLength = 1, uniLength = 1;
|
||||
+ int32_t charLength = 1, uniLength = 1;
|
||||
|
||||
rv = decoder->Convert(&source, &charLength, &uni, &uniLength);
|
||||
// Explicitly check NS_OK because we don't want to allow
|
||||
// NS_OK_UDEC_MOREOUTPUT or NS_OK_UDEC_MOREINPUT.
|
||||
if (rv != NS_OK || charLength != 1 || uniLength != 1)
|
||||
break;
|
||||
uniCased = ToLowerCase(uni);
|
||||
rv = encoder->Convert(&uniCased, &uniLength, &lower, &charLength);
|
|
@ -0,0 +1,43 @@
|
|||
Bug 784776 - Don't assume NULL is numeric in Hunspell code.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/affentry.hxx b/extensions/spellcheck/hunspell/src/affentry.hxx
|
||||
--- a/extensions/spellcheck/hunspell/src/affentry.hxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/affentry.hxx
|
||||
@@ -26,17 +26,17 @@ public:
|
||||
|
||||
PfxEntry(AffixMgr* pmgr, affentry* dp );
|
||||
~PfxEntry();
|
||||
|
||||
inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
|
||||
struct hentry * checkword(const char * word, int len, char in_compound,
|
||||
const FLAG needflag = FLAG_NULL);
|
||||
|
||||
- struct hentry * check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);
|
||||
+ struct hentry * check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = FLAG_NULL);
|
||||
|
||||
char * check_morph(const char * word, int len, char in_compound,
|
||||
const FLAG needflag = FLAG_NULL);
|
||||
|
||||
char * check_twosfx_morph(const char * word, int len,
|
||||
char in_compound, const FLAG needflag = FLAG_NULL);
|
||||
|
||||
inline FLAG getFlag() { return aflag; }
|
||||
@@ -93,17 +93,17 @@ public:
|
||||
~SfxEntry();
|
||||
|
||||
inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
|
||||
struct hentry * checkword(const char * word, int len, int optflags,
|
||||
PfxEntry* ppfx, char ** wlst, int maxSug, int * ns,
|
||||
// const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, char in_compound=IN_CPD_NOT);
|
||||
const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, const FLAG badflag = 0);
|
||||
|
||||
- struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);
|
||||
+ struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
|
||||
|
||||
char * check_twosfx_morph(const char * word, int len, int optflags,
|
||||
PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
|
||||
struct hentry * get_next_homonym(struct hentry * he);
|
||||
struct hentry * get_next_homonym(struct hentry * word, int optflags, PfxEntry* ppfx,
|
||||
const FLAG cclass, const FLAG needflag);
|
||||
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
Bug 927728 - Replace PRUnichar with char16_t.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -5527,17 +5527,17 @@ struct cs_info * get_current_cs(const ch
|
||||
// in this 1-byte character encoding. Call our encoding/decoding
|
||||
// APIs separately for each byte since they may reject some of the
|
||||
// bytes, and we want to handle errors separately for each byte.
|
||||
char lower, upper;
|
||||
do {
|
||||
if (i == 0)
|
||||
break;
|
||||
const char source = char(i);
|
||||
- PRUnichar uni, uniCased;
|
||||
+ char16_t uni, uniCased;
|
||||
int32_t charLength = 1, uniLength = 1;
|
||||
|
||||
rv = decoder->Convert(&source, &charLength, &uni, &uniLength);
|
||||
// Explicitly check NS_OK because we don't want to allow
|
||||
// NS_OK_UDEC_MOREOUTPUT or NS_OK_UDEC_MOREINPUT.
|
||||
if (rv != NS_OK || charLength != 1 || uniLength != 1)
|
||||
break;
|
||||
uniCased = ToLowerCase(uni);
|
||||
@@ -5680,17 +5680,17 @@ unsigned short unicodetoupper(unsigned s
|
||||
// There are a dotless lower case i pair of upper `I',
|
||||
// and an upper I with dot pair of lower `i'.
|
||||
if (c == 0x0069 && ((langnum == LANG_az) || (langnum == LANG_tr)))
|
||||
return 0x0130;
|
||||
#ifdef OPENOFFICEORG
|
||||
return static_cast<unsigned short>(u_toupper(c));
|
||||
#else
|
||||
#ifdef MOZILLA_CLIENT
|
||||
- return ToUpperCase((PRUnichar) c);
|
||||
+ return ToUpperCase((char16_t) c);
|
||||
#else
|
||||
return (utf_tbl) ? utf_tbl[c].cupper : c;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned short unicodetolower(unsigned short c, int langnum)
|
||||
{
|
||||
@@ -5698,17 +5698,17 @@ unsigned short unicodetolower(unsigned s
|
||||
// There are a dotless lower case i pair of upper `I',
|
||||
// and an upper I with dot pair of lower `i'.
|
||||
if (c == 0x0049 && ((langnum == LANG_az) || (langnum == LANG_tr)))
|
||||
return 0x0131;
|
||||
#ifdef OPENOFFICEORG
|
||||
return static_cast<unsigned short>(u_tolower(c));
|
||||
#else
|
||||
#ifdef MOZILLA_CLIENT
|
||||
- return ToLowerCase((PRUnichar) c);
|
||||
+ return ToLowerCase((char16_t) c);
|
||||
#else
|
||||
return (utf_tbl) ? utf_tbl[c].clower : c;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
int unicodeisalpha(unsigned short c)
|
||||
{
|
|
@ -0,0 +1,71 @@
|
|||
Bug 943268 - Remove nsCharsetAlias and nsCharsetConverterManager.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/csutil.cxx b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
--- a/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
+++ b/extensions/spellcheck/hunspell/src/csutil.cxx
|
||||
@@ -28,23 +28,22 @@ struct unicode_info {
|
||||
# ifndef MOZILLA_CLIENT
|
||||
# include "utf_info.cxx"
|
||||
# define UTF_LST_LEN (sizeof(utf_lst) / (sizeof(unicode_info)))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef MOZILLA_CLIENT
|
||||
#include "nsCOMPtr.h"
|
||||
-#include "nsServiceManagerUtils.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
-#include "nsICharsetConverterManager.h"
|
||||
+#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
-static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
+using mozilla::dom::EncodingUtils;
|
||||
#endif
|
||||
|
||||
struct unicode_info2 {
|
||||
char cletter;
|
||||
unsigned short cupper;
|
||||
unsigned short clower;
|
||||
};
|
||||
|
||||
@@ -5500,32 +5499,27 @@ struct cs_info * get_current_cs(const ch
|
||||
ccs[i].cupper = i;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIUnicodeEncoder> encoder;
|
||||
nsCOMPtr<nsIUnicodeDecoder> decoder;
|
||||
|
||||
nsresult rv;
|
||||
- nsCOMPtr<nsICharsetConverterManager> ccm = do_GetService(kCharsetConverterManagerCID, &rv);
|
||||
- if (NS_FAILED(rv))
|
||||
+
|
||||
+ nsAutoCString label(es);
|
||||
+ nsAutoCString encoding;
|
||||
+ if (!EncodingUtils::FindEncodingForLabelNoReplacement(label, encoding)) {
|
||||
return ccs;
|
||||
-
|
||||
- rv = ccm->GetUnicodeEncoder(es, getter_AddRefs(encoder));
|
||||
- if (NS_FAILED(rv))
|
||||
- return ccs;
|
||||
+ }
|
||||
+ encoder = EncodingUtils::EncoderForEncoding(encoding);
|
||||
+ decoder = EncodingUtils::DecoderForEncoding(encoding);
|
||||
encoder->SetOutputErrorBehavior(encoder->kOnError_Signal, nullptr, '?');
|
||||
- rv = ccm->GetUnicodeDecoder(es, getter_AddRefs(decoder));
|
||||
- if (NS_FAILED(rv))
|
||||
- return ccs;
|
||||
decoder->SetInputErrorBehavior(decoder->kOnError_Signal);
|
||||
|
||||
- if (NS_FAILED(rv))
|
||||
- return ccs;
|
||||
-
|
||||
for (unsigned int i = 0; i <= 0xff; ++i) {
|
||||
bool success = false;
|
||||
// We want to find the upper/lowercase equivalents of each byte
|
||||
// in this 1-byte character encoding. Call our encoding/decoding
|
||||
// APIs separately for each byte since they may reject some of the
|
||||
// bytes, and we want to handle errors separately for each byte.
|
||||
char lower, upper;
|
||||
do {
|
|
@ -0,0 +1,18 @@
|
|||
Don't include config.h in license.hunspell if MOZILLA_CLIENT is set.
|
||||
|
||||
diff --git a/extensions/spellcheck/hunspell/src/license.hunspell b/extensions/spellcheck/hunspell/src/license.hunspell
|
||||
--- a/extensions/spellcheck/hunspell/src/license.hunspell
|
||||
+++ b/extensions/spellcheck/hunspell/src/license.hunspell
|
||||
@@ -51,9 +51,11 @@
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
-#include "config.h"
|
||||
+#ifndef MOZILLA_CLIENT
|
||||
+# include "config.h"
|
||||
+#endif
|
|
@ -1,48 +1,31 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Björn Jacke. Portions created
|
||||
* by the Initial Developers are Copyright (C) 2000-2007 the Initial
|
||||
* Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Björn Jacke (bjoern.jacke@gmx.de)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* Changelog:
|
||||
* 2000-01-05 Björn Jacke <bjoern.jacke AT gmx.de>
|
||||
* Initial Release insprired by the article about phonetic
|
||||
* transformations out of c't 25/1999
|
||||
*
|
||||
* 2007-07-26 Björn Jacke <bjoern.jacke AT gmx.de>
|
||||
* Released under MPL/GPL/LGPL tri-license for Hunspell
|
||||
*
|
||||
* 2007-08-23 László Németh <nemeth at OOo>
|
||||
* Porting from Aspell to Hunspell using C-like structs
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
/* phonetic.c - generic replacement aglogithms for phonetic transformation
|
||||
Copyright (C) 2000 Bjoern Jacke
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License version 2.1 as published by the Free Software Foundation;
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
Changelog:
|
||||
|
||||
2000-01-05 Bjoern Jacke <bjoern at j3e.de>
|
||||
Initial Release insprired by the article about phonetic
|
||||
transformations out of c't 25/1999
|
||||
|
||||
2007-07-26 Bjoern Jacke <bjoern at j3e.de>
|
||||
Released under MPL/GPL/LGPL tri-license for Hunspell
|
||||
|
||||
2007-08-23 Laszlo Nemeth <nemeth at OOo>
|
||||
Porting from Aspell to Hunspell using C-like structs
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -104,7 +87,8 @@ int phonet (const char * inword, char * target,
|
|||
char word[MAXPHONETUTF8LEN + 1];
|
||||
if (len == -1) len = strlen(inword);
|
||||
if (len > MAXPHONETUTF8LEN) return 0;
|
||||
strcpy(word, inword);
|
||||
strncpy(word, inword, MAXPHONETUTF8LEN);
|
||||
word[MAXPHONETUTF8LEN] = '\0';
|
||||
|
||||
/** check word **/
|
||||
i = j = z = 0;
|
|
@ -1,48 +1,31 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Björn Jacke. Portions created
|
||||
* by the Initial Developers are Copyright (C) 2000-2007 the Initial
|
||||
* Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Björn Jacke (bjoern.jacke@gmx.de)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* Changelog:
|
||||
* 2000-01-05 Björn Jacke <bjoern.jacke AT gmx.de>
|
||||
* Initial Release insprired by the article about phonetic
|
||||
* transformations out of c't 25/1999
|
||||
*
|
||||
* 2007-07-20 Björn Jacke <bjoern.jacke AT gmx.de>
|
||||
* Released under MPL/GPL/LGPL tri-license for Hunspell
|
||||
*
|
||||
* 2007-08-22 László Németh <nemeth at OOo>
|
||||
* Porting from Aspell to Hunspell by little modifications
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
/* phonetic.c - generic replacement aglogithms for phonetic transformation
|
||||
Copyright (C) 2000 Bjoern Jacke
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License version 2.1 as published by the Free Software Foundation;
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; If not, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
Changelog:
|
||||
|
||||
2000-01-05 Bjoern Jacke <bjoern at j3e.de>
|
||||
Initial Release insprired by the article about phonetic
|
||||
transformations out of c't 25/1999
|
||||
|
||||
2007-07-26 Bjoern Jacke <bjoern at j3e.de>
|
||||
Released under MPL/GPL/LGPL tri-license for Hunspell
|
||||
|
||||
2007-08-23 Laszlo Nemeth <nemeth at OOo>
|
||||
Porting from Aspell to Hunspell using C-like structs
|
||||
*/
|
||||
|
||||
#ifndef __PHONETHXX__
|
||||
#define __PHONETHXX__
|
||||
|
|
|
@ -1,36 +1,5 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
|
@ -1,37 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
/* string replacement list class */
|
||||
#ifndef _REPLIST_HXX_
|
||||
#define _REPLIST_HXX_
|
||||
|
@ -42,6 +8,9 @@
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED RepList
|
||||
{
|
||||
private:
|
||||
RepList(const RepList&);
|
||||
RepList& operator = (const RepList&);
|
||||
protected:
|
||||
replentry ** dat;
|
||||
int size;
|
||||
|
|
|
@ -1,59 +1,5 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
#include "license.hunspell"
|
||||
#include "license.myspell"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -161,7 +107,10 @@ int SuggestMgr::testsug(char** wlst, const char * candidate, int wl, int ns, int
|
|||
int cwrd = 1;
|
||||
if (ns == maxSug) return maxSug;
|
||||
for (int k=0; k < ns; k++) {
|
||||
if (strcmp(candidate,wlst[k]) == 0) cwrd = 0;
|
||||
if (strcmp(candidate,wlst[k]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((cwrd) && checkword(candidate, wl, cpdsuggest, timer, timelimit)) {
|
||||
wlst[ns] = mystrdup(candidate);
|
||||
|
@ -418,8 +367,12 @@ int SuggestMgr::map_related(const char * word, char * candidate, int wn, int cn,
|
|||
int cwrd = 1;
|
||||
*(candidate + cn) = '\0';
|
||||
int wl = strlen(candidate);
|
||||
for (int m=0; m < ns; m++)
|
||||
if (strcmp(candidate, wlst[m]) == 0) cwrd = 0;
|
||||
for (int m=0; m < ns; m++) {
|
||||
if (strcmp(candidate, wlst[m]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((cwrd) && checkword(candidate, wl, cpdsuggest, timer, timelimit)) {
|
||||
if (ns < maxSug) {
|
||||
wlst[ns] = mystrdup(candidate);
|
||||
|
@ -732,7 +685,7 @@ int SuggestMgr::extrachar(char** wlst, const char * word, int ns, int cpdsuggest
|
|||
// error is missing a letter it needs
|
||||
int SuggestMgr::forgotchar(char ** wlst, const char * word, int ns, int cpdsuggest)
|
||||
{
|
||||
char candidate[MAXSWUTF8L];
|
||||
char candidate[MAXSWUTF8L + 4];
|
||||
char * p;
|
||||
clock_t timelimit = clock();
|
||||
int timer = MINTIMER;
|
||||
|
@ -754,8 +707,8 @@ int SuggestMgr::forgotchar(char ** wlst, const char * word, int ns, int cpdsugge
|
|||
// error is missing a letter it needs
|
||||
int SuggestMgr::forgotchar_utf(char ** wlst, const w_char * word, int wl, int ns, int cpdsuggest)
|
||||
{
|
||||
w_char candidate_utf[MAXSWL];
|
||||
char candidate[MAXSWUTF8L];
|
||||
w_char candidate_utf[MAXSWL + 1];
|
||||
char candidate[MAXSWUTF8L + 4];
|
||||
w_char * p;
|
||||
clock_t timelimit = clock();
|
||||
int timer = MINTIMER;
|
||||
|
@ -815,8 +768,12 @@ int SuggestMgr::twowords(char ** wlst, const char * word, int ns, int cpdsuggest
|
|||
((c1 == 3) && (c2 >= 2)))) *p = '-';
|
||||
|
||||
cwrd = 1;
|
||||
for (int k=0; k < ns; k++)
|
||||
if (strcmp(candidate,wlst[k]) == 0) cwrd = 0;
|
||||
for (int k=0; k < ns; k++) {
|
||||
if (strcmp(candidate,wlst[k]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ns < maxSug) {
|
||||
if (cwrd) {
|
||||
wlst[ns] = mystrdup(candidate);
|
||||
|
@ -831,8 +788,12 @@ int SuggestMgr::twowords(char ** wlst, const char * word, int ns, int cpdsuggest
|
|||
mystrlen(p + 1) > 1 &&
|
||||
mystrlen(candidate) - mystrlen(p) > 1) {
|
||||
*p = '-';
|
||||
for (int k=0; k < ns; k++)
|
||||
if (strcmp(candidate,wlst[k]) == 0) cwrd = 0;
|
||||
for (int k=0; k < ns; k++) {
|
||||
if (strcmp(candidate,wlst[k]) == 0) {
|
||||
cwrd = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ns < maxSug) {
|
||||
if (cwrd) {
|
||||
wlst[ns] = mystrdup(candidate);
|
||||
|
@ -1387,7 +1348,10 @@ int SuggestMgr::ngsuggest(char** wlst, char * w, int ns, HashMgr** pHMgr, int md
|
|||
if ((!guessorig[i] && strstr(guess[i], wlst[j])) ||
|
||||
(guessorig[i] && strstr(guessorig[i], wlst[j])) ||
|
||||
// check forbidden words
|
||||
!checkword(guess[i], strlen(guess[i]), 0, NULL, NULL)) unique = 0;
|
||||
!checkword(guess[i], strlen(guess[i]), 0, NULL, NULL)) {
|
||||
unique = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (unique) {
|
||||
wlst[ns++] = guess[i];
|
||||
|
@ -1415,7 +1379,10 @@ int SuggestMgr::ngsuggest(char** wlst, char * w, int ns, HashMgr** pHMgr, int md
|
|||
// don't suggest previous suggestions or a previous suggestion with prefixes or affixes
|
||||
if (strstr(rootsphon[i], wlst[j]) ||
|
||||
// check forbidden words
|
||||
!checkword(rootsphon[i], strlen(rootsphon[i]), 0, NULL, NULL)) unique = 0;
|
||||
!checkword(rootsphon[i], strlen(rootsphon[i]), 0, NULL, NULL)) {
|
||||
unique = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (unique) {
|
||||
wlst[ns++] = mystrdup(rootsphon[i]);
|
||||
|
@ -1909,6 +1876,10 @@ int SuggestMgr::commoncharacterpositions(char * s1, const char * s2, int * is_sw
|
|||
w_char su2[MAXSWL];
|
||||
int l1 = u8_u16(su1, MAXSWL, s1);
|
||||
int l2 = u8_u16(su2, MAXSWL, s2);
|
||||
|
||||
if (l1 <= 0 || l2 <= 0)
|
||||
return 0;
|
||||
|
||||
// decapitalize dictionary word
|
||||
if (complexprefixes) {
|
||||
mkallsmall_utf(su2+l2-1, 1, langnum);
|
|
@ -1,60 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
|
||||
* David Einstein (deinst@world.std.com)
|
||||
* László Németh (nemethl@gyorsposta.hu)
|
||||
* Caolan McNamara (caolanm@redhat.com)
|
||||
* Davide Prina
|
||||
* Giuseppe Modugno
|
||||
* Gianluca Turconi
|
||||
* Simon Brouwer
|
||||
* Noll Janos
|
||||
* Biro Arpad
|
||||
* Goldman Eleonora
|
||||
* Sarlos Tamas
|
||||
* Bencsath Boldizsar
|
||||
* Halacsy Peter
|
||||
* Dvornik Laszlo
|
||||
* Gefferth Andras
|
||||
* Nagy Viktor
|
||||
* Varga Daniel
|
||||
* Chris Halls
|
||||
* Rene Engelhard
|
||||
* Bram Moolenaar
|
||||
* Dafydd Jones
|
||||
* Harri Pitkanen
|
||||
* Andras Timar
|
||||
* Tor Lillqvist
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef _SUGGESTMGR_HXX_
|
||||
#define _SUGGESTMGR_HXX_
|
||||
|
||||
|
@ -89,6 +32,10 @@ enum { LCS_UP, LCS_LEFT, LCS_UPLEFT };
|
|||
|
||||
class LIBHUNSPELL_DLL_EXPORTED SuggestMgr
|
||||
{
|
||||
private:
|
||||
SuggestMgr(const SuggestMgr&);
|
||||
SuggestMgr& operator = (const SuggestMgr&);
|
||||
private:
|
||||
char * ckey;
|
||||
int ckeyl;
|
||||
w_char * ckey_utf;
|
||||
|
|
|
@ -1,36 +1,3 @@
|
|||
/******* BEGIN LICENSE BLOCK *******
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
|
||||
* and László Németh (Hunspell). Portions created by the Initial Developers
|
||||
* are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): László Németh (nemethl@gyorsposta.hu)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
******* END LICENSE BLOCK *******/
|
||||
|
||||
#ifndef __WCHARHXX__
|
||||
#define __WCHARHXX__
|
||||
|
||||
|
|
|
@ -106,6 +106,10 @@ have_cpuid (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h> /* for __cpuid */
|
||||
#endif
|
||||
|
||||
static void
|
||||
pixman_cpuid (uint32_t feature,
|
||||
uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d)
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#include "GLContext.h"
|
||||
#include "OGLShaderProgram.h"
|
||||
#include "gfxTypes.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "ScopedGLHelpers.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "gfx2DGlue.h"
|
||||
|
@ -491,24 +489,29 @@ static TemporaryRef<DataSourceSurface> YInvertImageSurface(DataSourceSurface* aS
|
|||
Factory::CreateDataSourceSurfaceWithStride(aSurf->GetSize(),
|
||||
aSurf->GetFormat(),
|
||||
aSurf->Stride());
|
||||
if (!temp) {
|
||||
return nullptr;
|
||||
}
|
||||
DataSourceSurface::MappedSurface map;
|
||||
if (!temp->Map(DataSourceSurface::MapType::WRITE, &map)) {
|
||||
return nullptr;
|
||||
}
|
||||
RefPtr<DrawTarget> dt =
|
||||
Factory::CreateDrawTargetForData(BackendType::CAIRO,
|
||||
temp->GetData(),
|
||||
map.mData,
|
||||
temp->GetSize(),
|
||||
temp->Stride(),
|
||||
map.mStride,
|
||||
temp->GetFormat());
|
||||
nsRefPtr<gfxContext> ctx = new gfxContext(dt);
|
||||
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||
ctx->Scale(1.0, -1.0);
|
||||
ctx->Translate(-gfxPoint(0.0, aSurf->GetSize().height));
|
||||
|
||||
nsRefPtr<gfxImageSurface> thebesSurf =
|
||||
new gfxImageSurface(aSurf->GetData(),
|
||||
ThebesIntSize(aSurf->GetSize()),
|
||||
aSurf->Stride(),
|
||||
SurfaceFormatToImageFormat(aSurf->GetFormat()));
|
||||
ctx->SetSource(thebesSurf);
|
||||
ctx->Paint();
|
||||
if (!dt) {
|
||||
temp->Unmap();
|
||||
return nullptr;
|
||||
}
|
||||
dt->SetTransform(Matrix::Translation(0.0, aSurf->GetSize().height) *
|
||||
Matrix::Scaling(1.0, -1.0));
|
||||
Rect rect(0, 0, aSurf->GetSize().width, aSurf->GetSize().height);
|
||||
dt->DrawSurface(aSurf, rect, rect, DrawSurfaceOptions(),
|
||||
DrawOptions(1.0, CompositionOp::OP_SOURCE, AntialiasMode::NONE));
|
||||
temp->Unmap();
|
||||
return temp.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/gfx/Types.h"
|
||||
|
||||
class gfxImageSurface;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace gfx {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "GLScreenBuffer.h"
|
||||
|
||||
#include <cstring>
|
||||
#include "gfxImageSurface.h"
|
||||
#include "GLContext.h"
|
||||
#include "GLBlitHelper.h"
|
||||
#include "GLReadTexImageHelper.h"
|
||||
|
|
|
@ -22,9 +22,6 @@
|
|||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/Point.h"
|
||||
|
||||
// Forwards:
|
||||
class gfxImageSurface;
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
class SurfaceStream;
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
#include "GLTextureImage.h"
|
||||
#include "GLContext.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "gfxPlatform.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "gfx2DGlue.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "ScopedGLHelpers.h"
|
||||
#include "GLUploadHelpers.h"
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
|||
#include "TextureImageCGL.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
||||
|
@ -516,10 +518,6 @@ TiledTextureImage::EndUpdate()
|
|||
|
||||
RefPtr<gfx::SourceSurface> updateSnapshot = mUpdateDrawTarget->Snapshot();
|
||||
RefPtr<gfx::DataSourceSurface> updateData = updateSnapshot->GetDataSurface();
|
||||
nsRefPtr<gfxASurface> updateSurface = new gfxImageSurface(updateData->GetData(),
|
||||
gfx::ThebesIntSize(updateData->GetSize()),
|
||||
updateData->Stride(),
|
||||
gfx::SurfaceFormatToImageFormat(updateData->GetFormat()));
|
||||
|
||||
// upload tiles from temp surface
|
||||
for (unsigned i = 0; i < mImages.Length(); i++) {
|
||||
|
@ -535,11 +533,18 @@ TiledTextureImage::EndUpdate()
|
|||
subregion.MoveBy(-xPos, -yPos); // Tile-local space
|
||||
// copy tile from temp target
|
||||
gfx::DrawTarget* drawTarget = mImages[i]->BeginUpdate(subregion);
|
||||
nsRefPtr<gfxContext> ctx = new gfxContext(drawTarget);
|
||||
gfxUtils::ClipToRegion(ctx, subregion);
|
||||
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
|
||||
ctx->SetSource(updateSurface, gfxPoint(-xPos, -yPos));
|
||||
ctx->Paint();
|
||||
MOZ_ASSERT(drawTarget->GetType() == BackendType::CAIRO,
|
||||
"updateSnapshot should not have been converted to data");
|
||||
gfxUtils::ClipToRegion(drawTarget, subregion);
|
||||
Size size(updateData->GetSize().width,
|
||||
updateData->GetSize().height);
|
||||
drawTarget->DrawSurface(updateData,
|
||||
Rect(Point(-xPos, -yPos), size),
|
||||
Rect(Point(0, 0), size),
|
||||
DrawSurfaceOptions(),
|
||||
DrawOptions(1.0, CompositionOp::OP_SOURCE,
|
||||
AntialiasMode::NONE));
|
||||
drawTarget->PopClip();
|
||||
mImages[i]->EndUpdate();
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "GLContext.h"
|
||||
#include "GLBlitHelper.h"
|
||||
#include "ScopedGLHelpers.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "GLReadTexImageHelper.h"
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#ifndef SHARED_SURFACEIO_H_
|
||||
#define SHARED_SURFACEIO_H_
|
||||
|
||||
#include "gfxImageSurface.h"
|
||||
#include "SharedSurfaceGL.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
|
||||
|
@ -54,7 +53,6 @@ private:
|
|||
SharedSurface_IOSurface(MacIOSurface* surface, GLContext* gl, const gfx::IntSize& size, bool hasAlpha);
|
||||
|
||||
RefPtr<MacIOSurface> mSurface;
|
||||
nsRefPtr<gfxImageSurface> mImageSurface;
|
||||
GLuint mProdTex;
|
||||
const GLContext* mCurConsGL;
|
||||
GLuint mConsTex;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include "ImageDataSerializer.h"
|
||||
#include "gfx2DGlue.h" // for SurfaceFormatToImageFormat
|
||||
#include "gfxImageSurface.h" // for gfxImageSurface
|
||||
#include "gfxPoint.h" // for gfxIntSize
|
||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
||||
#include "mozilla/gfx/2D.h" // for DataSourceSurface, Factory
|
||||
|
@ -127,17 +126,6 @@ ImageDataSerializerBase::GetFormat() const
|
|||
return GetBufferInfo(mData, mDataSize)->format;
|
||||
}
|
||||
|
||||
TemporaryRef<gfxImageSurface>
|
||||
ImageDataSerializerBase::GetAsThebesSurface()
|
||||
{
|
||||
MOZ_ASSERT(IsValid());
|
||||
IntSize size = GetSize();
|
||||
return new gfxImageSurface(GetData(),
|
||||
gfxIntSize(size.width, size.height),
|
||||
GetStride(),
|
||||
SurfaceFormatToImageFormat(GetFormat()));
|
||||
}
|
||||
|
||||
TemporaryRef<DrawTarget>
|
||||
ImageDataSerializerBase::GetAsDrawTarget(gfx::BackendType aBackend)
|
||||
{
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#include "mozilla/gfx/Point.h" // for IntSize
|
||||
#include "mozilla/gfx/Types.h" // for SurfaceFormat
|
||||
|
||||
class gfxImageSurface;
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
class DataSourceSurface;
|
||||
|
@ -36,7 +34,6 @@ public:
|
|||
gfx::IntSize GetSize() const;
|
||||
gfx::SurfaceFormat GetFormat() const;
|
||||
TemporaryRef<gfx::DataSourceSurface> GetAsSurface();
|
||||
TemporaryRef<gfxImageSurface> GetAsThebesSurface();
|
||||
TemporaryRef<gfx::DrawTarget> GetAsDrawTarget(gfx::BackendType aBackend);
|
||||
|
||||
static uint32_t ComputeMinBufferSize(gfx::IntSize aSize,
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "gfxPlatform.h" // for gfxPlatform
|
||||
#include "gfxUtils.h" // for gfxUtils, etc
|
||||
#include "gfx2DGlue.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "mozilla/DebugOnly.h" // for DebugOnly
|
||||
#include "mozilla/Telemetry.h" // for Accumulate
|
||||
#include "mozilla/gfx/2D.h" // for DrawTarget
|
||||
|
|
|
@ -1974,8 +1974,8 @@ bool AsyncPanZoomController::UpdateAnimation(const TimeStamp& aSampleTime,
|
|||
return false;
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::ApplyOverscrollEffect(ViewTransform* aTransform) const {
|
||||
// The overscroll effect applied here is a combination of a translation in
|
||||
void AsyncPanZoomController::GetOverscrollTransform(ViewTransform* aTransform) const {
|
||||
// The overscroll effect is a combination of a translation in
|
||||
// the direction of overscroll, and shrinking in both directions.
|
||||
// With the effect applied, we can think of the composited region as being
|
||||
// made up of the following subregions.
|
||||
|
@ -2066,8 +2066,9 @@ void AsyncPanZoomController::ApplyOverscrollEffect(ViewTransform* aTransform) co
|
|||
}
|
||||
|
||||
bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSampleTime,
|
||||
ViewTransform* aNewTransform,
|
||||
ScreenPoint& aScrollOffset) {
|
||||
ViewTransform* aOutTransform,
|
||||
ScreenPoint& aScrollOffset,
|
||||
ViewTransform* aOutOverscrollTransform) {
|
||||
// The eventual return value of this function. The compositor needs to know
|
||||
// whether or not to advance by a frame as soon as it can. For example, if a
|
||||
// fling is happening, it has to keep compositing so that the animation is
|
||||
|
@ -2082,12 +2083,22 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
|
|||
requestAnimationFrame = UpdateAnimation(aSampleTime, &deferredTasks);
|
||||
|
||||
aScrollOffset = mFrameMetrics.GetScrollOffset() * mFrameMetrics.GetZoom();
|
||||
*aNewTransform = GetCurrentAsyncTransform();
|
||||
*aOutTransform = GetCurrentAsyncTransform();
|
||||
|
||||
if (IsOverscrolled()) {
|
||||
// GetCurrentAsyncTransform() does not consider any overscroll we may have.
|
||||
// Adjust the transform to account for that.
|
||||
ApplyOverscrollEffect(aNewTransform);
|
||||
// If we are overscrolled, we would like the compositor to apply an
|
||||
// additional transform that produces an overscroll effect.
|
||||
if (aOutOverscrollTransform && IsOverscrolled()) {
|
||||
GetOverscrollTransform(aOutOverscrollTransform);
|
||||
|
||||
// Since the caller will apply aOverscrollTransform after aNewTransform,
|
||||
// aOverscrollTransform's translation will be not be scaled by
|
||||
// aNewTransform's scale. Since the resulting transform is then
|
||||
// multiplied by the CSS transform, which cancels out the non-transient
|
||||
// part of aNewTransform->mScale, this results in an overscroll
|
||||
// translation whose magnitude varies with the zoom. To avoid this,
|
||||
// we adjust for that here.
|
||||
aOutOverscrollTransform->mTranslation.x *= aOutTransform->mScale.scale;
|
||||
aOutOverscrollTransform->mTranslation.y *= aOutTransform->mScale.scale;
|
||||
}
|
||||
|
||||
LogRendertraceRect(GetGuid(), "viewport", "red",
|
||||
|
|
|
@ -154,21 +154,26 @@ public:
|
|||
Vector<Task*>* aOutDeferredTasks);
|
||||
|
||||
/**
|
||||
* The compositor calls this when it's about to draw pannable/zoomable content
|
||||
* and is setting up transforms for compositing the layer tree. This is not
|
||||
* idempotent. For example, a fling transform can be applied each time this is
|
||||
* called (though not necessarily). |aSampleTime| is the time that this is
|
||||
* sampled at; this is used for interpolating animations. Calling this sets a
|
||||
* new transform in |aNewTransform| which should be multiplied to the transform
|
||||
* in the shadow layer corresponding to this APZC.
|
||||
* RQuery the transforms that should be applied to the layer corresponding
|
||||
* to this APZC due to asynchronous panning and zooming.
|
||||
* |aSampleTime| is the time that this is sampled at; this is used for
|
||||
* interpolating animations.
|
||||
* This function returns two transforms via out parameters:
|
||||
* |aOutTransform| is the transform due to regular panning and zooming
|
||||
* |aOverscrollTransform| is the transform due to overscrolling
|
||||
* The two are separated because some clients want to ignore the overscroll
|
||||
* transform for some purposes (and for convenience to these clients, the
|
||||
* overscroll transform parameter may be nullptr). Clients who do not want
|
||||
* to ignore the overscroll transform should multiply the two transforms
|
||||
* together.
|
||||
*
|
||||
* Return value indicates whether or not any currently running animation
|
||||
* should continue. That is, if true, the compositor should schedule another
|
||||
* composite.
|
||||
* The return value indicates whether or not any currently running animation
|
||||
* should continue. If true, the compositor should schedule another composite.
|
||||
*/
|
||||
bool SampleContentTransformForFrame(const TimeStamp& aSampleTime,
|
||||
ViewTransform* aNewTransform,
|
||||
ScreenPoint& aScrollOffset);
|
||||
ViewTransform* aOutTransform,
|
||||
ScreenPoint& aScrollOffset,
|
||||
ViewTransform* aOutOverscrollTransform = nullptr);
|
||||
|
||||
/**
|
||||
* A shadow layer update has arrived. |aLayerMetrics| is the new FrameMetrics
|
||||
|
@ -643,10 +648,10 @@ private:
|
|||
bool IsPanningState(PanZoomState mState);
|
||||
|
||||
/**
|
||||
* Apply to |aTransform| a visual effect that reflects this apzc's
|
||||
* Return in |aTransform| a visual effect that reflects this apzc's
|
||||
* overscrolled state, if any.
|
||||
*/
|
||||
void ApplyOverscrollEffect(ViewTransform* aTransform) const;
|
||||
void GetOverscrollTransform(ViewTransform* aTransform) const;
|
||||
|
||||
enum AxisLockMode {
|
||||
FREE, /* No locking at all */
|
||||
|
|
|
@ -155,15 +155,6 @@ ClientTiledThebesLayer::BeginPaint()
|
|||
ApplyParentLayerToLayerTransform(mPaintData.mTransformDisplayPortToLayer, criticalDisplayPort));
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Critical displayport %s\n", this, tmpstr.get()), mPaintData.mCriticalDisplayPort);
|
||||
|
||||
// Compute the viewport that applies to this layer in the LayoutDevice
|
||||
// space of this layer.
|
||||
ParentLayerRect viewport =
|
||||
(displayportMetrics.mViewport * displayportMetrics.GetZoomToParent())
|
||||
+ displayportMetrics.mCompositionBounds.TopLeft();
|
||||
mPaintData.mViewport = ApplyParentLayerToLayerTransform(
|
||||
mPaintData.mTransformDisplayPortToLayer, viewport);
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Viewport %s\n", this, tmpstr.get()), mPaintData.mViewport);
|
||||
|
||||
// Store the resolution from the displayport ancestor layer. Because this is Gecko-side,
|
||||
// before any async transforms have occurred, we can use the zoom for this.
|
||||
mPaintData.mResolution = displayportMetrics.GetZoomToParent();
|
||||
|
@ -273,13 +264,15 @@ ClientTiledThebesLayer::RenderLowPrecision(nsIntRegion& aInvalidRegion,
|
|||
aInvalidRegion.Sub(aInvalidRegion, mValidRegion);
|
||||
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive paint: low-precision invalid region is %s\n", this, tmpstr.get()), aInvalidRegion);
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive paint: low-precision new valid region is %s\n", this, tmpstr.get()), mLowPrecisionValidRegion);
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive paint: low-precision old valid region is %s\n", this, tmpstr.get()), oldValidRegion);
|
||||
|
||||
if (!aInvalidRegion.IsEmpty()) {
|
||||
updatedBuffer = mContentClient->mLowPrecisionTiledBuffer.ProgressiveUpdate(
|
||||
mLowPrecisionValidRegion, aInvalidRegion, oldValidRegion,
|
||||
&mPaintData, aCallback, aCallbackData);
|
||||
}
|
||||
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive paint: low-precision new valid region is %s\n", this, tmpstr.get()), mLowPrecisionValidRegion);
|
||||
return updatedBuffer;
|
||||
}
|
||||
if (!mLowPrecisionValidRegion.IsEmpty()) {
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
* 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/. */
|
||||
|
||||
// Uncomment this to enable the TILING_PRLOG stuff in this file
|
||||
// for release builds. To get the output you need to have
|
||||
// NSPR_LOG_MODULES=tiling:5 in your environment at runtime.
|
||||
// #define FORCE_PR_LOG
|
||||
|
||||
#include "mozilla/layers/TiledContentClient.h"
|
||||
#include <math.h> // for ceil, ceilf, floor
|
||||
#include "ClientTiledThebesLayer.h" // for ClientTiledThebesLayer
|
||||
|
@ -25,6 +30,7 @@
|
|||
#include "gfxReusableSharedImageSurfaceWrapper.h"
|
||||
#include "nsMathUtils.h" // for NS_roundf
|
||||
#include "gfx2DGlue.h"
|
||||
#include "LayersLogging.h"
|
||||
|
||||
// This is the minimum area that we deem reasonable to copy from the front buffer to the
|
||||
// back buffer on tile updates. If the valid region is smaller than this, we just
|
||||
|
@ -629,6 +635,9 @@ ClientTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion,
|
|||
LayerManager::DrawThebesLayerCallback aCallback,
|
||||
void* aCallbackData)
|
||||
{
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: PaintThebes painting region %s\n", mThebesLayer, tmpstr.get()), aPaintRegion);
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: PaintThebes new valid region %s\n", mThebesLayer, tmpstr.get()), aNewValidRegion);
|
||||
|
||||
mCallback = aCallback;
|
||||
mCallbackData = aCallbackData;
|
||||
|
||||
|
@ -940,6 +949,8 @@ ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInval
|
|||
nsIntRegion staleRegion;
|
||||
staleRegion.And(aInvalidRegion, aOldValidRegion);
|
||||
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive update stale region %s\n", mThebesLayer, tmpstr.get()), staleRegion);
|
||||
|
||||
// Find out the current view transform to determine which tiles to draw
|
||||
// first, and see if we should just abort this paint. Aborting is usually
|
||||
// caused by there being an incoming, more relevant paint.
|
||||
|
@ -963,6 +974,8 @@ ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInval
|
|||
zoom);
|
||||
#endif
|
||||
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive update compositor bounds %s zoom %f abort %d\n", mThebesLayer, tmpstr.get(), zoom.scale, abortPaint), compositionBounds);
|
||||
|
||||
if (abortPaint) {
|
||||
// We ignore if front-end wants to abort if this is the first,
|
||||
// non-low-precision paint, as in that situation, we're about to override
|
||||
|
@ -980,6 +993,10 @@ ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInval
|
|||
TransformCompositionBounds(compositionBounds, zoom, aPaintData->mScrollOffset,
|
||||
aPaintData->mResolution, aPaintData->mTransformDisplayPortToLayer);
|
||||
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive update transformed compositor bounds %s using resolution %f and scroll (%f,%f)\n",
|
||||
mThebesLayer, tmpstr.get(), aPaintData->mResolution.scale, aPaintData->mScrollOffset.x, aPaintData->mScrollOffset.y),
|
||||
transformedCompositionBounds);
|
||||
|
||||
// Paint tiles that have stale content or that intersected with the screen
|
||||
// at the time of issuing the draw command in a single transaction first.
|
||||
// This is to avoid rendering glitches on animated page content, and when
|
||||
|
@ -987,15 +1004,14 @@ ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInval
|
|||
LayerRect typedCoherentUpdateRect =
|
||||
transformedCompositionBounds.Intersect(aPaintData->mCompositionBounds);
|
||||
|
||||
// Offset by the viewport origin, as the composition bounds are stored in
|
||||
// Layer space and not LayoutDevice space.
|
||||
// TODO(kats): does this make sense?
|
||||
typedCoherentUpdateRect.MoveBy(aPaintData->mViewport.TopLeft());
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive update intersected coherency rect %s\n", mThebesLayer, tmpstr.get()), typedCoherentUpdateRect);
|
||||
|
||||
// Convert to untyped to intersect with the invalid region.
|
||||
nsIntRect untypedCoherentUpdateRect(LayerIntRect::ToUntyped(
|
||||
RoundedOut(typedCoherentUpdateRect)));
|
||||
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive update final coherency rect %s\n", mThebesLayer, tmpstr.get()), untypedCoherentUpdateRect);
|
||||
|
||||
aRegionToPaint.And(aInvalidRegion, untypedCoherentUpdateRect);
|
||||
aRegionToPaint.Or(aRegionToPaint, staleRegion);
|
||||
bool drawingStale = !aRegionToPaint.IsEmpty();
|
||||
|
@ -1010,6 +1026,8 @@ ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInval
|
|||
paintVisible = true;
|
||||
}
|
||||
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive update final paint region %s\n", mThebesLayer, tmpstr.get()), aRegionToPaint);
|
||||
|
||||
// Paint area that's visible and overlaps previously valid content to avoid
|
||||
// visible glitches in animated elements, such as gifs.
|
||||
bool paintInSingleTransaction = paintVisible && (drawingStale || aPaintData->mFirstPaint);
|
||||
|
@ -1085,6 +1103,10 @@ ClientTiledLayerBuffer::ProgressiveUpdate(nsIntRegion& aValidRegion,
|
|||
LayerManager::DrawThebesLayerCallback aCallback,
|
||||
void* aCallbackData)
|
||||
{
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive update valid region %s\n", mThebesLayer, tmpstr.get()), aValidRegion);
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive update invalid region %s\n", mThebesLayer, tmpstr.get()), aInvalidRegion);
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive update old valid region %s\n", mThebesLayer, tmpstr.get()), aOldValidRegion);
|
||||
|
||||
bool repeat = false;
|
||||
bool isBufferChanged = false;
|
||||
do {
|
||||
|
@ -1097,6 +1119,8 @@ ClientTiledLayerBuffer::ProgressiveUpdate(nsIntRegion& aValidRegion,
|
|||
aPaintData,
|
||||
repeat);
|
||||
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive update computed paint region %s repeat %d\n", mThebesLayer, tmpstr.get(), repeat), regionToPaint);
|
||||
|
||||
// There's no further work to be done.
|
||||
if (regionToPaint.IsEmpty()) {
|
||||
break;
|
||||
|
@ -1118,6 +1142,9 @@ ClientTiledLayerBuffer::ProgressiveUpdate(nsIntRegion& aValidRegion,
|
|||
aInvalidRegion.Sub(aInvalidRegion, regionToPaint);
|
||||
} while (repeat);
|
||||
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive update final valid region %s buffer changed %d\n", mThebesLayer, tmpstr.get(), isBufferChanged), aValidRegion);
|
||||
TILING_PRLOG_OBJ(("TILING 0x%p: Progressive update final invalid region %s\n", mThebesLayer, tmpstr.get()), aInvalidRegion);
|
||||
|
||||
// Return false if nothing has been drawn, or give what has been drawn
|
||||
// to the shadow layer to upload.
|
||||
return isBufferChanged;
|
||||
|
|
|
@ -267,12 +267,6 @@ struct BasicTiledLayerPaintData {
|
|||
*/
|
||||
LayerIntRect mCriticalDisplayPort;
|
||||
|
||||
/*
|
||||
* The viewport of the content from the nearest ancestor layer that
|
||||
* represents scrollable content with a display port set.
|
||||
*/
|
||||
LayerRect mViewport;
|
||||
|
||||
/*
|
||||
* The render resolution of the document that the content this layer
|
||||
* represents is in.
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче