Merge inbound to mozilla-central r=merge a=merge

This commit is contained in:
shindli 2017-12-22 23:41:44 +02:00
Родитель 33f5a120df 0b411e80c7
Коммит bdec02b3ec
82 изменённых файлов: 6713 добавлений и 8515 удалений

Просмотреть файл

@ -4,6 +4,3 @@
MOZ_APP_DISPLAYNAME="Firefox Nightly"
MOZ_MACBUNDLE_ID=nightly
MOZ_MACBUNDLE_ID=nightly

Просмотреть файл

@ -182,10 +182,26 @@ var gMenuBuilder = {
// The rendering engine will truncate the title if it's longer than 64 characters.
// But if it makes sense let's try truncate selection text only, to handle cases like
// 'look up "%s" in MyDictionary' more elegantly.
let maxSelectionLength = gMaxLabelLength - label.length + 2;
if (maxSelectionLength > 4) {
selection = selection.substring(0, maxSelectionLength - 3) + "...";
let codePointsToRemove = 0;
let selectionArray = Array.from(selection);
let completeLabelLength = label.length - 2 + selectionArray.length;
if (completeLabelLength > gMaxLabelLength) {
codePointsToRemove = completeLabelLength - gMaxLabelLength;
}
if (codePointsToRemove) {
let ellipsis = "\u2026";
try {
ellipsis = Services.prefs.getComplexValue("intl.ellipsis",
Ci.nsIPrefLocalizedString).data;
} catch (e) { }
codePointsToRemove += 1;
selection = selectionArray.slice(0, -codePointsToRemove).join("") + ellipsis;
}
label = label.replace(/%s/g, selection);
}

Просмотреть файл

@ -282,7 +282,7 @@ add_task(async function() {
extensionMenuRoot = await openExtensionContextMenu();
// Check some menu items
items = extensionMenuRoot.getElementsByAttribute("label", "selection is: 'just some text 123456789012345678901234567890...'");
items = extensionMenuRoot.getElementsByAttribute("label", "selection is: 'just some text 12345678901234567890123456789012\u2026'");
is(items.length, 1, "contextMenu item for selection was found (context=selection)");
let selectionItem = items[0];
@ -318,7 +318,7 @@ add_task(async function() {
extensionMenuRoot = await openExtensionContextMenu("#longtext");
// Check some menu items
items = extensionMenuRoot.getElementsByAttribute("label", "selection is: 'Sed ut perspiciatis unde omnis iste natus err...'");
items = extensionMenuRoot.getElementsByAttribute("label", "selection is: 'Sed ut perspiciatis unde omnis iste natus error\u2026'");
is(items.length, 1, `contextMenu item for longtext selection was found (context=selection)`);
await closeExtensionContextMenu(items[0]);

Просмотреть файл

@ -5,11 +5,6 @@
var gSanitizeDialog = Object.freeze({
init() {
let customWidthElements = document.getElementsByAttribute("dialogWidth", "*");
let isInSubdialog = document.documentElement.hasAttribute("subdialog");
for (let element of customWidthElements) {
element.style.width = element.getAttribute(isInSubdialog ? "subdialogWidth" : "dialogWidth");
}
this.onClearHistoryChanged();
},

Просмотреть файл

@ -19,8 +19,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
dlgbuttons="accept,cancel,help"
ondialoghelp="openPrefsHelp()"
dialogWidth="&sanitizePrefs2.modal.width;"
subdialogWidth="&sanitizePrefs2.inContent.dialog.width;"
style="width: &sanitizePrefs2.modal.width;"
title="&sanitizePrefs2.title;"
onload="gSanitizeDialog.init();">
@ -48,8 +47,7 @@
<caption><label>&historySection.label;</label></caption>
<grid flex="1">
<columns>
<column dialogWidth="&sanitizePrefs2.column.width;"
subdialogWidth="&sanitizePrefs2.inContent.column.width;"/>
<column style="width: &sanitizePrefs2.column.width;"/>
<column flex="1"/>
</columns>
<rows>
@ -81,8 +79,7 @@
<caption><label>&dataSection.label;</label></caption>
<grid flex="1">
<columns>
<column dialogWidth="&sanitizePrefs2.column.width;"
subdialogWidth="&sanitizePrefs2.inContent.column.width;"/>
<column style="width: &sanitizePrefs2.column.width;"/>
<column flex="1"/>
</columns>
<rows>

Просмотреть файл

@ -8,14 +8,6 @@
The column width should be set at half of the dialog width. -->
<!ENTITY sanitizePrefs2.modal.width "34em">
<!ENTITY sanitizePrefs2.column.width "17em">
<!-- LOCALIZATION NOTE (sanitizePrefs2.inContent.dialog.width): width of the
Clear History on Shutdown subdialog in the in-content preferences.
Should be large enough to contain the item* strings on a single line.
The column width adjusts the width of the first column in the dialog.
You can set the column width to a value that makes the dialog look visually balanced,
or at half of the dialog width if unsure. -->
<!ENTITY sanitizePrefs2.inContent.dialog.width "34em">
<!ENTITY sanitizePrefs2.inContent.column.width "24em">
<!ENTITY sanitizeDialog2.title "Clear Recent History">
<!-- LOCALIZATION NOTE (sanitizeDialog2.width): width of the Clear Recent History dialog -->

Просмотреть файл

@ -1,7 +1,7 @@
This is the debugger.html project output.
See https://github.com/devtools-html/debugger.html
Taken from upstream commit: 53faca589b021f01c7af5980c8c0e98b58c02e4c
Taken from upstream commit: f98e56ff661460044382df55bd33cea601e093f0
Packages:
- babel-plugin-transform-es2015-modules-commonjs @6.26.0

Просмотреть файл

@ -428,24 +428,15 @@ body {
}
.modal {
display: flex;
width: 80%;
height: auto;
max-height: 80vh;
overflow-y: auto;
background-color: var(--theme-toolbar-background);
transition: transform 150ms cubic-bezier(0.07, 0.95, 0, 1);
box-shadow: 1px 1px 3px 1px var(--popup-shadow-color);
}
.modal .input-wrapper {
display: flex;
justify-content: center;
}
.modal .result-list {
height: calc(100% - 28px);
overflow-y: auto;
}
.modal.entering,
.modal.exited {
transform: translateY(-101%);
@ -454,20 +445,17 @@ body {
.modal.entered,
.modal.exiting {
transform: translateY(5px);
flex-direction: column;
}
/* This rule is active when the screen is not short and narrow */
@media (min-width: 580px) and (min-height: 340px) {
/* This rule is active when the screen is not narrow */
@media (min-width: 580px) {
.modal {
width: 50%;
}
}
@media (min-height: 340px) {
.modal {
height: auto;
max-height: 80vh;
}
.modal.entered,
.modal.exiting {
transform: translateY(30px);
@ -1757,6 +1745,10 @@ html .toggle-button.end.vertical svg {
justify-content: center;
}
.source-footer > button.action:hover {
background: var(--theme-toolbar-background-hover);
}
.source-footer > .commands > button.action:focus {
outline: none;
}
@ -2279,12 +2271,17 @@ html[dir="rtl"] .arrow svg,
.popover .preview-popup .header-container {
width: 100%;
line-height: 20px;
line-height: 15px;
display: flex;
flex-direction: column;
flex-direction: row;
margin-bottom: 5px;
}
.popover .preview-popup .immutable-logo {
width: 20px;
margin-right: 5px;
}
.popover .preview-popup .header-container h3 {
margin: 0;
margin-bottom: 5px;
@ -3325,7 +3322,7 @@ img.resume {
border-bottom: none;
background-color: var(--theme-body-background);
border-top: 1px solid var(--theme-splitter-color);
flex: 0 0 27px;
flex: 0 0 26px;
}
.command-bar.bottom {
@ -3810,6 +3807,7 @@ html .welcomebox .toggle-button-end.collapsed {
padding: 0px;
overflow: auto;
width: calc(100% - 1px); /* 1px fixes the hidden right border */
background: var(--theme-body-background);
}
.result-list * {
@ -3822,7 +3820,6 @@ html .welcomebox .toggle-button-end.collapsed {
padding: 4px 13px;
display: flex;
justify-content: space-between;
border: 1px solid transparent;
}
.result-list.big li {
@ -3836,7 +3833,7 @@ html .welcomebox .toggle-button-end.collapsed {
}
.result-list li.selected {
border-color: var(--theme-selection-background);
background: var(--accordion-header-background);
}
.result-list.small li.selected {

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -31653,19 +31653,40 @@ module.exports = isEmpty;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.parseScriptTags = exports.parseScripts = exports.parseScript = exports.getCandidateScriptLocations = exports.generateWhitespace = exports.extractScriptTags = undefined;
var _babelTypes = __webpack_require__(493);
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var types = _interopRequireWildcard(_babelTypes);
var babylon = __webpack_require__(435);
var types = __webpack_require__(493);
var _babylon = __webpack_require__(435);
var startScript = /<script[^>]*>/im;
var endScript = /<\/script\s*>/im;
// https://stackoverflow.com/questions/5034781/js-regex-to-split-by-line#comment5633979_5035005
var newLines = /\r\n|[\n\v\f\r\x85\u2028\u2029]/;
var babylon = _interopRequireWildcard(_babylon);
function getCandidateScriptLocations(source, index) {
var i = index || 0;
var str = source.substring(i);
var _customParse = __webpack_require__(1794);
var startMatch = startScript.exec(str);
if (startMatch) {
var startsAt = startMatch.index + startMatch[0].length;
var afterStart = str.substring(startsAt);
var endMatch = endScript.exec(afterStart);
if (endMatch) {
var locLength = endMatch.index;
var locIndex = i + startsAt;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
return [adjustForLineAndColumn(source, {
index: locIndex,
length: locLength,
source: source.substring(locIndex, locIndex + locLength)
})].concat(_toConsumableArray(getCandidateScriptLocations(source, locIndex + locLength + endMatch[0].length)));
}
}
return [];
}
function parseScript(_ref) {
var source = _ref.source,
@ -31689,11 +31710,69 @@ function parseScript(_ref) {
function parseScripts(locations) {
var parser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : parseScript;
return (0, _customParse.parseScripts)(locations, parser);
return locations.map(parser);
}
function generateWhitespace(length) {
return Array.from(new Array(length + 1)).join(" ");
}
function calcLineAndColumn(source, index) {
var lines = source.substring(0, index).split(newLines);
var line = lines.length;
var column = lines.pop().length + 1;
return {
column: column,
line: line
};
}
function adjustForLineAndColumn(fullSource, location) {
var _calcLineAndColumn = calcLineAndColumn(fullSource, location.index),
column = _calcLineAndColumn.column,
line = _calcLineAndColumn.line;
return Object.assign({}, location, {
line: line,
column: column,
// prepend whitespace for scripts that do not start on the first column
source: generateWhitespace(column) + location.source
});
}
function parseScriptTags(source, parser) {
var scripts = parseScripts(getCandidateScriptLocations(source), parser).filter(types.isFile).reduce(function (main, script) {
return {
statements: main.statements.concat(script.program.body),
comments: main.comments.concat(script.comments),
tokens: main.tokens.concat(script.tokens)
};
}, {
statements: [],
comments: [],
tokens: []
});
var program = types.program(scripts.statements);
var file = types.file(program, scripts.comments, scripts.tokens);
var end = calcLineAndColumn(source, source.length);
file.start = program.start = 0;
file.end = program.end = source.length;
file.loc = program.loc = {
start: {
line: 1,
column: 0
},
end: end
};
return file;
}
function extractScriptTags(source) {
return parseScripts((0, _customParse.getCandidateScriptLocations)(source), function (loc) {
return parseScripts(getCandidateScriptLocations(source), function (loc) {
var ast = parseScript(loc);
if (ast) {
@ -31704,16 +31783,10 @@ function extractScriptTags(source) {
}).filter(types.isFile);
}
function parseScriptTags(source) {
var parser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : parseScript;
return (0, _customParse.parseScriptTags)(source, parser);
}
exports.default = parseScriptTags;
exports.extractScriptTags = extractScriptTags;
exports.generateWhitespace = _customParse.generateWhitespace;
exports.getCandidateScriptLocations = _customParse.getCandidateScriptLocations;
exports.generateWhitespace = generateWhitespace;
exports.getCandidateScriptLocations = getCandidateScriptLocations;
exports.parseScript = parseScript;
exports.parseScripts = parseScripts;
exports.parseScriptTags = parseScriptTags;
@ -35492,7 +35565,7 @@ function getAst(source) {
const { contentType } = source;
if (contentType == "text/html") {
ast = (0, _parseScriptTags2.default)(source.text, htmlParser) || {};
} else if (contentType && contentType.includes("javascript")) {
} else if (contentType && contentType.match(/(javascript|jsx)/)) {
ast = parse(source.text);
}
@ -35565,6 +35638,7 @@ exports.isAwaitExpression = isAwaitExpression;
exports.isYieldExpression = isYieldExpression;
exports.isVariable = isVariable;
exports.getMemberExpression = getMemberExpression;
exports.getVariables = getVariables;
var _babelTypes = __webpack_require__(493);
@ -35616,6 +35690,22 @@ function getMemberExpression(root) {
return expr.join(".");
}
function getVariables(dec) {
if (dec.id.type === "ArrayPattern") {
return dec.id.elements.map(element => {
return {
name: element.name || element.argument.name,
location: element.loc
};
});
}
return [{
name: dec.id.name,
location: dec.loc
}];
}
/***/ }),
/* 1412 */,
/* 1413 */,
@ -35834,6 +35924,10 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
exports.default = getSymbols;
exports.clearSymbols = clearSymbols;
var _flatten = __webpack_require__(706);
var _flatten2 = _interopRequireDefault(_flatten);
var _ast = __webpack_require__(1375);
var _helpers = __webpack_require__(1411);
@ -35848,10 +35942,10 @@ var _getFunctionName = __webpack_require__(1621);
var _getFunctionName2 = _interopRequireDefault(_getFunctionName);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let symbolDeclarations = new Map();
function getFunctionParameterNames(path) {
@ -35868,7 +35962,12 @@ function getVariableNames(path) {
name: path.node.key.value,
location: path.node.loc
}];
} else if (path.node.value.type === "Identifier") {
return [{ name: path.node.value.name, location: path.node.loc }];
} else if (path.node.value.type === "AssignmentPattern") {
return [{ name: path.node.value.left.name, location: path.node.loc }];
}
return [{
name: path.node.key.name,
location: path.node.loc
@ -35882,10 +35981,9 @@ function getVariableNames(path) {
}));
}
return path.node.declarations.map(dec => ({
name: dec.id.name,
location: dec.loc
}));
const declarations = path.node.declarations.filter(dec => dec.id.type !== "ObjectPattern").map(_helpers.getVariables);
return (0, _flatten2.default)(declarations);
}
function getComments(ast) {
@ -35975,10 +36073,12 @@ function extractSymbols(source) {
if (t.isCallExpression(path)) {
const callee = path.node.callee;
const args = path.node.arguments;
if (!t.isMemberExpression(callee)) {
const { start, end, identifierName } = callee.loc;
callExpressions.push({
name: identifierName,
values: args.filter(arg => arg.value).map(arg => arg.value),
location: { start, end }
});
}
@ -36436,9 +36536,9 @@ var _getScopes2 = _interopRequireDefault(_getScopes);
var _sources = __webpack_require__(1458);
var _getOutOfScopeLocations = __webpack_require__(1624);
var _findOutOfScopeLocations = __webpack_require__(1624);
var _getOutOfScopeLocations2 = _interopRequireDefault(_getOutOfScopeLocations);
var _findOutOfScopeLocations2 = _interopRequireDefault(_findOutOfScopeLocations);
var _steps = __webpack_require__(1625);
@ -36460,7 +36560,7 @@ const { workerHandler } = _devtoolsUtils.workerUtils; /* This Source Code Form i
self.onmessage = workerHandler({
getClosestExpression: _closest.getClosestExpression,
getOutOfScopeLocations: _getOutOfScopeLocations2.default,
findOutOfScopeLocations: _findOutOfScopeLocations2.default,
getSymbols: _getSymbols2.default,
getScopes: _getScopes2.default,
clearSymbols: _getSymbols.clearSymbols,
@ -37002,6 +37102,14 @@ var _get = __webpack_require__(1073);
var _get2 = _interopRequireDefault(_get);
var _findIndex = __webpack_require__(262);
var _findIndex2 = _interopRequireDefault(_findIndex);
var _findLastIndex = __webpack_require__(1686);
var _findLastIndex2 = _interopRequireDefault(_findLastIndex);
var _contains = __webpack_require__(1456);
var _getSymbols = __webpack_require__(1457);
@ -37035,22 +37143,55 @@ function getLocation(func) {
}
/**
* Reduces an array of locations to remove items that are completely enclosed
* by another location in the array.
* Find the nearest location containing the input position and
* return new locations without inner locations under that nearest location
*
* @param locations Notice! The locations MUST be sorted by `sortByStart`
* so that we can do linear time complexity operation.
*/
function removeOverlaps(locations, location) {
// support reducing without an initializing array
if (!Array.isArray(locations)) {
locations = [locations];
function removeInnerLocations(locations, position) {
// First, let's find the nearest position-enclosing function location,
// which is to find the last location enclosing the position.
const newLocs = locations.slice();
const parentIndex = (0, _findLastIndex2.default)(newLocs, loc => (0, _contains.containsPosition)(loc, position));
if (parentIndex < 0) {
return newLocs;
}
const contains = locations.filter(a => (0, _contains.containsLocation)(a, location)).length > 0;
// Second, from the nearest location, loop locations again, stop looping
// once seeing the 1st location not enclosed by the nearest location
// to find the last inner locations inside the nearest location.
const innerStartIndex = parentIndex + 1;
const parentLoc = newLocs[parentIndex];
const outerBoundaryIndex = (0, _findIndex2.default)(newLocs, loc => !(0, _contains.containsLocation)(parentLoc, loc), innerStartIndex);
const innerBoundaryIndex = outerBoundaryIndex < 0 ? newLocs.length - 1 : outerBoundaryIndex - 1;
if (!contains) {
locations.push(location);
// Third, remove those inner functions
newLocs.splice(innerStartIndex, innerBoundaryIndex - parentIndex);
return newLocs;
}
/**
* Return an new locations array which excludes
* items that are completely enclosed by another location in the input locations
*
* @param locations Notice! The locations MUST be sorted by `sortByStart`
* so that we can do linear time complexity operation.
*/
function removeOverlaps(locations) {
if (locations.length == 0) {
return [];
}
const firstParent = locations[0];
return locations.reduce(deduplicateNode, [firstParent]);
}
return locations;
function deduplicateNode(nodes, location) {
const parent = nodes[nodes.length - 1];
if (!(0, _contains.containsLocation)(parent, location)) {
nodes.push(location);
}
return nodes;
}
/**
@ -37070,14 +37211,17 @@ function sortByStart(a, b) {
* Returns an array of locations that are considered out of scope for the given
* location.
*/
function getOutOfScopeLocations(source, position) {
function findOutOfScopeLocations(source, position) {
const { functions, comments } = findSymbols(source);
const commentLocations = comments.map(c => c.location);
return functions.map(getLocation).concat(commentLocations).filter(loc => !(0, _contains.containsPosition)(loc, position)).reduce(removeOverlaps, []).sort(sortByStart);
let locations = functions.map(getLocation).concat(commentLocations).sort(sortByStart);
// Must remove inner locations then filter, otherwise,
// we will mis-judge in-scope inner locations as out of scope.
locations = removeInnerLocations(locations, position).filter(loc => !(0, _contains.containsPosition)(loc, position));
return removeOverlaps(locations);
}
exports.default = getOutOfScopeLocations;
exports.default = findOutOfScopeLocations;
/***/ }),
/* 1625 */
@ -41671,13 +41815,8 @@ var _getSymbols2 = _interopRequireDefault(_getSymbols);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isReactComponent(source) {
const { imports, classes } = (0, _getSymbols2.default)(source);
if (!imports || !classes) {
return false;
}
return importsReact(imports) && extendsComponent(classes);
const { imports, classes, callExpressions } = (0, _getSymbols2.default)(source);
return (importsReact(imports) || requiresReact(callExpressions)) && extendsComponent(classes);
} /* 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/>. */
@ -41686,10 +41825,14 @@ function importsReact(imports) {
return imports.some(importObj => importObj.source === "react" && importObj.specifiers.some(specifier => specifier === "React"));
}
function requiresReact(callExpressions) {
return callExpressions.some(callExpression => callExpression.name === "require" && callExpression.values.some(value => value === "react"));
}
function extendsComponent(classes) {
let result = false;
classes.some(classObj => {
if (classObj.parent.name === "Component" || classObj.parent.name === "PureComponent") {
if (classObj.parent.name === "Component" || classObj.parent.name === "PureComponent" || classObj.parent.property.name === "Component") {
result = true;
}
});
@ -41809,344 +41952,6 @@ function baseToPairs(object, props) {
module.exports = baseToPairs;
/***/ }),
/* 1758 */,
/* 1759 */,
/* 1760 */,
/* 1761 */,
/* 1762 */,
/* 1763 */,
/* 1764 */,
/* 1765 */,
/* 1766 */,
/* 1767 */,
/* 1768 */,
/* 1769 */,
/* 1770 */,
/* 1771 */,
/* 1772 */,
/* 1773 */,
/* 1774 */,
/* 1775 */,
/* 1776 */,
/* 1777 */,
/* 1778 */,
/* 1779 */,
/* 1780 */,
/* 1781 */,
/* 1782 */,
/* 1783 */,
/* 1784 */,
/* 1785 */,
/* 1786 */,
/* 1787 */,
/* 1788 */,
/* 1789 */,
/* 1790 */,
/* 1791 */,
/* 1792 */,
/* 1793 */,
/* 1794 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.parseScriptTags = exports.parseScripts = exports.getCandidateScriptLocations = exports.generateWhitespace = undefined;
var _babelTypes = __webpack_require__(493);
var types = _interopRequireWildcard(_babelTypes);
var _parseScriptFragment = __webpack_require__(1795);
var _parseScriptFragment2 = _interopRequireDefault(_parseScriptFragment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var startScript = /<script[^>]*>/im;
var endScript = /<\/script\s*>/im;
// https://stackoverflow.com/questions/5034781/js-regex-to-split-by-line#comment5633979_5035005
var newLines = /\r\n|[\n\v\f\r\x85\u2028\u2029]/;
function getType(tag) {
var fragment = (0, _parseScriptFragment2.default)(tag);
if (fragment) {
var type = fragment.attributes.type;
return type ? type.toLowerCase() : null;
}
return null;
}
function getCandidateScriptLocations(source, index) {
var i = index || 0;
var str = source.substring(i);
var startMatch = startScript.exec(str);
if (startMatch) {
var startsAt = startMatch.index + startMatch[0].length;
var afterStart = str.substring(startsAt);
var endMatch = endScript.exec(afterStart);
if (endMatch) {
var locLength = endMatch.index;
var locIndex = i + startsAt;
var endIndex = locIndex + locLength + endMatch[0].length;
// extract the complete tag (incl start and end tags and content). if the
// type is invalid (= not JS), skip this tag and continue
var tag = source.substring(i + startMatch.index, endIndex);
var type = getType(tag);
if (type && type !== "javascript" && type !== "text/javascript") {
return getCandidateScriptLocations(source, endIndex);
}
return [adjustForLineAndColumn(source, {
index: locIndex,
length: locLength,
source: source.substring(locIndex, locIndex + locLength)
})].concat(_toConsumableArray(getCandidateScriptLocations(source, endIndex)));
}
}
return [];
}
function parseScripts(locations, parser) {
return locations.map(parser);
}
function generateWhitespace(length) {
return Array.from(new Array(length + 1)).join(" ");
}
function calcLineAndColumn(source, index) {
var lines = source.substring(0, index).split(newLines);
var line = lines.length;
var column = lines.pop().length + 1;
return {
column: column,
line: line
};
}
function adjustForLineAndColumn(fullSource, location) {
var _calcLineAndColumn = calcLineAndColumn(fullSource, location.index),
column = _calcLineAndColumn.column,
line = _calcLineAndColumn.line;
return Object.assign({}, location, {
line: line,
column: column,
// prepend whitespace for scripts that do not start on the first column
source: generateWhitespace(column) + location.source
});
}
function parseScriptTags(source, parser) {
var scripts = parseScripts(getCandidateScriptLocations(source), parser).filter(types.isFile).reduce(function (main, script) {
return {
statements: main.statements.concat(script.program.body),
comments: main.comments.concat(script.comments),
tokens: main.tokens.concat(script.tokens)
};
}, {
statements: [],
comments: [],
tokens: []
});
var program = types.program(scripts.statements);
var file = types.file(program, scripts.comments, scripts.tokens);
var end = calcLineAndColumn(source, source.length);
file.start = program.start = 0;
file.end = program.end = source.length;
file.loc = program.loc = {
start: {
line: 1,
column: 0
},
end: end
};
return file;
}
exports.default = parseScriptTags;
exports.generateWhitespace = generateWhitespace;
exports.getCandidateScriptLocations = getCandidateScriptLocations;
exports.parseScripts = parseScripts;
exports.parseScriptTags = parseScriptTags;
/***/ }),
/* 1795 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var alphanum = /[a-z0-9\-]/i;
function parseToken(str, start) {
var i = start;
while (i < str.length && alphanum.test(str.charAt(i++))) {
continue;
}
if (i !== start) {
return {
token: str.substring(start, i - 1),
index: i
};
}
return null;
}
function parseAttributes(str, start) {
var i = start;
var attributes = {};
var attribute = null;
while (i < str.length) {
var c = str.charAt(i);
if (attribute === null && c == ">") {
break;
} else if (attribute === null && alphanum.test(c)) {
attribute = {
name: null,
value: true,
bool: true,
terminator: null
};
var attributeNameNode = parseToken(str, i);
if (attributeNameNode) {
attribute.name = attributeNameNode.token;
i = attributeNameNode.index - 2;
}
} else if (attribute !== null) {
if (c === "=") {
// once we've started an attribute, look for = to indicate
// it's a non-boolean attribute
attribute.bool = false;
if (attribute.value === true) {
attribute.value = "";
}
} else if (!attribute.bool && attribute.terminator === null && (c === '"' || c === "'")) {
// once we've determined it's non-boolean, look for a
// value terminator (", ')
attribute.terminator = c;
} else if (attribute.terminator) {
if (c === attribute.terminator) {
// if we had a terminator and found another, we've
// reach the end of the attribute
attributes[attribute.name] = attribute.value;
attribute = null;
} else {
// otherwise, append the character to the attribute value
attribute.value += c;
// check for an escaped terminator and push it as well
// to avoid terminating prematurely
if (c === "\\") {
var next = str.charAt(i + 1);
if (next === attribute.terminator) {
attribute.value += next;
i += 1;
}
}
}
} else if (!/\s/.test(c)) {
// if we've hit a non-space character and aren't processing a value,
// we're starting a new attribute so push the attribute and clear the
// local variable
attributes[attribute.name] = attribute.value;
attribute = null;
// move the cursor back to re-find the start of the attribute
i -= 1;
}
}
i++;
}
if (i !== start) {
return {
attributes: attributes,
index: i
};
}
return null;
}
function parseFragment(str) {
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var tag = null;
var open = false;
var attributes = {};
var i = start;
while (i < str.length) {
var c = str.charAt(i++);
if (!open && !tag && c === "<") {
// Open Start Tag
open = true;
var tagNode = parseToken(str, i);
if (!tagNode) {
return null;
}
i = tagNode.index - 1;
tag = tagNode.token;
} else if (open && c === ">") {
// Close Start Tag
break;
} else if (open) {
// Attributes
var attributeNode = parseAttributes(str, i - 1);
if (attributeNode) {
i = attributeNode.index;
attributes = attributeNode.attributes || attributes;
}
}
}
if (tag) {
return {
tag: tag,
attributes: attributes
};
}
return null;
}
exports.default = parseFragment;
exports.parseFragment = parseFragment;
/***/ })
/******/ ]);
});

Просмотреть файл

@ -281,8 +281,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
const { workerHandler } = _devtoolsUtils.workerUtils;
function prettyPrint({ url, indent, source }) {
const prettified = (0, _prettyFast2.default)(source, {
function prettyPrint({ url, indent, sourceText }) {
const prettified = (0, _prettyFast2.default)(sourceText, {
url: url,
indent: " ".repeat(indent)
});

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -10,13 +10,6 @@ add_task(async function() {
const { selectors: { getSource }, getState } = dbg;
const sourceUrl = EXAMPLE_URL + "long.js";
async function waitForLoaded(dbg, srcUrl) {
return waitForState(
dbg,
state => findSource(dbg, srcUrl).loadedState == "loaded"
);
}
// The source itself doesn't even exist yet, and using
// `selectSourceURL` will set a pending request to load this source
// and highlight a specific line.
@ -24,13 +17,14 @@ add_task(async function() {
// Wait for the source text to load and make sure we're in the right
// place.
await waitForLoaded(dbg, sourceUrl);
await waitForLoadedSource(dbg, sourceUrl);
// TODO: revisit highlighting lines when the debugger opens
// assertHighlightLocation(dbg, "long.js", 66);
// Jump to line 16 and make sure the editor scrolled.
await selectSource(dbg, "long.js", 16);
await waitForElement(dbg, ".CodeMirror-code > .highlight-line");
assertHighlightLocation(dbg, "long.js", 16);
// Make sure only one line is ever highlighted and the flash
@ -38,11 +32,6 @@ add_task(async function() {
await selectSource(dbg, "long.js", 17);
await selectSource(dbg, "long.js", 18);
assertHighlightLocation(dbg, "long.js", 18);
is(
findAllElements(dbg, "highlightLine").length,
1,
"Only 1 line is highlighted"
);
// Test jumping to a line in a source that exists but hasn't been
// loaded yet.
@ -51,8 +40,9 @@ add_task(async function() {
// Make sure the source is in the loading state, wait for it to be
// fully loaded, and check the highlighted line.
const simple1 = findSource(dbg, "simple1.js");
ok(getSource(getState(), simple1.id).get("loadedState"));
await waitForLoaded(dbg, "simple1.js");
is(getSource(getState(), simple1.id).get("loadedState"), "loading");
await waitForLoadedSource(dbg, "simple1.js");
ok(getSource(getState(), simple1.id).get("text"));
assertHighlightLocation(dbg, "simple1.js", 6);
});

Просмотреть файл

@ -27,12 +27,12 @@ add_task(async function() {
await waitForPaused(dbg);
await waitForMappedScopes(dbg);
is(getScopeNodeLabel(dbg, 1), "sum");
is(getScopeNodeLabel(dbg, 2), "<this>");
is(getScopeNodeLabel(dbg, 3), "arguments");
is(getScopeNodeLabel(dbg, 1), "sum", "check scope label");
is(getScopeNodeLabel(dbg, 2), "<this>", "check scope label");
is(getScopeNodeLabel(dbg, 3), "arguments", "check scope label");
is(getScopeNodeLabel(dbg, 4), "first");
is(getScopeNodeValue(dbg, 4), "40");
is(getScopeNodeLabel(dbg, 5), "second");
is(getScopeNodeValue(dbg, 5), "2");
is(getScopeNodeLabel(dbg, 4), "first", "check scope label");
is(getScopeNodeValue(dbg, 4), "40", "check scope value");
is(getScopeNodeLabel(dbg, 5), "second", "check scope label");
is(getScopeNodeValue(dbg, 5), "2", "check scope value");
});

Просмотреть файл

@ -17,7 +17,7 @@ add_task(async function() {
const { selectors: { getSelectedSource }, getState } = dbg;
await selectSource(dbg, "simple1", 1);
await waitForLoadedSource(dbg, "simple1");
await waitForSelectedSource(dbg, "simple1");
findElementWithSelector(dbg, ".outline-tab").click();
is(getItems(dbg).length, 5, "5 items in the list");

Просмотреть файл

@ -7,18 +7,29 @@
* 2. re-sync breakpoints
*/
async function waitForBreakpoint(dbg, location) {
return waitForState(
dbg,
state => {
return dbg.selectors.getBreakpoint(dbg.getState(), location);
},
"Waiting for breakpoint"
);
}
add_task(async function() {
const dbg = await initDebugger("reload/doc_reload.html", "sjs_code_reload");
const sym = waitForDispatch(dbg, "SET_SYMBOLS");
await selectSource(dbg, "sjs_code_reload");
await sym;
await waitForSelectedSource(dbg, "sjs_code_reload");
await addBreakpoint(dbg, "sjs_code_reload", 2);
const sync = waitForDispatch(dbg, "SYNC_BREAKPOINT");
await reload(dbg, "sjs_code_reload");
await sync;
const source = findSource(dbg, "sjs_code_reload");
const location = { sourceId: source.id, line: 6 };
await waitForBreakpoint(dbg, location);
const breakpoints = dbg.selectors.getBreakpoints(dbg.getState());
const breakpointList = breakpoints.valueSeq().toJS();

Просмотреть файл

@ -1,5 +1,6 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html>
<html>
<head>

Просмотреть файл

@ -1,5 +1,6 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html>
<html>
<head>

Просмотреть файл

@ -1,5 +1,6 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html>
<html>
<head>

Просмотреть файл

@ -1,3 +1,6 @@
<!-- 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/. -->
<html>
<head>
<title>Debugger Statements</title>

Просмотреть файл

@ -1,3 +1,6 @@
<!-- 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/. -->
<html>
<head>
<title>Debugger test page</title>

Просмотреть файл

@ -1,3 +1,6 @@
<!-- 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/. -->
<html>
<head>
<title>Frames</title>

Просмотреть файл

@ -1,3 +1,6 @@
<!-- 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/. -->
<html>
<head>
<title>Iframe</title>

Просмотреть файл

@ -1,5 +1,6 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!doctype html>
<html>

Просмотреть файл

@ -1,5 +1,6 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!doctype html>
<html>

Просмотреть файл

@ -1,3 +1,6 @@
<!-- 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/. -->
<html>
<head>
<title>Return Values</title>

Просмотреть файл

@ -1,5 +1,6 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!doctype html>
<html>

Просмотреть файл

@ -1,5 +1,6 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!doctype html>
<html>

Просмотреть файл

@ -1,5 +1,6 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html>
<html>
<head>

Просмотреть файл

@ -1,5 +1,6 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html>
<html>
<head>

Просмотреть файл

@ -1,5 +1,6 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html>
<html>
<head>

Просмотреть файл

@ -1,3 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html>
<html>
<head>

Просмотреть файл

@ -1,3 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html>
<html>
<head>

Просмотреть файл

@ -1,5 +1,6 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html>
<html>
<head>

Просмотреть файл

@ -1,5 +1,6 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html>
<html>
<head>

Просмотреть файл

@ -352,6 +352,12 @@ function assertHighlightLocation(dbg, source, line) {
const lineEl = findElement(dbg, "highlightLine");
ok(lineEl, "Line is highlighted");
is(
findAllElements(dbg, "highlightLine").length,
1,
"Only 1 line is highlighted"
);
ok(isVisibleInEditor(dbg, lineEl), "Highlighted line is visible");
ok(
getCM(dbg)

Просмотреть файл

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generated by IcoMoon.io -->
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="34" height="32" viewBox="0 0 34 32">
<path fill="#444444" d="M19.314 15.987c0 1.321-1.071 2.392-2.392 2.392s-2.392-1.071-2.392-2.392c0-1.321 1.071-2.392 2.392-2.392s2.392 1.071 2.392 2.392z"></path>

До

Ширина:  |  Высота:  |  Размер: 3.9 KiB

После

Ширина:  |  Высота:  |  Размер: 4.0 KiB

Просмотреть файл

@ -970,8 +970,7 @@ protected:
NS_ASSERTION(nullptr != aName, "must have attribute name");
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown,
"must have a real namespace ID!");
MOZ_ASSERT(aResult.HasStringBuffer() && aResult.StringBufferLength() == 0,
"Should have empty string coming in");
MOZ_ASSERT(aResult.IsEmpty(), "Should have empty string coming in");
const nsAttrValue* val = mAttrsAndChildren.GetAttr(aName, aNameSpaceID);
if (val) {
val->ToString(aResult);
@ -986,8 +985,7 @@ public:
inline bool GetAttr(const nsAString& aName, DOMString& aResult) const
{
MOZ_ASSERT(aResult.HasStringBuffer() && aResult.StringBufferLength() == 0,
"Should have empty string coming in");
MOZ_ASSERT(aResult.IsEmpty(), "Should have empty string coming in");
const nsAttrValue* val = mAttrsAndChildren.GetAttr(aName);
if (val) {
val->ToString(aResult);

Просмотреть файл

@ -270,7 +270,8 @@ nsAttrValue::ToString(mozilla::dom::DOMString& aResult) const
{
nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
if (str) {
aResult.SetStringBuffer(str, str->StorageSize()/sizeof(char16_t) - 1);
aResult.SetKnownLiveStringBuffer(
str, str->StorageSize()/sizeof(char16_t) - 1);
}
// else aResult is already empty
return;
@ -278,7 +279,7 @@ nsAttrValue::ToString(mozilla::dom::DOMString& aResult) const
case eAtom:
{
nsAtom *atom = static_cast<nsAtom*>(GetPtr());
aResult.SetOwnedAtom(atom, mozilla::dom::DOMString::eNullNotExpected);
aResult.SetKnownLiveAtom(atom, mozilla::dom::DOMString::eNullNotExpected);
break;
}
default:

Просмотреть файл

@ -59,7 +59,7 @@ public:
void GetType(mozilla::dom::DOMString& aRetVal) const
{
aRetVal.SetOwnedAtom(mType, mozilla::dom::DOMString::eNullNotExpected);
aRetVal.SetKnownLiveAtom(mType, mozilla::dom::DOMString::eNullNotExpected);
}
nsINode* GetTarget() const
@ -83,17 +83,18 @@ public:
void GetAttributeName(mozilla::dom::DOMString& aRetVal) const
{
aRetVal.SetOwnedAtom(mAttrName, mozilla::dom::DOMString::eTreatNullAsNull);
aRetVal.SetKnownLiveAtom(mAttrName,
mozilla::dom::DOMString::eTreatNullAsNull);
}
void GetAttributeNamespace(mozilla::dom::DOMString& aRetVal) const
{
aRetVal.SetOwnedString(mAttrNamespace);
aRetVal.SetKnownLiveString(mAttrNamespace);
}
void GetOldValue(mozilla::dom::DOMString& aRetVal) const
{
aRetVal.SetOwnedString(mPrevValue);
aRetVal.SetKnownLiveString(mPrevValue);
}
void GetAddedAnimations(AnimationArray& aRetVal) const

Просмотреть файл

@ -1818,7 +1818,7 @@ public:
void GetNodeName(mozilla::dom::DOMString& aNodeName)
{
const nsString& nodeName = NodeName();
aNodeName.SetOwnedString(nodeName);
aNodeName.SetKnownLiveString(nodeName);
}
MOZ_MUST_USE nsresult GetBaseURI(nsAString& aBaseURI) const;
// Return the base URI for the document.
@ -1882,7 +1882,7 @@ public:
void GetLocalName(mozilla::dom::DOMString& aLocalName) const
{
const nsString& localName = LocalName();
aLocalName.SetOwnedString(localName);
aLocalName.SetKnownLiveString(localName);
}
nsDOMAttributeMap* GetAttributes();

Просмотреть файл

@ -22,41 +22,45 @@ namespace dom {
* A class for representing string return values. This can be either passed to
* callees that have an nsString or nsAString out param or passed to a callee
* that actually knows about this class and can work with it. Such a callee may
* call SetStringBuffer or SetEphemeralStringBuffer or SetOwnedString or
* SetOwnedAtom on this object. It's only OK to call
* SetStringBuffer/SetOwnedString/SetOwnedAtom if the caller of the method in
* question plans to keep holding a strong ref to the stringbuffer involved,
* whether it's a raw nsStringBuffer, or stored inside the string or atom being
* passed. In the string/atom cases that means the caller must own the string
* or atom, and not mutate it (in the string case) for the lifetime of the
* DOMString.
* call these setters:
*
* The proper way to store a value in this class is to either to do nothing
* (which leaves this as an empty string), to call
* SetStringBuffer/SetEphemeralStringBuffer with a non-null stringbuffer, to
* call SetOwnedString, to call SetOwnedAtom, to call SetNull(), or to call
* AsAString() and set the value in the resulting nsString. These options are
* mutually exclusive! Don't do more than one of them.
* SetKnownLiveStringBuffer
* SetStringBuffer
* SetKnownLiveString
* SetKnownLiveAtom
* SetNull
*
* to assign a value to the DOMString without instantiating an actual nsString
* in the process, or use AsAString() to instantiate an nsString and work with
* it. These options are mutually exclusive! Don't do more than one of them.
*
* It's only OK to call
* SetKnownLiveStringBuffer/SetKnownLiveString/SetKnownLiveAtom if the caller of
* the method in question plans to keep holding a strong ref to the stringbuffer
* involved, whether it's a raw nsStringBuffer, or stored inside the string or
* atom being passed. In the string/atom cases that means the caller must own
* the string or atom, and not mutate it (in the string case) for the lifetime
* of the DOMString.
*
* The proper way to extract a value is to check IsNull(). If not null, then
* check HasStringBuffer(). If that's true, check for a zero length, and if the
* length is nonzero call StringBuffer(). If the length is zero this is the
* empty string. If HasStringBuffer() returns false, call AsAString() and get
* the value from that.
* check IsEmpty(). If neither of those is true, check HasStringBuffer(). If
* that's true, call StringBuffer()/StringBufferLength(). If HasStringBuffer()
* returns false, check HasLiteral, and if that returns true call
* Literal()/LiteralLength(). If HasLiteral() is false, call AsAString() and
* get the value from that.
*/
class MOZ_STACK_CLASS DOMString {
public:
DOMString()
: mStringBuffer(nullptr)
, mLength(0)
, mIsNull(false)
, mStringBufferOwned(false)
, mState(State::Empty)
{}
~DOMString()
{
MOZ_ASSERT(!mString || !mStringBuffer,
"Shouldn't have both present!");
if (mStringBufferOwned) {
if (mState == State::OwnedStringBuffer) {
MOZ_ASSERT(mStringBuffer);
mStringBuffer->Release();
}
@ -74,10 +78,12 @@ public:
nsString& AsAString()
{
MOZ_ASSERT(mState == State::Empty || mState == State::String,
"Moving from nonempty state to another nonempty state?");
MOZ_ASSERT(!mStringBuffer, "We already have a stringbuffer?");
MOZ_ASSERT(!mIsNull, "We're already set as null");
if (!mString) {
mString.emplace();
mState = State::String;
}
return *mString;
}
@ -86,23 +92,21 @@ public:
{
MOZ_ASSERT(!mString || !mStringBuffer,
"Shouldn't have both present!");
MOZ_ASSERT(!mIsNull, "Caller should have checked IsNull() first");
return !mString;
MOZ_ASSERT(mState > State::Null,
"Caller should have checked IsNull() and IsEmpty() first");
return mState >= State::OwnedStringBuffer;
}
// Get the stringbuffer. This can only be called if HasStringBuffer()
// returned true and StringBufferLength() is nonzero. If that's true, it will
// never return null. Note that constructing a string from this
// nsStringBuffer with length given by StringBufferLength() might give you
// something that is not null-terminated.
// returned true. If that's true, it will never return null. Note that
// constructing a string from this nsStringBuffer with length given by
// StringBufferLength() might give you something that is not null-terminated.
nsStringBuffer* StringBuffer() const
{
MOZ_ASSERT(!mIsNull, "Caller should have checked IsNull() first");
MOZ_ASSERT(HasStringBuffer(),
"Don't ask for the stringbuffer if we don't have it");
MOZ_ASSERT(StringBufferLength() != 0, "Why are you asking for this?");
MOZ_ASSERT(mStringBuffer,
"If our length is nonzero, we better have a stringbuffer.");
"We better have a stringbuffer if we claim to");
return mStringBuffer;
}
@ -119,49 +123,83 @@ public:
void RelinquishBufferOwnership()
{
MOZ_ASSERT(HasStringBuffer(), "Don't call this if there is no stringbuffer");
if (mStringBufferOwned) {
if (mState == State::OwnedStringBuffer) {
// Just hand that ref over.
mStringBufferOwned = false;
mState = State::UnownedStringBuffer;
} else {
// Caller should end up holding a ref.
mStringBuffer->AddRef();
}
}
bool HasLiteral() const
{
MOZ_ASSERT(!mString || !mStringBuffer,
"Shouldn't have both present!");
MOZ_ASSERT(mState > State::Null,
"Caller should have checked IsNull() and IsEmpty() first");
return mState == State::Literal;
}
// Get the literal string. This can only be called if HasLiteral()
// returned true. If that's true, it will never return null.
const char16_t* Literal() const
{
MOZ_ASSERT(HasLiteral(),
"Don't ask for the literal if we don't have it");
MOZ_ASSERT(mLiteral,
"We better have a literal if we claim to");
return mLiteral;
}
// Get the length of the literal. Can only be called if HasLiteral().
uint32_t LiteralLength() const
{
MOZ_ASSERT(HasLiteral(), "Don't call this if there is no literal");
return mLength;
}
// Initialize the DOMString to a (nsStringBuffer, length) pair. The length
// does NOT have to be the full length of the (null-terminated) string in the
// nsStringBuffer.
void SetKnownLiveStringBuffer(nsStringBuffer* aStringBuffer, uint32_t aLength)
{
MOZ_ASSERT(mState == State::Empty, "We're already set to a value");
if (aLength != 0) {
SetStringBufferInternal(aStringBuffer, aLength);
mState = State::UnownedStringBuffer;
}
// else nothing to do
}
// Like SetKnownLiveStringBuffer, but holds a reference to the nsStringBuffer.
void SetStringBuffer(nsStringBuffer* aStringBuffer, uint32_t aLength)
{
MOZ_ASSERT(mString.isNothing(), "We already have a string?");
MOZ_ASSERT(!mIsNull, "We're already set as null");
MOZ_ASSERT(!mStringBuffer, "Setting stringbuffer twice?");
MOZ_ASSERT(aStringBuffer, "Why are we getting null?");
mStringBuffer = aStringBuffer;
mLength = aLength;
MOZ_ASSERT(mState == State::Empty, "We're already set to a value");
if (aLength != 0) {
SetStringBufferInternal(aStringBuffer, aLength);
aStringBuffer->AddRef();
mState = State::OwnedStringBuffer;
}
// else nothing to do
}
// Like SetStringBuffer, but holds a reference to the nsStringBuffer.
void SetEphemeralStringBuffer(nsStringBuffer* aStringBuffer, uint32_t aLength)
{
// We rely on SetStringBuffer to ensure our state invariants.
SetStringBuffer(aStringBuffer, aLength);
aStringBuffer->AddRef();
mStringBufferOwned = true;
}
void SetOwnedString(const nsAString& aString)
void SetKnownLiveString(const nsAString& aString)
{
MOZ_ASSERT(mString.isNothing(), "We already have a string?");
MOZ_ASSERT(!mIsNull, "We're already set as null");
MOZ_ASSERT(mState == State::Empty, "We're already set to a value");
MOZ_ASSERT(!mStringBuffer, "Setting stringbuffer twice?");
nsStringBuffer* buf = nsStringBuffer::FromString(aString);
if (buf) {
SetStringBuffer(buf, aString.Length());
} else if (aString.IsVoid()) {
if (MOZ_UNLIKELY(aString.IsVoid())) {
SetNull();
} else if (!aString.IsEmpty()) {
AsAString() = aString;
nsStringBuffer* buf = nsStringBuffer::FromString(aString);
if (buf) {
SetKnownLiveStringBuffer(buf, aString.Length());
} else if (aString.IsLiteral()) {
SetLiteralInternal(aString.BeginReading(), aString.Length());
} else {
AsAString() = aString;
}
}
}
@ -172,20 +210,20 @@ public:
eNullNotExpected
};
void SetOwnedAtom(nsAtom* aAtom, NullHandling aNullHandling)
void SetKnownLiveAtom(nsAtom* aAtom, NullHandling aNullHandling)
{
MOZ_ASSERT(mString.isNothing(), "We already have a string?");
MOZ_ASSERT(!mIsNull, "We're already set as null");
MOZ_ASSERT(mState == State::Empty, "We're already set to a value");
MOZ_ASSERT(!mStringBuffer, "Setting stringbuffer twice?");
MOZ_ASSERT(aAtom || aNullHandling != eNullNotExpected);
if (aNullHandling == eNullNotExpected || aAtom) {
if (aAtom->IsStaticAtom()) {
// XXX: bug 1407858 will replace this with a direct assignment of the
// static atom that doesn't go via nsString.
AsAString().AssignLiteral(aAtom->GetUTF16String(), aAtom->GetLength());
// Static atoms are backed by literals.
SetLiteralInternal(aAtom->GetUTF16String(), aAtom->GetLength());
} else {
// Dynamic atoms always have a string buffer.
SetStringBuffer(aAtom->GetStringBuffer(), aAtom->GetLength());
// Dynamic atoms always have a string buffer and never have 0 length,
// because nsGkAtoms::_empty is a static atom.
SetKnownLiveStringBuffer(aAtom->GetStringBuffer(), aAtom->GetLength());
}
} else if (aNullHandling == eTreatNullAsNull) {
SetNull();
@ -196,54 +234,106 @@ public:
{
MOZ_ASSERT(!mStringBuffer, "Should have no stringbuffer if null");
MOZ_ASSERT(mString.isNothing(), "Should have no string if null");
mIsNull = true;
MOZ_ASSERT(mState == State::Empty, "Already set to a value?");
mState = State::Null;
}
bool IsNull() const
{
MOZ_ASSERT(!mStringBuffer || mString.isNothing(),
"How could we have a stringbuffer and a nonempty string?");
return mIsNull || (mString && mString->IsVoid());
return mState == State::Null || (mString && mString->IsVoid());
}
bool IsEmpty() const
{
MOZ_ASSERT(!mStringBuffer || mString.isNothing(),
"How could we have a stringbuffer and a nonempty string?");
// This is not exact, because we might still have an empty XPCOM string.
// But that's OK; in that case the callers will try the XPCOM string
// themselves.
return mState == State::Empty;
}
void ToString(nsAString& aString)
{
if (IsNull()) {
SetDOMStringToNull(aString);
} else if (IsEmpty()) {
aString.Truncate();
} else if (HasStringBuffer()) {
if (StringBufferLength() == 0) {
aString.Truncate();
// Don't share the nsStringBuffer with aString if the result would not
// be null-terminated.
nsStringBuffer* buf = StringBuffer();
uint32_t len = StringBufferLength();
auto chars = static_cast<char16_t*>(buf->Data());
if (chars[len] == '\0') {
// Safe to share the buffer.
buf->ToString(len, aString);
} else {
// Don't share the nsStringBuffer with aString if the result would not
// be null-terminated.
nsStringBuffer* buf = StringBuffer();
uint32_t len = StringBufferLength();
auto chars = static_cast<char16_t*>(buf->Data());
if (chars[len] == '\0') {
// Safe to share the buffer.
buf->ToString(len, aString);
} else {
// We need to copy, unfortunately.
aString.Assign(chars, len);
}
// We need to copy, unfortunately.
aString.Assign(chars, len);
}
} else if (HasLiteral()) {
aString.AssignLiteral(Literal(), LiteralLength());
} else {
aString = AsAString();
}
}
private:
void SetStringBufferInternal(nsStringBuffer* aStringBuffer, uint32_t aLength)
{
MOZ_ASSERT(mString.isNothing(), "We already have a string?");
MOZ_ASSERT(mState == State::Empty, "We're already set to a value");
MOZ_ASSERT(!mStringBuffer, "Setting stringbuffer twice?");
MOZ_ASSERT(aStringBuffer, "Why are we getting null?");
MOZ_ASSERT(aLength != 0, "Should not have empty string here");
mStringBuffer = aStringBuffer;
mLength = aLength;
}
void SetLiteralInternal(const char16_t* aLiteral, uint32_t aLength)
{
MOZ_ASSERT(!mLiteral, "What's going on here?");
mLiteral = aLiteral;
mLength = aLength;
mState = State::Literal;
}
enum class State : uint8_t
{
Empty, // An empty string. Default state.
Null, // Null (not a string at all)
// All states that involve actual string data should come after
// Empty and Null.
String, // An XPCOM string stored in mString.
Literal, // A string literal (static lifetime).
OwnedStringBuffer, // mStringBuffer is valid and we have a ref to it.
UnownedStringBuffer, // mStringBuffer is valid; we are not holding a ref.
// The two string buffer values must come last. This lets us avoid doing
// two tests to figure out whether we have a stringbuffer.
};
// We need to be able to act like a string as needed
Maybe<nsAutoString> mString;
// For callees that know we exist, we can be a stringbuffer/length/null-flag
// triple.
nsStringBuffer* MOZ_UNSAFE_REF("The ways in which this can be safe are "
union
{
// The nsStringBuffer in the OwnedStringBuffer/UnownedStringBuffer cases.
nsStringBuffer* MOZ_UNSAFE_REF("The ways in which this can be safe are "
"documented above and enforced through "
"assertions") mStringBuffer;
// The literal in the Literal case.
const char16_t* mLiteral;
};
// Length in the stringbuffer and literal cases.
uint32_t mLength;
bool mIsNull;
bool mStringBufferOwned;
State mState;
};
} // namespace dom

Просмотреть файл

@ -75,7 +75,7 @@ TestFunctions::GetStringDataAsDOMString(const Optional<uint32_t>& aLength,
nsStringBuffer* buf = nsStringBuffer::FromString(mStringData);
if (buf) {
aString.SetStringBuffer(buf, length);
aString.SetKnownLiveStringBuffer(buf, length);
return;
}

Просмотреть файл

@ -162,17 +162,31 @@ private:
}
};
class WorkerFetchResolver;
class WorkerNotifier final : public WorkerHolder
{
RefPtr<WorkerFetchResolver> mResolver;
public:
explicit WorkerNotifier(WorkerFetchResolver* aResolver)
: WorkerHolder("WorkerNotifier", AllowIdleShutdownStart)
, mResolver(aResolver)
{}
bool
Notify(Status aStatus) override;
};
class WorkerFetchResolver final : public FetchDriverObserver
{
friend class MainThreadFetchRunnable;
friend class WorkerDataAvailableRunnable;
friend class WorkerFetchResponseEndBase;
friend class WorkerFetchResponseEndRunnable;
friend class WorkerFetchResponseRunnable;
// Thread-safe:
RefPtr<PromiseWorkerProxy> mPromiseProxy;
RefPtr<AbortSignalProxy> mSignalProxy;
// Touched only on the worker thread.
RefPtr<FetchObserver> mFetchObserver;
UniquePtr<WorkerHolder> mWorkerHolder;
public:
// Returns null if worker is shutting down.
@ -196,6 +210,11 @@ public:
RefPtr<WorkerFetchResolver> r =
new WorkerFetchResolver(proxy, signalProxy, aObserver);
if (NS_WARN_IF(!r->HoldWorker(aWorkerPrivate))) {
return nullptr;
}
return r.forget();
}
@ -223,6 +242,31 @@ public:
return mSignalProxy->GetSignalForTargetThread();
}
PromiseWorkerProxy*
PromiseProxy() const
{
MOZ_ASSERT(NS_IsMainThread());
return mPromiseProxy;
}
Promise*
WorkerPromise(WorkerPrivate* aWorkerPrivate) const
{
MOZ_ASSERT(aWorkerPrivate);
aWorkerPrivate->AssertIsOnWorkerThread();
return mPromiseProxy->WorkerPromise();
}
FetchObserver*
GetFetchObserver(WorkerPrivate* aWorkerPrivate) const
{
MOZ_ASSERT(aWorkerPrivate);
aWorkerPrivate->AssertIsOnWorkerThread();
return mFetchObserver;
}
void
OnResponseAvailableInternal(InternalResponse* aResponse) override;
@ -235,6 +279,24 @@ public:
void
OnDataAvailable() override;
void
Shutdown(WorkerPrivate* aWorkerPrivate)
{
MOZ_ASSERT(aWorkerPrivate);
aWorkerPrivate->AssertIsOnWorkerThread();
mPromiseProxy->CleanUp();
mFetchObserver = nullptr;
if (mSignalProxy) {
mSignalProxy->Shutdown();
mSignalProxy = nullptr;
}
mWorkerHolder = nullptr;
}
private:
WorkerFetchResolver(PromiseWorkerProxy* aProxy,
AbortSignalProxy* aSignalProxy,
@ -252,6 +314,18 @@ private:
virtual void
FlushConsoleReport() override;
bool
HoldWorker(WorkerPrivate* aWorkerPrivate)
{
UniquePtr<WorkerNotifier> wn(new WorkerNotifier(this));
if (NS_WARN_IF(!wn->HoldWorker(aWorkerPrivate, Canceling))) {
return false;
}
mWorkerHolder = Move(wn);
return true;
}
};
class MainThreadFetchResolver final : public FetchDriverObserver
@ -329,7 +403,7 @@ public:
{
AssertIsOnMainThread();
RefPtr<FetchDriver> fetch;
RefPtr<PromiseWorkerProxy> proxy = mResolver->mPromiseProxy;
RefPtr<PromiseWorkerProxy> proxy = mResolver->PromiseProxy();
{
// Acquire the proxy mutex while getting data from the WorkerPrivate...
@ -561,11 +635,13 @@ public:
MOZ_ASSERT(aWorkerPrivate);
aWorkerPrivate->AssertIsOnWorkerThread();
RefPtr<Promise> promise = mResolver->mPromiseProxy->WorkerPromise();
RefPtr<Promise> promise = mResolver->WorkerPromise(aWorkerPrivate);
RefPtr<FetchObserver> fetchObserver =
mResolver->GetFetchObserver(aWorkerPrivate);
if (mInternalResponse->Type() != ResponseType::Error) {
if (mResolver->mFetchObserver) {
mResolver->mFetchObserver->SetState(FetchState::Complete);
if (fetchObserver) {
fetchObserver->SetState(FetchState::Complete);
}
RefPtr<nsIGlobalObject> global = aWorkerPrivate->GlobalScope();
@ -574,8 +650,8 @@ public:
mResolver->GetAbortSignalForTargetThread());
promise->MaybeResolve(response);
} else {
if (mResolver->mFetchObserver) {
mResolver->mFetchObserver->SetState(FetchState::Errored);
if (fetchObserver) {
fetchObserver->SetState(FetchState::Errored);
}
ErrorResult result;
@ -603,9 +679,12 @@ public:
MOZ_ASSERT(aWorkerPrivate);
aWorkerPrivate->AssertIsOnWorkerThread();
if (mResolver->mFetchObserver &&
mResolver->mFetchObserver->State() == FetchState::Requesting) {
mResolver->mFetchObserver->SetState(FetchState::Responding);
RefPtr<FetchObserver> fetchObserver =
mResolver->GetFetchObserver(aWorkerPrivate);
if (fetchObserver &&
fetchObserver->State() == FetchState::Requesting) {
fetchObserver->SetState(FetchState::Responding);
}
return true;
@ -627,17 +706,7 @@ public:
void
WorkerRunInternal(WorkerPrivate* aWorkerPrivate)
{
MOZ_ASSERT(aWorkerPrivate);
aWorkerPrivate->AssertIsOnWorkerThread();
mResolver->mPromiseProxy->CleanUp();
mResolver->mFetchObserver = nullptr;
if (mResolver->mSignalProxy) {
mResolver->mSignalProxy->Shutdown();
mResolver->mSignalProxy = nullptr;
}
mResolver->Shutdown(aWorkerPrivate);
}
};
@ -660,8 +729,7 @@ public:
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
{
if (mReason == FetchDriverObserver::eAborted) {
RefPtr<Promise> promise = mResolver->mPromiseProxy->WorkerPromise();
promise->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
mResolver->WorkerPromise(aWorkerPrivate)->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
}
WorkerRunInternal(aWorkerPrivate);
@ -699,6 +767,18 @@ public:
// Control runnable cancel already calls Run().
};
bool
WorkerNotifier::Notify(Status aStatus)
{
if (mResolver) {
// This will nullify this object.
// No additional operation after this line!
mResolver->Shutdown(mWorkerPrivate);
}
return true;
}
void
WorkerFetchResolver::OnResponseAvailableInternal(InternalResponse* aResponse)
{

Просмотреть файл

@ -70,10 +70,10 @@ public:
// DOMString.
nsStringBuffer* buf = nsStringBuffer::FromString(mData);
if (buf) {
// We have to use SetEphemeralStringBuffer, because once we release our
// mutex mData can get mutated from some other thread while the DOMString
// is still alive.
aString.SetEphemeralStringBuffer(buf, aLength);
// We have to use SetStringBuffer, because once we release our mutex mData
// can get mutated from some other thread while the DOMString is still
// alive.
aString.SetStringBuffer(buf, aLength);
return true;
}

Просмотреть файл

@ -60,14 +60,7 @@ XPCStringConvert::ReadableToJSVal(JSContext* cx,
uint32_t length = readable.Length();
if (readable.IsLiteral()) {
bool ignored;
JSString* str = JS_NewMaybeExternalString(cx,
static_cast<const char16_t*>(readable.BeginReading()),
length, &sLiteralFinalizer, &ignored);
if (!str)
return false;
vp.setString(str);
return true;
return StringLiteralToJSVal(cx, readable.BeginReading(), length, vp);
}
nsStringBuffer* buf = nsStringBuffer::FromString(readable);

Просмотреть файл

@ -281,6 +281,19 @@ public:
return true;
}
static inline bool
StringLiteralToJSVal(JSContext* cx, const char16_t* literal, uint32_t length,
JS::MutableHandleValue rval)
{
bool ignored;
JSString* str = JS_NewMaybeExternalString(cx, literal, length,
&sLiteralFinalizer, &ignored);
if (!str)
return false;
rval.setString(str);
return true;
}
static MOZ_ALWAYS_INLINE bool IsLiteral(JSString* str)
{
return JS_IsExternalString(str) &&
@ -356,28 +369,33 @@ inline
bool NonVoidStringToJsval(JSContext* cx, mozilla::dom::DOMString& str,
JS::MutableHandleValue rval)
{
if (!str.HasStringBuffer()) {
// It's an actual XPCOM string
return NonVoidStringToJsval(cx, str.AsAString(), rval);
}
uint32_t length = str.StringBufferLength();
if (length == 0) {
if (str.IsEmpty()) {
rval.set(JS_GetEmptyStringValue(cx));
return true;
}
nsStringBuffer* buf = str.StringBuffer();
bool shared;
if (!XPCStringConvert::StringBufferToJSVal(cx, buf, length, rval,
&shared)) {
return false;
if (str.HasStringBuffer()) {
uint32_t length = str.StringBufferLength();
nsStringBuffer* buf = str.StringBuffer();
bool shared;
if (!XPCStringConvert::StringBufferToJSVal(cx, buf, length, rval,
&shared)) {
return false;
}
if (shared) {
// JS now needs to hold a reference to the buffer
str.RelinquishBufferOwnership();
}
return true;
}
if (shared) {
// JS now needs to hold a reference to the buffer
str.RelinquishBufferOwnership();
if (str.HasLiteral()) {
return XPCStringConvert::StringLiteralToJSVal(cx, str.Literal(),
str.LiteralLength(), rval);
}
return true;
// It's an actual XPCOM string
return NonVoidStringToJsval(cx, str.AsAString(), rval);
}
MOZ_ALWAYS_INLINE

Просмотреть файл

@ -5786,14 +5786,13 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
UpdateTextEmphasis(parentWM, aProvider));
}
// text-stroke overflows
// text-stroke overflows: add half of text-stroke-width on all sides
nscoord textStrokeWidth = StyleText()->mWebkitTextStrokeWidth;
if (textStrokeWidth > 0) {
// Inflate rect by stroke-width/2; we add an extra pixel to allow for
// antialiasing, rounding errors, etc.
nsRect strokeRect = *aVisualOverflowRect;
strokeRect.x -= textStrokeWidth;
strokeRect.y -= textStrokeWidth;
strokeRect.width += textStrokeWidth;
strokeRect.height += textStrokeWidth;
strokeRect.Inflate(textStrokeWidth / 2 + appUnitsPerDevUnit);
aVisualOverflowRect->UnionRect(*aVisualOverflowRect, strokeRect);
}

Просмотреть файл

@ -7,3 +7,4 @@ fuzzy-if(gtkWidget,255,20) fuzzy-if(winWidget,20,10) fails-if(skiaContent&&(gtkW
fuzzy-if(gtkWidget,255,20) fuzzy-if(winWidget,20,10) fails-if(skiaContent&&(gtkWidget||winWidget)) == webkit-text-stroke-property-003.html webkit-text-stroke-property-003-ref.html
fuzzy-if(gtkWidget,255,20) fuzzy-if(winWidget,20,10) fails-if(skiaContent&&(gtkWidget||winWidget)) == webkit-text-stroke-property-004.html webkit-text-stroke-property-004-ref.html
fuzzy-if(gtkWidget,255,20) fuzzy-if(winWidget,20,10) fails-if(skiaContent&&(gtkWidget||winWidget)) == webkit-text-stroke-property-005.html webkit-text-stroke-property-005-ref.html
fuzzy-if(gtkWidget,255,392) fuzzy-if(winWidget&&!d2d,48,372) fuzzy-if(winWidget&&d2d,71,10) == webkit-text-stroke-property-006.html webkit-text-stroke-property-006-ref.html

Просмотреть файл

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>webkit-text-stroke: SVG text reference</title>
<link rel="author" title="Jonathan Kew" href="jfkthame@gmail.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<style>
@font-face { font-family: test; src: url(../fonts/sil/CharisSIL-R.ttf); }
body { font-family: test; }
</style>
<body>
<div style="width: 500px; height: 400px;">
<svg xmlns="http://www.w3.org/2000/svg" style="width: 100%; height: 100%;">
<text x="50" y="200" font-size="64px" stroke="green"
stroke-width="10px">g&#x324;&#x326;&#x308;&#x302;</text>
</svg>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>webkit-text-stroke: fat stroke should not be clipped</title>
<link rel="author" title="Jonathan Kew" href="jfkthame@gmail.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<style>
@font-face { font-family: test; src: url(../fonts/sil/CharisSIL-R.ttf); }
body { font-family: test; }
</style>
<body>
<div style="width: 500px; height: 400px;">
<span style="margin-left: 50px; font-size: 64px;
-webkit-text-stroke: 10px green;">g&#x324;&#x326;&#x308;&#x302;</span>
<!-- need this inline-block to make sure text is rendered at the same position as the SVG reference -->
<div style="display:inline-block; width:0px; height:200px;"/>
</div>
<body>
<html>

Просмотреть файл

@ -40,7 +40,7 @@ public:
GetURLSpec(aNamespaceURI);
}
void GetPrefix(DOMString& aPrefix) {
aPrefix.SetOwnedAtom(GetPrefix(), DOMString::eTreatNullAsEmpty);
aPrefix.SetKnownLiveAtom(GetPrefix(), DOMString::eTreatNullAsEmpty);
}
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const = 0;

Просмотреть файл

@ -232,7 +232,7 @@ public abstract class MetaScanner {
continue;
}
}
// WARNING FALLTHRU CASE TRANSITION: DON'T REORDER
// CPPONLY: MOZ_FALLTHROUGH;
case TAG_OPEN:
tagopenloop: for (;;) {
c = read();
@ -267,7 +267,7 @@ public abstract class MetaScanner {
continue stateloop;
}
}
// FALL THROUGH DON'T REORDER
// CPPONLY: MOZ_FALLTHROUGH;
case TAG_NAME:
tagnameloop: for (;;) {
c = read();
@ -316,7 +316,7 @@ public abstract class MetaScanner {
continue;
}
}
// FALLTHRU DON'T REORDER
// CPPONLY: MOZ_FALLTHROUGH;
case BEFORE_ATTRIBUTE_NAME:
beforeattributenameloop: for (;;) {
if (reconsume) {
@ -370,7 +370,7 @@ public abstract class MetaScanner {
// continue stateloop;
}
}
// FALLTHRU DON'T REORDER
// CPPONLY: MOZ_FALLTHROUGH;
case ATTRIBUTE_NAME:
attributenameloop: for (;;) {
c = read();
@ -422,7 +422,7 @@ public abstract class MetaScanner {
continue;
}
}
// FALLTHRU DON'T REORDER
// CPPONLY: MOZ_FALLTHROUGH;
case BEFORE_ATTRIBUTE_VALUE:
beforeattributevalueloop: for (;;) {
c = read();
@ -453,7 +453,7 @@ public abstract class MetaScanner {
continue stateloop;
}
}
// FALLTHRU DON'T REORDER
// CPPONLY: MOZ_FALLTHROUGH;
case ATTRIBUTE_VALUE_DOUBLE_QUOTED:
attributevaluedoublequotedloop: for (;;) {
if (reconsume) {
@ -474,7 +474,7 @@ public abstract class MetaScanner {
continue;
}
}
// FALLTHRU DON'T REORDER
// CPPONLY: MOZ_FALLTHROUGH;
case AFTER_ATTRIBUTE_VALUE_QUOTED:
afterattributevaluequotedloop: for (;;) {
c = read();
@ -503,7 +503,7 @@ public abstract class MetaScanner {
continue stateloop;
}
}
// FALLTHRU DON'T REORDER
// CPPONLY: MOZ_FALLTHROUGH;
case SELF_CLOSING_START_TAG:
c = read();
switch (c) {
@ -520,7 +520,6 @@ public abstract class MetaScanner {
reconsume = true;
continue stateloop;
}
// XXX reorder point
case ATTRIBUTE_VALUE_UNQUOTED:
for (;;) {
if (reconsume) {
@ -551,7 +550,6 @@ public abstract class MetaScanner {
continue;
}
}
// XXX reorder point
case AFTER_ATTRIBUTE_NAME:
for (;;) {
c = read();
@ -592,7 +590,6 @@ public abstract class MetaScanner {
continue stateloop;
}
}
// XXX reorder point
case MARKUP_DECLARATION_OPEN:
markupdeclarationopenloop: for (;;) {
c = read();
@ -609,7 +606,7 @@ public abstract class MetaScanner {
continue stateloop;
}
}
// FALLTHRU DON'T REORDER
// CPPONLY: MOZ_FALLTHROUGH;
case MARKUP_DECLARATION_HYPHEN:
markupdeclarationhyphenloop: for (;;) {
c = read();
@ -626,7 +623,7 @@ public abstract class MetaScanner {
continue stateloop;
}
}
// FALLTHRU DON'T REORDER
// CPPONLY: MOZ_FALLTHROUGH;
case COMMENT_START:
commentstartloop: for (;;) {
c = read();
@ -645,7 +642,7 @@ public abstract class MetaScanner {
// continue stateloop;
}
}
// FALLTHRU DON'T REORDER
// CPPONLY: MOZ_FALLTHROUGH;
case COMMENT:
commentloop: for (;;) {
c = read();
@ -660,7 +657,7 @@ public abstract class MetaScanner {
continue;
}
}
// FALLTHRU DON'T REORDER
// CPPONLY: MOZ_FALLTHROUGH;
case COMMENT_END_DASH:
commentenddashloop: for (;;) {
c = read();
@ -676,7 +673,7 @@ public abstract class MetaScanner {
continue stateloop;
}
}
// FALLTHRU DON'T REORDER
// CPPONLY: MOZ_FALLTHROUGH;
case COMMENT_END:
for (;;) {
c = read();
@ -693,7 +690,6 @@ public abstract class MetaScanner {
continue stateloop;
}
}
// XXX reorder point
case COMMENT_START_DASH:
c = read();
switch (c) {
@ -709,7 +705,6 @@ public abstract class MetaScanner {
state = MetaScanner.COMMENT;
continue stateloop;
}
// XXX reorder point
case ATTRIBUTE_VALUE_SINGLE_QUOTED:
for (;;) {
if (reconsume) {
@ -729,7 +724,6 @@ public abstract class MetaScanner {
continue;
}
}
// XXX reorder point
case SCAN_UNTIL_GT:
for (;;) {
if (reconsume) {

Просмотреть файл

@ -82,6 +82,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
/**
* @see nu.validator.htmlparser.impl.TreeBuilderState#getStack()
*/
@Override
public StackNode<T>[] getStack() {
return stack;
}
@ -89,6 +90,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
/**
* @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStack()
*/
@Override
public int[] getTemplateModeStack() {
return templateModeStack;
}
@ -96,6 +98,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
/**
* @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElements()
*/
@Override
public StackNode<T>[] getListOfActiveFormattingElements() {
return listOfActiveFormattingElements;
}
@ -103,6 +106,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
/**
* @see nu.validator.htmlparser.impl.TreeBuilderState#getFormPointer()
*/
@Override
public T getFormPointer() {
return formPointer;
}
@ -112,6 +116,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
*
* @return the headPointer
*/
@Override
public T getHeadPointer() {
return headPointer;
}
@ -121,6 +126,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
*
* @return the deepTreeSurrogateParent
*/
@Override
public T getDeepTreeSurrogateParent() {
return deepTreeSurrogateParent;
}
@ -130,6 +136,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
*
* @return the mode
*/
@Override
public int getMode() {
return mode;
}
@ -139,6 +146,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
*
* @return the originalMode
*/
@Override
public int getOriginalMode() {
return originalMode;
}
@ -148,6 +156,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
*
* @return the framesetOk
*/
@Override
public boolean isFramesetOk() {
return framesetOk;
}
@ -157,6 +166,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
*
* @return the needToDropLF
*/
@Override
public boolean isNeedToDropLF() {
return needToDropLF;
}
@ -166,6 +176,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
*
* @return the quirks
*/
@Override
public boolean isQuirks() {
return quirks;
}
@ -173,6 +184,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
/**
* @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElementsLength()
*/
@Override
public int getListOfActiveFormattingElementsLength() {
return listOfActiveFormattingElements.length;
}
@ -180,6 +192,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
/**
* @see nu.validator.htmlparser.impl.TreeBuilderState#getStackLength()
*/
@Override
public int getStackLength() {
return stack.length;
}
@ -187,6 +200,7 @@ public class StateSnapshot<T> implements TreeBuilderState<T> {
/**
* @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStackLength()
*/
@Override
public int getTemplateModeStackLength() {
return templateModeStack.length;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1072,7 +1072,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
if (!isInForeignButNotHtmlOrMathTextIntegrationPoint()) {
reconstructTheActiveFormattingElements();
}
// fall through
// CPPONLY: MOZ_FALLTHROUGH;
case TEXT:
accumulateCharacters(buf, start, length);
return;
@ -1573,6 +1573,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
}
// fall through to IN_TEMPLATE
// CPPONLY: MOZ_FALLTHROUGH;
case IN_TEMPLATE:
int eltPos = findLast("template");
if (eltPos == TreeBuilder.NOT_FOUND_ON_STACK) {
@ -1738,7 +1739,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
continue starttagloop;
} // else fall thru
}
// else fall thru
// CPPONLY: MOZ_FALLTHROUGH;
default:
if ("http://www.w3.org/2000/svg" == currNs) {
attributes.adjustForSvg();
@ -1866,6 +1867,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
default:
// fall through to IN_TABLE
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_TABLE_BODY:
switch (group) {
case TR:
@ -1902,6 +1904,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
default:
// fall through to IN_TABLE
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_TABLE:
intableloop: for (;;) {
switch (group) {
@ -2017,6 +2020,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
break intableloop;
}
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_CAPTION:
switch (group) {
case CAPTION:
@ -2043,6 +2047,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
default:
// fall through to IN_BODY
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_CELL:
switch (group) {
case CAPTION:
@ -2062,6 +2067,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
default:
// fall through to IN_BODY
}
// CPPONLY: MOZ_FALLTHROUGH;
case FRAMESET_OK:
switch (group) {
case FRAMESET:
@ -2113,10 +2119,11 @@ public abstract class TreeBuilder<T> implements TokenHandler,
framesetOk = false;
mode = IN_BODY;
}
// fall through to IN_BODY
// CPPONLY: MOZ_FALLTHROUGH;
default:
// fall through to IN_BODY
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_BODY:
inbodyloop: for (;;) {
switch (group) {
@ -2333,6 +2340,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
case AREA_OR_WBR:
reconstructTheActiveFormattingElements();
// FALL THROUGH to PARAM_OR_SOURCE_OR_TRACK
// CPPONLY: MOZ_FALLTHROUGH;
// CPPONLY: case MENUITEM:
case PARAM_OR_SOURCE_OR_TRACK:
appendVoidElementToCurrentMayFoster(
@ -2394,9 +2402,8 @@ public abstract class TreeBuilder<T> implements TokenHandler,
attributes);
attributes = null; // CPP
break starttagloop;
} else {
// fall through
}
// CPPONLY: MOZ_FALLTHROUGH;
case NOFRAMES:
case IFRAME:
case NOEMBED:
@ -2524,6 +2531,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
break starttagloop;
}
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_HEAD:
inheadloop: for (;;) {
switch (group) {
@ -2590,6 +2598,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
continue starttagloop;
}
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_HEAD_NOSCRIPT:
switch (group) {
case HTML:
@ -2690,6 +2699,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
default:
// fall through to IN_SELECT
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_SELECT:
switch (group) {
case HTML:
@ -2792,6 +2802,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
default:
// fall through to AFTER_FRAMESET
}
// CPPONLY: MOZ_FALLTHROUGH;
case AFTER_FRAMESET:
switch (group) {
case HTML:
@ -3371,6 +3382,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
errStrayEndTag(name);
break endtagloop;
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_ROW:
switch (group) {
case TR:
@ -3421,6 +3433,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
default:
// fall through to IN_TABLE
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_TABLE_BODY:
switch (group) {
case TBODY_OR_THEAD_OR_TFOOT:
@ -3456,6 +3469,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
default:
// fall through to IN_TABLE
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_TABLE:
switch (group) {
case TABLE:
@ -3487,6 +3501,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
errStrayEndTag(name);
// fall through to IN_BODY
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_CAPTION:
switch (group) {
case CAPTION:
@ -3532,6 +3547,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
default:
// fall through to IN_BODY
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_CELL:
switch (group) {
case TD_OR_TH:
@ -3570,6 +3586,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
default:
// fall through to IN_BODY
}
// CPPONLY: MOZ_FALLTHROUGH;
case FRAMESET_OK:
case IN_BODY:
switch (group) {
@ -3807,9 +3824,8 @@ public abstract class TreeBuilder<T> implements TokenHandler,
if (scriptingEnabled) {
errStrayEndTag(name);
break endtagloop;
} else {
// fall through
}
// CPPONLY: MOZ_FALLTHROUGH;
case A:
case B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U:
case FONT:
@ -3818,6 +3834,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
break endtagloop;
}
// else handle like any other tag
// CPPONLY: MOZ_FALLTHROUGH;
default:
if (isCurrent(name)) {
pop();
@ -3844,6 +3861,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
eltPos--;
}
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_HEAD:
switch (group) {
case HEAD:
@ -3932,6 +3950,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
default:
// fall through to IN_SELECT
}
// CPPONLY: MOZ_FALLTHROUGH;
case IN_SELECT:
switch (group) {
case OPTION:
@ -6288,6 +6307,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
/**
* @see nu.validator.htmlparser.impl.TreeBuilderState#getFormPointer()
*/
@Override
public T getFormPointer() {
return formPointer;
}
@ -6297,6 +6317,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
*
* @return the headPointer
*/
@Override
public T getHeadPointer() {
return headPointer;
}
@ -6306,6 +6327,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
*
* @return the deepTreeSurrogateParent
*/
@Override
public T getDeepTreeSurrogateParent() {
return deepTreeSurrogateParent;
}
@ -6313,6 +6335,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
/**
* @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElements()
*/
@Override
public StackNode<T>[] getListOfActiveFormattingElements() {
return listOfActiveFormattingElements;
}
@ -6320,6 +6343,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
/**
* @see nu.validator.htmlparser.impl.TreeBuilderState#getStack()
*/
@Override
public StackNode<T>[] getStack() {
return stack;
}
@ -6327,6 +6351,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
/**
* @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStack()
*/
@Override
public int[] getTemplateModeStack() {
return templateModeStack;
}
@ -6336,6 +6361,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
*
* @return the mode
*/
@Override
public int getMode() {
return mode;
}
@ -6345,6 +6371,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
*
* @return the originalMode
*/
@Override
public int getOriginalMode() {
return originalMode;
}
@ -6354,6 +6381,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
*
* @return the framesetOk
*/
@Override
public boolean isFramesetOk() {
return framesetOk;
}
@ -6363,6 +6391,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
*
* @return the needToDropLF
*/
@Override
public boolean isNeedToDropLF() {
return needToDropLF;
}
@ -6372,6 +6401,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
*
* @return the quirks
*/
@Override
public boolean isQuirks() {
return quirks;
}
@ -6379,6 +6409,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
/**
* @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElementsLength()
*/
@Override
public int getListOfActiveFormattingElementsLength() {
return listPtr + 1;
}
@ -6386,6 +6417,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
/**
* @see nu.validator.htmlparser.impl.TreeBuilderState#getStackLength()
*/
@Override
public int getStackLength() {
return currentPtr + 1;
}
@ -6393,6 +6425,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
/**
* @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStackLength()
*/
@Override
public int getTemplateModeStackLength() {
return templateModePtr + 1;
}

Просмотреть файл

@ -99,5 +99,4 @@ LOCAL_INCLUDES += [
]
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
CXXFLAGS += ['-Wno-error=shadow',
'-Wno-implicit-fallthrough']
CXXFLAGS += ['-Wno-error=shadow']

Просмотреть файл

@ -62,7 +62,7 @@ nsAtom** nsHtml5AttributeName::ALL_NO_PREFIX = 0;
nsAtom** nsHtml5AttributeName::XMLNS_PREFIX = 0;
nsAtom** nsHtml5AttributeName::XLINK_PREFIX = 0;
nsAtom** nsHtml5AttributeName::XML_PREFIX = 0;
nsAtom**
nsAtom**
nsHtml5AttributeName::SVG_DIFFERENT(nsAtom* name, nsAtom* camel)
{
nsAtom** arr = new nsAtom*[4];
@ -72,7 +72,7 @@ nsHtml5AttributeName::SVG_DIFFERENT(nsAtom* name, nsAtom* camel)
return arr;
}
nsAtom**
nsAtom**
nsHtml5AttributeName::MATH_DIFFERENT(nsAtom* name, nsAtom* camel)
{
nsAtom** arr = new nsAtom*[4];
@ -82,7 +82,7 @@ nsHtml5AttributeName::MATH_DIFFERENT(nsAtom* name, nsAtom* camel)
return arr;
}
nsAtom**
nsAtom**
nsHtml5AttributeName::COLONIFIED_LOCAL(nsAtom* name, nsAtom* suffix)
{
nsAtom** arr = new nsAtom*[4];
@ -92,7 +92,7 @@ nsHtml5AttributeName::COLONIFIED_LOCAL(nsAtom* name, nsAtom* suffix)
return arr;
}
nsAtom**
nsAtom**
nsHtml5AttributeName::SAME_LOCAL(nsAtom* name)
{
nsAtom** arr = new nsAtom*[4];
@ -130,32 +130,31 @@ nsHtml5AttributeName::createAttributeName(nsAtom* name)
ALL_NO_PREFIX);
}
nsHtml5AttributeName::~nsHtml5AttributeName()
{
MOZ_COUNT_DTOR(nsHtml5AttributeName);
delete[] local;
}
int32_t
int32_t
nsHtml5AttributeName::getUri(int32_t mode)
{
return uri[mode];
}
nsAtom*
nsAtom*
nsHtml5AttributeName::getLocal(int32_t mode)
{
return local[mode];
}
nsAtom*
nsAtom*
nsHtml5AttributeName::getPrefix(int32_t mode)
{
return prefix[mode];
}
bool
bool
nsHtml5AttributeName::equalsAnother(nsHtml5AttributeName* another)
{
return this->getLocal(nsHtml5AttributeName::HTML) ==
@ -743,7 +742,10 @@ static int32_t const ATTRIBUTE_HASHES_DATA[] = {
2007064819, 2008401563, 2009041198, 2009079867, 2009231684, 2010716309,
2016711994, 2016810187, 2017010843, 2019887833, 2023342821, 2024647008
};
staticJArray<int32_t,int32_t> nsHtml5AttributeName::ATTRIBUTE_HASHES = { ATTRIBUTE_HASHES_DATA, MOZ_ARRAY_LENGTH(ATTRIBUTE_HASHES_DATA) };
staticJArray<int32_t, int32_t> nsHtml5AttributeName::ATTRIBUTE_HASHES = {
ATTRIBUTE_HASHES_DATA,
MOZ_ARRAY_LENGTH(ATTRIBUTE_HASHES_DATA)
};
void
nsHtml5AttributeName::initializeStatics()
{
@ -2901,5 +2903,3 @@ nsHtml5AttributeName::releaseStatics()
delete ATTR_REFY;
delete[] ATTRIBUTE_NAMES;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -79,7 +79,6 @@ nsHtml5ElementName::nsHtml5ElementName()
MOZ_COUNT_CTOR(nsHtml5ElementName);
}
nsHtml5ElementName::~nsHtml5ElementName()
{
MOZ_COUNT_DTOR(nsHtml5ElementName);
@ -330,7 +329,10 @@ static int32_t const ELEMENT_HASHES_DATA[] = {
1938817026, 1941178676, 1963982850, 1965334268, 1967128578, 1967788867,
1967795958, 1968836118
};
staticJArray<int32_t,int32_t> nsHtml5ElementName::ELEMENT_HASHES = { ELEMENT_HASHES_DATA, MOZ_ARRAY_LENGTH(ELEMENT_HASHES_DATA) };
staticJArray<int32_t, int32_t> nsHtml5ElementName::ELEMENT_HASHES = {
ELEMENT_HASHES_DATA,
MOZ_ARRAY_LENGTH(ELEMENT_HASHES_DATA)
};
void
nsHtml5ElementName::initializeStatics()
{
@ -1926,5 +1928,3 @@ nsHtml5ElementName::releaseStatics()
delete ELT_TBODY;
delete[] ELEMENT_NAMES;
}

Просмотреть файл

@ -54,7 +54,6 @@ class nsHtml5UTF16Buffer;
class nsHtml5StateSnapshot;
class nsHtml5Portability;
class nsHtml5ElementName
{
public:
@ -143,276 +142,277 @@ public:
}
return elementName;
}
}
private:
inline static uint32_t bufToHash(char16_t* buf, int32_t length)
{
uint32_t len = length;
uint32_t first = buf[0];
first <<= 19;
uint32_t second = 1 << 23;
uint32_t third = 0;
uint32_t fourth = 0;
uint32_t fifth = 0;
if (length >= 4) {
second = buf[length - 4];
second <<= 4;
third = buf[length - 3];
third <<= 9;
fourth = buf[length - 2];
fourth <<= 14;
fifth = buf[length - 1];
fifth <<= 24;
} else if (length == 3) {
second = buf[1];
second <<= 4;
third = buf[2];
third <<= 9;
} else if (length == 2) {
second = buf[1];
second <<= 24;
}
return len + first + second + third + fourth + fifth;
}
private:
inline static uint32_t bufToHash(char16_t* buf, int32_t length)
{
uint32_t len = length;
uint32_t first = buf[0];
first <<= 19;
uint32_t second = 1 << 23;
uint32_t third = 0;
uint32_t fourth = 0;
uint32_t fifth = 0;
if (length >= 4) {
second = buf[length - 4];
second <<= 4;
third = buf[length - 3];
third <<= 9;
fourth = buf[length - 2];
fourth <<= 14;
fifth = buf[length - 1];
fifth <<= 24;
} else if (length == 3) {
second = buf[1];
second <<= 4;
third = buf[2];
third <<= 9;
} else if (length == 2) {
second = buf[1];
second <<= 24;
}
return len + first + second + third + fourth + fifth;
nsHtml5ElementName(nsAtom* name,
nsAtom* camelCaseName,
mozilla::dom::HTMLContentCreatorFunction htmlCreator,
mozilla::dom::SVGContentCreatorFunction svgCreator,
int32_t flags);
public:
nsHtml5ElementName();
~nsHtml5ElementName();
inline void setNameForNonInterned(nsAtom* name, bool custom)
{
this->name = name;
this->camelCaseName = name;
if (custom) {
this->htmlCreator = NS_NewCustomElement;
} else {
this->htmlCreator = NS_NewHTMLUnknownElement;
}
MOZ_ASSERT(this->flags == nsHtml5ElementName::NOT_INTERNED);
}
nsHtml5ElementName(nsAtom* name,
nsAtom* camelCaseName,
mozilla::dom::HTMLContentCreatorFunction htmlCreator,
mozilla::dom::SVGContentCreatorFunction svgCreator,
int32_t flags);
inline bool isCustom() { return this->htmlCreator == NS_NewCustomElement; }
public:
nsHtml5ElementName();
~nsHtml5ElementName();
inline void setNameForNonInterned(nsAtom* name, bool custom)
{
this->name = name;
this->camelCaseName = name;
if (custom) {
this->htmlCreator = NS_NewCustomElement;
} else {
this->htmlCreator = NS_NewHTMLUnknownElement;
}
MOZ_ASSERT(this->flags == nsHtml5ElementName::NOT_INTERNED);
}
static nsHtml5ElementName* ELT_ANNOTATION_XML;
static nsHtml5ElementName* ELT_BIG;
static nsHtml5ElementName* ELT_BDO;
static nsHtml5ElementName* ELT_COL;
static nsHtml5ElementName* ELT_DEL;
static nsHtml5ElementName* ELT_DFN;
static nsHtml5ElementName* ELT_DIR;
static nsHtml5ElementName* ELT_DIV;
static nsHtml5ElementName* ELT_IMG;
static nsHtml5ElementName* ELT_INS;
static nsHtml5ElementName* ELT_KBD;
static nsHtml5ElementName* ELT_MAP;
static nsHtml5ElementName* ELT_NAV;
static nsHtml5ElementName* ELT_PRE;
static nsHtml5ElementName* ELT_A;
static nsHtml5ElementName* ELT_B;
static nsHtml5ElementName* ELT_RTC;
static nsHtml5ElementName* ELT_SUB;
static nsHtml5ElementName* ELT_SVG;
static nsHtml5ElementName* ELT_SUP;
static nsHtml5ElementName* ELT_SET;
static nsHtml5ElementName* ELT_USE;
static nsHtml5ElementName* ELT_VAR;
static nsHtml5ElementName* ELT_G;
static nsHtml5ElementName* ELT_WBR;
static nsHtml5ElementName* ELT_XMP;
static nsHtml5ElementName* ELT_I;
static nsHtml5ElementName* ELT_P;
static nsHtml5ElementName* ELT_Q;
static nsHtml5ElementName* ELT_S;
static nsHtml5ElementName* ELT_U;
static nsHtml5ElementName* ELT_H1;
static nsHtml5ElementName* ELT_H2;
static nsHtml5ElementName* ELT_H3;
static nsHtml5ElementName* ELT_H4;
static nsHtml5ElementName* ELT_H5;
static nsHtml5ElementName* ELT_H6;
static nsHtml5ElementName* ELT_AREA;
static nsHtml5ElementName* ELT_DATA;
static nsHtml5ElementName* ELT_FEFUNCA;
static nsHtml5ElementName* ELT_METADATA;
static nsHtml5ElementName* ELT_META;
static nsHtml5ElementName* ELT_TEXTAREA;
static nsHtml5ElementName* ELT_FEFUNCB;
static nsHtml5ElementName* ELT_RB;
static nsHtml5ElementName* ELT_DESC;
static nsHtml5ElementName* ELT_DD;
static nsHtml5ElementName* ELT_BGSOUND;
static nsHtml5ElementName* ELT_EMBED;
static nsHtml5ElementName* ELT_FEBLEND;
static nsHtml5ElementName* ELT_FEFLOOD;
static nsHtml5ElementName* ELT_HEAD;
static nsHtml5ElementName* ELT_LEGEND;
static nsHtml5ElementName* ELT_NOEMBED;
static nsHtml5ElementName* ELT_TD;
static nsHtml5ElementName* ELT_THEAD;
static nsHtml5ElementName* ELT_ASIDE;
static nsHtml5ElementName* ELT_ARTICLE;
static nsHtml5ElementName* ELT_ANIMATE;
static nsHtml5ElementName* ELT_BASE;
static nsHtml5ElementName* ELT_BLOCKQUOTE;
static nsHtml5ElementName* ELT_CODE;
static nsHtml5ElementName* ELT_CIRCLE;
static nsHtml5ElementName* ELT_CITE;
static nsHtml5ElementName* ELT_ELLIPSE;
static nsHtml5ElementName* ELT_FETURBULENCE;
static nsHtml5ElementName* ELT_FEMERGENODE;
static nsHtml5ElementName* ELT_FEIMAGE;
static nsHtml5ElementName* ELT_FEMERGE;
static nsHtml5ElementName* ELT_FETILE;
static nsHtml5ElementName* ELT_FRAME;
static nsHtml5ElementName* ELT_FIGURE;
static nsHtml5ElementName* ELT_FECOMPOSITE;
static nsHtml5ElementName* ELT_IMAGE;
static nsHtml5ElementName* ELT_IFRAME;
static nsHtml5ElementName* ELT_LINE;
static nsHtml5ElementName* ELT_MARQUEE;
static nsHtml5ElementName* ELT_POLYLINE;
static nsHtml5ElementName* ELT_PICTURE;
static nsHtml5ElementName* ELT_SOURCE;
static nsHtml5ElementName* ELT_STRIKE;
static nsHtml5ElementName* ELT_STYLE;
static nsHtml5ElementName* ELT_TABLE;
static nsHtml5ElementName* ELT_TITLE;
static nsHtml5ElementName* ELT_TIME;
static nsHtml5ElementName* ELT_TEMPLATE;
static nsHtml5ElementName* ELT_ALTGLYPHDEF;
static nsHtml5ElementName* ELT_GLYPHREF;
static nsHtml5ElementName* ELT_DIALOG;
static nsHtml5ElementName* ELT_FEFUNCG;
static nsHtml5ElementName* ELT_FEDIFFUSELIGHTING;
static nsHtml5ElementName* ELT_FESPECULARLIGHTING;
static nsHtml5ElementName* ELT_LISTING;
static nsHtml5ElementName* ELT_STRONG;
static nsHtml5ElementName* ELT_ALTGLYPH;
static nsHtml5ElementName* ELT_CLIPPATH;
static nsHtml5ElementName* ELT_MGLYPH;
static nsHtml5ElementName* ELT_MATH;
static nsHtml5ElementName* ELT_MPATH;
static nsHtml5ElementName* ELT_PATH;
static nsHtml5ElementName* ELT_TH;
static nsHtml5ElementName* ELT_SWITCH;
static nsHtml5ElementName* ELT_TEXTPATH;
static nsHtml5ElementName* ELT_LI;
static nsHtml5ElementName* ELT_MI;
static nsHtml5ElementName* ELT_LINK;
static nsHtml5ElementName* ELT_MARK;
static nsHtml5ElementName* ELT_MALIGNMARK;
static nsHtml5ElementName* ELT_MASK;
static nsHtml5ElementName* ELT_TRACK;
static nsHtml5ElementName* ELT_DL;
static nsHtml5ElementName* ELT_HTML;
static nsHtml5ElementName* ELT_OL;
static nsHtml5ElementName* ELT_LABEL;
static nsHtml5ElementName* ELT_UL;
static nsHtml5ElementName* ELT_SMALL;
static nsHtml5ElementName* ELT_SYMBOL;
static nsHtml5ElementName* ELT_ALTGLYPHITEM;
static nsHtml5ElementName* ELT_ANIMATETRANSFORM;
static nsHtml5ElementName* ELT_ACRONYM;
static nsHtml5ElementName* ELT_EM;
static nsHtml5ElementName* ELT_FORM;
static nsHtml5ElementName* ELT_MENUITEM;
static nsHtml5ElementName* ELT_PARAM;
static nsHtml5ElementName* ELT_ANIMATEMOTION;
static nsHtml5ElementName* ELT_BUTTON;
static nsHtml5ElementName* ELT_CAPTION;
static nsHtml5ElementName* ELT_FIGCAPTION;
static nsHtml5ElementName* ELT_MN;
static nsHtml5ElementName* ELT_KEYGEN;
static nsHtml5ElementName* ELT_MAIN;
static nsHtml5ElementName* ELT_OPTION;
static nsHtml5ElementName* ELT_POLYGON;
static nsHtml5ElementName* ELT_PATTERN;
static nsHtml5ElementName* ELT_SPAN;
static nsHtml5ElementName* ELT_SECTION;
static nsHtml5ElementName* ELT_TSPAN;
static nsHtml5ElementName* ELT_AUDIO;
static nsHtml5ElementName* ELT_MO;
static nsHtml5ElementName* ELT_VIDEO;
static nsHtml5ElementName* ELT_COLGROUP;
static nsHtml5ElementName* ELT_FEDISPLACEMENTMAP;
static nsHtml5ElementName* ELT_HGROUP;
static nsHtml5ElementName* ELT_RP;
static nsHtml5ElementName* ELT_OPTGROUP;
static nsHtml5ElementName* ELT_SAMP;
static nsHtml5ElementName* ELT_STOP;
static nsHtml5ElementName* ELT_BR;
static nsHtml5ElementName* ELT_ABBR;
static nsHtml5ElementName* ELT_ANIMATECOLOR;
static nsHtml5ElementName* ELT_CENTER;
static nsHtml5ElementName* ELT_HR;
static nsHtml5ElementName* ELT_FEFUNCR;
static nsHtml5ElementName* ELT_FECOMPONENTTRANSFER;
static nsHtml5ElementName* ELT_FILTER;
static nsHtml5ElementName* ELT_FOOTER;
static nsHtml5ElementName* ELT_FEGAUSSIANBLUR;
static nsHtml5ElementName* ELT_HEADER;
static nsHtml5ElementName* ELT_MARKER;
static nsHtml5ElementName* ELT_METER;
static nsHtml5ElementName* ELT_NOBR;
static nsHtml5ElementName* ELT_TR;
static nsHtml5ElementName* ELT_ADDRESS;
static nsHtml5ElementName* ELT_CANVAS;
static nsHtml5ElementName* ELT_DEFS;
static nsHtml5ElementName* ELT_DETAILS;
static nsHtml5ElementName* ELT_MS;
static nsHtml5ElementName* ELT_NOFRAMES;
static nsHtml5ElementName* ELT_PROGRESS;
static nsHtml5ElementName* ELT_DT;
static nsHtml5ElementName* ELT_APPLET;
static nsHtml5ElementName* ELT_BASEFONT;
static nsHtml5ElementName* ELT_DATALIST;
static nsHtml5ElementName* ELT_FOREIGNOBJECT;
static nsHtml5ElementName* ELT_FIELDSET;
static nsHtml5ElementName* ELT_FRAMESET;
static nsHtml5ElementName* ELT_FEOFFSET;
static nsHtml5ElementName* ELT_FESPOTLIGHT;
static nsHtml5ElementName* ELT_FEPOINTLIGHT;
static nsHtml5ElementName* ELT_FEDISTANTLIGHT;
static nsHtml5ElementName* ELT_FONT;
static nsHtml5ElementName* ELT_INPUT;
static nsHtml5ElementName* ELT_LINEARGRADIENT;
static nsHtml5ElementName* ELT_MTEXT;
static nsHtml5ElementName* ELT_NOSCRIPT;
static nsHtml5ElementName* ELT_RT;
static nsHtml5ElementName* ELT_OBJECT;
static nsHtml5ElementName* ELT_OUTPUT;
static nsHtml5ElementName* ELT_PLAINTEXT;
static nsHtml5ElementName* ELT_TT;
static nsHtml5ElementName* ELT_RECT;
static nsHtml5ElementName* ELT_RADIALGRADIENT;
static nsHtml5ElementName* ELT_SELECT;
static nsHtml5ElementName* ELT_SLOT;
static nsHtml5ElementName* ELT_SCRIPT;
static nsHtml5ElementName* ELT_TFOOT;
static nsHtml5ElementName* ELT_TEXT;
static nsHtml5ElementName* ELT_MENU;
static nsHtml5ElementName* ELT_FEDROPSHADOW;
static nsHtml5ElementName* ELT_VIEW;
static nsHtml5ElementName* ELT_FECOLORMATRIX;
static nsHtml5ElementName* ELT_FECONVOLVEMATRIX;
static nsHtml5ElementName* ELT_BODY;
static nsHtml5ElementName* ELT_FEMORPHOLOGY;
static nsHtml5ElementName* ELT_RUBY;
static nsHtml5ElementName* ELT_SUMMARY;
static nsHtml5ElementName* ELT_TBODY;
inline bool isCustom() { return this->htmlCreator == NS_NewCustomElement; }
private:
static nsHtml5ElementName** ELEMENT_NAMES;
static staticJArray<int32_t, int32_t> ELEMENT_HASHES;
static nsHtml5ElementName* ELT_ANNOTATION_XML;
static nsHtml5ElementName* ELT_BIG;
static nsHtml5ElementName* ELT_BDO;
static nsHtml5ElementName* ELT_COL;
static nsHtml5ElementName* ELT_DEL;
static nsHtml5ElementName* ELT_DFN;
static nsHtml5ElementName* ELT_DIR;
static nsHtml5ElementName* ELT_DIV;
static nsHtml5ElementName* ELT_IMG;
static nsHtml5ElementName* ELT_INS;
static nsHtml5ElementName* ELT_KBD;
static nsHtml5ElementName* ELT_MAP;
static nsHtml5ElementName* ELT_NAV;
static nsHtml5ElementName* ELT_PRE;
static nsHtml5ElementName* ELT_A;
static nsHtml5ElementName* ELT_B;
static nsHtml5ElementName* ELT_RTC;
static nsHtml5ElementName* ELT_SUB;
static nsHtml5ElementName* ELT_SVG;
static nsHtml5ElementName* ELT_SUP;
static nsHtml5ElementName* ELT_SET;
static nsHtml5ElementName* ELT_USE;
static nsHtml5ElementName* ELT_VAR;
static nsHtml5ElementName* ELT_G;
static nsHtml5ElementName* ELT_WBR;
static nsHtml5ElementName* ELT_XMP;
static nsHtml5ElementName* ELT_I;
static nsHtml5ElementName* ELT_P;
static nsHtml5ElementName* ELT_Q;
static nsHtml5ElementName* ELT_S;
static nsHtml5ElementName* ELT_U;
static nsHtml5ElementName* ELT_H1;
static nsHtml5ElementName* ELT_H2;
static nsHtml5ElementName* ELT_H3;
static nsHtml5ElementName* ELT_H4;
static nsHtml5ElementName* ELT_H5;
static nsHtml5ElementName* ELT_H6;
static nsHtml5ElementName* ELT_AREA;
static nsHtml5ElementName* ELT_DATA;
static nsHtml5ElementName* ELT_FEFUNCA;
static nsHtml5ElementName* ELT_METADATA;
static nsHtml5ElementName* ELT_META;
static nsHtml5ElementName* ELT_TEXTAREA;
static nsHtml5ElementName* ELT_FEFUNCB;
static nsHtml5ElementName* ELT_RB;
static nsHtml5ElementName* ELT_DESC;
static nsHtml5ElementName* ELT_DD;
static nsHtml5ElementName* ELT_BGSOUND;
static nsHtml5ElementName* ELT_EMBED;
static nsHtml5ElementName* ELT_FEBLEND;
static nsHtml5ElementName* ELT_FEFLOOD;
static nsHtml5ElementName* ELT_HEAD;
static nsHtml5ElementName* ELT_LEGEND;
static nsHtml5ElementName* ELT_NOEMBED;
static nsHtml5ElementName* ELT_TD;
static nsHtml5ElementName* ELT_THEAD;
static nsHtml5ElementName* ELT_ASIDE;
static nsHtml5ElementName* ELT_ARTICLE;
static nsHtml5ElementName* ELT_ANIMATE;
static nsHtml5ElementName* ELT_BASE;
static nsHtml5ElementName* ELT_BLOCKQUOTE;
static nsHtml5ElementName* ELT_CODE;
static nsHtml5ElementName* ELT_CIRCLE;
static nsHtml5ElementName* ELT_CITE;
static nsHtml5ElementName* ELT_ELLIPSE;
static nsHtml5ElementName* ELT_FETURBULENCE;
static nsHtml5ElementName* ELT_FEMERGENODE;
static nsHtml5ElementName* ELT_FEIMAGE;
static nsHtml5ElementName* ELT_FEMERGE;
static nsHtml5ElementName* ELT_FETILE;
static nsHtml5ElementName* ELT_FRAME;
static nsHtml5ElementName* ELT_FIGURE;
static nsHtml5ElementName* ELT_FECOMPOSITE;
static nsHtml5ElementName* ELT_IMAGE;
static nsHtml5ElementName* ELT_IFRAME;
static nsHtml5ElementName* ELT_LINE;
static nsHtml5ElementName* ELT_MARQUEE;
static nsHtml5ElementName* ELT_POLYLINE;
static nsHtml5ElementName* ELT_PICTURE;
static nsHtml5ElementName* ELT_SOURCE;
static nsHtml5ElementName* ELT_STRIKE;
static nsHtml5ElementName* ELT_STYLE;
static nsHtml5ElementName* ELT_TABLE;
static nsHtml5ElementName* ELT_TITLE;
static nsHtml5ElementName* ELT_TIME;
static nsHtml5ElementName* ELT_TEMPLATE;
static nsHtml5ElementName* ELT_ALTGLYPHDEF;
static nsHtml5ElementName* ELT_GLYPHREF;
static nsHtml5ElementName* ELT_DIALOG;
static nsHtml5ElementName* ELT_FEFUNCG;
static nsHtml5ElementName* ELT_FEDIFFUSELIGHTING;
static nsHtml5ElementName* ELT_FESPECULARLIGHTING;
static nsHtml5ElementName* ELT_LISTING;
static nsHtml5ElementName* ELT_STRONG;
static nsHtml5ElementName* ELT_ALTGLYPH;
static nsHtml5ElementName* ELT_CLIPPATH;
static nsHtml5ElementName* ELT_MGLYPH;
static nsHtml5ElementName* ELT_MATH;
static nsHtml5ElementName* ELT_MPATH;
static nsHtml5ElementName* ELT_PATH;
static nsHtml5ElementName* ELT_TH;
static nsHtml5ElementName* ELT_SWITCH;
static nsHtml5ElementName* ELT_TEXTPATH;
static nsHtml5ElementName* ELT_LI;
static nsHtml5ElementName* ELT_MI;
static nsHtml5ElementName* ELT_LINK;
static nsHtml5ElementName* ELT_MARK;
static nsHtml5ElementName* ELT_MALIGNMARK;
static nsHtml5ElementName* ELT_MASK;
static nsHtml5ElementName* ELT_TRACK;
static nsHtml5ElementName* ELT_DL;
static nsHtml5ElementName* ELT_HTML;
static nsHtml5ElementName* ELT_OL;
static nsHtml5ElementName* ELT_LABEL;
static nsHtml5ElementName* ELT_UL;
static nsHtml5ElementName* ELT_SMALL;
static nsHtml5ElementName* ELT_SYMBOL;
static nsHtml5ElementName* ELT_ALTGLYPHITEM;
static nsHtml5ElementName* ELT_ANIMATETRANSFORM;
static nsHtml5ElementName* ELT_ACRONYM;
static nsHtml5ElementName* ELT_EM;
static nsHtml5ElementName* ELT_FORM;
static nsHtml5ElementName* ELT_MENUITEM;
static nsHtml5ElementName* ELT_PARAM;
static nsHtml5ElementName* ELT_ANIMATEMOTION;
static nsHtml5ElementName* ELT_BUTTON;
static nsHtml5ElementName* ELT_CAPTION;
static nsHtml5ElementName* ELT_FIGCAPTION;
static nsHtml5ElementName* ELT_MN;
static nsHtml5ElementName* ELT_KEYGEN;
static nsHtml5ElementName* ELT_MAIN;
static nsHtml5ElementName* ELT_OPTION;
static nsHtml5ElementName* ELT_POLYGON;
static nsHtml5ElementName* ELT_PATTERN;
static nsHtml5ElementName* ELT_SPAN;
static nsHtml5ElementName* ELT_SECTION;
static nsHtml5ElementName* ELT_TSPAN;
static nsHtml5ElementName* ELT_AUDIO;
static nsHtml5ElementName* ELT_MO;
static nsHtml5ElementName* ELT_VIDEO;
static nsHtml5ElementName* ELT_COLGROUP;
static nsHtml5ElementName* ELT_FEDISPLACEMENTMAP;
static nsHtml5ElementName* ELT_HGROUP;
static nsHtml5ElementName* ELT_RP;
static nsHtml5ElementName* ELT_OPTGROUP;
static nsHtml5ElementName* ELT_SAMP;
static nsHtml5ElementName* ELT_STOP;
static nsHtml5ElementName* ELT_BR;
static nsHtml5ElementName* ELT_ABBR;
static nsHtml5ElementName* ELT_ANIMATECOLOR;
static nsHtml5ElementName* ELT_CENTER;
static nsHtml5ElementName* ELT_HR;
static nsHtml5ElementName* ELT_FEFUNCR;
static nsHtml5ElementName* ELT_FECOMPONENTTRANSFER;
static nsHtml5ElementName* ELT_FILTER;
static nsHtml5ElementName* ELT_FOOTER;
static nsHtml5ElementName* ELT_FEGAUSSIANBLUR;
static nsHtml5ElementName* ELT_HEADER;
static nsHtml5ElementName* ELT_MARKER;
static nsHtml5ElementName* ELT_METER;
static nsHtml5ElementName* ELT_NOBR;
static nsHtml5ElementName* ELT_TR;
static nsHtml5ElementName* ELT_ADDRESS;
static nsHtml5ElementName* ELT_CANVAS;
static nsHtml5ElementName* ELT_DEFS;
static nsHtml5ElementName* ELT_DETAILS;
static nsHtml5ElementName* ELT_MS;
static nsHtml5ElementName* ELT_NOFRAMES;
static nsHtml5ElementName* ELT_PROGRESS;
static nsHtml5ElementName* ELT_DT;
static nsHtml5ElementName* ELT_APPLET;
static nsHtml5ElementName* ELT_BASEFONT;
static nsHtml5ElementName* ELT_DATALIST;
static nsHtml5ElementName* ELT_FOREIGNOBJECT;
static nsHtml5ElementName* ELT_FIELDSET;
static nsHtml5ElementName* ELT_FRAMESET;
static nsHtml5ElementName* ELT_FEOFFSET;
static nsHtml5ElementName* ELT_FESPOTLIGHT;
static nsHtml5ElementName* ELT_FEPOINTLIGHT;
static nsHtml5ElementName* ELT_FEDISTANTLIGHT;
static nsHtml5ElementName* ELT_FONT;
static nsHtml5ElementName* ELT_INPUT;
static nsHtml5ElementName* ELT_LINEARGRADIENT;
static nsHtml5ElementName* ELT_MTEXT;
static nsHtml5ElementName* ELT_NOSCRIPT;
static nsHtml5ElementName* ELT_RT;
static nsHtml5ElementName* ELT_OBJECT;
static nsHtml5ElementName* ELT_OUTPUT;
static nsHtml5ElementName* ELT_PLAINTEXT;
static nsHtml5ElementName* ELT_TT;
static nsHtml5ElementName* ELT_RECT;
static nsHtml5ElementName* ELT_RADIALGRADIENT;
static nsHtml5ElementName* ELT_SELECT;
static nsHtml5ElementName* ELT_SLOT;
static nsHtml5ElementName* ELT_SCRIPT;
static nsHtml5ElementName* ELT_TFOOT;
static nsHtml5ElementName* ELT_TEXT;
static nsHtml5ElementName* ELT_MENU;
static nsHtml5ElementName* ELT_FEDROPSHADOW;
static nsHtml5ElementName* ELT_VIEW;
static nsHtml5ElementName* ELT_FECOLORMATRIX;
static nsHtml5ElementName* ELT_FECONVOLVEMATRIX;
static nsHtml5ElementName* ELT_BODY;
static nsHtml5ElementName* ELT_FEMORPHOLOGY;
static nsHtml5ElementName* ELT_RUBY;
static nsHtml5ElementName* ELT_SUMMARY;
static nsHtml5ElementName* ELT_TBODY;
private:
static nsHtml5ElementName** ELEMENT_NAMES;
static staticJArray<int32_t,int32_t> ELEMENT_HASHES;
public:
static void initializeStatics();
static void releaseStatics();
public:
static void initializeStatics();
static void releaseStatics();
};
#endif

Просмотреть файл

@ -56,13 +56,27 @@
#include "nsHtml5MetaScanner.h"
static char16_t const CHARSET_DATA[] = { 'h', 'a', 'r', 's', 'e', 't' };
staticJArray<char16_t,int32_t> nsHtml5MetaScanner::CHARSET = { CHARSET_DATA, MOZ_ARRAY_LENGTH(CHARSET_DATA) };
staticJArray<char16_t, int32_t> nsHtml5MetaScanner::CHARSET = {
CHARSET_DATA,
MOZ_ARRAY_LENGTH(CHARSET_DATA)
};
static char16_t const CONTENT_DATA[] = { 'o', 'n', 't', 'e', 'n', 't' };
staticJArray<char16_t,int32_t> nsHtml5MetaScanner::CONTENT = { CONTENT_DATA, MOZ_ARRAY_LENGTH(CONTENT_DATA) };
static char16_t const HTTP_EQUIV_DATA[] = { 't', 't', 'p', '-', 'e', 'q', 'u', 'i', 'v' };
staticJArray<char16_t,int32_t> nsHtml5MetaScanner::HTTP_EQUIV = { HTTP_EQUIV_DATA, MOZ_ARRAY_LENGTH(HTTP_EQUIV_DATA) };
static char16_t const CONTENT_TYPE_DATA[] = { 'c', 'o', 'n', 't', 'e', 'n', 't', '-', 't', 'y', 'p', 'e' };
staticJArray<char16_t,int32_t> nsHtml5MetaScanner::CONTENT_TYPE = { CONTENT_TYPE_DATA, MOZ_ARRAY_LENGTH(CONTENT_TYPE_DATA) };
staticJArray<char16_t, int32_t> nsHtml5MetaScanner::CONTENT = {
CONTENT_DATA,
MOZ_ARRAY_LENGTH(CONTENT_DATA)
};
static char16_t const HTTP_EQUIV_DATA[] = { 't', 't', 'p', '-', 'e',
'q', 'u', 'i', 'v' };
staticJArray<char16_t, int32_t> nsHtml5MetaScanner::HTTP_EQUIV = {
HTTP_EQUIV_DATA,
MOZ_ARRAY_LENGTH(HTTP_EQUIV_DATA)
};
static char16_t const CONTENT_TYPE_DATA[] = { 'c', 'o', 'n', 't', 'e', 'n',
't', '-', 't', 'y', 'p', 'e' };
staticJArray<char16_t, int32_t> nsHtml5MetaScanner::CONTENT_TYPE = {
CONTENT_TYPE_DATA,
MOZ_ARRAY_LENGTH(CONTENT_TYPE_DATA)
};
nsHtml5MetaScanner::nsHtml5MetaScanner(nsHtml5TreeBuilder* tb)
: readable(nullptr)
@ -83,7 +97,6 @@ nsHtml5MetaScanner::nsHtml5MetaScanner(nsHtml5TreeBuilder* tb)
MOZ_COUNT_CTOR(nsHtml5MetaScanner);
}
nsHtml5MetaScanner::~nsHtml5MetaScanner()
{
MOZ_COUNT_DTOR(nsHtml5MetaScanner);
@ -91,21 +104,22 @@ nsHtml5MetaScanner::~nsHtml5MetaScanner()
charset.Release();
}
void
void
nsHtml5MetaScanner::stateLoop(int32_t state)
{
int32_t c = -1;
bool reconsume = false;
stateloop: for (; ; ) {
switch(state) {
stateloop:
for (;;) {
switch (state) {
case DATA: {
for (; ; ) {
for (;;) {
if (reconsume) {
reconsume = false;
} else {
c = read();
}
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -118,12 +132,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
dataloop_end: ;
dataloop_end:;
MOZ_FALLTHROUGH;
}
case TAG_OPEN: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -158,12 +173,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
tagopenloop_end: ;
tagopenloop_end:;
MOZ_FALLTHROUGH;
}
case TAG_NAME: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -215,16 +231,17 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
tagnameloop_end: ;
tagnameloop_end:;
MOZ_FALLTHROUGH;
}
case BEFORE_ATTRIBUTE_NAME: {
for (; ; ) {
for (;;) {
if (reconsume) {
reconsume = false;
} else {
c = read();
}
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -273,12 +290,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
beforeattributenameloop_end: ;
beforeattributenameloop_end:;
MOZ_FALLTHROUGH;
}
case ATTRIBUTE_NAME: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -311,17 +329,20 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
if (c >= 'A' && c <= 'Z') {
c += 0x20;
}
if (contentIndex < CONTENT.length && c == CONTENT[contentIndex]) {
if (contentIndex < CONTENT.length &&
c == CONTENT[contentIndex]) {
++contentIndex;
} else {
contentIndex = INT32_MAX;
}
if (charsetIndex < CHARSET.length && c == CHARSET[charsetIndex]) {
if (charsetIndex < CHARSET.length &&
c == CHARSET[charsetIndex]) {
++charsetIndex;
} else {
charsetIndex = INT32_MAX;
}
if (httpEquivIndex < HTTP_EQUIV.length && c == HTTP_EQUIV[httpEquivIndex]) {
if (httpEquivIndex < HTTP_EQUIV.length &&
c == HTTP_EQUIV[httpEquivIndex]) {
++httpEquivIndex;
} else {
httpEquivIndex = INT32_MAX;
@ -331,12 +352,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
attributenameloop_end: ;
attributenameloop_end:;
MOZ_FALLTHROUGH;
}
case BEFORE_ATTRIBUTE_VALUE: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -368,16 +390,17 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
beforeattributevalueloop_end: ;
beforeattributevalueloop_end:;
MOZ_FALLTHROUGH;
}
case ATTRIBUTE_VALUE_DOUBLE_QUOTED: {
for (; ; ) {
for (;;) {
if (reconsume) {
reconsume = false;
} else {
c = read();
}
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -392,12 +415,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
attributevaluedoublequotedloop_end: ;
attributevaluedoublequotedloop_end:;
MOZ_FALLTHROUGH;
}
case AFTER_ATTRIBUTE_VALUE_QUOTED: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -426,11 +450,12 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
afterattributevaluequotedloop_end: ;
afterattributevaluequotedloop_end:;
MOZ_FALLTHROUGH;
}
case SELF_CLOSING_START_TAG: {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -449,13 +474,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
case ATTRIBUTE_VALUE_UNQUOTED: {
for (; ; ) {
for (;;) {
if (reconsume) {
reconsume = false;
} else {
c = read();
}
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -483,9 +508,9 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
case AFTER_ATTRIBUTE_NAME: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -531,9 +556,9 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
case MARKUP_DECLARATION_OPEN: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -548,12 +573,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
markupdeclarationopenloop_end: ;
markupdeclarationopenloop_end:;
MOZ_FALLTHROUGH;
}
case MARKUP_DECLARATION_HYPHEN: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -568,12 +594,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
markupdeclarationhyphenloop_end: ;
markupdeclarationhyphenloop_end:;
MOZ_FALLTHROUGH;
}
case COMMENT_START: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -591,12 +618,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
commentstartloop_end: ;
commentstartloop_end:;
MOZ_FALLTHROUGH;
}
case COMMENT: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -609,12 +637,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
commentloop_end: ;
commentloop_end:;
MOZ_FALLTHROUGH;
}
case COMMENT_END_DASH: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -628,12 +657,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
commentenddashloop_end: ;
commentenddashloop_end:;
MOZ_FALLTHROUGH;
}
case COMMENT_END: {
for (; ; ) {
for (;;) {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -653,7 +683,7 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
case COMMENT_START_DASH: {
c = read();
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -672,13 +702,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
case ATTRIBUTE_VALUE_SINGLE_QUOTED: {
for (; ; ) {
for (;;) {
if (reconsume) {
reconsume = false;
} else {
c = read();
}
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -695,13 +725,13 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
case SCAN_UNTIL_GT: {
for (; ; ) {
for (;;) {
if (reconsume) {
reconsume = false;
} else {
c = read();
}
switch(c) {
switch (c) {
case -1: {
NS_HTML5_BREAK(stateloop);
}
@ -717,18 +747,19 @@ nsHtml5MetaScanner::stateLoop(int32_t state)
}
}
}
stateloop_end: ;
stateloop_end:;
stateSave = state;
}
void
void
nsHtml5MetaScanner::handleCharInAttributeValue(int32_t c)
{
if (metaState == A) {
if (contentIndex == CONTENT.length || charsetIndex == CHARSET.length) {
addToBuffer(c);
} else if (httpEquivIndex == HTTP_EQUIV.length) {
if (contentTypeIndex < CONTENT_TYPE.length && toAsciiLowerCase(c) == CONTENT_TYPE[contentTypeIndex]) {
if (contentTypeIndex < CONTENT_TYPE.length &&
toAsciiLowerCase(c) == CONTENT_TYPE[contentTypeIndex]) {
++contentTypeIndex;
} else {
contentTypeIndex = INT32_MAX;
@ -737,18 +768,19 @@ nsHtml5MetaScanner::handleCharInAttributeValue(int32_t c)
}
}
void
void
nsHtml5MetaScanner::addToBuffer(int32_t c)
{
if (strBufLen == strBuf.length) {
jArray<char16_t,int32_t> newBuf = jArray<char16_t,int32_t>::newJArray(strBuf.length + (strBuf.length << 1));
jArray<char16_t, int32_t> newBuf = jArray<char16_t, int32_t>::newJArray(
strBuf.length + (strBuf.length << 1));
nsHtml5ArrayCopy::arraycopy(strBuf, newBuf, strBuf.length);
strBuf = newBuf;
}
strBuf[strBufLen++] = (char16_t) c;
strBuf[strBufLen++] = (char16_t)c;
}
void
void
nsHtml5MetaScanner::handleAttributeValue()
{
if (metaState != A) {
@ -773,7 +805,7 @@ nsHtml5MetaScanner::handleAttributeValue()
}
}
bool
bool
nsHtml5MetaScanner::handleTag()
{
bool stop = handleTagInner();
@ -785,7 +817,7 @@ nsHtml5MetaScanner::handleTag()
return stop;
}
bool
bool
nsHtml5MetaScanner::handleTagInner()
{
if (!!charset && tryCharset(charset)) {
@ -814,6 +846,4 @@ nsHtml5MetaScanner::releaseStatics()
{
}
#include "nsHtml5MetaScannerCppSupplement.h"

Просмотреть файл

@ -55,114 +55,120 @@ class nsHtml5UTF16Buffer;
class nsHtml5StateSnapshot;
class nsHtml5Portability;
class nsHtml5MetaScanner
{
private:
static staticJArray<char16_t,int32_t> CHARSET;
static staticJArray<char16_t,int32_t> CONTENT;
static staticJArray<char16_t,int32_t> HTTP_EQUIV;
static staticJArray<char16_t,int32_t> CONTENT_TYPE;
static const int32_t NO = 0;
private:
static staticJArray<char16_t, int32_t> CHARSET;
static staticJArray<char16_t, int32_t> CONTENT;
static staticJArray<char16_t, int32_t> HTTP_EQUIV;
static staticJArray<char16_t, int32_t> CONTENT_TYPE;
static const int32_t NO = 0;
static const int32_t M = 1;
static const int32_t M = 1;
static const int32_t E = 2;
static const int32_t E = 2;
static const int32_t T = 3;
static const int32_t T = 3;
static const int32_t A = 4;
static const int32_t A = 4;
static const int32_t DATA = 0;
static const int32_t DATA = 0;
static const int32_t TAG_OPEN = 1;
static const int32_t TAG_OPEN = 1;
static const int32_t SCAN_UNTIL_GT = 2;
static const int32_t SCAN_UNTIL_GT = 2;
static const int32_t TAG_NAME = 3;
static const int32_t TAG_NAME = 3;
static const int32_t BEFORE_ATTRIBUTE_NAME = 4;
static const int32_t BEFORE_ATTRIBUTE_NAME = 4;
static const int32_t ATTRIBUTE_NAME = 5;
static const int32_t ATTRIBUTE_NAME = 5;
static const int32_t AFTER_ATTRIBUTE_NAME = 6;
static const int32_t AFTER_ATTRIBUTE_NAME = 6;
static const int32_t BEFORE_ATTRIBUTE_VALUE = 7;
static const int32_t BEFORE_ATTRIBUTE_VALUE = 7;
static const int32_t ATTRIBUTE_VALUE_DOUBLE_QUOTED = 8;
static const int32_t ATTRIBUTE_VALUE_DOUBLE_QUOTED = 8;
static const int32_t ATTRIBUTE_VALUE_SINGLE_QUOTED = 9;
static const int32_t ATTRIBUTE_VALUE_SINGLE_QUOTED = 9;
static const int32_t ATTRIBUTE_VALUE_UNQUOTED = 10;
static const int32_t ATTRIBUTE_VALUE_UNQUOTED = 10;
static const int32_t AFTER_ATTRIBUTE_VALUE_QUOTED = 11;
static const int32_t AFTER_ATTRIBUTE_VALUE_QUOTED = 11;
static const int32_t MARKUP_DECLARATION_OPEN = 13;
static const int32_t MARKUP_DECLARATION_OPEN = 13;
static const int32_t MARKUP_DECLARATION_HYPHEN = 14;
static const int32_t MARKUP_DECLARATION_HYPHEN = 14;
static const int32_t COMMENT_START = 15;
static const int32_t COMMENT_START = 15;
static const int32_t COMMENT_START_DASH = 16;
static const int32_t COMMENT_START_DASH = 16;
static const int32_t COMMENT = 17;
static const int32_t COMMENT = 17;
static const int32_t COMMENT_END_DASH = 18;
static const int32_t COMMENT_END_DASH = 18;
static const int32_t COMMENT_END = 19;
static const int32_t COMMENT_END = 19;
static const int32_t SELF_CLOSING_START_TAG = 20;
static const int32_t SELF_CLOSING_START_TAG = 20;
static const int32_t HTTP_EQUIV_NOT_SEEN = 0;
static const int32_t HTTP_EQUIV_NOT_SEEN = 0;
static const int32_t HTTP_EQUIV_CONTENT_TYPE = 1;
static const int32_t HTTP_EQUIV_CONTENT_TYPE = 1;
static const int32_t HTTP_EQUIV_OTHER = 2;
static const int32_t HTTP_EQUIV_OTHER = 2;
protected:
nsHtml5ByteReadable* readable;
private:
int32_t metaState;
int32_t contentIndex;
int32_t charsetIndex;
int32_t httpEquivIndex;
int32_t contentTypeIndex;
protected:
int32_t stateSave;
private:
int32_t strBufLen;
autoJArray<char16_t,int32_t> strBuf;
nsHtml5String content;
nsHtml5String charset;
int32_t httpEquivState;
nsHtml5TreeBuilder* treeBuilder;
public:
explicit nsHtml5MetaScanner(nsHtml5TreeBuilder* tb);
~nsHtml5MetaScanner();
protected:
void stateLoop(int32_t state);
private:
void handleCharInAttributeValue(int32_t c);
inline int32_t toAsciiLowerCase(int32_t c)
{
if (c >= 'A' && c <= 'Z') {
return c + 0x20;
}
return c;
protected:
nsHtml5ByteReadable* readable;
private:
int32_t metaState;
int32_t contentIndex;
int32_t charsetIndex;
int32_t httpEquivIndex;
int32_t contentTypeIndex;
protected:
int32_t stateSave;
private:
int32_t strBufLen;
autoJArray<char16_t, int32_t> strBuf;
nsHtml5String content;
nsHtml5String charset;
int32_t httpEquivState;
nsHtml5TreeBuilder* treeBuilder;
public:
explicit nsHtml5MetaScanner(nsHtml5TreeBuilder* tb);
~nsHtml5MetaScanner();
protected:
void stateLoop(int32_t state);
private:
void handleCharInAttributeValue(int32_t c);
inline int32_t toAsciiLowerCase(int32_t c)
{
if (c >= 'A' && c <= 'Z') {
return c + 0x20;
}
return c;
}
void addToBuffer(int32_t c);
void handleAttributeValue();
bool handleTag();
bool handleTagInner();
protected:
bool tryCharset(nsHtml5String encoding);
public:
static void initializeStatics();
static void releaseStatics();
void addToBuffer(int32_t c);
void handleAttributeValue();
bool handleTag();
bool handleTagInner();
protected:
bool tryCharset(nsHtml5String encoding);
public:
static void initializeStatics();
static void releaseStatics();
#include "nsHtml5MetaScannerHSupplement.h"
};
#endif

Просмотреть файл

@ -1,12 +1,12 @@
/* 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 "nsISupportsImpl.h"
#include "mozilla/Encoding.h"
const Encoding*
const mozilla::Encoding*
nsHtml5MetaScanner::sniff(nsHtml5ByteReadable* bytes)
{
readable = bytes;
@ -25,7 +25,7 @@ nsHtml5MetaScanner::tryCharset(nsHtml5String charset)
nsString charset16; // Not Auto, because using it to hold nsStringBuffer*
charset.ToString(charset16);
CopyUTF16toUTF8(charset16, label);
const Encoding* encoding = Encoding::ForLabel(label);
const mozilla::Encoding* encoding = Encoding::ForLabel(label);
if (!encoding) {
return false;
}

Просмотреть файл

@ -4,6 +4,10 @@
#include "nsHtml5OwningUTF16Buffer.h"
#include "mozilla/Span.h"
using namespace mozilla;
nsHtml5OwningUTF16Buffer::nsHtml5OwningUTF16Buffer(char16_t* aBuffer)
: nsHtml5UTF16Buffer(aBuffer, 0),
next(nullptr),

Просмотреть файл

@ -53,35 +53,34 @@ class nsHtml5MetaScanner;
class nsHtml5UTF16Buffer;
class nsHtml5StateSnapshot;
class nsHtml5Portability
{
public:
static nsAtom* newLocalNameFromBuffer(char16_t* buf, int32_t length, nsHtml5AtomTable* interner);
static nsHtml5String newStringFromBuffer(char16_t* buf,
int32_t offset,
int32_t length,
nsHtml5TreeBuilder* treeBuilder,
bool maybeAtomize);
static nsHtml5String newEmptyString();
static nsHtml5String newStringFromLiteral(const char* literal);
static nsHtml5String newStringFromString(nsHtml5String string);
static jArray<char16_t,int32_t> newCharArrayFromLocal(nsAtom* local);
static jArray<char16_t, int32_t> newCharArrayFromString(
nsHtml5String string);
static nsAtom* newLocalFromLocal(nsAtom* local, nsHtml5AtomTable* interner);
static bool localEqualsBuffer(nsAtom* local, char16_t* buf, int32_t length);
static bool lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(
const char* lowerCaseLiteral,
nsHtml5String string);
static bool lowerCaseLiteralEqualsIgnoreAsciiCaseString(
const char* lowerCaseLiteral,
nsHtml5String string);
static bool literalEqualsString(const char* literal, nsHtml5String string);
static bool stringEqualsString(nsHtml5String one, nsHtml5String other);
static void initializeStatics();
static void releaseStatics();
public:
static nsAtom* newLocalNameFromBuffer(char16_t* buf,
int32_t length,
nsHtml5AtomTable* interner);
static nsHtml5String newStringFromBuffer(char16_t* buf,
int32_t offset,
int32_t length,
nsHtml5TreeBuilder* treeBuilder,
bool maybeAtomize);
static nsHtml5String newEmptyString();
static nsHtml5String newStringFromLiteral(const char* literal);
static nsHtml5String newStringFromString(nsHtml5String string);
static jArray<char16_t, int32_t> newCharArrayFromLocal(nsAtom* local);
static jArray<char16_t, int32_t> newCharArrayFromString(nsHtml5String string);
static nsAtom* newLocalFromLocal(nsAtom* local, nsHtml5AtomTable* interner);
static bool localEqualsBuffer(nsAtom* local, char16_t* buf, int32_t length);
static bool lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(
const char* lowerCaseLiteral,
nsHtml5String string);
static bool lowerCaseLiteralEqualsIgnoreAsciiCaseString(
const char* lowerCaseLiteral,
nsHtml5String string);
static bool literalEqualsString(const char* literal, nsHtml5String string);
static bool stringEqualsString(nsHtml5String one, nsHtml5String other);
static void initializeStatics();
static void releaseStatics();
};
#endif

Просмотреть файл

@ -6,6 +6,8 @@
#include "nsHtml5TreeOpExecutor.h"
#include "mozilla/Encoding.h"
using namespace mozilla;
nsHtml5SpeculativeLoad::nsHtml5SpeculativeLoad()
:
#ifdef DEBUG

Просмотреть файл

@ -1,12 +1,14 @@
/* 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/. */
#ifndef nsHtml5SpeculativeLoad_h
#define nsHtml5SpeculativeLoad_h
#include "nsString.h"
#include "nsContentUtils.h"
#include "nsHtml5DocumentMode.h"
#include "nsHtml5String.h"
class nsHtml5TreeOpExecutor;

Просмотреть файл

@ -55,31 +55,31 @@
#include "nsHtml5StackNode.h"
int32_t
int32_t
nsHtml5StackNode::getGroup()
{
return flags & nsHtml5ElementName::GROUP_MASK;
}
bool
bool
nsHtml5StackNode::isScoping()
{
return (flags & nsHtml5ElementName::SCOPING);
}
bool
bool
nsHtml5StackNode::isSpecial()
{
return (flags & nsHtml5ElementName::SPECIAL);
}
bool
bool
nsHtml5StackNode::isFosterParenting()
{
return (flags & nsHtml5ElementName::FOSTER_PARENTING);
}
bool
bool
nsHtml5StackNode::isHtmlIntegrationPoint()
{
return (flags & nsHtml5ElementName::HTML_INTEGRATION_POINT);
@ -204,7 +204,7 @@ nsHtml5StackNode::setValues(nsHtml5ElementName* elementName,
this->htmlCreator = nullptr;
}
int32_t
int32_t
nsHtml5StackNode::prepareSvgFlags(int32_t flags)
{
flags &=
@ -217,7 +217,7 @@ nsHtml5StackNode::prepareSvgFlags(int32_t flags)
return flags;
}
int32_t
int32_t
nsHtml5StackNode::prepareMathFlags(int32_t flags, bool markAsIntegrationPoint)
{
flags &=
@ -232,19 +232,18 @@ nsHtml5StackNode::prepareMathFlags(int32_t flags, bool markAsIntegrationPoint)
return flags;
}
nsHtml5StackNode::~nsHtml5StackNode()
{
MOZ_COUNT_DTOR(nsHtml5StackNode);
}
void
void
nsHtml5StackNode::dropAttributes()
{
attributes = nullptr;
}
void
void
nsHtml5StackNode::retain()
{
refcount++;
@ -281,5 +280,3 @@ void
nsHtml5StackNode::releaseStatics()
{
}

Просмотреть файл

@ -56,67 +56,65 @@ class nsHtml5UTF16Buffer;
class nsHtml5StateSnapshot;
class nsHtml5Portability;
class nsHtml5StackNode
{
public:
int32_t idxInTreeBuilder;
int32_t flags;
nsAtom* name;
nsAtom* popName;
int32_t ns;
nsIContentHandle* node;
nsHtml5HtmlAttributes* attributes;
private:
int32_t refcount;
mozilla::dom::HTMLContentCreatorFunction htmlCreator;
public:
inline int32_t getFlags()
{
return flags;
}
public:
int32_t idxInTreeBuilder;
int32_t flags;
nsAtom* name;
nsAtom* popName;
int32_t ns;
nsIContentHandle* node;
nsHtml5HtmlAttributes* attributes;
int32_t getGroup();
bool isScoping();
bool isSpecial();
bool isFosterParenting();
bool isHtmlIntegrationPoint();
explicit nsHtml5StackNode(int32_t idxInTreeBuilder);
mozilla::dom::HTMLContentCreatorFunction getHtmlCreator();
void setValues(int32_t flags,
int32_t ns,
nsAtom* name,
nsIContentHandle* node,
nsAtom* popName,
nsHtml5HtmlAttributes* attributes,
mozilla::dom::HTMLContentCreatorFunction htmlCreator);
void setValues(nsHtml5ElementName* elementName, nsIContentHandle* node);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsHtml5HtmlAttributes* attributes);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName);
void setValues(nsHtml5ElementName* elementName,
nsAtom* popName,
nsIContentHandle* node);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName,
bool markAsIntegrationPoint);
private:
int32_t refcount;
mozilla::dom::HTMLContentCreatorFunction htmlCreator;
private:
static int32_t prepareSvgFlags(int32_t flags);
static int32_t prepareMathFlags(int32_t flags, bool markAsIntegrationPoint);
public:
~nsHtml5StackNode();
void dropAttributes();
void retain();
void release(nsHtml5TreeBuilder* owningTreeBuilder);
bool isUnused();
static void initializeStatics();
static void releaseStatics();
public:
inline int32_t getFlags() { return flags; }
int32_t getGroup();
bool isScoping();
bool isSpecial();
bool isFosterParenting();
bool isHtmlIntegrationPoint();
explicit nsHtml5StackNode(int32_t idxInTreeBuilder);
mozilla::dom::HTMLContentCreatorFunction getHtmlCreator();
void setValues(int32_t flags,
int32_t ns,
nsAtom* name,
nsIContentHandle* node,
nsAtom* popName,
nsHtml5HtmlAttributes* attributes,
mozilla::dom::HTMLContentCreatorFunction htmlCreator);
void setValues(nsHtml5ElementName* elementName, nsIContentHandle* node);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsHtml5HtmlAttributes* attributes);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName);
void setValues(nsHtml5ElementName* elementName,
nsAtom* popName,
nsIContentHandle* node);
void setValues(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName,
bool markAsIntegrationPoint);
private:
static int32_t prepareSvgFlags(int32_t flags);
static int32_t prepareMathFlags(int32_t flags, bool markAsIntegrationPoint);
public:
~nsHtml5StackNode();
void dropAttributes();
void retain();
void release(nsHtml5TreeBuilder* owningTreeBuilder);
bool isUnused();
static void initializeStatics();
static void releaseStatics();
};
#endif

Просмотреть файл

@ -1,22 +1,22 @@
/*
* Copyright (c) 2009-2010 Mozilla Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
@ -54,108 +54,117 @@
#include "nsHtml5StateSnapshot.h"
nsHtml5StateSnapshot::nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,int32_t> stack, jArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements, jArray<int32_t,int32_t> templateModeStack, nsIContentHandle* formPointer, nsIContentHandle* headPointer, nsIContentHandle* deepTreeSurrogateParent, int32_t mode, int32_t originalMode, bool framesetOk, bool needToDropLF, bool quirks)
: stack(stack),
listOfActiveFormattingElements(listOfActiveFormattingElements),
templateModeStack(templateModeStack),
formPointer(formPointer),
headPointer(headPointer),
deepTreeSurrogateParent(deepTreeSurrogateParent),
mode(mode),
originalMode(originalMode),
framesetOk(framesetOk),
needToDropLF(needToDropLF),
quirks(quirks)
nsHtml5StateSnapshot::nsHtml5StateSnapshot(
jArray<nsHtml5StackNode*, int32_t> stack,
jArray<nsHtml5StackNode*, int32_t> listOfActiveFormattingElements,
jArray<int32_t, int32_t> templateModeStack,
nsIContentHandle* formPointer,
nsIContentHandle* headPointer,
nsIContentHandle* deepTreeSurrogateParent,
int32_t mode,
int32_t originalMode,
bool framesetOk,
bool needToDropLF,
bool quirks)
: stack(stack)
, listOfActiveFormattingElements(listOfActiveFormattingElements)
, templateModeStack(templateModeStack)
, formPointer(formPointer)
, headPointer(headPointer)
, deepTreeSurrogateParent(deepTreeSurrogateParent)
, mode(mode)
, originalMode(originalMode)
, framesetOk(framesetOk)
, needToDropLF(needToDropLF)
, quirks(quirks)
{
MOZ_COUNT_CTOR(nsHtml5StateSnapshot);
}
jArray<nsHtml5StackNode*,int32_t>
jArray<nsHtml5StackNode*, int32_t>
nsHtml5StateSnapshot::getStack()
{
return stack;
}
jArray<int32_t,int32_t>
jArray<int32_t, int32_t>
nsHtml5StateSnapshot::getTemplateModeStack()
{
return templateModeStack;
}
jArray<nsHtml5StackNode*,int32_t>
jArray<nsHtml5StackNode*, int32_t>
nsHtml5StateSnapshot::getListOfActiveFormattingElements()
{
return listOfActiveFormattingElements;
}
nsIContentHandle*
nsIContentHandle*
nsHtml5StateSnapshot::getFormPointer()
{
return formPointer;
}
nsIContentHandle*
nsIContentHandle*
nsHtml5StateSnapshot::getHeadPointer()
{
return headPointer;
}
nsIContentHandle*
nsIContentHandle*
nsHtml5StateSnapshot::getDeepTreeSurrogateParent()
{
return deepTreeSurrogateParent;
}
int32_t
int32_t
nsHtml5StateSnapshot::getMode()
{
return mode;
}
int32_t
int32_t
nsHtml5StateSnapshot::getOriginalMode()
{
return originalMode;
}
bool
bool
nsHtml5StateSnapshot::isFramesetOk()
{
return framesetOk;
}
bool
bool
nsHtml5StateSnapshot::isNeedToDropLF()
{
return needToDropLF;
}
bool
bool
nsHtml5StateSnapshot::isQuirks()
{
return quirks;
}
int32_t
int32_t
nsHtml5StateSnapshot::getListOfActiveFormattingElementsLength()
{
return listOfActiveFormattingElements.length;
}
int32_t
int32_t
nsHtml5StateSnapshot::getStackLength()
{
return stack.length;
}
int32_t
int32_t
nsHtml5StateSnapshot::getTemplateModeStackLength()
{
return templateModeStack.length;
}
nsHtml5StateSnapshot::~nsHtml5StateSnapshot()
{
MOZ_COUNT_DTOR(nsHtml5StateSnapshot);
@ -178,5 +187,3 @@ void
nsHtml5StateSnapshot::releaseStatics()
{
}

Просмотреть файл

@ -1,22 +1,22 @@
/*
* Copyright (c) 2009-2010 Mozilla Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
@ -54,41 +54,52 @@ class nsHtml5MetaScanner;
class nsHtml5UTF16Buffer;
class nsHtml5Portability;
class nsHtml5StateSnapshot : public nsAHtml5TreeBuilderState
{
private:
autoJArray<nsHtml5StackNode*,int32_t> stack;
autoJArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements;
autoJArray<int32_t,int32_t> templateModeStack;
nsIContentHandle* formPointer;
nsIContentHandle* headPointer;
nsIContentHandle* deepTreeSurrogateParent;
int32_t mode;
int32_t originalMode;
bool framesetOk;
bool needToDropLF;
bool quirks;
public:
nsHtml5StateSnapshot(jArray<nsHtml5StackNode*,int32_t> stack, jArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements, jArray<int32_t,int32_t> templateModeStack, nsIContentHandle* formPointer, nsIContentHandle* headPointer, nsIContentHandle* deepTreeSurrogateParent, int32_t mode, int32_t originalMode, bool framesetOk, bool needToDropLF, bool quirks);
jArray<nsHtml5StackNode*,int32_t> getStack();
jArray<int32_t,int32_t> getTemplateModeStack();
jArray<nsHtml5StackNode*,int32_t> getListOfActiveFormattingElements();
nsIContentHandle* getFormPointer();
nsIContentHandle* getHeadPointer();
nsIContentHandle* getDeepTreeSurrogateParent();
int32_t getMode();
int32_t getOriginalMode();
bool isFramesetOk();
bool isNeedToDropLF();
bool isQuirks();
int32_t getListOfActiveFormattingElementsLength();
int32_t getStackLength();
int32_t getTemplateModeStackLength();
~nsHtml5StateSnapshot();
static void initializeStatics();
static void releaseStatics();
private:
autoJArray<nsHtml5StackNode*, int32_t> stack;
autoJArray<nsHtml5StackNode*, int32_t> listOfActiveFormattingElements;
autoJArray<int32_t, int32_t> templateModeStack;
nsIContentHandle* formPointer;
nsIContentHandle* headPointer;
nsIContentHandle* deepTreeSurrogateParent;
int32_t mode;
int32_t originalMode;
bool framesetOk;
bool needToDropLF;
bool quirks;
public:
nsHtml5StateSnapshot(
jArray<nsHtml5StackNode*, int32_t> stack,
jArray<nsHtml5StackNode*, int32_t> listOfActiveFormattingElements,
jArray<int32_t, int32_t> templateModeStack,
nsIContentHandle* formPointer,
nsIContentHandle* headPointer,
nsIContentHandle* deepTreeSurrogateParent,
int32_t mode,
int32_t originalMode,
bool framesetOk,
bool needToDropLF,
bool quirks);
jArray<nsHtml5StackNode*, int32_t> getStack() override;
jArray<int32_t, int32_t> getTemplateModeStack() override;
jArray<nsHtml5StackNode*, int32_t> getListOfActiveFormattingElements()
override;
nsIContentHandle* getFormPointer() override;
nsIContentHandle* getHeadPointer() override;
nsIContentHandle* getDeepTreeSurrogateParent() override;
int32_t getMode() override;
int32_t getOriginalMode() override;
bool isFramesetOk() override;
bool isNeedToDropLF() override;
bool isQuirks() override;
int32_t getListOfActiveFormattingElementsLength() override;
int32_t getStackLength() override;
int32_t getTemplateModeStackLength() override;
~nsHtml5StateSnapshot();
static void initializeStatics();
static void releaseStatics();
};
#endif

Просмотреть файл

@ -16,6 +16,7 @@
#include "nsHtml5AtomTable.h"
#include "nsHtml5Module.h"
#include "nsHtml5StreamParserPtr.h"
#include "nsIDocShell.h"
#include "nsIScriptError.h"
#include "mozilla/Preferences.h"
#include "mozilla/SystemGroup.h"

Просмотреть файл

@ -2,8 +2,11 @@
/* 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/. */
#ifndef nsHtml5StreamParserPtr_h
#define nsHtml5StreamParserPtr_h
#include "nsHtml5StreamParser.h"
#include "nsThreadUtils.h"
#include "mozilla/dom/DocGroup.h"
@ -24,6 +27,7 @@ public:
return NS_OK;
}
};
/**
* Like nsRefPtr except release is proxied to the main
* thread. Mostly copied from nsRefPtr.
@ -265,4 +269,5 @@ operator!=(decltype(nullptr), const nsHtml5StreamParserPtr& rhs)
{
return nullptr != rhs.get();
}
#endif // !defined(nsHtml5StreamParserPtr_h)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -57,410 +57,435 @@ class nsHtml5UTF16Buffer;
class nsHtml5StateSnapshot;
class nsHtml5Portability;
class nsHtml5Tokenizer
{
private:
static const int32_t DATA_AND_RCDATA_MASK = ~1;
private:
static const int32_t DATA_AND_RCDATA_MASK = ~1;
public:
static const int32_t DATA = 0;
public:
static const int32_t DATA = 0;
static const int32_t RCDATA = 1;
static const int32_t RCDATA = 1;
static const int32_t SCRIPT_DATA = 2;
static const int32_t SCRIPT_DATA = 2;
static const int32_t RAWTEXT = 3;
static const int32_t RAWTEXT = 3;
static const int32_t SCRIPT_DATA_ESCAPED = 4;
static const int32_t SCRIPT_DATA_ESCAPED = 4;
static const int32_t ATTRIBUTE_VALUE_DOUBLE_QUOTED = 5;
static const int32_t ATTRIBUTE_VALUE_DOUBLE_QUOTED = 5;
static const int32_t ATTRIBUTE_VALUE_SINGLE_QUOTED = 6;
static const int32_t ATTRIBUTE_VALUE_SINGLE_QUOTED = 6;
static const int32_t ATTRIBUTE_VALUE_UNQUOTED = 7;
static const int32_t ATTRIBUTE_VALUE_UNQUOTED = 7;
static const int32_t PLAINTEXT = 8;
static const int32_t PLAINTEXT = 8;
static const int32_t TAG_OPEN = 9;
static const int32_t TAG_OPEN = 9;
static const int32_t CLOSE_TAG_OPEN = 10;
static const int32_t CLOSE_TAG_OPEN = 10;
static const int32_t TAG_NAME = 11;
static const int32_t TAG_NAME = 11;
static const int32_t BEFORE_ATTRIBUTE_NAME = 12;
static const int32_t BEFORE_ATTRIBUTE_NAME = 12;
static const int32_t ATTRIBUTE_NAME = 13;
static const int32_t ATTRIBUTE_NAME = 13;
static const int32_t AFTER_ATTRIBUTE_NAME = 14;
static const int32_t AFTER_ATTRIBUTE_NAME = 14;
static const int32_t BEFORE_ATTRIBUTE_VALUE = 15;
static const int32_t BEFORE_ATTRIBUTE_VALUE = 15;
static const int32_t AFTER_ATTRIBUTE_VALUE_QUOTED = 16;
static const int32_t AFTER_ATTRIBUTE_VALUE_QUOTED = 16;
static const int32_t BOGUS_COMMENT = 17;
static const int32_t BOGUS_COMMENT = 17;
static const int32_t MARKUP_DECLARATION_OPEN = 18;
static const int32_t MARKUP_DECLARATION_OPEN = 18;
static const int32_t DOCTYPE = 19;
static const int32_t DOCTYPE = 19;
static const int32_t BEFORE_DOCTYPE_NAME = 20;
static const int32_t BEFORE_DOCTYPE_NAME = 20;
static const int32_t DOCTYPE_NAME = 21;
static const int32_t DOCTYPE_NAME = 21;
static const int32_t AFTER_DOCTYPE_NAME = 22;
static const int32_t AFTER_DOCTYPE_NAME = 22;
static const int32_t BEFORE_DOCTYPE_PUBLIC_IDENTIFIER = 23;
static const int32_t BEFORE_DOCTYPE_PUBLIC_IDENTIFIER = 23;
static const int32_t DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED = 24;
static const int32_t DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED = 24;
static const int32_t DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED = 25;
static const int32_t DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED = 25;
static const int32_t AFTER_DOCTYPE_PUBLIC_IDENTIFIER = 26;
static const int32_t AFTER_DOCTYPE_PUBLIC_IDENTIFIER = 26;
static const int32_t BEFORE_DOCTYPE_SYSTEM_IDENTIFIER = 27;
static const int32_t BEFORE_DOCTYPE_SYSTEM_IDENTIFIER = 27;
static const int32_t DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED = 28;
static const int32_t DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED = 28;
static const int32_t DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED = 29;
static const int32_t DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED = 29;
static const int32_t AFTER_DOCTYPE_SYSTEM_IDENTIFIER = 30;
static const int32_t AFTER_DOCTYPE_SYSTEM_IDENTIFIER = 30;
static const int32_t BOGUS_DOCTYPE = 31;
static const int32_t BOGUS_DOCTYPE = 31;
static const int32_t COMMENT_START = 32;
static const int32_t COMMENT_START = 32;
static const int32_t COMMENT_START_DASH = 33;
static const int32_t COMMENT_START_DASH = 33;
static const int32_t COMMENT = 34;
static const int32_t COMMENT = 34;
static const int32_t COMMENT_END_DASH = 35;
static const int32_t COMMENT_END_DASH = 35;
static const int32_t COMMENT_END = 36;
static const int32_t COMMENT_END = 36;
static const int32_t COMMENT_END_BANG = 37;
static const int32_t COMMENT_END_BANG = 37;
static const int32_t NON_DATA_END_TAG_NAME = 38;
static const int32_t NON_DATA_END_TAG_NAME = 38;
static const int32_t MARKUP_DECLARATION_HYPHEN = 39;
static const int32_t MARKUP_DECLARATION_HYPHEN = 39;
static const int32_t MARKUP_DECLARATION_OCTYPE = 40;
static const int32_t MARKUP_DECLARATION_OCTYPE = 40;
static const int32_t DOCTYPE_UBLIC = 41;
static const int32_t DOCTYPE_UBLIC = 41;
static const int32_t DOCTYPE_YSTEM = 42;
static const int32_t DOCTYPE_YSTEM = 42;
static const int32_t AFTER_DOCTYPE_PUBLIC_KEYWORD = 43;
static const int32_t AFTER_DOCTYPE_PUBLIC_KEYWORD = 43;
static const int32_t BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS = 44;
static const int32_t BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS = 44;
static const int32_t AFTER_DOCTYPE_SYSTEM_KEYWORD = 45;
static const int32_t AFTER_DOCTYPE_SYSTEM_KEYWORD = 45;
static const int32_t CONSUME_CHARACTER_REFERENCE = 46;
static const int32_t CONSUME_CHARACTER_REFERENCE = 46;
static const int32_t CONSUME_NCR = 47;
static const int32_t CONSUME_NCR = 47;
static const int32_t CHARACTER_REFERENCE_TAIL = 48;
static const int32_t CHARACTER_REFERENCE_TAIL = 48;
static const int32_t HEX_NCR_LOOP = 49;
static const int32_t HEX_NCR_LOOP = 49;
static const int32_t DECIMAL_NRC_LOOP = 50;
static const int32_t DECIMAL_NRC_LOOP = 50;
static const int32_t HANDLE_NCR_VALUE = 51;
static const int32_t HANDLE_NCR_VALUE = 51;
static const int32_t HANDLE_NCR_VALUE_RECONSUME = 52;
static const int32_t HANDLE_NCR_VALUE_RECONSUME = 52;
static const int32_t CHARACTER_REFERENCE_HILO_LOOKUP = 53;
static const int32_t CHARACTER_REFERENCE_HILO_LOOKUP = 53;
static const int32_t SELF_CLOSING_START_TAG = 54;
static const int32_t SELF_CLOSING_START_TAG = 54;
static const int32_t CDATA_START = 55;
static const int32_t CDATA_START = 55;
static const int32_t CDATA_SECTION = 56;
static const int32_t CDATA_SECTION = 56;
static const int32_t CDATA_RSQB = 57;
static const int32_t CDATA_RSQB = 57;
static const int32_t CDATA_RSQB_RSQB = 58;
static const int32_t CDATA_RSQB_RSQB = 58;
static const int32_t SCRIPT_DATA_LESS_THAN_SIGN = 59;
static const int32_t SCRIPT_DATA_LESS_THAN_SIGN = 59;
static const int32_t SCRIPT_DATA_ESCAPE_START = 60;
static const int32_t SCRIPT_DATA_ESCAPE_START = 60;
static const int32_t SCRIPT_DATA_ESCAPE_START_DASH = 61;
static const int32_t SCRIPT_DATA_ESCAPE_START_DASH = 61;
static const int32_t SCRIPT_DATA_ESCAPED_DASH = 62;
static const int32_t SCRIPT_DATA_ESCAPED_DASH = 62;
static const int32_t SCRIPT_DATA_ESCAPED_DASH_DASH = 63;
static const int32_t SCRIPT_DATA_ESCAPED_DASH_DASH = 63;
static const int32_t BOGUS_COMMENT_HYPHEN = 64;
static const int32_t BOGUS_COMMENT_HYPHEN = 64;
static const int32_t RAWTEXT_RCDATA_LESS_THAN_SIGN = 65;
static const int32_t RAWTEXT_RCDATA_LESS_THAN_SIGN = 65;
static const int32_t SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN = 66;
static const int32_t SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN = 66;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPE_START = 67;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPE_START = 67;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED = 68;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED = 68;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN = 69;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN = 69;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED_DASH = 70;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED_DASH = 70;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH = 71;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH = 71;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPE_END = 72;
static const int32_t SCRIPT_DATA_DOUBLE_ESCAPE_END = 72;
static const int32_t PROCESSING_INSTRUCTION = 73;
static const int32_t PROCESSING_INSTRUCTION = 73;
static const int32_t PROCESSING_INSTRUCTION_QUESTION_MARK = 74;
static const int32_t PROCESSING_INSTRUCTION_QUESTION_MARK = 74;
private:
static const int32_t LEAD_OFFSET = (0xD800 - (0x10000 >> 10));
private:
static const int32_t LEAD_OFFSET = (0xD800 - (0x10000 >> 10));
static char16_t LT_GT[];
static char16_t LT_SOLIDUS[];
static char16_t RSQB_RSQB[];
static char16_t REPLACEMENT_CHARACTER[];
static char16_t LF[];
static char16_t CDATA_LSQB[];
static char16_t OCTYPE[];
static char16_t UBLIC[];
static char16_t YSTEM[];
static staticJArray<char16_t,int32_t> TITLE_ARR;
static staticJArray<char16_t,int32_t> SCRIPT_ARR;
static staticJArray<char16_t,int32_t> STYLE_ARR;
static staticJArray<char16_t,int32_t> PLAINTEXT_ARR;
static staticJArray<char16_t,int32_t> XMP_ARR;
static staticJArray<char16_t,int32_t> TEXTAREA_ARR;
static staticJArray<char16_t,int32_t> IFRAME_ARR;
static staticJArray<char16_t,int32_t> NOEMBED_ARR;
static staticJArray<char16_t,int32_t> NOSCRIPT_ARR;
static staticJArray<char16_t,int32_t> NOFRAMES_ARR;
protected:
nsHtml5TreeBuilder* tokenHandler;
nsHtml5StreamParser* encodingDeclarationHandler;
bool lastCR;
int32_t stateSave;
private:
int32_t returnStateSave;
protected:
int32_t index;
private:
bool forceQuirks;
char16_t additional;
int32_t entCol;
int32_t firstCharKey;
int32_t lo;
int32_t hi;
int32_t candidate;
int32_t charRefBufMark;
protected:
int32_t value;
private:
bool seenDigits;
protected:
int32_t cstart;
private:
nsHtml5String publicId;
nsHtml5String systemId;
autoJArray<char16_t,int32_t> strBuf;
int32_t strBufLen;
autoJArray<char16_t,int32_t> charRefBuf;
int32_t charRefBufLen;
autoJArray<char16_t,int32_t> bmpChar;
autoJArray<char16_t,int32_t> astralChar;
protected:
nsHtml5ElementName* endTagExpectation;
private:
jArray<char16_t,int32_t> endTagExpectationAsArray;
protected:
bool endTag;
private:
bool containsHyphen;
nsHtml5ElementName* tagName;
nsHtml5ElementName* nonInternedTagName;
protected:
nsHtml5AttributeName* attributeName;
private:
nsHtml5AttributeName* nonInternedAttributeName;
nsAtom* doctypeName;
nsHtml5String publicIdentifier;
nsHtml5String systemIdentifier;
nsHtml5HtmlAttributes* attributes;
bool newAttributesEachTime;
bool shouldSuspend;
protected:
bool confident;
private:
int32_t line;
int32_t attributeLine;
nsHtml5AtomTable* interner;
bool viewingXmlSource;
public:
nsHtml5Tokenizer(nsHtml5TreeBuilder* tokenHandler, bool viewingXmlSource);
void setInterner(nsHtml5AtomTable* interner);
void initLocation(nsHtml5String newPublicId, nsHtml5String newSystemId);
bool isViewingXmlSource();
void setStateAndEndTagExpectation(int32_t specialTokenizerState, nsAtom* endTagExpectation);
void setStateAndEndTagExpectation(int32_t specialTokenizerState, nsHtml5ElementName* endTagExpectation);
private:
void endTagExpectationToArray();
public:
void setLineNumber(int32_t line);
inline int32_t getLineNumber()
{
return line;
}
nsHtml5HtmlAttributes* emptyAttributes();
private:
inline void appendCharRefBuf(char16_t c)
{
MOZ_RELEASE_ASSERT(charRefBufLen < charRefBuf.length, "Attempted to overrun charRefBuf!");
charRefBuf[charRefBufLen++] = c;
}
void emitOrAppendCharRefBuf(int32_t returnState);
inline void clearStrBufAfterUse()
{
strBufLen = 0;
}
inline void clearStrBufBeforeUse()
{
MOZ_ASSERT(!strBufLen, "strBufLen not reset after previous use!");
strBufLen = 0;
}
inline void clearStrBufAfterOneHyphen()
{
MOZ_ASSERT(strBufLen == 1, "strBufLen length not one!");
MOZ_ASSERT(strBuf[0] == '-', "strBuf does not start with a hyphen!");
strBufLen = 0;
}
inline void appendStrBuf(char16_t c)
{
MOZ_ASSERT(strBufLen < strBuf.length, "Previous buffer length insufficient.");
if (MOZ_UNLIKELY(strBufLen == strBuf.length)) {
if (MOZ_UNLIKELY(!EnsureBufferSpace(1))) {
MOZ_CRASH("Unable to recover from buffer reallocation failure");
}
static char16_t LT_GT[];
static char16_t LT_SOLIDUS[];
static char16_t RSQB_RSQB[];
static char16_t REPLACEMENT_CHARACTER[];
static char16_t LF[];
static char16_t CDATA_LSQB[];
static char16_t OCTYPE[];
static char16_t UBLIC[];
static char16_t YSTEM[];
static staticJArray<char16_t, int32_t> TITLE_ARR;
static staticJArray<char16_t, int32_t> SCRIPT_ARR;
static staticJArray<char16_t, int32_t> STYLE_ARR;
static staticJArray<char16_t, int32_t> PLAINTEXT_ARR;
static staticJArray<char16_t, int32_t> XMP_ARR;
static staticJArray<char16_t, int32_t> TEXTAREA_ARR;
static staticJArray<char16_t, int32_t> IFRAME_ARR;
static staticJArray<char16_t, int32_t> NOEMBED_ARR;
static staticJArray<char16_t, int32_t> NOSCRIPT_ARR;
static staticJArray<char16_t, int32_t> NOFRAMES_ARR;
protected:
nsHtml5TreeBuilder* tokenHandler;
nsHtml5StreamParser* encodingDeclarationHandler;
bool lastCR;
int32_t stateSave;
private:
int32_t returnStateSave;
protected:
int32_t index;
private:
bool forceQuirks;
char16_t additional;
int32_t entCol;
int32_t firstCharKey;
int32_t lo;
int32_t hi;
int32_t candidate;
int32_t charRefBufMark;
protected:
int32_t value;
private:
bool seenDigits;
protected:
int32_t cstart;
private:
nsHtml5String publicId;
nsHtml5String systemId;
autoJArray<char16_t, int32_t> strBuf;
int32_t strBufLen;
autoJArray<char16_t, int32_t> charRefBuf;
int32_t charRefBufLen;
autoJArray<char16_t, int32_t> bmpChar;
autoJArray<char16_t, int32_t> astralChar;
protected:
nsHtml5ElementName* endTagExpectation;
private:
jArray<char16_t, int32_t> endTagExpectationAsArray;
protected:
bool endTag;
private:
bool containsHyphen;
nsHtml5ElementName* tagName;
nsHtml5ElementName* nonInternedTagName;
protected:
nsHtml5AttributeName* attributeName;
private:
nsHtml5AttributeName* nonInternedAttributeName;
nsAtom* doctypeName;
nsHtml5String publicIdentifier;
nsHtml5String systemIdentifier;
nsHtml5HtmlAttributes* attributes;
bool newAttributesEachTime;
bool shouldSuspend;
protected:
bool confident;
private:
int32_t line;
int32_t attributeLine;
nsHtml5AtomTable* interner;
bool viewingXmlSource;
public:
nsHtml5Tokenizer(nsHtml5TreeBuilder* tokenHandler, bool viewingXmlSource);
void setInterner(nsHtml5AtomTable* interner);
void initLocation(nsHtml5String newPublicId, nsHtml5String newSystemId);
bool isViewingXmlSource();
void setStateAndEndTagExpectation(int32_t specialTokenizerState,
nsAtom* endTagExpectation);
void setStateAndEndTagExpectation(int32_t specialTokenizerState,
nsHtml5ElementName* endTagExpectation);
private:
void endTagExpectationToArray();
public:
void setLineNumber(int32_t line);
inline int32_t getLineNumber() { return line; }
nsHtml5HtmlAttributes* emptyAttributes();
private:
inline void appendCharRefBuf(char16_t c)
{
MOZ_RELEASE_ASSERT(charRefBufLen < charRefBuf.length,
"Attempted to overrun charRefBuf!");
charRefBuf[charRefBufLen++] = c;
}
void emitOrAppendCharRefBuf(int32_t returnState);
inline void clearStrBufAfterUse() { strBufLen = 0; }
inline void clearStrBufBeforeUse()
{
MOZ_ASSERT(!strBufLen, "strBufLen not reset after previous use!");
strBufLen = 0;
}
inline void clearStrBufAfterOneHyphen()
{
MOZ_ASSERT(strBufLen == 1, "strBufLen length not one!");
MOZ_ASSERT(strBuf[0] == '-', "strBuf does not start with a hyphen!");
strBufLen = 0;
}
inline void appendStrBuf(char16_t c)
{
MOZ_ASSERT(strBufLen < strBuf.length,
"Previous buffer length insufficient.");
if (MOZ_UNLIKELY(strBufLen == strBuf.length)) {
if (MOZ_UNLIKELY(!EnsureBufferSpace(1))) {
MOZ_CRASH("Unable to recover from buffer reallocation failure");
}
strBuf[strBufLen++] = c;
}
strBuf[strBufLen++] = c;
}
protected:
nsHtml5String strBufToString();
private:
void strBufToDoctypeName();
void emitStrBuf();
inline void appendSecondHyphenToBogusComment()
{
appendStrBuf('-');
}
protected:
nsHtml5String strBufToString();
inline void adjustDoubleHyphenAndAppendToStrBufAndErr(char16_t c)
{
errConsecutiveHyphens();
appendStrBuf(c);
}
private:
void strBufToDoctypeName();
void emitStrBuf();
inline void appendSecondHyphenToBogusComment() { appendStrBuf('-'); }
void appendStrBuf(char16_t* buffer, int32_t offset, int32_t length);
inline void appendCharRefBufToStrBuf()
{
appendStrBuf(charRefBuf, 0, charRefBufLen);
charRefBufLen = 0;
}
inline void adjustDoubleHyphenAndAppendToStrBufAndErr(char16_t c)
{
errConsecutiveHyphens();
appendStrBuf(c);
}
void emitComment(int32_t provisionalHyphens, int32_t pos);
protected:
void flushChars(char16_t* buf, int32_t pos);
private:
void strBufToElementNameString();
int32_t emitCurrentTagToken(bool selfClosing, int32_t pos);
void attributeNameComplete();
void addAttributeWithoutValue();
void addAttributeWithValue();
public:
void start();
bool tokenizeBuffer(nsHtml5UTF16Buffer* buffer);
private:
template<class P> int32_t stateLoop(int32_t state, char16_t c, int32_t pos, char16_t* buf, bool reconsume, int32_t returnState, int32_t endPos);
void initDoctypeFields();
inline void adjustDoubleHyphenAndAppendToStrBufCarriageReturn()
{
silentCarriageReturn();
adjustDoubleHyphenAndAppendToStrBufAndErr('\n');
}
void appendStrBuf(char16_t* buffer, int32_t offset, int32_t length);
inline void appendCharRefBufToStrBuf()
{
appendStrBuf(charRefBuf, 0, charRefBufLen);
charRefBufLen = 0;
}
inline void adjustDoubleHyphenAndAppendToStrBufLineFeed()
{
silentLineFeed();
adjustDoubleHyphenAndAppendToStrBufAndErr('\n');
}
void emitComment(int32_t provisionalHyphens, int32_t pos);
inline void appendStrBufLineFeed()
{
silentLineFeed();
appendStrBuf('\n');
}
protected:
void flushChars(char16_t* buf, int32_t pos);
inline void appendStrBufCarriageReturn()
{
silentCarriageReturn();
appendStrBuf('\n');
}
private:
void strBufToElementNameString();
int32_t emitCurrentTagToken(bool selfClosing, int32_t pos);
void attributeNameComplete();
void addAttributeWithoutValue();
void addAttributeWithValue();
protected:
inline void silentCarriageReturn()
{
++line;
lastCR = true;
}
public:
void start();
bool tokenizeBuffer(nsHtml5UTF16Buffer* buffer);
inline void silentLineFeed()
{
++line;
}
private:
template<class P>
int32_t stateLoop(int32_t state,
char16_t c,
int32_t pos,
char16_t* buf,
bool reconsume,
int32_t returnState,
int32_t endPos);
void initDoctypeFields();
inline void adjustDoubleHyphenAndAppendToStrBufCarriageReturn()
{
silentCarriageReturn();
adjustDoubleHyphenAndAppendToStrBufAndErr('\n');
}
private:
void emitCarriageReturn(char16_t* buf, int32_t pos);
void emitReplacementCharacter(char16_t* buf, int32_t pos);
void emitPlaintextReplacementCharacter(char16_t* buf, int32_t pos);
void setAdditionalAndRememberAmpersandLocation(char16_t add);
void bogusDoctype();
void bogusDoctypeWithoutQuirks();
void handleNcrValue(int32_t returnState);
public:
void eof();
private:
void emitDoctypeToken(int32_t pos);
protected:
inline char16_t checkChar(char16_t* buf, int32_t pos)
{
return buf[pos];
}
inline void adjustDoubleHyphenAndAppendToStrBufLineFeed()
{
silentLineFeed();
adjustDoubleHyphenAndAppendToStrBufAndErr('\n');
}
public:
bool internalEncodingDeclaration(nsHtml5String internalCharset);
private:
void emitOrAppendTwo(const char16_t* val, int32_t returnState);
void emitOrAppendOne(const char16_t* val, int32_t returnState);
public:
void end();
void requestSuspension();
bool isInDataState();
void resetToDataState();
void loadState(nsHtml5Tokenizer* other);
void initializeWithoutStarting();
void setEncodingDeclarationHandler(nsHtml5StreamParser* encodingDeclarationHandler);
~nsHtml5Tokenizer();
static void initializeStatics();
static void releaseStatics();
inline void appendStrBufLineFeed()
{
silentLineFeed();
appendStrBuf('\n');
}
inline void appendStrBufCarriageReturn()
{
silentCarriageReturn();
appendStrBuf('\n');
}
protected:
inline void silentCarriageReturn()
{
++line;
lastCR = true;
}
inline void silentLineFeed() { ++line; }
private:
void emitCarriageReturn(char16_t* buf, int32_t pos);
void emitReplacementCharacter(char16_t* buf, int32_t pos);
void emitPlaintextReplacementCharacter(char16_t* buf, int32_t pos);
void setAdditionalAndRememberAmpersandLocation(char16_t add);
void bogusDoctype();
void bogusDoctypeWithoutQuirks();
void handleNcrValue(int32_t returnState);
public:
void eof();
private:
void emitDoctypeToken(int32_t pos);
protected:
inline char16_t checkChar(char16_t* buf, int32_t pos) { return buf[pos]; }
public:
bool internalEncodingDeclaration(nsHtml5String internalCharset);
private:
void emitOrAppendTwo(const char16_t* val, int32_t returnState);
void emitOrAppendOne(const char16_t* val, int32_t returnState);
public:
void end();
void requestSuspension();
bool isInDataState();
void resetToDataState();
void loadState(nsHtml5Tokenizer* other);
void initializeWithoutStarting();
void setEncodingDeclarationHandler(
nsHtml5StreamParser* encodingDeclarationHandler);
~nsHtml5Tokenizer();
static void initializeStatics();
static void releaseStatics();
#include "nsHtml5TokenizerHSupplement.h"
};
#endif

Просмотреть файл

@ -2,6 +2,7 @@
* 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 "mozilla/CheckedInt.h"
#include "mozilla/Likely.h"
// INT32_MAX is (2^31)-1. Therefore, the highest power-of-two that fits
@ -19,7 +20,7 @@ nsHtml5Tokenizer::EnsureBufferSpace(int32_t aLength)
// Can't happen when loading from network.
return false;
}
CheckedInt<int32_t> worstCase(strBufLen);
mozilla::CheckedInt<int32_t> worstCase(strBufLen);
worstCase += aLength;
worstCase += charRefBufLen;
// Add 2 to account for emissions of LT_GT, LT_SOLIDUS and RSQB_RSQB.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -67,518 +67,574 @@ class nsHtml5UTF16Buffer;
class nsHtml5StateSnapshot;
class nsHtml5Portability;
class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState
{
private:
static char16_t REPLACEMENT_CHARACTER[];
public:
static const int32_t OTHER = 0;
private:
static char16_t REPLACEMENT_CHARACTER[];
static const int32_t A = 1;
public:
static const int32_t OTHER = 0;
static const int32_t BASE = 2;
static const int32_t A = 1;
static const int32_t BODY = 3;
static const int32_t BASE = 2;
static const int32_t BR = 4;
static const int32_t BODY = 3;
static const int32_t BUTTON = 5;
static const int32_t BR = 4;
static const int32_t CAPTION = 6;
static const int32_t BUTTON = 5;
static const int32_t COL = 7;
static const int32_t CAPTION = 6;
static const int32_t COLGROUP = 8;
static const int32_t COL = 7;
static const int32_t FORM = 9;
static const int32_t COLGROUP = 8;
static const int32_t FRAME = 10;
static const int32_t FORM = 9;
static const int32_t FRAMESET = 11;
static const int32_t FRAME = 10;
static const int32_t IMAGE = 12;
static const int32_t FRAMESET = 11;
static const int32_t INPUT = 13;
static const int32_t IMAGE = 12;
static const int32_t RT_OR_RP = 14;
static const int32_t INPUT = 13;
static const int32_t LI = 15;
static const int32_t RT_OR_RP = 14;
static const int32_t LINK_OR_BASEFONT_OR_BGSOUND = 16;
static const int32_t LI = 15;
static const int32_t MATH = 17;
static const int32_t LINK_OR_BASEFONT_OR_BGSOUND = 16;
static const int32_t META = 18;
static const int32_t MATH = 17;
static const int32_t SVG = 19;
static const int32_t META = 18;
static const int32_t HEAD = 20;
static const int32_t SVG = 19;
static const int32_t HR = 22;
static const int32_t HEAD = 20;
static const int32_t HTML = 23;
static const int32_t HR = 22;
static const int32_t NOBR = 24;
static const int32_t HTML = 23;
static const int32_t NOFRAMES = 25;
static const int32_t NOBR = 24;
static const int32_t NOSCRIPT = 26;
static const int32_t NOFRAMES = 25;
static const int32_t OPTGROUP = 27;
static const int32_t NOSCRIPT = 26;
static const int32_t OPTION = 28;
static const int32_t OPTGROUP = 27;
static const int32_t P = 29;
static const int32_t OPTION = 28;
static const int32_t PLAINTEXT = 30;
static const int32_t P = 29;
static const int32_t SCRIPT = 31;
static const int32_t PLAINTEXT = 30;
static const int32_t SELECT = 32;
static const int32_t SCRIPT = 31;
static const int32_t STYLE = 33;
static const int32_t SELECT = 32;
static const int32_t TABLE = 34;
static const int32_t STYLE = 33;
static const int32_t TEXTAREA = 35;
static const int32_t TABLE = 34;
static const int32_t TITLE = 36;
static const int32_t TEXTAREA = 35;
static const int32_t TR = 37;
static const int32_t TITLE = 36;
static const int32_t XMP = 38;
static const int32_t TR = 37;
static const int32_t TBODY_OR_THEAD_OR_TFOOT = 39;
static const int32_t XMP = 38;
static const int32_t TD_OR_TH = 40;
static const int32_t TBODY_OR_THEAD_OR_TFOOT = 39;
static const int32_t DD_OR_DT = 41;
static const int32_t TD_OR_TH = 40;
static const int32_t H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 = 42;
static const int32_t DD_OR_DT = 41;
static const int32_t MARQUEE_OR_APPLET = 43;
static const int32_t H1_OR_H2_OR_H3_OR_H4_OR_H5_OR_H6 = 42;
static const int32_t PRE_OR_LISTING = 44;
static const int32_t MARQUEE_OR_APPLET = 43;
static const int32_t
B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U =
45;
static const int32_t PRE_OR_LISTING = 44;
static const int32_t UL_OR_OL_OR_DL = 46;
static const int32_t
B_OR_BIG_OR_CODE_OR_EM_OR_I_OR_S_OR_SMALL_OR_STRIKE_OR_STRONG_OR_TT_OR_U =
45;
static const int32_t IFRAME = 47;
static const int32_t UL_OR_OL_OR_DL = 46;
static const int32_t EMBED = 48;
static const int32_t IFRAME = 47;
static const int32_t AREA_OR_WBR = 49;
static const int32_t EMBED = 48;
static const int32_t DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU = 50;
static const int32_t AREA_OR_WBR = 49;
static const int32_t
ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY =
51;
static const int32_t DIV_OR_BLOCKQUOTE_OR_CENTER_OR_MENU = 50;
static const int32_t RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR = 52;
static const int32_t
ADDRESS_OR_ARTICLE_OR_ASIDE_OR_DETAILS_OR_DIALOG_OR_DIR_OR_FIGCAPTION_OR_FIGURE_OR_FOOTER_OR_HEADER_OR_HGROUP_OR_MAIN_OR_NAV_OR_SECTION_OR_SUMMARY =
51;
static const int32_t RB_OR_RTC = 53;
static const int32_t RUBY_OR_SPAN_OR_SUB_OR_SUP_OR_VAR = 52;
static const int32_t PARAM_OR_SOURCE_OR_TRACK = 55;
static const int32_t RB_OR_RTC = 53;
static const int32_t MGLYPH_OR_MALIGNMARK = 56;
static const int32_t PARAM_OR_SOURCE_OR_TRACK = 55;
static const int32_t MI_MO_MN_MS_MTEXT = 57;
static const int32_t MGLYPH_OR_MALIGNMARK = 56;
static const int32_t ANNOTATION_XML = 58;
static const int32_t MI_MO_MN_MS_MTEXT = 57;
static const int32_t FOREIGNOBJECT_OR_DESC = 59;
static const int32_t ANNOTATION_XML = 58;
static const int32_t NOEMBED = 60;
static const int32_t FOREIGNOBJECT_OR_DESC = 59;
static const int32_t FIELDSET = 61;
static const int32_t NOEMBED = 60;
static const int32_t OUTPUT = 62;
static const int32_t FIELDSET = 61;
static const int32_t OBJECT = 63;
static const int32_t OUTPUT = 62;
static const int32_t FONT = 64;
static const int32_t OBJECT = 63;
static const int32_t KEYGEN = 65;
static const int32_t FONT = 64;
static const int32_t MENUITEM = 66;
static const int32_t KEYGEN = 65;
static const int32_t TEMPLATE = 67;
static const int32_t MENUITEM = 66;
static const int32_t IMG = 68;
static const int32_t TEMPLATE = 67;
private:
static const int32_t IN_ROW = 0;
static const int32_t IMG = 68;
static const int32_t IN_TABLE_BODY = 1;
private:
static const int32_t IN_ROW = 0;
static const int32_t IN_TABLE = 2;
static const int32_t IN_TABLE_BODY = 1;
static const int32_t IN_CAPTION = 3;
static const int32_t IN_TABLE = 2;
static const int32_t IN_CELL = 4;
static const int32_t IN_CAPTION = 3;
static const int32_t FRAMESET_OK = 5;
static const int32_t IN_CELL = 4;
static const int32_t IN_BODY = 6;
static const int32_t FRAMESET_OK = 5;
static const int32_t IN_HEAD = 7;
static const int32_t IN_BODY = 6;
static const int32_t IN_HEAD_NOSCRIPT = 8;
static const int32_t IN_HEAD = 7;
static const int32_t IN_COLUMN_GROUP = 9;
static const int32_t IN_HEAD_NOSCRIPT = 8;
static const int32_t IN_SELECT_IN_TABLE = 10;
static const int32_t IN_COLUMN_GROUP = 9;
static const int32_t IN_SELECT = 11;
static const int32_t IN_SELECT_IN_TABLE = 10;
static const int32_t AFTER_BODY = 12;
static const int32_t IN_SELECT = 11;
static const int32_t IN_FRAMESET = 13;
static const int32_t AFTER_BODY = 12;
static const int32_t AFTER_FRAMESET = 14;
static const int32_t IN_FRAMESET = 13;
static const int32_t INITIAL = 15;
static const int32_t AFTER_FRAMESET = 14;
static const int32_t BEFORE_HTML = 16;
static const int32_t INITIAL = 15;
static const int32_t BEFORE_HEAD = 17;
static const int32_t BEFORE_HTML = 16;
static const int32_t AFTER_HEAD = 18;
static const int32_t BEFORE_HEAD = 17;
static const int32_t AFTER_AFTER_BODY = 19;
static const int32_t AFTER_HEAD = 18;
static const int32_t AFTER_AFTER_FRAMESET = 20;
static const int32_t AFTER_AFTER_BODY = 19;
static const int32_t TEXT = 21;
static const int32_t AFTER_AFTER_FRAMESET = 20;
static const int32_t IN_TEMPLATE = 22;
static const int32_t TEXT = 21;
static const int32_t CHARSET_INITIAL = 0;
static const int32_t IN_TEMPLATE = 22;
static const int32_t CHARSET_C = 1;
static const int32_t CHARSET_INITIAL = 0;
static const int32_t CHARSET_H = 2;
static const int32_t CHARSET_C = 1;
static const int32_t CHARSET_A = 3;
static const int32_t CHARSET_H = 2;
static const int32_t CHARSET_R = 4;
static const int32_t CHARSET_A = 3;
static const int32_t CHARSET_S = 5;
static const int32_t CHARSET_R = 4;
static const int32_t CHARSET_E = 6;
static const int32_t CHARSET_S = 5;
static const int32_t CHARSET_T = 7;
static const int32_t CHARSET_E = 6;
static const int32_t CHARSET_EQUALS = 8;
static const int32_t CHARSET_T = 7;
static const int32_t CHARSET_SINGLE_QUOTED = 9;
static const int32_t CHARSET_EQUALS = 8;
static const int32_t CHARSET_DOUBLE_QUOTED = 10;
static const int32_t CHARSET_SINGLE_QUOTED = 9;
static const int32_t CHARSET_UNQUOTED = 11;
static const int32_t CHARSET_DOUBLE_QUOTED = 10;
static staticJArray<const char*,int32_t> QUIRKY_PUBLIC_IDS;
static const int32_t NOT_FOUND_ON_STACK = INT32_MAX;
static const int32_t CHARSET_UNQUOTED = 11;
int32_t mode;
int32_t originalMode;
bool framesetOk;
protected:
nsHtml5Tokenizer* tokenizer;
private:
bool scriptingEnabled;
bool needToDropLF;
bool fragment;
nsAtom* contextName;
int32_t contextNamespace;
nsIContentHandle* contextNode;
autoJArray<int32_t,int32_t> templateModeStack;
int32_t templateModePtr;
autoJArray<nsHtml5StackNode*, int32_t> stackNodes;
int32_t stackNodesIdx;
int32_t numStackNodes;
autoJArray<nsHtml5StackNode*,int32_t> stack;
int32_t currentPtr;
autoJArray<nsHtml5StackNode*,int32_t> listOfActiveFormattingElements;
int32_t listPtr;
nsIContentHandle* formPointer;
nsIContentHandle* headPointer;
nsIContentHandle* deepTreeSurrogateParent;
protected:
autoJArray<char16_t,int32_t> charBuffer;
int32_t charBufferLen;
private:
bool quirks;
bool isSrcdocDocument;
inline nsHtml5ContentCreatorFunction htmlCreator(
mozilla::dom::HTMLContentCreatorFunction htmlCreator)
{
nsHtml5ContentCreatorFunction creator;
creator.html = htmlCreator;
return creator;
}
inline nsHtml5ContentCreatorFunction svgCreator(
mozilla::dom::SVGContentCreatorFunction svgCreator)
{
nsHtml5ContentCreatorFunction creator;
creator.svg = svgCreator;
return creator;
}
public:
void startTokenization(nsHtml5Tokenizer* self);
void doctype(nsAtom* name,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier,
bool forceQuirks);
void comment(char16_t* buf, int32_t start, int32_t length);
void characters(const char16_t* buf, int32_t start, int32_t length);
void zeroOriginatingReplacementCharacter();
void eof();
void endTokenization();
void startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, bool selfClosing);
private:
void startTagTitleInHead(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void startTagGenericRawText(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void startTagScriptInHead(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void startTagTemplateInHead(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
bool isTemplateContents();
bool isTemplateModeStackEmpty();
bool isSpecialParentInForeign(nsHtml5StackNode* stackNode);
public:
static nsHtml5String extractCharsetFromContent(nsHtml5String attributeValue,
nsHtml5TreeBuilder* tb);
private:
void checkMetaCharset(nsHtml5HtmlAttributes* attributes);
public:
void endTag(nsHtml5ElementName* elementName);
private:
void endTagTemplateInHead();
int32_t findLastInTableScopeOrRootTemplateTbodyTheadTfoot();
int32_t findLast(nsAtom* name);
int32_t findLastInTableScope(nsAtom* name);
int32_t findLastInButtonScope(nsAtom* name);
int32_t findLastInScope(nsAtom* name);
int32_t findLastInListScope(nsAtom* name);
int32_t findLastInScopeHn();
void generateImpliedEndTagsExceptFor(nsAtom* name);
void generateImpliedEndTags();
bool isSecondOnStackBody();
void documentModeInternal(nsHtml5DocumentMode m,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier,
bool html4SpecificAdditionalErrorChecks);
bool isAlmostStandards(nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier);
bool isQuirky(nsAtom* name,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier,
bool forceQuirks);
void closeTheCell(int32_t eltPos);
int32_t findLastInTableScopeTdTh();
void clearStackBackTo(int32_t eltPos);
void resetTheInsertionMode();
void implicitlyCloseP();
bool debugOnlyClearLastStackSlot();
bool debugOnlyClearLastListSlot();
void pushTemplateMode(int32_t mode);
void push(nsHtml5StackNode* node);
void silentPush(nsHtml5StackNode* node);
void append(nsHtml5StackNode* node);
inline void insertMarker()
{
append(nullptr);
}
void clearTheListOfActiveFormattingElementsUpToTheLastMarker();
inline bool isCurrent(nsAtom* name)
{
return stack[currentPtr]->ns == kNameSpaceID_XHTML && name == stack[currentPtr]->name;
}
void removeFromStack(int32_t pos);
void removeFromStack(nsHtml5StackNode* node);
void removeFromListOfActiveFormattingElements(int32_t pos);
bool adoptionAgencyEndTag(nsAtom* name);
void insertIntoStack(nsHtml5StackNode* node, int32_t position);
void insertIntoListOfActiveFormattingElements(nsHtml5StackNode* formattingClone, int32_t bookmark);
int32_t findInListOfActiveFormattingElements(nsHtml5StackNode* node);
int32_t findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(
nsAtom* name);
void maybeForgetEarlierDuplicateFormattingElement(
nsAtom* name,
nsHtml5HtmlAttributes* attributes);
int32_t findLastOrRoot(nsAtom* name);
int32_t findLastOrRoot(int32_t group);
bool addAttributesToBody(nsHtml5HtmlAttributes* attributes);
void addAttributesToHtml(nsHtml5HtmlAttributes* attributes);
void pushHeadPointerOntoStack();
void reconstructTheActiveFormattingElements();
public:
void notifyUnusedStackNode(int32_t idxInStackNodes);
private:
nsHtml5StackNode* getUnusedStackNode();
nsHtml5StackNode* createStackNode(
int32_t flags,
int32_t ns,
nsAtom* name,
nsIContentHandle* node,
nsAtom* popName,
nsHtml5HtmlAttributes* attributes,
mozilla::dom::HTMLContentCreatorFunction htmlCreator);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsHtml5HtmlAttributes* attributes);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsAtom* popName,
nsIContentHandle* node);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName,
bool markAsIntegrationPoint);
void insertIntoFosterParent(nsIContentHandle* child);
nsIContentHandle* createAndInsertFosterParentedElement(
int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createAndInsertFosterParentedElement(
int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form,
nsHtml5ContentCreatorFunction creator);
bool isInStack(nsHtml5StackNode* node);
void popTemplateMode();
void pop();
void silentPop();
void popOnEof();
void appendHtmlElementToDocumentAndPush(nsHtml5HtmlAttributes* attributes);
void appendHtmlElementToDocumentAndPush();
void appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushBodyElement(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushBodyElement();
void appendToCurrentNodeAndPushFormElementMayFoster(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushFormattingElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElement(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
bool annotationXmlEncodingPermitsHtml(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes, nsIContentHandle* form);
void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form);
void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendVoidElementToCurrentMayFosterSVG(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendVoidElementToCurrentMayFosterMathML(nsHtml5ElementName* elementName, nsHtml5HtmlAttributes* attributes);
void appendVoidInputToCurrent(nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form);
void appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes);
protected:
void accumulateCharacters(const char16_t* buf, int32_t start, int32_t length);
void requestSuspension();
nsIContentHandle* createElement(int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* intendedParent,
nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createElement(int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form,
nsIContentHandle* intendedParent,
nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createHtmlElementSetAsRoot(nsHtml5HtmlAttributes* attributes);
void detachFromParent(nsIContentHandle* element);
bool hasChildren(nsIContentHandle* element);
void appendElement(nsIContentHandle* child, nsIContentHandle* newParent);
void appendChildrenToNewParent(nsIContentHandle* oldParent, nsIContentHandle* newParent);
void insertFosterParentedChild(nsIContentHandle* child, nsIContentHandle* table, nsIContentHandle* stackParent);
nsIContentHandle* createAndInsertFosterParentedElement(
int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form,
nsIContentHandle* table,
nsIContentHandle* stackParent,
nsHtml5ContentCreatorFunction creator);
;void insertFosterParentedCharacters(char16_t* buf, int32_t start, int32_t length, nsIContentHandle* table, nsIContentHandle* stackParent);
void appendCharacters(nsIContentHandle* parent, char16_t* buf, int32_t start, int32_t length);
void appendComment(nsIContentHandle* parent, char16_t* buf, int32_t start, int32_t length);
void appendCommentToDocument(char16_t* buf, int32_t start, int32_t length);
void addAttributesToElement(nsIContentHandle* element, nsHtml5HtmlAttributes* attributes);
void markMalformedIfScript(nsIContentHandle* elt);
void start(bool fragmentMode);
void end();
void appendDoctypeToDocument(nsAtom* name,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier);
void elementPushed(int32_t ns, nsAtom* name, nsIContentHandle* node);
void elementPopped(int32_t ns, nsAtom* name, nsIContentHandle* node);
public:
inline bool cdataSectionAllowed()
{
return isInForeign();
}
private:
bool isInForeign();
bool isInForeignButNotHtmlOrMathTextIntegrationPoint();
public:
void setFragmentContext(nsAtom* context,
int32_t ns,
nsIContentHandle* node,
bool quirks);
protected:
nsIContentHandle* currentNode();
public:
bool isScriptingEnabled();
void setScriptingEnabled(bool scriptingEnabled);
void setIsSrcdocDocument(bool isSrcdocDocument);
void flushCharacters();
private:
bool charBufferContainsNonWhitespace();
public:
nsAHtml5TreeBuilderState* newSnapshot();
bool snapshotMatches(nsAHtml5TreeBuilderState* snapshot);
void loadState(nsAHtml5TreeBuilderState* snapshot, nsHtml5AtomTable* interner);
private:
int32_t findInArray(nsHtml5StackNode* node, jArray<nsHtml5StackNode*,int32_t> arr);
public:
nsIContentHandle* getFormPointer();
nsIContentHandle* getHeadPointer();
nsIContentHandle* getDeepTreeSurrogateParent();
jArray<nsHtml5StackNode*,int32_t> getListOfActiveFormattingElements();
jArray<nsHtml5StackNode*,int32_t> getStack();
jArray<int32_t,int32_t> getTemplateModeStack();
int32_t getMode();
int32_t getOriginalMode();
bool isFramesetOk();
bool isNeedToDropLF();
bool isQuirks();
int32_t getListOfActiveFormattingElementsLength();
int32_t getStackLength();
int32_t getTemplateModeStackLength();
static void initializeStatics();
static void releaseStatics();
static staticJArray<const char*, int32_t> QUIRKY_PUBLIC_IDS;
static const int32_t NOT_FOUND_ON_STACK = INT32_MAX;
int32_t mode;
int32_t originalMode;
bool framesetOk;
protected:
nsHtml5Tokenizer* tokenizer;
private:
bool scriptingEnabled;
bool needToDropLF;
bool fragment;
nsAtom* contextName;
int32_t contextNamespace;
nsIContentHandle* contextNode;
autoJArray<int32_t, int32_t> templateModeStack;
int32_t templateModePtr;
autoJArray<nsHtml5StackNode*, int32_t> stackNodes;
int32_t stackNodesIdx;
int32_t numStackNodes;
autoJArray<nsHtml5StackNode*, int32_t> stack;
int32_t currentPtr;
autoJArray<nsHtml5StackNode*, int32_t> listOfActiveFormattingElements;
int32_t listPtr;
nsIContentHandle* formPointer;
nsIContentHandle* headPointer;
nsIContentHandle* deepTreeSurrogateParent;
protected:
autoJArray<char16_t, int32_t> charBuffer;
int32_t charBufferLen;
private:
bool quirks;
bool isSrcdocDocument;
inline nsHtml5ContentCreatorFunction htmlCreator(
mozilla::dom::HTMLContentCreatorFunction htmlCreator)
{
nsHtml5ContentCreatorFunction creator;
creator.html = htmlCreator;
return creator;
}
inline nsHtml5ContentCreatorFunction svgCreator(
mozilla::dom::SVGContentCreatorFunction svgCreator)
{
nsHtml5ContentCreatorFunction creator;
creator.svg = svgCreator;
return creator;
}
public:
void startTokenization(nsHtml5Tokenizer* self);
void doctype(nsAtom* name,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier,
bool forceQuirks);
void comment(char16_t* buf, int32_t start, int32_t length);
void characters(const char16_t* buf, int32_t start, int32_t length);
void zeroOriginatingReplacementCharacter();
void eof();
void endTokenization();
void startTag(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes,
bool selfClosing);
private:
void startTagTitleInHead(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void startTagGenericRawText(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void startTagScriptInHead(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void startTagTemplateInHead(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
bool isTemplateContents();
bool isTemplateModeStackEmpty();
bool isSpecialParentInForeign(nsHtml5StackNode* stackNode);
public:
static nsHtml5String extractCharsetFromContent(nsHtml5String attributeValue,
nsHtml5TreeBuilder* tb);
private:
void checkMetaCharset(nsHtml5HtmlAttributes* attributes);
public:
void endTag(nsHtml5ElementName* elementName);
private:
void endTagTemplateInHead();
int32_t findLastInTableScopeOrRootTemplateTbodyTheadTfoot();
int32_t findLast(nsAtom* name);
int32_t findLastInTableScope(nsAtom* name);
int32_t findLastInButtonScope(nsAtom* name);
int32_t findLastInScope(nsAtom* name);
int32_t findLastInListScope(nsAtom* name);
int32_t findLastInScopeHn();
void generateImpliedEndTagsExceptFor(nsAtom* name);
void generateImpliedEndTags();
bool isSecondOnStackBody();
void documentModeInternal(nsHtml5DocumentMode m,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier,
bool html4SpecificAdditionalErrorChecks);
bool isAlmostStandards(nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier);
bool isQuirky(nsAtom* name,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier,
bool forceQuirks);
void closeTheCell(int32_t eltPos);
int32_t findLastInTableScopeTdTh();
void clearStackBackTo(int32_t eltPos);
void resetTheInsertionMode();
void implicitlyCloseP();
bool debugOnlyClearLastStackSlot();
bool debugOnlyClearLastListSlot();
void pushTemplateMode(int32_t mode);
void push(nsHtml5StackNode* node);
void silentPush(nsHtml5StackNode* node);
void append(nsHtml5StackNode* node);
inline void insertMarker() { append(nullptr); }
void clearTheListOfActiveFormattingElementsUpToTheLastMarker();
inline bool isCurrent(nsAtom* name)
{
return stack[currentPtr]->ns == kNameSpaceID_XHTML &&
name == stack[currentPtr]->name;
}
void removeFromStack(int32_t pos);
void removeFromStack(nsHtml5StackNode* node);
void removeFromListOfActiveFormattingElements(int32_t pos);
bool adoptionAgencyEndTag(nsAtom* name);
void insertIntoStack(nsHtml5StackNode* node, int32_t position);
void insertIntoListOfActiveFormattingElements(
nsHtml5StackNode* formattingClone,
int32_t bookmark);
int32_t findInListOfActiveFormattingElements(nsHtml5StackNode* node);
int32_t findInListOfActiveFormattingElementsContainsBetweenEndAndLastMarker(
nsAtom* name);
void maybeForgetEarlierDuplicateFormattingElement(
nsAtom* name,
nsHtml5HtmlAttributes* attributes);
int32_t findLastOrRoot(nsAtom* name);
int32_t findLastOrRoot(int32_t group);
bool addAttributesToBody(nsHtml5HtmlAttributes* attributes);
void addAttributesToHtml(nsHtml5HtmlAttributes* attributes);
void pushHeadPointerOntoStack();
void reconstructTheActiveFormattingElements();
public:
void notifyUnusedStackNode(int32_t idxInStackNodes);
private:
nsHtml5StackNode* getUnusedStackNode();
nsHtml5StackNode* createStackNode(
int32_t flags,
int32_t ns,
nsAtom* name,
nsIContentHandle* node,
nsAtom* popName,
nsHtml5HtmlAttributes* attributes,
mozilla::dom::HTMLContentCreatorFunction htmlCreator);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsHtml5HtmlAttributes* attributes);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsAtom* popName,
nsIContentHandle* node);
nsHtml5StackNode* createStackNode(nsHtml5ElementName* elementName,
nsIContentHandle* node,
nsAtom* popName,
bool markAsIntegrationPoint);
void insertIntoFosterParent(nsIContentHandle* child);
nsIContentHandle* createAndInsertFosterParentedElement(
int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createAndInsertFosterParentedElement(
int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form,
nsHtml5ContentCreatorFunction creator);
bool isInStack(nsHtml5StackNode* node);
void popTemplateMode();
void pop();
void silentPop();
void popOnEof();
void appendHtmlElementToDocumentAndPush(nsHtml5HtmlAttributes* attributes);
void appendHtmlElementToDocumentAndPush();
void appendToCurrentNodeAndPushHeadElement(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushBodyElement(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushBodyElement();
void appendToCurrentNodeAndPushFormElementMayFoster(
nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushFormattingElementMayFoster(
nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElement(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFoster(
nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFosterMathML(
nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
bool annotationXmlEncodingPermitsHtml(nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFosterSVG(
nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void appendToCurrentNodeAndPushElementMayFoster(
nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form);
void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form);
void appendVoidElementToCurrentMayFoster(nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void appendVoidElementToCurrentMayFosterSVG(
nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void appendVoidElementToCurrentMayFosterMathML(
nsHtml5ElementName* elementName,
nsHtml5HtmlAttributes* attributes);
void appendVoidInputToCurrent(nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form);
void appendVoidFormToCurrent(nsHtml5HtmlAttributes* attributes);
protected:
void accumulateCharacters(const char16_t* buf, int32_t start, int32_t length);
void requestSuspension();
nsIContentHandle* createElement(int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* intendedParent,
nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createElement(int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form,
nsIContentHandle* intendedParent,
nsHtml5ContentCreatorFunction creator);
nsIContentHandle* createHtmlElementSetAsRoot(
nsHtml5HtmlAttributes* attributes);
void detachFromParent(nsIContentHandle* element);
bool hasChildren(nsIContentHandle* element);
void appendElement(nsIContentHandle* child, nsIContentHandle* newParent);
void appendChildrenToNewParent(nsIContentHandle* oldParent,
nsIContentHandle* newParent);
void insertFosterParentedChild(nsIContentHandle* child,
nsIContentHandle* table,
nsIContentHandle* stackParent);
nsIContentHandle* createAndInsertFosterParentedElement(
int32_t ns,
nsAtom* name,
nsHtml5HtmlAttributes* attributes,
nsIContentHandle* form,
nsIContentHandle* table,
nsIContentHandle* stackParent,
nsHtml5ContentCreatorFunction creator);
;
void insertFosterParentedCharacters(char16_t* buf,
int32_t start,
int32_t length,
nsIContentHandle* table,
nsIContentHandle* stackParent);
void appendCharacters(nsIContentHandle* parent,
char16_t* buf,
int32_t start,
int32_t length);
void appendComment(nsIContentHandle* parent,
char16_t* buf,
int32_t start,
int32_t length);
void appendCommentToDocument(char16_t* buf, int32_t start, int32_t length);
void addAttributesToElement(nsIContentHandle* element,
nsHtml5HtmlAttributes* attributes);
void markMalformedIfScript(nsIContentHandle* elt);
void start(bool fragmentMode);
void end();
void appendDoctypeToDocument(nsAtom* name,
nsHtml5String publicIdentifier,
nsHtml5String systemIdentifier);
void elementPushed(int32_t ns, nsAtom* name, nsIContentHandle* node);
void elementPopped(int32_t ns, nsAtom* name, nsIContentHandle* node);
public:
inline bool cdataSectionAllowed() { return isInForeign(); }
private:
bool isInForeign();
bool isInForeignButNotHtmlOrMathTextIntegrationPoint();
public:
void setFragmentContext(nsAtom* context,
int32_t ns,
nsIContentHandle* node,
bool quirks);
protected:
nsIContentHandle* currentNode();
public:
bool isScriptingEnabled();
void setScriptingEnabled(bool scriptingEnabled);
void setIsSrcdocDocument(bool isSrcdocDocument);
void flushCharacters();
private:
bool charBufferContainsNonWhitespace();
public:
nsAHtml5TreeBuilderState* newSnapshot();
bool snapshotMatches(nsAHtml5TreeBuilderState* snapshot);
void loadState(nsAHtml5TreeBuilderState* snapshot,
nsHtml5AtomTable* interner);
private:
int32_t findInArray(nsHtml5StackNode* node,
jArray<nsHtml5StackNode*, int32_t> arr);
public:
nsIContentHandle* getFormPointer() override;
nsIContentHandle* getHeadPointer() override;
nsIContentHandle* getDeepTreeSurrogateParent() override;
jArray<nsHtml5StackNode*, int32_t> getListOfActiveFormattingElements()
override;
jArray<nsHtml5StackNode*, int32_t> getStack() override;
jArray<int32_t, int32_t> getTemplateModeStack() override;
int32_t getMode() override;
int32_t getOriginalMode() override;
bool isFramesetOk() override;
bool isNeedToDropLF() override;
bool isQuirks() override;
int32_t getListOfActiveFormattingElementsLength() override;
int32_t getStackLength() override;
int32_t getTemplateModeStackLength() override;
static void initializeStatics();
static void releaseStatics();
#include "nsHtml5TreeBuilderHSupplement.h"
};
#endif

Просмотреть файл

@ -8,6 +8,7 @@
#include "nsIPresShell.h"
#include "nsNodeUtils.h"
#include "nsIFrame.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/Likely.h"
#include "mozilla/UniquePtr.h"
@ -595,7 +596,7 @@ nsHtml5TreeBuilder::insertFosterParentedCharacters(char16_t* aBuffer, int32_t aS
return;
}
auto bufferCopy = MakeUniqueFallible<char16_t[]>(aLength);
auto bufferCopy = mozilla::MakeUniqueFallible<char16_t[]>(aLength);
if (!bufferCopy) {
// Just assigning mBroken instead of generating tree op. The caller
// of tokenizeBuffer() will call MarkAsBroken() as appropriate.
@ -661,7 +662,7 @@ nsHtml5TreeBuilder::appendCharacters(nsIContentHandle* aParent, char16_t* aBuffe
return;
}
auto bufferCopy = MakeUniqueFallible<char16_t[]>(aLength);
auto bufferCopy = mozilla::MakeUniqueFallible<char16_t[]>(aLength);
if (!bufferCopy) {
// Just assigning mBroken instead of generating tree op. The caller
// of tokenizeBuffer() will call MarkAsBroken() as appropriate.
@ -704,7 +705,7 @@ nsHtml5TreeBuilder::appendComment(nsIContentHandle* aParent, char16_t* aBuffer,
return;
}
auto bufferCopy = MakeUniqueFallible<char16_t[]>(aLength);
auto bufferCopy = mozilla::MakeUniqueFallible<char16_t[]>(aLength);
if (!bufferCopy) {
// Just assigning mBroken instead of generating tree op. The caller
// of tokenizeBuffer() will call MarkAsBroken() as appropriate.
@ -740,7 +741,7 @@ nsHtml5TreeBuilder::appendCommentToDocument(char16_t* aBuffer, int32_t aStart, i
return;
}
auto bufferCopy = MakeUniqueFallible<char16_t[]>(aLength);
auto bufferCopy = mozilla::MakeUniqueFallible<char16_t[]>(aLength);
if (!bufferCopy) {
// Just assigning mBroken instead of generating tree op. The caller
// of tokenizeBuffer() will call MarkAsBroken() as appropriate.
@ -1081,7 +1082,7 @@ nsHtml5TreeBuilder::EnsureBufferSpace(int32_t aLength)
{
// TODO: Unify nsHtml5Tokenizer::strBuf and nsHtml5TreeBuilder::charBuffer
// so that this method becomes unnecessary.
CheckedInt<int32_t> worstCase(charBufferLen);
mozilla::CheckedInt<int32_t> worstCase(charBufferLen);
worstCase += aLength;
if (!worstCase.isValid()) {
return false;
@ -1119,7 +1120,7 @@ nsHtml5TreeBuilder::AllocateContentHandle()
}
if (mHandlesUsed == NS_HTML5_TREE_BUILDER_HANDLE_ARRAY_LENGTH) {
mOldHandles.AppendElement(Move(mHandles));
mHandles = MakeUnique<nsIContent*[]>(NS_HTML5_TREE_BUILDER_HANDLE_ARRAY_LENGTH);
mHandles = mozilla::MakeUnique<nsIContent*[]>(NS_HTML5_TREE_BUILDER_HANDLE_ARRAY_LENGTH);
mHandlesUsed = 0;
}
#ifdef DEBUG

Просмотреть файл

@ -16,6 +16,7 @@
#include "nsIDocShellTreeItem.h"
#include "nsIDocShell.h"
#include "nsIDOMDocument.h"
#include "nsINestedURI.h"
#include "nsIScriptGlobalObject.h"
#include "nsIWebShellServices.h"
#include "nsContentUtils.h"

Просмотреть файл

@ -1,22 +1,22 @@
/*
* Copyright (c) 2008-2010 Mozilla Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
@ -54,27 +54,26 @@ class nsHtml5MetaScanner;
class nsHtml5StateSnapshot;
class nsHtml5Portability;
class nsHtml5UTF16Buffer
{
private:
char16_t* buffer;
int32_t start;
int32_t end;
public:
int32_t getStart();
void setStart(int32_t start);
char16_t* getBuffer();
int32_t getEnd();
bool hasMore();
int32_t getLength();
void adjust(bool lastWasCR);
void setEnd(int32_t end);
static void initializeStatics();
static void releaseStatics();
private:
char16_t* buffer;
int32_t start;
int32_t end;
public:
int32_t getStart();
void setStart(int32_t start);
char16_t* getBuffer();
int32_t getEnd();
bool hasMore();
int32_t getLength();
void adjust(bool lastWasCR);
void setEnd(int32_t end);
static void initializeStatics();
static void releaseStatics();
#include "nsHtml5UTF16BufferHSupplement.h"
};
#endif