Merge mozilla-central to mozilla-autoland. r=merge a=merge CLOSED TREE

This commit is contained in:
Attila Craciun 2017-10-26 12:32:58 +03:00
Родитель abef3a3a96 0cab95ab0f
Коммит 252daa8e0a
648 изменённых файлов: 1291 добавлений и 889 удалений

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

@ -101,10 +101,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1378010
(async function() {
SimpleTest.waitForExplicitFinish();
// On Windows, nsICommandLine doesn't support double-dash arguments,
// nor single-dash arguments whose value is specified via an equals sign,
// so we only test those variations on non-Windows platforms.
// Test all four basic variations of the "screenshot" argument
// when a file path is specified.
await testFileCreationPositive(["-url", "http://mochi.test:8888/headless.html", "-screenshot", screenshotPath], screenshotPath);

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

@ -5,7 +5,7 @@
var list =
[
"js-input/speedometer/index.html",
"js-input/webkit/PerformanceTests/Speedometer/index.html",
"blueprint/sample.html",
"blueprint/forms.html",
"blueprint/grid.html",

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

@ -18,7 +18,7 @@ from mozrunner import FirefoxRunner, CLI
PORT = 8888
PATH_MAPPINGS = {
'/js-input/speedometer': 'third_party/speedometer',
'/js-input/webkit/PerformanceTests': 'third_party/webkit/PerformanceTests',
}

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

@ -0,0 +1,27 @@
if [ -z "${VSPATH}" ]; then
TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
VSPATH="$(cd ${TOOLTOOL_DIR} && pwd)/vs2017_15.4.1"
fi
if [ -d "${VSPATH}" ]; then
VSWINPATH="$(cd ${VSPATH} && pwd -W)"
export WINDOWSSDKDIR="${VSWINPATH}/SDK"
export WIN32_REDIST_DIR="${VSPATH}/VC/redist/x86/Microsoft.VC141.CRT"
export WIN_UCRT_REDIST_DIR="${VSPATH}/SDK/Redist/ucrt/DLLs/x86"
export PATH="${VSPATH}/VC/bin/Hostx86/x86:${VSPATH}/VC/bin/Hostx64/x86:${VSPATH}/VC/bin/Hostx64/x64:${VSPATH}/SDK/bin/10.0.16299.0/x64:${VSPATH}/DIA SDK/bin:${PATH}"
export PATH="${VSPATH}/VC/redist/x86/Microsoft.VC141.CRT:${VSPATH}/SDK/Redist/ucrt/DLLs/x86:${PATH}"
export INCLUDE="${VSPATH}/VC/include:${VSPATH}/VC/atlmfc/include:${VSPATH}/SDK/Include/10.0.16299.0/ucrt:${VSPATH}/SDK/Include/10.0.16299.0/shared:${VSPATH}/SDK/Include/10.0.16299.0/um:${VSPATH}/SDK/Include/10.0.16299.0/winrt:${VSPATH}/DIA SDK/include"
export LIB="${VSPATH}/VC/lib/x86:${VSPATH}/VC/atlmfc/lib/x86:${VSPATH}/SDK/Lib/10.0.16299.0/ucrt/x86:${VSPATH}/SDK/Lib/10.0.16299.0/um/x86:${VSPATH}/DIA SDK/lib"
fi
. $topsrcdir/build/mozconfig.vs-common
mk_export_correct_style WINDOWSSDKDIR
mk_export_correct_style WIN32_REDIST_DIR
mk_export_correct_style WIN_UCRT_REDIST_DIR
mk_export_correct_style PATH
mk_export_correct_style INCLUDE
mk_export_correct_style LIB

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

@ -0,0 +1,26 @@
if [ -z "${VSPATH}" ]; then
TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
VSPATH="$(cd ${TOOLTOOL_DIR} && pwd)/vs2017_15.4.1"
fi
if [ -d "${VSPATH}" ]; then
VSWINPATH="$(cd ${VSPATH} && pwd -W)"
export WINDOWSSDKDIR="${VSWINPATH}/SDK"
export WIN32_REDIST_DIR=${VSPATH}/VC/redist/x64/Microsoft.VC141.CRT
export WIN_UCRT_REDIST_DIR="${VSPATH}/SDK/Redist/ucrt/DLLs/x64"
export PATH="${VSPATH}/VC/bin/Hostx64/x64:${VSPATH}/SDK/bin/10.0.16299.0/x64:${VSPATH}/VC/redist/x64/Microsoft.VC141.CRT:${VSPATH}/SDK/Redist/ucrt/DLLs/x64:${VSPATH}/DIA SDK/bin/amd64:${PATH}"
export INCLUDE="${VSPATH}/VC/include:${VSPATH}/VC/atlmfc/include:${VSPATH}/SDK/Include/10.0.16299.0/ucrt:${VSPATH}/SDK/Include/10.0.16299.0/shared:${VSPATH}/SDK/Include/10.0.16299.0/um:${VSPATH}/SDK/Include/10.0.16299.0/winrt:${VSPATH}/DIA SDK/include"
export LIB="${VSPATH}/VC/lib/x64:${VSPATH}/VC/atlmfc/lib/x64:${VSPATH}/SDK/Lib/10.0.16299.0/ucrt/x64:${VSPATH}/SDK/Lib/10.0.16299.0/um/x64:${VSPATH}/DIA SDK/lib/amd64"
fi
. $topsrcdir/build/mozconfig.vs-common
mk_export_correct_style WINDOWSSDKDIR
mk_export_correct_style WIN32_REDIST_DIR
mk_export_correct_style WIN_UCRT_REDIST_DIR
mk_export_correct_style PATH
mk_export_correct_style INCLUDE
mk_export_correct_style LIB

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

@ -0,0 +1,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/. */
"use strict";
const { createEnum } = require("devtools/client/shared/enum");
createEnum([
], module.exports);

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

@ -0,0 +1,9 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
DevToolsModules(
'index.js',
)

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

@ -0,0 +1,26 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {
DOM: dom,
PureComponent,
} = require("devtools/client/shared/vendor/react");
class Flexbox extends PureComponent {
static get propTypes() {
return {};
}
render() {
return dom.div(
{
id: "layout-flexbox-container",
}
);
}
}
module.exports = Flexbox;

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

@ -0,0 +1,9 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
DevToolsModules(
'Flexbox.js',
)

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

@ -0,0 +1,23 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
class FlexboxInspector {
constructor(inspector, window) {
this.document = window.document;
this.inspector = inspector;
this.store = inspector.store;
}
destroy() {
this.document = null;
this.inspector = null;
this.store = null;
}
}
module.exports = FlexboxInspector;

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

@ -0,0 +1,16 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
DIRS += [
'actions',
'components',
'reducers',
]
DevToolsModules(
'flexbox.js',
'types.js',
)

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

@ -0,0 +1,19 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const INITIAL_FLEXBOXES = [];
let reducers = {
};
module.exports = function (flexboxes = INITIAL_FLEXBOXES, action) {
let reducer = reducers[action.type];
if (!reducer) {
return flexboxes;
}
return reducer(flexboxes, action);
};

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

@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
exports.flexboxes = require("./flexboxes");

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

@ -0,0 +1,10 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
DevToolsModules(
'flexboxes.js',
'index.js',
)

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

@ -0,0 +1,9 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
exports.flexbox = {
};

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

@ -15,6 +15,7 @@ const { connect } = require("devtools/client/shared/vendor/react-redux");
const { LocalizationHelper } = require("devtools/shared/l10n");
const BoxModel = createFactory(require("devtools/client/inspector/boxmodel/components/BoxModel"));
const Flexbox = createFactory(require("devtools/client/inspector/flexbox/components/Flexbox"));
const Grid = createFactory(require("devtools/client/inspector/grids/components/Grid"));
const BoxModelTypes = require("devtools/client/inspector/boxmodel/types");
@ -28,7 +29,10 @@ const BOXMODEL_L10N = new LocalizationHelper(BOXMODEL_STRINGS_URI);
const LAYOUT_STRINGS_URI = "devtools/client/locales/layout.properties";
const LAYOUT_L10N = new LocalizationHelper(LAYOUT_STRINGS_URI);
const FLEXBOX_ENABLED_PREF = "devtools.flexboxinspector.enabled";
const BOXMODEL_OPENED_PREF = "devtools.layout.boxmodel.opened";
const FLEXBOX_OPENED_PREF = "devtools.layout.flexbox.opened";
const GRID_OPENED_PREF = "devtools.layout.grid.opened";
class App extends PureComponent {
@ -52,34 +56,48 @@ class App extends PureComponent {
}
render() {
return dom.div(
let items = [
{
id: "layout-container",
component: Grid,
componentProps: this.props,
header: LAYOUT_L10N.getStr("layout.header"),
opened: Services.prefs.getBoolPref(GRID_OPENED_PREF),
onToggled: () => {
let opened = Services.prefs.getBoolPref(GRID_OPENED_PREF);
Services.prefs.setBoolPref(GRID_OPENED_PREF, !opened);
}
},
Accordion({
items: [
{
component: Grid,
componentProps: this.props,
header: LAYOUT_L10N.getStr("layout.header"),
opened: Services.prefs.getBoolPref(GRID_OPENED_PREF),
onToggled: () => {
let opened = Services.prefs.getBoolPref(GRID_OPENED_PREF);
Services.prefs.setBoolPref(GRID_OPENED_PREF, !opened);
}
},
{
component: BoxModel,
componentProps: this.props,
header: BOXMODEL_L10N.getStr("boxmodel.title"),
opened: Services.prefs.getBoolPref(BOXMODEL_OPENED_PREF),
onToggled: () => {
let opened = Services.prefs.getBoolPref(BOXMODEL_OPENED_PREF);
Services.prefs.setBoolPref(BOXMODEL_OPENED_PREF, !opened);
}
},
]
})
{
component: BoxModel,
componentProps: this.props,
header: BOXMODEL_L10N.getStr("boxmodel.title"),
opened: Services.prefs.getBoolPref(BOXMODEL_OPENED_PREF),
onToggled: () => {
let opened = Services.prefs.getBoolPref(BOXMODEL_OPENED_PREF);
Services.prefs.setBoolPref(BOXMODEL_OPENED_PREF, !opened);
}
},
];
if (Services.prefs.getBoolPref(FLEXBOX_ENABLED_PREF)) {
items = [
{
component: Flexbox,
componentProps: this.props,
header: LAYOUT_L10N.getStr("flexbox.header"),
opened: Services.prefs.getBoolPref(FLEXBOX_OPENED_PREF),
onToggled: () => {
let opened = Services.prefs.getBoolPref(FLEXBOX_OPENED_PREF);
Services.prefs.setBoolPref(FLEXBOX_OPENED_PREF, !opened);
}
},
...items
];
}
return dom.div(
{ id: "layout-container" },
Accordion({ items })
);
}
}

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

@ -13,6 +13,7 @@ const { LocalizationHelper } = require("devtools/shared/l10n");
const INSPECTOR_L10N =
new LocalizationHelper("devtools/client/locales/inspector.properties");
loader.lazyRequireGetter(this, "FlexboxInspector", "devtools/client/inspector/flexbox/flexbox");
loader.lazyRequireGetter(this, "GridInspector", "devtools/client/inspector/grids/grid-inspector");
function LayoutView(inspector, window) {

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

@ -7,6 +7,7 @@ DIRS += [
'components',
'computed',
'extensions',
'flexbox',
'fonts',
'grids',
'layout',

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

@ -9,6 +9,7 @@
exports.boxModel = require("devtools/client/inspector/boxmodel/reducers/box-model");
exports.extensionsSidebar = require("devtools/client/inspector/extensions/reducers/sidebar");
exports.flexboxes = require("devtools/client/inspector/flexbox/reducers/flexboxes");
exports.fontOptions = require("devtools/client/inspector/fonts/reducers/font-options");
exports.fonts = require("devtools/client/inspector/fonts/reducers/fonts");
exports.grids = require("devtools/client/inspector/grids/reducers/grids");

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

@ -5,6 +5,9 @@
# LOCALIZATION NOTE This file contains the Layout Inspector strings.
# The Layout Inspector is a panel accessible in the Inspector sidebar.
# LOCALIZATION NOTE (flexbox.header): The accordion header for the Flexbox pane.
flexbox.header=Flexbox
# LOCALIZATION NOTE (layout.cannotShowGridOutline, layout.cannotSHowGridOutline.title):
# In the case where the grid outline cannot be effectively displayed.
layout.cannotShowGridOutline=Cannot show outline for this grid

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

@ -61,6 +61,9 @@ pref("devtools.inspector.colorWidget.enabled", false);
// Enable the CSS shapes highlighter
pref("devtools.inspector.shapesHighlighter.enabled", true);
// Enable the Flexbox Inspector
pref("devtools.flexboxinspector.enabled", false);
// Grid highlighter preferences
pref("devtools.gridinspector.gridOutlineMaxColumns", 50);
pref("devtools.gridinspector.gridOutlineMaxRows", 50);
@ -73,6 +76,8 @@ pref("devtools.gridinspector.showNegativeLineNumbers", false);
pref("devtools.computed.boxmodel.opened", true);
// Whether or not the box model panel is opened in the layout view
pref("devtools.layout.boxmodel.opened", true);
// Whether or not the flexbox panel is opened in the layout view
pref("devtools.layout.flexbox.opened", true);
// Whether or not the grid inspector panel is opened in the layout view
pref("devtools.layout.grid.opened", true);

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

@ -13,6 +13,7 @@ const { AppConstants } = devtools.require("resource://gre/modules/AppConstants.j
const BROWSER_BASED_DIRS = [
"resource://devtools/client/inspector/boxmodel",
"resource://devtools/client/inspector/computed",
"resource://devtools/client/inspector/flexbox",
"resource://devtools/client/inspector/fonts",
"resource://devtools/client/inspector/grids",
"resource://devtools/client/inspector/layout",

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

@ -73,7 +73,6 @@ const ErrorDocs = {
JSMSG_GETTER_ONLY: "Getter_only",
JSMSG_INVALID_DATE: "Invalid_date",
JSMSG_DEPRECATED_STRING_METHOD: "Deprecated_String_generics",
JSMSG_DEPRECATED_TOLOCALEFORMAT: "Deprecated_toLocaleFormat",
JSMSG_RESERVED_ID: "Reserved_identifier",
JSMSG_BAD_CONST_ASSIGN: "Invalid_const_assignment",
JSMSG_BAD_CONST_DECL: "Missing_initializer_in_const",

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

@ -500,8 +500,6 @@ ShadowRoot::AttributeChanged(nsIDocument* aDocument,
}
// Attributes may change insertion point matching, find its new distribution.
//
// FIXME(emilio): What about state changes?
if (!RedistributeElement(aElement)) {
return;
}

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

@ -4360,12 +4360,12 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess
virtual void DrawText(nscoord aXOffset, nscoord aWidth)
{
gfxPoint point = mPt;
gfx::Point point = mPt;
bool rtl = mTextRun->IsRightToLeft();
bool verticalRun = mTextRun->IsVertical();
RefPtr<gfxPattern> pattern;
gfxFloat& inlineCoord = verticalRun ? point.y : point.x;
float& inlineCoord = verticalRun ? point.y : point.x;
inlineCoord += aXOffset;
// offset is given in terms of left side of string
@ -4475,7 +4475,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess
CanvasRenderingContext2D* mCtx;
// position of the left side of the string, alphabetic baseline
gfxPoint mPt;
gfx::Point mPt;
// current font
gfxFontGroup* mFontgrp;
@ -4590,7 +4590,7 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
: gfx::ShapedTextFlags();
GetAppUnitsValues(&processor.mAppUnitsPerDevPixel, nullptr);
processor.mPt = gfxPoint(aX, aY);
processor.mPt = gfx::Point(aX, aY);
processor.mDrawTarget =
gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
@ -4697,7 +4697,7 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
// correct bounding box to get it to be the correct size/position
processor.mBoundingBox.width = totalWidth;
processor.mBoundingBox.MoveBy(processor.mPt);
processor.mBoundingBox.MoveBy(gfxPoint(processor.mPt.x, processor.mPt.y));
processor.mPt.x *= processor.mAppUnitsPerDevPixel;
processor.mPt.y *= processor.mAppUnitsPerDevPixel;

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

@ -364,7 +364,7 @@ nsFontMetrics::DrawString(const char *aString, uint32_t aLength,
if (!textRun.get()) {
return;
}
gfxPoint pt(aX, aY);
gfx::Point pt(aX, aY);
Range range(0, aLength);
if (mTextRunRTL) {
if (mVertical) {
@ -392,7 +392,7 @@ nsFontMetrics::DrawString(const char16_t* aString, uint32_t aLength,
if (!textRun.get()) {
return;
}
gfxPoint pt(aX, aY);
gfx::Point pt(aX, aY);
Range range(0, aLength);
if (mTextRunRTL) {
if (mVertical) {

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

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
function boom() {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
ctx.arc(32, 2, 64, 512, 1024, false);
ctx.scale(256, 16);
ctx.transform(32, 64, 16, 256, 0.5000140400370615, -0.6268189185361422);
ctx.scale(2, 0.33614443599622335);
ctx.transform(16, -64, 512, 0.5546715728833042, 4, -0.09260164319830985);
ctx.isPointInStroke(1024, 2048);
}
</script>
</head>
<body onload="boom();"></body>
</html>

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

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
function boom() {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
ctx.scale(49572022, 5988146080);
ctx.rotate(243.375);
ctx.transform(55.3, 963, 130.57142857142858, 26, 48.4, 13.666666666666666);
ctx.lineWidth = 212.5;
ctx.strokeText("abcdefghijklmnopqrstuvw", 0, 0, 329.3333333333333);
}
</script>
</head>
<body onload="boom();"></body>
</html>

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

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
function boom() {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
ctx.scale(2, 0);
ctx.fillText("AB", 0, 0, 1);
}
</script>
</head>
<body onload="boom();"></body>
</html>

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

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
function boom() {
var canvasA = document.createElement('canvas');
var ctxA = (canvasA.getContext('2d'));
var canvasB = document.createElement('canvas');
var ctxB = (canvasB.getContext('2d'));
var canvasC = document.createElement('canvas');
var ctxC = (canvasC.getContext('2d'));
var canvasD = document.createElement('canvas');
document.body.appendChild(canvasD);
var ctxD = (canvasD.getContext('2d'));
ctxB.setTransform(0.11269837969744075, 0.5254615427752635, 0.2, 4, 0.8446743569440848, 0.144);
ctxB.strokeText("DDDD",2,16);
ctxC.setTransform(8,0.10555935723370857,-2,0.35743616669379086,8,0.6599638731358489);
ctxC.strokeText("CCCC",0.309,0.7226920560287992);
ctxD.setTransform(-6, -0.40335219665508537, -32, -16, 8, 0.06330341125449711);
ctxD.fillText("AAAAAAAA",0.749783522856837,3);
setTimeout(function() {
canvasC.height = 400;
setTimeout(function() {
ctxA.setTransform(-0.2578973174095154, 0, 8, -41.83665466308594, 4.02983283996582, 1041.4510498046875);
ctxA.fillText("AA",16,0.417);
ctxC.setTransform(0.22722245734818802, 0.04656468332897981, 8, 8, 2, 256);
ctxC.strokeText("QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ",2048,-0.903);
}, 0);
}, 0);
}
</script>
</head>
<body onload="boom();"></body>
</html>

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

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
function boom() {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
ctx.shadowBlur = 1024;
ctx.shadowColor = "red"
ctx.transform(16384,-0.6842606067657471,32768,-1.0760749578475952,2048,-1.9289406538009644);
ctx.strokeText("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",0.691153419364978,0.7370920539221475);
}
</script>
</head>
<body onload="boom();"></body>
</html>

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

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
function boom() {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
ctx.setTransform(0.1393438068077303, 0.25634277175561127, 512, 32, 0.5548660053300825, 8);
ctx.transform(16, 1024, -0.958697722982312, 6, 32, 256);
ctx.fillRect(0.20365260220217812, -0.8620547922006936, 1, 0.6929549739446852);
}
</script>
</head>
<body onload="boom();"></body>
</html>

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

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var ctx = document.querySelector("canvas").getContext('2d');
ctx.lineTo(0, 3);
ctx.moveTo(0, 1);
ctx.isPointInPath(0, 2);
}
</script>
</head>
<body onload="boom();"><canvas width="100" height="100"></canvas></body>
</html>

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

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var ctx = document.querySelector("canvas").getContext('2d');
ctx.scale(69.25, 61);
ctx.transform(87.875, 89.5, 317.6666666666667, 86.5, 93, 196);
ctx.bezierCurveTo(30.142857142857142, 13926147670, 66.66666666666667, 243.66666666666666, 42.6, 85.5);
ctx.arc(1.6, 364955956612165500, 110.375, 15.1, 80.55555555555556, 0);
ctx.shadowColor = "green";
ctx.shadowOffsetY = 754;
ctx.lineJoin = 'round';
ctx.setTransform(95.125, 11, 834, 34.5, 265.3333333333333, 26.4);
ctx.stroke();
}
</script>
</head>
<body onload="boom();"><canvas width="100" height="100"></canvas></body>
</html>

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

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var ctx = document.querySelector("canvas").getContext('2d');
ctx.arc(112.75, 22.8, 10.142857142857142, 20.5, 196, 1);
ctx.translate(48.22222222222222, 18.25);
ctx.lineTo(7, 50);
ctx.scale(445, 24.22222222222222);
ctx.stroke();
ctx.stroke();
}
</script>
</head>
<body onload="boom();"><canvas width="100" height="100"></canvas></body>
</html>

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

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var ctx = document.querySelector("canvas").getContext('2d');
ctx.rotate(108);
ctx.shadowBlur = 220.75;
ctx.shadowColor = "#777777";
ctx.bezierCurveTo(450, 24.857142857142858, 191, 75.71428571428571, -1125899906842623, 0);
ctx.transform(843, 152.66666666666666, 42.7, 65.33333333333333, 86.66666666666667, 30.714285714285715);
ctx.transform(204, 112.5, 159, 96.75, 239.33333333333334, 0);
ctx.bezierCurveTo(42.4, 96.44444444444444, 480.5, 185.5, 44.666666666666664, 90.14285714285714);
ctx.isPointInPath(71.5, 81);
ctx.fill();
}
</script>
</head>
<body onload="boom();"><canvas width="100" height="100"></canvas></body>
</html>

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

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var ctx = document.querySelector("canvas").getContext('2d');
ctx.setTransform(75.875, 113.8, 144, 55, 185.4, 310);
ctx.translate(26.5, 72.6);
ctx.arcTo(183.6, 29.6, 94.33333333333333, 1, 72057594037927940);
ctx.arcTo(75.83333333333333, 73.71428571428571, 40.4, 88.8, 23.285714285714285);
ctx.fill();
}
</script>
</head>
<body onload="boom();"><canvas width="100" height="100"></canvas></body>
</html>

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

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var ctx = document.querySelector("canvas").getContext('2d');
ctx.rect(1, 2, 3, 4);
ctx.fill();
for (var i = 0; i < 48; ++i) {
ctx.scale(100, 100);
}
ctx.isPointInPath(5, 6);
}
</script>
</head>
<body onload="boom();"><canvas width="100" height="100"></canvas></body>
</html>

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

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var ctx = document.querySelector("canvas").getContext('2d');
ctx.rotate(17);
ctx.closePath();
ctx.setTransform(107, 16, 113, 76, 0, 165);
ctx.lineTo(4, 0);
ctx.arc(104, -8191, 35, 50, 359, 0);
ctx.scale(74.75, 729);
ctx.stroke();
ctx.stroke();
ctx.lineTo(-1, 40);
ctx.isPointInPath(92, 463);
ctx.clip();
}
</script>
</head>
<body onload="boom();"><canvas width="100" height="100"></canvas></body>
</html>

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

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var ctx = document.querySelector("canvas").getContext('2d');
ctx.strokeRect(0.5, 1, 2, 3);
}
</script>
</head>
<body onload="boom();"><canvas width="100" height="100"></canvas></body>
</html>

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

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var ctx = document.querySelector("canvas").getContext('2d');
ctx.rotate(470);
ctx.clearRect(71.5, -0.5, 666, 380);
}
</script>
</head>
<body onload="boom();"><canvas width="41700" height="500"></canvas></body>
</html>

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

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script>
function boom()
{
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
ctx.isPointInPath(7.5, 900);
ctx.setTransform(44.333333333333336, 61, 256.3333333333333, 135.8, 810, 200);
ctx.save();
ctx.bezierCurveTo(63, 91, 520, 83, 213.66666666666666, 384);
ctx.closePath();
ctx.bezierCurveTo(0.5, 83.16666666666667, 209, 276, 3.6, 453.5);
ctx.stroke();
ctx.restore();
ctx.isPointInStroke(0, 0);
ctx.setTransform(445, 33, 0, 403.5, 175.2, 49.4);
ctx.rotate(83.125);
ctx.transform(2097153, 477.5, 34.888888888888886, 63, 9.5, 914);
ctx.isPointInStroke(0, 0);
}
</script>
</head>
<body onload="boom();"></body>
</html>

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

@ -105,6 +105,15 @@ load 693143-1.html
load 696936-1.html
load 699563-1.html
load 710149-1.html
load 746491.html
load 746495.html
load 746497.html
load 746844.html
load 746847.html
load 746849.html
load 746866.html
load 747132.html
load 747302.html
load 766452-1.html
load 766452-2.html
load 768079-1.html
@ -122,6 +131,7 @@ load 893572-1.html
load 893572-2.html
load 893572-3.html
load 893572-4.html
load 895233.html
pref(layers.force-active,true) load 914457-1.html
load 944579.svg
load 944579.html
@ -133,7 +143,13 @@ load 1205900.html
load 1134549-1.svg
load balinese-letter-spacing.html
load 1216832-1.html
load 1221304.html
load 1225125-1.html
load 1228127.html
load 1229972.html
load 1242811.html
load 1242822.html
load 1248222.html
load 1278305.html
load 1308394.html
load 1317403-1.html # bug 1331533

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

@ -1585,6 +1585,8 @@ static AntialiasMode Get2DAAMode(gfxFont::AntialiasOption aAAOption) {
class GlyphBufferAzure
{
#define AUTO_BUFFER_SIZE (2048/sizeof(Glyph))
typedef mozilla::image::imgDrawingParams imgDrawingParams;
public:
@ -1592,42 +1594,66 @@ public:
const FontDrawParams& aFontParams)
: mRunParams(aRunParams)
, mFontParams(aFontParams)
, mBuffer(*mAutoBuffer.addr())
, mBufSize(AUTO_BUFFER_SIZE)
, mCapacity(0)
, mNumGlyphs(0)
{
}
~GlyphBufferAzure()
{
Flush(true); // flush any remaining buffered glyphs
if (mNumGlyphs > 0) {
Flush();
}
if (mBuffer != *mAutoBuffer.addr()) {
free(mBuffer);
}
}
void OutputGlyph(uint32_t aGlyphID, const gfxPoint& aPt)
// Ensure the buffer has enough space for aGlyphCount glyphs to be added.
// This MUST be called before OutputGlyph is used to actually store glyph
// records in the buffer. It may be called repeated to add further capacity
// in case we don't know up-front exactly what will be needed.
void AddCapacity(uint32_t aGlyphCount)
{
Glyph *glyph = AppendGlyph();
// See if the required capacity fits within the already-allocated space
if (mCapacity + aGlyphCount <= mBufSize) {
mCapacity += aGlyphCount;
return;
}
// We need to grow the buffer: determine a new size, allocate, and
// copy the existing data over if we didn't use realloc (which would
// do it automatically).
mBufSize = std::max(mCapacity + aGlyphCount, mBufSize * 2);
if (mBuffer == *mAutoBuffer.addr()) {
// switching from autobuffer to malloc, so we need to copy
mBuffer =
reinterpret_cast<Glyph*>(moz_xmalloc(mBufSize * sizeof(Glyph)));
std::memcpy(mBuffer, *mAutoBuffer.addr(),
mNumGlyphs * sizeof(Glyph));
} else {
mBuffer =
reinterpret_cast<Glyph*>(moz_xrealloc(mBuffer,
mBufSize * sizeof(Glyph)));
}
mCapacity += aGlyphCount;
}
void OutputGlyph(uint32_t aGlyphID, const gfx::Point& aPt)
{
// Check that AddCapacity has been used appropriately!
MOZ_ASSERT(mNumGlyphs < mCapacity);
Glyph* glyph = mBuffer + mNumGlyphs++;
glyph->mIndex = aGlyphID;
glyph->mPosition.x = aPt.x;
glyph->mPosition.y = aPt.y;
glyph->mPosition = mFontParams.matInv.TransformPoint(glyph->mPosition);
Flush(false); // this will flush only if the buffer is full
glyph->mPosition = mFontParams.matInv.TransformPoint(aPt);
}
const TextRunDrawParams& mRunParams;
const FontDrawParams& mFontParams;
private:
#define GLYPH_BUFFER_SIZE (2048/sizeof(Glyph))
Glyph* GlyphBuffer()
{
return *mGlyphBuffer.addr();
}
Glyph *AppendGlyph()
{
return &GlyphBuffer()[mNumGlyphs++];
}
static DrawMode
GetStrokeMode(DrawMode aMode)
{
@ -1635,24 +1661,15 @@ private:
DrawMode::GLYPH_STROKE_UNDERNEATH);
}
// Render the buffered glyphs to the draw target and clear the buffer.
// This actually flushes the glyphs only if the buffer is full, or if the
// aFinish parameter is true; otherwise it simply returns.
void Flush(bool aFinish)
// Render the buffered glyphs to the draw target.
void Flush()
{
// Ensure there's enough room for a glyph to be added to the buffer
if ((!aFinish && mNumGlyphs < GLYPH_BUFFER_SIZE) || !mNumGlyphs) {
return;
}
if (mRunParams.isRTL) {
Glyph *begin = &GlyphBuffer()[0];
Glyph *end = &GlyphBuffer()[mNumGlyphs];
std::reverse(begin, end);
std::reverse(mBuffer, mBuffer + mNumGlyphs);
}
gfx::GlyphBuffer buf;
buf.mGlyphs = GlyphBuffer();
buf.mGlyphs = mBuffer;
buf.mNumGlyphs = mNumGlyphs;
const gfxContext::AzureState &state = mRunParams.context->CurrentState();
@ -1781,8 +1798,6 @@ private:
mFontParams.scaledFont->CopyGlyphsToBuilder(
buf, mRunParams.context->mPathBuilder, &mat);
}
mNumGlyphs = 0;
}
void FlushStroke(gfx::GlyphBuffer& aBuf, const Pattern& aPattern)
@ -1794,12 +1809,52 @@ private:
mFontParams.renderingOptions);
}
// We use an "inline" buffer automatically allocated (on the stack) as part
// of the GlyphBufferAzure object to hold the glyphs in most cases, falling
// back to a separately-allocated heap buffer if the count of buffered
// glyphs gets too big.
//
// This is basically a rudimentary AutoTArray; so why not use AutoTArray
// itself?
//
// If we used an AutoTArray, we'd want to avoid using SetLength or
// AppendElements to allocate the space we actually need, because those
// methods would default-construct the new elements.
//
// Could we use SetCapacity to reserve the necessary buffer space without
// default-constructing all the Glyph records? No, because of a failure
// that could occur when we need to grow the buffer, which happens when we
// encounter a DetailedGlyph in the textrun that refers to a sequence of
// several real glyphs. At that point, we need to add some extra capacity
// to the buffer we initially allocated based on the length of the textrun
// range we're rendering.
//
// This buffer growth would work fine as long as it still fits within the
// array's inline buffer (we just use a bit more of it), or if the buffer
// was already heap-allocated (in which case AutoTArray will use realloc(),
// preserving its contents). But a problem will arise when the initial
// capacity we allocated (based on the length of the run) fits within the
// array's inline buffer, but subsequently we need to extend the buffer
// beyond the inline buffer size, so we reallocate to the heap. Because we
// haven't "officially" filled the array with SetLength or AppendElements,
// its mLength is still zero; as far as it's concerned the buffer is just
// uninitialized space, and when it switches to use a malloc'd buffer it
// won't copy the existing contents.
// Allocate space for a buffer of Glyph records, without initializing them.
AlignedStorage2<Glyph[GLYPH_BUFFER_SIZE]> mGlyphBuffer;
AlignedStorage2<Glyph[AUTO_BUFFER_SIZE]> mAutoBuffer;
unsigned int mNumGlyphs;
// Pointer to the buffer we're currently using -- initially mAutoBuffer,
// but may be changed to a malloc'd buffer, in which case that buffer must
// be free'd on destruction.
Glyph* mBuffer;
#undef GLYPH_BUFFER_SIZE
uint32_t mBufSize; // size of allocated buffer; capacity can grow to
// this before reallocation is needed
uint32_t mCapacity; // amount of buffer size reserved
uint32_t mNumGlyphs; // number of glyphs actually present in the buffer
#undef AUTO_BUFFER_SIZE
};
// Bug 674909. When synthetic bolding text by drawing twice, need to
@ -1829,214 +1884,219 @@ gfxFont::CalcXScale(DrawTarget* aDrawTarget)
return 1.0 / m;
}
// Draw an individual glyph at a specific location.
// *aPt is the glyph position in appUnits; it is converted to device
// coordinates (devPt) here.
void
gfxFont::DrawOneGlyph(uint32_t aGlyphID, double aAdvance, gfxPoint *aPt,
GlyphBufferAzure& aBuffer, bool *aEmittedGlyphs) const
{
const TextRunDrawParams& runParams(aBuffer.mRunParams);
const FontDrawParams& fontParams(aBuffer.mFontParams);
double glyphX, glyphY;
if (fontParams.isVerticalFont) {
glyphX = aPt->x;
if (runParams.isRTL) {
aPt->y -= aAdvance;
glyphY = aPt->y;
} else {
glyphY = aPt->y;
aPt->y += aAdvance;
}
} else {
glyphY = aPt->y;
if (runParams.isRTL) {
aPt->x -= aAdvance;
glyphX = aPt->x;
} else {
glyphX = aPt->x;
aPt->x += aAdvance;
}
}
gfxPoint devPt(ToDeviceUnits(glyphX, runParams.devPerApp),
ToDeviceUnits(glyphY, runParams.devPerApp));
if (fontParams.haveSVGGlyphs) {
if (!runParams.paintSVGGlyphs) {
return;
}
NS_WARNING_ASSERTION(
runParams.drawMode != DrawMode::GLYPH_PATH,
"Rendering SVG glyph despite request for glyph path");
if (RenderSVGGlyph(runParams.context, devPt,
aGlyphID, fontParams.contextPaint,
runParams.callbacks, *aEmittedGlyphs)) {
return;
}
}
if (fontParams.haveColorGlyphs &&
RenderColorGlyph(runParams.dt, runParams.context,
fontParams.scaledFont, fontParams.renderingOptions,
fontParams.drawOptions,
fontParams.matInv.TransformPoint(gfx::Point(devPt.x, devPt.y)),
aGlyphID)) {
return;
}
aBuffer.OutputGlyph(aGlyphID, devPt);
// Synthetic bolding (if required) by multi-striking.
for (int32_t i = 0; i < fontParams.extraStrikes; ++i) {
if (fontParams.isVerticalFont) {
devPt.y += fontParams.synBoldOnePixelOffset;
} else {
devPt.x += fontParams.synBoldOnePixelOffset;
}
aBuffer.OutputGlyph(aGlyphID, devPt);
}
*aEmittedGlyphs = true;
}
// Draw a run of CharacterGlyph records from the given offset in aShapedText.
// Returns true if glyph paths were actually emitted.
template<gfxFont::FontComplexityT FC, gfxFont::SpacingT S>
bool
gfxFont::DrawGlyphs(const gfxShapedText *aShapedText,
uint32_t aOffset, // offset in the textrun
uint32_t aCount, // length of run to draw
gfxPoint *aPt,
const TextRunDrawParams& aRunParams,
const FontDrawParams& aFontParams)
gfxFont::DrawGlyphs(const gfxShapedText* aShapedText,
uint32_t aOffset, // offset in the textrun
uint32_t aCount, // length of run to draw
gfx::Point* aPt,
GlyphBufferAzure& aBuffer)
{
bool emittedGlyphs = false;
GlyphBufferAzure buffer(aRunParams, aFontParams);
gfxFloat& inlineCoord = aFontParams.isVerticalFont ? aPt->y : aPt->x;
if (aRunParams.spacing) {
inlineCoord += aRunParams.isRTL ? -aRunParams.spacing[0].mBefore
: aRunParams.spacing[0].mBefore;
}
float& inlineCoord = aBuffer.mFontParams.isVerticalFont ? aPt->y : aPt->x;
const gfxShapedText::CompressedGlyph *glyphData =
&aShapedText->GetCharacterGlyphs()[aOffset];
if (S == SpacingT::HasSpacing) {
float space = aBuffer.mRunParams.spacing[0].mBefore;
inlineCoord += aBuffer.mRunParams.isRTL ? - space : space;
}
// Allocate buffer space for the run, assuming all simple glyphs.
uint32_t capacityMult = 1 + aBuffer.mFontParams.extraStrikes;
aBuffer.AddCapacity(capacityMult * aCount);
bool emittedGlyphs = false;
for (uint32_t i = 0; i < aCount; ++i, ++glyphData) {
if (glyphData->IsSimpleGlyph()) {
DrawOneGlyph(glyphData->GetSimpleGlyph(),
glyphData->GetSimpleAdvance(),
aPt, buffer, &emittedGlyphs);
float advance = glyphData->GetSimpleAdvance();
if (aBuffer.mRunParams.isRTL) {
inlineCoord -= advance;
}
DrawOneGlyph<FC>(glyphData->GetSimpleGlyph(), *aPt, aBuffer,
&emittedGlyphs);
if (!aBuffer.mRunParams.isRTL) {
inlineCoord += advance;
}
} else {
uint32_t glyphCount = glyphData->GetGlyphCount();
if (glyphCount > 0) {
// Add extra buffer capacity to allow for multiple-glyph entry.
aBuffer.AddCapacity(capacityMult * (glyphCount - 1));
const gfxShapedText::DetailedGlyph *details =
aShapedText->GetDetailedGlyphs(aOffset + i);
NS_ASSERTION(details, "detailedGlyph should not be missing!");
MOZ_ASSERT(details, "missing DetailedGlyph!");
for (uint32_t j = 0; j < glyphCount; ++j, ++details) {
double advance = details->mAdvance;
float advance = details->mAdvance;
if (aBuffer.mRunParams.isRTL) {
inlineCoord -= advance;
}
if (glyphData->IsMissing()) {
// Default-ignorable chars will have zero advance width;
// we don't have to draw the hexbox for them.
if (aRunParams.drawMode != DrawMode::GLYPH_PATH &&
advance > 0) {
if (auto* textDrawer = aRunParams.context->GetTextDrawer()) {
textDrawer->FoundUnsupportedFeature();
return false;
}
double glyphX = aPt->x;
double glyphY = aPt->y;
if (aRunParams.isRTL) {
if (aFontParams.isVerticalFont) {
glyphY -= advance;
} else {
glyphX -= advance;
}
}
Point pt(Float(ToDeviceUnits(glyphX, aRunParams.devPerApp)),
Float(ToDeviceUnits(glyphY, aRunParams.devPerApp)));
Float advanceDevUnits =
Float(ToDeviceUnits(advance, aRunParams.devPerApp));
Float height = GetMetrics(eHorizontal).maxAscent;
Rect glyphRect = aFontParams.isVerticalFont ?
Rect(pt.x - height / 2, pt.y,
height, advanceDevUnits) :
Rect(pt.x, pt.y - height,
advanceDevUnits, height);
// If there's a fake-italic skew in effect as part
// of the drawTarget's transform, we need to remove
// this before drawing the hexbox. (Bug 983985)
Matrix oldMat;
if (aFontParams.passedInvMatrix) {
oldMat = aRunParams.dt->GetTransform();
aRunParams.dt->SetTransform(
*aFontParams.passedInvMatrix * oldMat);
}
gfxFontMissingGlyphs::DrawMissingGlyph(
details->mGlyphID, glyphRect, *aRunParams.dt,
PatternFromState(aRunParams.context),
aShapedText->GetAppUnitsPerDevUnit());
// Restore the matrix, if we modified it before
// drawing the hexbox.
if (aFontParams.passedInvMatrix) {
aRunParams.dt->SetTransform(oldMat);
}
if (!DrawMissingGlyph(aBuffer.mRunParams,
aBuffer.mFontParams,
details, *aPt)) {
return false;
}
} else {
gfxPoint glyphXY(*aPt);
if (aFontParams.isVerticalFont) {
glyphXY.x += details->mYOffset;
glyphXY.y += details->mXOffset;
gfx::Point glyphPt(*aPt);
if (aBuffer.mFontParams.isVerticalFont) {
glyphPt.x += details->mYOffset;
glyphPt.y += details->mXOffset;
} else {
glyphXY.x += details->mXOffset;
glyphXY.y += details->mYOffset;
glyphPt.x += details->mXOffset;
glyphPt.y += details->mYOffset;
}
DrawOneGlyph(details->mGlyphID, advance, &glyphXY,
buffer, &emittedGlyphs);
DrawOneGlyph<FC>(details->mGlyphID, glyphPt, aBuffer,
&emittedGlyphs);
}
if (!aBuffer.mRunParams.isRTL) {
inlineCoord += advance;
}
inlineCoord += aRunParams.isRTL ? -advance : advance;
}
}
}
if (aRunParams.spacing) {
double space = aRunParams.spacing[i].mAfter;
if (S == SpacingT::HasSpacing) {
float space = aBuffer.mRunParams.spacing[i].mAfter;
if (i + 1 < aCount) {
space += aRunParams.spacing[i + 1].mBefore;
space += aBuffer.mRunParams.spacing[i + 1].mBefore;
}
inlineCoord += aRunParams.isRTL ? -space : space;
inlineCoord += aBuffer.mRunParams.isRTL ? -space : space;
}
}
return emittedGlyphs;
}
// Draw an individual glyph at a specific location.
// *aPt is the glyph position in appUnits; it is converted to device
// coordinates (devPt) here.
template<gfxFont::FontComplexityT FC>
void
gfxFont::DrawOneGlyph(uint32_t aGlyphID, const gfx::Point& aPt,
GlyphBufferAzure& aBuffer, bool *aEmittedGlyphs) const
{
const TextRunDrawParams& runParams(aBuffer.mRunParams);
gfx::Point devPt(ToDeviceUnits(aPt.x, runParams.devPerApp),
ToDeviceUnits(aPt.y, runParams.devPerApp));
if (FC == FontComplexityT::ComplexFont) {
const FontDrawParams& fontParams(aBuffer.mFontParams);
if (fontParams.haveSVGGlyphs) {
if (!runParams.paintSVGGlyphs) {
return;
}
NS_WARNING_ASSERTION(
runParams.drawMode != DrawMode::GLYPH_PATH,
"Rendering SVG glyph despite request for glyph path");
if (RenderSVGGlyph(runParams.context, devPt,
aGlyphID, fontParams.contextPaint,
runParams.callbacks, *aEmittedGlyphs)) {
return;
}
}
if (fontParams.haveColorGlyphs &&
RenderColorGlyph(runParams.dt, runParams.context,
fontParams.scaledFont,
fontParams.renderingOptions,
fontParams.drawOptions,
fontParams.matInv.TransformPoint(devPt),
aGlyphID)) {
return;
}
}
aBuffer.OutputGlyph(aGlyphID, devPt);
if (FC == FontComplexityT::ComplexFont) {
const FontDrawParams& fontParams(aBuffer.mFontParams);
// Synthetic bolding (if required) by multi-striking.
for (int32_t i = 0; i < fontParams.extraStrikes; ++i) {
if (fontParams.isVerticalFont) {
devPt.y += fontParams.synBoldOnePixelOffset;
} else {
devPt.x += fontParams.synBoldOnePixelOffset;
}
aBuffer.OutputGlyph(aGlyphID, devPt);
}
}
*aEmittedGlyphs = true;
}
bool
gfxFont::DrawMissingGlyph(const TextRunDrawParams& aRunParams,
const FontDrawParams& aFontParams,
const gfxShapedText::DetailedGlyph* aDetails,
const gfx::Point& aPt)
{
// Default-ignorable chars will have zero advance width;
// we don't have to draw the hexbox for them.
float advance = aDetails->mAdvance;
if (aRunParams.drawMode != DrawMode::GLYPH_PATH && advance > 0) {
if (auto* textDrawer = aRunParams.context->GetTextDrawer()) {
textDrawer->FoundUnsupportedFeature();
return false;
}
Point pt(Float(ToDeviceUnits(aPt.x, aRunParams.devPerApp)),
Float(ToDeviceUnits(aPt.y, aRunParams.devPerApp)));
Float advanceDevUnits =
Float(ToDeviceUnits(advance, aRunParams.devPerApp));
Float height = GetMetrics(eHorizontal).maxAscent;
Rect glyphRect = aFontParams.isVerticalFont ?
Rect(pt.x - height / 2, pt.y,
height, advanceDevUnits) :
Rect(pt.x, pt.y - height,
advanceDevUnits, height);
// If there's a fake-italic skew in effect as part
// of the drawTarget's transform, we need to remove
// this before drawing the hexbox. (Bug 983985)
Matrix oldMat;
if (aFontParams.passedInvMatrix) {
oldMat = aRunParams.dt->GetTransform();
aRunParams.dt->SetTransform(
*aFontParams.passedInvMatrix * oldMat);
}
gfxFontMissingGlyphs::DrawMissingGlyph(
aDetails->mGlyphID, glyphRect, *aRunParams.dt,
PatternFromState(aRunParams.context),
1.0 / aRunParams.devPerApp);
// Restore the matrix, if we modified it before
// drawing the hexbox.
if (aFontParams.passedInvMatrix) {
aRunParams.dt->SetTransform(oldMat);
}
}
return true;
}
// This method is mostly parallel to DrawGlyphs.
void
gfxFont::DrawEmphasisMarks(const gfxTextRun* aShapedText, gfxPoint* aPt,
gfxFont::DrawEmphasisMarks(const gfxTextRun* aShapedText, gfx::Point* aPt,
uint32_t aOffset, uint32_t aCount,
const EmphasisMarkDrawParams& aParams)
{
gfxFloat& inlineCoord = aParams.isVertical ? aPt->y : aPt->x;
float& inlineCoord = aParams.isVertical ? aPt->y : aPt->x;
gfxTextRun::Range markRange(aParams.mark);
gfxTextRun::DrawParams params(aParams.context);
gfxFloat clusterStart = -std::numeric_limits<gfxFloat>::infinity();
float clusterStart = -std::numeric_limits<float>::infinity();
bool shouldDrawEmphasisMark = false;
for (uint32_t i = 0, idx = aOffset; i < aCount; ++i, ++idx) {
if (aParams.spacing) {
inlineCoord += aParams.direction * aParams.spacing[i].mBefore;
}
if (aShapedText->IsClusterStart(idx) ||
clusterStart == -std::numeric_limits<gfxFloat>::infinity()) {
clusterStart == -std::numeric_limits<float>::infinity()) {
clusterStart = inlineCoord;
}
if (aShapedText->CharMayHaveEmphasisMark(idx)) {
@ -2045,9 +2105,9 @@ gfxFont::DrawEmphasisMarks(const gfxTextRun* aShapedText, gfxPoint* aPt,
inlineCoord += aParams.direction * aShapedText->GetAdvanceForGlyph(idx);
if (shouldDrawEmphasisMark &&
(i + 1 == aCount || aShapedText->IsClusterStart(idx + 1))) {
gfxFloat clusterAdvance = inlineCoord - clusterStart;
float clusterAdvance = inlineCoord - clusterStart;
// Move the coord backward to get the needed start point.
gfxFloat delta = (clusterAdvance + aParams.advance) / 2;
float delta = (clusterAdvance + aParams.advance) / 2;
inlineCoord -= delta;
aParams.mark->Draw(markRange, *aPt, params);
inlineCoord += delta;
@ -2061,7 +2121,7 @@ gfxFont::DrawEmphasisMarks(const gfxTextRun* aShapedText, gfxPoint* aPt,
void
gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
gfxPoint *aPt, const TextRunDrawParams& aRunParams,
gfx::Point* aPt, const TextRunDrawParams& aRunParams,
gfx::ShapedTextFlags aOrientation)
{
NS_ASSERTION(aRunParams.drawMode == DrawMode::GLYPH_PATH ||
@ -2099,7 +2159,7 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
bool sideways = false;
gfxContextMatrixAutoSaveRestore matrixRestore;
gfxPoint origPt = *aPt;
gfx::Point origPt = *aPt;
if (aRunParams.isVerticalRun && !fontParams.isVerticalFont) {
if (textDrawer) {
@ -2221,16 +2281,51 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
}
}
gfxFloat& baseline = fontParams.isVerticalFont ? aPt->x : aPt->y;
gfxFloat origBaseline = baseline;
float& baseline = fontParams.isVerticalFont ? aPt->x : aPt->y;
float origBaseline = baseline;
if (mStyle.baselineOffset != 0.0) {
baseline +=
mStyle.baselineOffset * aTextRun->GetAppUnitsPerDevUnit();
}
bool emittedGlyphs =
DrawGlyphs(aTextRun, aStart, aEnd - aStart, aPt,
aRunParams, fontParams);
bool emittedGlyphs;
{
// Select appropriate version of the templated DrawGlyphs method
// to output glyphs to the buffer, depending on complexity needed
// for the type of font, and whether added inter-glyph spacing
// is specified.
GlyphBufferAzure buffer(aRunParams, fontParams);
if (fontParams.haveSVGGlyphs || fontParams.haveColorGlyphs ||
fontParams.extraStrikes) {
if (aRunParams.spacing) {
emittedGlyphs =
DrawGlyphs<FontComplexityT::ComplexFont,
SpacingT::HasSpacing>(aTextRun, aStart,
aEnd - aStart, aPt,
buffer);
} else {
emittedGlyphs =
DrawGlyphs<FontComplexityT::ComplexFont,
SpacingT::NoSpacing>(aTextRun, aStart,
aEnd - aStart, aPt,
buffer);
}
} else {
if (aRunParams.spacing) {
emittedGlyphs =
DrawGlyphs<FontComplexityT::SimpleFont,
SpacingT::HasSpacing>(aTextRun, aStart,
aEnd - aStart, aPt,
buffer);
} else {
emittedGlyphs =
DrawGlyphs<FontComplexityT::SimpleFont,
SpacingT::NoSpacing>(aTextRun, aStart,
aEnd - aStart, aPt,
buffer);
}
}
}
baseline = origBaseline;
@ -2243,18 +2338,18 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
if (sideways) {
// adjust updated aPt to account for the transform we were using
gfxFloat advance = aPt->x - origPt.x;
float advance = aPt->x - origPt.x;
if (aOrientation ==
gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT) {
*aPt = gfxPoint(origPt.x, origPt.y - advance);
*aPt = gfx::Point(origPt.x, origPt.y - advance);
} else {
*aPt = gfxPoint(origPt.x, origPt.y + advance);
*aPt = gfx::Point(origPt.x, origPt.y + advance);
}
}
}
bool
gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint,
gfxFont::RenderSVGGlyph(gfxContext *aContext, gfx::Point aPoint,
uint32_t aGlyphId, SVGContextPaint* aContextPaint) const
{
if (!GetFontEntry()->HasSVGGlyph(aGlyphId)) {
@ -2277,7 +2372,7 @@ gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint,
}
bool
gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint,
gfxFont::RenderSVGGlyph(gfxContext *aContext, gfx::Point aPoint,
uint32_t aGlyphId, SVGContextPaint* aContextPaint,
gfxTextRunDrawCallbacks *aCallbacks,
bool& aEmittedGlyphs) const

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

@ -1701,7 +1701,7 @@ public:
* -- all glyphs use this font
*/
void Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
gfxPoint *aPt, const TextRunDrawParams& aRunParams,
mozilla::gfx::Point* aPt, const TextRunDrawParams& aRunParams,
mozilla::gfx::ShapedTextFlags aOrientation);
/**
@ -1710,7 +1710,8 @@ public:
* @param aPt the baseline origin of the emphasis marks.
* @param aParams some drawing parameters, see EmphasisMarkDrawParams.
*/
void DrawEmphasisMarks(const gfxTextRun* aShapedText, gfxPoint* aPt,
void DrawEmphasisMarks(const gfxTextRun* aShapedText,
mozilla::gfx::Point* aPt,
uint32_t aOffset, uint32_t aCount,
const EmphasisMarkDrawParams& aParams);
@ -1951,25 +1952,43 @@ protected:
mozilla::UniquePtr<const Metrics> CreateVerticalMetrics();
// Output a single glyph at *aPt, which is updated by the glyph's advance.
// Normal glyphs are simply accumulated in aBuffer until it is full and
// gets flushed, but SVG or color-font glyphs will instead be rendered
// directly to the destination (found from the buffer's parameters).
void DrawOneGlyph(uint32_t aGlyphID,
double aAdvance,
gfxPoint *aPt,
GlyphBufferAzure& aBuffer,
bool *aEmittedGlyphs) const;
// Template parameters for DrawGlyphs/DrawOneGlyph, used to select
// simplified versions of the methods in the most common cases.
enum class FontComplexityT {
SimpleFont,
ComplexFont
};
enum class SpacingT {
NoSpacing,
HasSpacing
};
// Output a run of glyphs at *aPt, which is updated to follow the last glyph
// in the run. This method also takes account of any letter-spacing provided
// in aRunParams.
bool DrawGlyphs(const gfxShapedText *aShapedText,
uint32_t aOffset, // offset in the textrun
uint32_t aCount, // length of run to draw
gfxPoint *aPt,
const TextRunDrawParams& aRunParams,
const FontDrawParams& aFontParams);
template<FontComplexityT FC, SpacingT S>
bool DrawGlyphs(const gfxShapedText* aShapedText,
uint32_t aOffset, // offset in the textrun
uint32_t aCount, // length of run to draw
mozilla::gfx::Point* aPt,
GlyphBufferAzure& aBuffer);
// Output a single glyph at *aPt.
// Normal glyphs are simply accumulated in aBuffer until it is full and
// gets flushed, but SVG or color-font glyphs will instead be rendered
// directly to the destination (found from the buffer's parameters).
template<FontComplexityT FC>
void DrawOneGlyph(uint32_t aGlyphID,
const mozilla::gfx::Point& aPt,
GlyphBufferAzure& aBuffer,
bool* aEmittedGlyphs) const;
// Helper for DrawOneGlyph to handle missing glyphs, rendering either
// nothing (for default-ignorables) or a missing-glyph hexbox.
bool DrawMissingGlyph(const TextRunDrawParams& aRunParams,
const FontDrawParams& aFontParams,
const gfxShapedText::DetailedGlyph* aDetails,
const mozilla::gfx::Point& aPt);
// set the font size and offset used for
// synthetic subscript/superscript glyphs
@ -2243,9 +2262,9 @@ protected:
// if this font has bad underline offset, aIsBadUnderlineFont should be true.
void SanitizeMetrics(Metrics *aMetrics, bool aIsBadUnderlineFont);
bool RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint,
bool RenderSVGGlyph(gfxContext *aContext, mozilla::gfx::Point aPoint,
uint32_t aGlyphId, SVGContextPaint* aContextPaint) const;
bool RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint,
bool RenderSVGGlyph(gfxContext *aContext, mozilla::gfx::Point aPoint,
uint32_t aGlyphId, SVGContextPaint* aContextPaint,
gfxTextRunDrawCallbacks *aCallbacks,
bool& aEmittedGlyphs) const;

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

@ -428,8 +428,8 @@ gfxTextRun::ShrinkToLigatureBoundaries(Range* aRange) const
}
void
gfxTextRun::DrawGlyphs(gfxFont *aFont, Range aRange, gfxPoint *aPt,
PropertyProvider *aProvider, Range aSpacingRange,
gfxTextRun::DrawGlyphs(gfxFont* aFont, Range aRange, gfx::Point* aPt,
PropertyProvider* aProvider, Range aSpacingRange,
TextRunDrawParams& aParams,
gfx::ShapedTextFlags aOrientation) const
{
@ -465,8 +465,8 @@ ClipPartialLigature(const gfxTextRun* aTextRun,
}
void
gfxTextRun::DrawPartialLigature(gfxFont *aFont, Range aRange,
gfxPoint *aPt, PropertyProvider *aProvider,
gfxTextRun::DrawPartialLigature(gfxFont* aFont, Range aRange,
gfx::Point* aPt, PropertyProvider* aProvider,
TextRunDrawParams& aParams,
gfx::ShapedTextFlags aOrientation) const
{
@ -507,11 +507,11 @@ gfxTextRun::DrawPartialLigature(gfxFont *aFont, Range aRange,
aParams.context->Clip(clipRect);
}
gfxPoint pt;
gfx::Point pt;
if (aParams.isVerticalRun) {
pt = gfxPoint(aPt->x, aPt->y - aParams.direction * data.mPartAdvance);
pt = Point(aPt->x, aPt->y - aParams.direction * data.mPartAdvance);
} else {
pt = gfxPoint(aPt->x - aParams.direction * data.mPartAdvance, aPt->y);
pt = Point(aPt->x - aParams.direction * data.mPartAdvance, aPt->y);
}
DrawGlyphs(aFont, data.mRange, &pt,
@ -600,7 +600,7 @@ struct MOZ_STACK_CLASS BufferAlphaColor {
};
void
gfxTextRun::Draw(Range aRange, gfxPoint aPt, const DrawParams& aParams) const
gfxTextRun::Draw(Range aRange, gfx::Point aPt, const DrawParams& aParams) const
{
NS_ASSERTION(aRange.end <= GetLength(), "Substring out of range");
NS_ASSERTION(aParams.drawMode == DrawMode::GLYPH_PATH ||
@ -655,7 +655,7 @@ gfxTextRun::Draw(Range aRange, gfxPoint aPt, const DrawParams& aParams) const
metrics.mBoundingBox.MoveBy(gfxPoint(aPt.x - metrics.mAdvanceWidth,
aPt.y));
} else {
metrics.mBoundingBox.MoveBy(aPt);
metrics.mBoundingBox.MoveBy(gfxPoint(aPt.x, aPt.y));
}
syntheticBoldBuffer.PushSolidColor(metrics.mBoundingBox, currentColor,
GetAppUnitsPerDevUnit());
@ -695,7 +695,7 @@ gfxTextRun::Draw(Range aRange, gfxPoint aPt, const DrawParams& aParams) const
bool drawPartial = (aParams.drawMode & DrawMode::GLYPH_FILL) ||
(aParams.drawMode == DrawMode::GLYPH_PATH &&
aParams.callbacks);
gfxPoint origPt = aPt;
gfx::Point origPt = aPt;
if (drawPartial) {
DrawPartialLigature(font, Range(start, ligatureRange.start),
@ -734,7 +734,7 @@ gfxTextRun::Draw(Range aRange, gfxPoint aPt, const DrawParams& aParams) const
void
gfxTextRun::DrawEmphasisMarks(gfxContext *aContext,
gfxTextRun* aMark,
gfxFloat aMarkAdvance, gfxPoint aPt,
gfxFloat aMarkAdvance, gfx::Point aPt,
Range aRange, PropertyProvider* aProvider) const
{
MOZ_ASSERT(aRange.end <= GetLength());
@ -746,8 +746,8 @@ gfxTextRun::DrawEmphasisMarks(gfxContext *aContext,
params.direction = GetDirection();
params.isVertical = IsVertical();
gfxFloat& inlineCoord = params.isVertical ? aPt.y : aPt.x;
gfxFloat direction = params.direction;
float& inlineCoord = params.isVertical ? aPt.y : aPt.x;
float direction = params.direction;
GlyphRunIterator iter(this, aRange);
while (iter.NextRun()) {

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

@ -277,7 +277,8 @@ public:
* Glyphs should be drawn in logical content order, which can be significant
* if they overlap (perhaps due to negative spacing).
*/
void Draw(Range aRange, gfxPoint aPt, const DrawParams& aParams) const;
void Draw(Range aRange, mozilla::gfx::Point aPt,
const DrawParams& aParams) const;
/**
* Draws the emphasis marks for this text run. Uses only GetSpacing
@ -286,7 +287,7 @@ public:
*/
void DrawEmphasisMarks(gfxContext* aContext,
gfxTextRun* aMark,
gfxFloat aMarkAdvance, gfxPoint aPt,
gfxFloat aMarkAdvance, mozilla::gfx::Point aPt,
Range aRange, PropertyProvider* aProvider) const;
/**
@ -756,8 +757,9 @@ private:
PropertyProvider *aProvider) const;
gfxFloat ComputePartialLigatureWidth(Range aPartRange,
PropertyProvider *aProvider) const;
void DrawPartialLigature(gfxFont *aFont, Range aRange,
gfxPoint *aPt, PropertyProvider *aProvider,
void DrawPartialLigature(gfxFont* aFont, Range aRange,
mozilla::gfx::Point* aPt,
PropertyProvider* aProvider,
TextRunDrawParams& aParams,
mozilla::gfx::ShapedTextFlags aOrientation) const;
// Advance aRange.start to the start of the nearest ligature, back
@ -784,8 +786,8 @@ private:
Metrics *aMetrics) const;
// **** drawing helper ****
void DrawGlyphs(gfxFont *aFont, Range aRange, gfxPoint *aPt,
PropertyProvider *aProvider, Range aSpacingRange,
void DrawGlyphs(gfxFont* aFont, Range aRange, mozilla::gfx::Point* aPt,
PropertyProvider* aProvider, Range aSpacingRange,
TextRunDrawParams& aParams,
mozilla::gfx::ShapedTextFlags aOrientation) const;

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

@ -148,7 +148,6 @@ test("new Date()", d => justDontThrow(Date.prototype.toISOString.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toLocaleString.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toLocaleDateString.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toLocaleTimeString.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toLocaleFormat.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toTimeString.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toDateString.call(d)));
test("new Date()", d => justDontThrow(Date.prototype.toSource.call(d)));

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

@ -124,7 +124,6 @@ MSG_DEF(JSMSG_CANT_DECLARE_GLOBAL_BINDING, 2, JSEXN_TYPEERR, "cannot declare glo
// Date
MSG_DEF(JSMSG_INVALID_DATE, 0, JSEXN_RANGEERR, "invalid date")
MSG_DEF(JSMSG_BAD_TOISOSTRING_PROP, 0, JSEXN_TYPEERR, "toISOString property is not callable")
MSG_DEF(JSMSG_DEPRECATED_TOLOCALEFORMAT, 0, JSEXN_WARN, "Date.prototype.toLocaleFormat is deprecated; consider using Intl.DateTimeFormat instead")
// String
MSG_DEF(JSMSG_BAD_URI, 0, JSEXN_URIERR, "malformed URI sequence")

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

@ -55,7 +55,6 @@ JSCompartment::JSCompartment(Zone* zone, const JS::CompartmentOptions& options =
isAtomsCompartment_(false),
isSelfHosting(false),
marked(true),
warnedAboutDateToLocaleFormat(false),
warnedAboutExprClosure(false),
warnedAboutForEach(false),
warnedAboutLegacyGenerator(false),

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

@ -622,7 +622,6 @@ struct JSCompartment
public:
bool isSelfHosting;
bool marked;
bool warnedAboutDateToLocaleFormat : 1;
bool warnedAboutExprClosure : 1;
bool warnedAboutForEach : 1;
bool warnedAboutLegacyGenerator : 1;

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

@ -2733,6 +2733,7 @@ FormatDate(JSContext* cx, double utcTime, FormatSpec format, MutableHandleValue
return true;
}
#if !EXPOSE_INTL_API
static bool
ToLocaleFormatHelper(JSContext* cx, HandleObject obj, const char* format, MutableHandleValue rval)
{
@ -2778,7 +2779,7 @@ ToLocaleFormatHelper(JSContext* cx, HandleObject obj, const char* format, Mutabl
return true;
}
#if !EXPOSE_INTL_API
/* ES5 15.9.5.5. */
MOZ_ALWAYS_INLINE bool
date_toLocaleString_impl(JSContext* cx, const CallArgs& args)
@ -2849,56 +2850,6 @@ date_toLocaleTimeString(JSContext* cx, unsigned argc, Value* vp)
}
#endif /* !EXPOSE_INTL_API */
MOZ_ALWAYS_INLINE bool
date_toLocaleFormat_impl(JSContext* cx, const CallArgs& args)
{
Rooted<DateObject*> dateObj(cx, &args.thisv().toObject().as<DateObject>());
#if EXPOSE_INTL_API
if (!cx->compartment()->warnedAboutDateToLocaleFormat) {
if (!JS_ReportErrorFlagsAndNumberASCII(cx, JSREPORT_WARNING, GetErrorMessage, nullptr,
JSMSG_DEPRECATED_TOLOCALEFORMAT))
{
return false;
}
cx->compartment()->warnedAboutDateToLocaleFormat = true;
}
#endif
if (args.length() == 0) {
/*
* Use '%#c' for windows, because '%c' is backward-compatible and non-y2k
* with msvc; '%#c' requests that a full year be used in the result string.
*/
static const char format[] =
#if defined(_WIN32) && !defined(__MWERKS__)
"%#c"
#else
"%c"
#endif
;
return ToLocaleFormatHelper(cx, dateObj, format, args.rval());
}
RootedString fmt(cx, ToString<CanGC>(cx, args[0]));
if (!fmt)
return false;
JSAutoByteString fmtbytes(cx, fmt);
if (!fmtbytes)
return false;
return ToLocaleFormatHelper(cx, dateObj, fmtbytes.ptr(), args.rval());
}
static bool
date_toLocaleFormat(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
return CallNonGenericMethod<IsDate, date_toLocaleFormat_impl>(cx, args);
}
/* ES5 15.9.5.4. */
MOZ_ALWAYS_INLINE bool
date_toTimeString_impl(JSContext* cx, const CallArgs& args)
@ -3055,7 +3006,6 @@ static const JSFunctionSpec date_methods[] = {
JS_FN("setMilliseconds", date_setMilliseconds, 1,0),
JS_FN("setUTCMilliseconds", date_setUTCMilliseconds, 1,0),
JS_FN("toUTCString", date_toGMTString, 0,0),
JS_FN("toLocaleFormat", date_toLocaleFormat, 0,0),
#if EXPOSE_INTL_API
JS_SELF_HOSTED_FN(js_toLocaleString_str, "Date_toLocaleString", 0,0),
JS_SELF_HOSTED_FN("toLocaleDateString", "Date_toLocaleDateString", 0,0),

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

@ -34,8 +34,7 @@ var ClassToMethodMap =
"sup", "sub", "substr", "trimLeft", "trimRight", "toJSON"],
Boolean: ["toSource", "toJSON"],
Number: ["toSource", "toJSON"],
Date: ["toSource", "toLocaleFormat", "getYear", "setYear",
"toGMTString"],
Date: ["toSource", "getYear", "setYear", "toGMTString"],
RegExp: ["toSource"],
Error: ["toSource"],
};

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

@ -1,230 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//-----------------------------------------------------------------------------
var BUGNUMBER = 291494;
var summary = 'Date.prototype.toLocaleFormat extension';
var actual = '';
var expect = '';
var temp;
/*
* SpiderMonkey only.
*
* When the output of toLocaleFormat exceeds 100 bytes toLocaleFormat
* defaults to using toString to produce the result.
*/
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
var date = new Date("06/05/2005 00:00:00 GMT-0000");
expect = date.getTimezoneOffset() > 0 ? 'Sat' : 'Sun';
actual = date.toLocaleFormat('%a');
reportCompare(expect, actual, 'Date.toLocaleFormat("%a")');
expect = date.getTimezoneOffset() > 0 ? 'Saturday' : 'Sunday';
actual = date.toLocaleFormat('%A');
reportCompare(expect, actual, 'Date.toLocaleFormat("%A")');
expect = 'Jun';
actual = date.toLocaleFormat('%b');
reportCompare(expect, actual, 'Date.toLocaleFormat("%b")');
expect = 'June';
actual = date.toLocaleFormat('%B');
reportCompare(expect, actual, 'Date.toLocaleFormat("%B")');
expect = (date.getTimezoneOffset() > 0) ? '04' : '05';
actual = date.toLocaleFormat('%d');
reportCompare(expect, actual, 'Date.toLocaleFormat("%d")');
expect = '0';
actual = String((Number(date.toLocaleFormat('%H')) +
date.getTimezoneOffset()/60) % 24);
reportCompare(expect, actual, 'Date.toLocaleFormat(%H)');
expect = '12';
actual = String(Number(date.toLocaleFormat('%I')) +
date.getTimezoneOffset()/60);
reportCompare(expect, actual, 'Date.toLocaleFormat(%I)');
expect = String(155 + ((date.getTimezoneOffset() > 0) ? 0 : 1));
actual = date.toLocaleFormat('%j');
reportCompare(expect, actual, 'Date.toLocaleFormat("%j")');
expect = '06';
actual = date.toLocaleFormat('%m');
reportCompare(expect, actual, 'Date.toLocaleFormat("%m")');
expect = '00';
actual = date.toLocaleFormat('%M');
reportCompare(expect, actual, 'Date.toLocaleFormat("%M")');
expect = true;
temp = date.toLocaleFormat('%p');
actual = temp == 'AM' || date.toLocaleFormat('%p') == 'PM';
reportCompare(expect, actual, 'Date.toLocaleFormat("%p") is AM or PM');
expect = '00';
actual = date.toLocaleFormat('%S');
reportCompare(expect, actual, 'Date.toLocaleFormat("%S")');
expect = String(22 + ((date.getTimezoneOffset() > 0) ? 0 : 1));
actual = date.toLocaleFormat('%U');
reportCompare(expect, actual, 'Date.toLocaleFormat("%U")');
expect = String((6 + ((date.getTimezoneOffset() > 0) ? 0 : 1))%7);
actual = date.toLocaleFormat('%w');
reportCompare(expect, actual, 'Date.toLocaleFormat("%w")');
expect = '22';
actual = date.toLocaleFormat('%W');
reportCompare(expect, actual, 'Date.toLocaleFormat("%W")');
expect = '05';
actual = date.toLocaleFormat('%y');
reportCompare(expect, actual, 'Date.toLocaleFormat("%y")');
expect = '2005';
actual = date.toLocaleFormat('%Y');
reportCompare(expect, actual, 'Date.toLocaleFormat("%Y")');
expect = '%';
actual = date.toLocaleFormat('%%');
reportCompare(expect, actual, 'Date.toLocaleFormat("%%")');
expect = '1899 99';
temp='%Y %y';
actual = new Date(0, 0, 0, 13, 14, 15, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = '1899189918991899189918991899189918991899189918991899189918991899189918991899189918991899';
temp = '%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(0, 0, 0, 13, 14, 15, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = 'xxx189918991899189918991899189918991899189918991899189918991899189918991899189918991899189918991899';
temp = 'xxx%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(0, 0, 0, 13, 14, 15, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = new Date(0, 0, 0, 13, 14, 15, 0).toString();
temp = 'xxxx%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(0, 0, 0, 13, 14, 15, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = 'xxxx189918991899189918991899189918991899';
temp = 'xxxx%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(0, 0, 0, 13, 14, 15, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = '-51 49';
temp = '%Y %y';
actual = new Date(-51, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = '-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51';
temp = '%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(-51, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = 'xxx-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51-51';
temp = 'xxx%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(-51, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = new Date(-51, 0).toString();
temp = 'xxxx%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(-51, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = '1851 51';
temp = '%Y %y';
actual = new Date(1851, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = '1851185118511851185118511851185118511851185118511851185118511851185118511851185118511851';
temp = '%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(1851, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = 'xxx185118511851185118511851185118511851185118511851185118511851185118511851185118511851185118511851';
temp = 'xxx%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(1851, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = new Date(1851, 0).toString();
temp = 'xxxx%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(1851, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = '-1 99';
temp = '%Y %y';
actual = new Date(-1, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = '-100 00';
temp = '%Y %y';
actual = new Date(-100, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = '1900 00';
temp = '%Y %y';
actual = new Date(0, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = '1901 01';
temp = '%Y %y';
actual = new Date(1, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = '1970 70';
temp = '%Y %y';
actual = new Date(1970, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = new Date(32767, 0).toString();
temp = 'xxxx%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(32767, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = '32767327673276732767327673276732767327673276732767327673276732767327673276732767327673276732767';
temp = '%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(32767, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = 'xxxx32767327673276732767327673276732767327673276732767327673276732767327673276732767327673276732767';
temp = 'xxxx%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(32767, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = new Date(32767, 0).toString();
temp = 'xxxxx%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(32767, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = '-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999';
temp = '%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(-9999, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = 'xxxx-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999';
temp = 'xxxx%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(-9999, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');
expect = new Date(-9999, 0).toString();
temp = 'xxxx%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y%Y';
actual = new Date(-9999, 0).toLocaleFormat(temp);
reportCompare(expect, actual, 'Date.toLocaleFormat("'+temp+'")');

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

@ -1,105 +0,0 @@
// |reftest| skip-if(xulRuntime.OS=="WINNT")
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//-----------------------------------------------------------------------------
var BUGNUMBER = 291494;
var summary = 'Date.prototype.toLocaleFormat extension';
var actual = '';
var expect = '';
var temp;
/*
* SpiderMonkey only.
*
* This test uses format strings which are not supported cross
* platform and are expected to fail on at least some platforms
* however they all currently pass on Linux (Fedora Core 6). They are
* included here in order to increase coverage for cases where a crash
* may occur. These failures will be tracked in the
* mozilla/js/tests/public-failures.txt list.
*
*/
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
var date = new Date("06/05/2005 00:00:00 GMT-0000");
expect = '20';
actual = date.toLocaleFormat('%C');
reportCompare(expect, actual, 'Date.toLocaleFormat("%C")');
expect = date.toLocaleFormat('%C%y');
actual = date.toLocaleFormat('%Y');
reportCompare(expect, actual, 'Date.toLocaleFormat("%C%y") == ' +
'Date.toLocaleFormat("%Y")');
expect = date.toLocaleFormat('%m/%d/%y');
actual = date.toLocaleFormat('%D');
reportCompare(expect, actual, 'Date.toLocaleFormat("%m/%d/%y") == ' +
'Date.toLocaleFormat("%D")');
expect = (date.getTimezoneOffset() > 0) ? ' 4' : ' 5';
actual = date.toLocaleFormat('%e');
reportCompare(expect, actual, 'Date.toLocaleFormat("%e")');
expect = date.toLocaleFormat('%Y-%m-%d');
actual = date.toLocaleFormat('%F');
reportCompare(expect, actual, 'Date.toLocaleFormat("%Y-%m-%d") == ' +
'Date.toLocaleFormat("%F")');
expect = '05';
actual = date.toLocaleFormat('%g');
reportCompare(expect, actual, 'Date.toLocaleFormat("%g")');
expect = '2005';
actual = date.toLocaleFormat('%G');
reportCompare(expect, actual, 'Date.toLocaleFormat("%G")');
expect = date.toLocaleFormat('%b');
actual = date.toLocaleFormat('%h');
reportCompare(expect, actual, 'Date.toLocaleFormat("%b") == ' +
'Date.toLocaleFormat("%h")');
expect = '\n';
actual = date.toLocaleFormat('%n');
reportCompare(expect, actual, 'Date.toLocaleFormat("%n") == "\\n"');
expect = date.toLocaleFormat('%I:%M:%S %p');
actual = date.toLocaleFormat('%r');
reportCompare(expect, actual, 'Date.toLocaleFormat("%I:%M:%S %p") == ' +
'Date.toLocaleFormat("%r")');
expect = date.toLocaleFormat('%H:%M');
actual = date.toLocaleFormat('%R');
reportCompare(expect, actual, 'Date.toLocaleFormat("%H:%M") == ' +
'Date.toLocaleFormat("%R")');
expect = '\t';
actual = date.toLocaleFormat('%t');
reportCompare(expect, actual, 'Date.toLocaleFormat("%t") == "\\t"');
expect = date.toLocaleFormat('%H:%M:%S');
actual = date.toLocaleFormat('%T');
reportCompare(expect, actual, 'Date.toLocaleFormat("%H:%M:%S") == ' +
'Date.toLocaleFormat("%T")');
expect = String(6 + ((date.getTimezoneOffset() > 0) ? 0 : 1));
actual = date.toLocaleFormat('%u');
reportCompare(expect, actual, 'Date.toLocaleFormat("%u")');
expect = '22';
actual = date.toLocaleFormat('%V');
reportCompare(expect, actual, 'Date.toLocaleFormat("%V")');
print('Note: For Date.toLocaleFormat("%m/%d/%y") == Date.toLocaleFormat("%x") ' +
'to pass in Windows, the Regional Setting for the short date must be ' +
'set to mm/dd/yyyy');
expect = date.toLocaleFormat('%m/%d/%Y');
actual = date.toLocaleFormat('%x');
reportCompare(expect, actual, 'Date.toLocaleFormat("%m/%d/%Y") == ' +
'Date.toLocaleFormat("%x")');

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

@ -1,18 +0,0 @@
// |reftest| skip-if(!xulRuntime.shell||this.hasOwnProperty("Intl"))
/* 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/. */
// Don't warn about Date.prototype.toLocaleFormat() when Intl isn't supported.
enableLastWarning();
new Date().toLocaleFormat("%Y");
var warning = getLastWarning();
assertEq(warning, null, "warning shouldn't be emitted for toLocaleFormat");
disableLastWarning();
if (typeof reportCompare === 'function')
reportCompare(0, 0);

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

@ -1,28 +0,0 @@
// |reftest| skip-if(!xulRuntime.shell||!this.hasOwnProperty("Intl"))
/* 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/. */
// Warn once about Date.prototype.toLocaleFormat().
enableLastWarning();
new Date().toLocaleFormat("%Y");
var warning = getLastWarning();
assertEq(warning !== null, true, "warning should be emitted for toLocaleFormat");
assertEq(warning.name, "Warning");
assertEq(warning.message.indexOf("toLocaleFormat") !== -1, true,
"warning should mention toLocaleFormat");
clearLastWarning();
new Date().toLocaleFormat("%Y");
warning = getLastWarning();
assertEq(warning, null, "warning shouldn't be emitted for 2nd call to toLocaleFormat");
disableLastWarning();
if (typeof reportCompare === 'function')
reportCompare(0, 0);

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

@ -322,8 +322,6 @@ PRMJ_FormatTime(char* buf, int buflen, const char* fmt, PRMJTime* prtm)
* Note that FAKE_YEAR_BASE should be a multiple of 100 to make 2-digit
* year formats (%y) work correctly (since we won't find the fake year
* in that case).
* e.g. new Date(1873, 0).toLocaleFormat('%Y %y') => "1873 73"
* See bug 327869.
*/
#define FAKE_YEAR_BASE 9900
if (prtm->tm_year < 1900 || prtm->tm_year > 9999) {

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

@ -8,11 +8,8 @@
#include "jsapi.h"
#include "nsCollationCID.h"
#include "nsJSUtils.h"
#include "nsICollation.h"
#include "nsIObserver.h"
#include "nsNativeCharsetUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/CycleCollectedJSContext.h"
@ -76,11 +73,12 @@ struct XPCLocaleCallbacks : public JSLocaleCallbacks
// Disable the toLocaleUpper/Lower case hooks to use the standard,
// locale-insensitive definition from String.prototype. (These hooks are
// only consulted when EXPOSE_INTL_API is not set.)
// only consulted when EXPOSE_INTL_API is not set.) Since EXPOSE_INTL_API
// is always set, these hooks should be disabled.
localeToUpperCase = nullptr;
localeToLowerCase = nullptr;
localeCompare = LocaleCompare;
localeToUnicode = LocaleToUnicode;
localeCompare = nullptr;
localeToUnicode = nullptr;
// It's going to be retained by the ObserverService.
RefPtr<XPCLocaleObserver> locObs = new XPCLocaleObserver();
@ -93,15 +91,6 @@ struct XPCLocaleCallbacks : public JSLocaleCallbacks
MOZ_COUNT_DTOR(XPCLocaleCallbacks);
}
/**
* Return the XPCLocaleCallbacks from |cx|'s runtime (see below).
*/
static XPCLocaleCallbacks*
This(JSContext* cx)
{
return This(JS_GetRuntime(cx));
}
/**
* Return the XPCLocaleCallbacks that's hidden away in |rt|. (This impl uses
* the locale callbacks struct to store away its per-context data.)
@ -115,93 +104,20 @@ struct XPCLocaleCallbacks : public JSLocaleCallbacks
MOZ_ASSERT(lc);
MOZ_ASSERT(lc->localeToUpperCase == nullptr);
MOZ_ASSERT(lc->localeToLowerCase == nullptr);
MOZ_ASSERT(lc->localeCompare == LocaleCompare);
MOZ_ASSERT(lc->localeToUnicode == LocaleToUnicode);
MOZ_ASSERT(lc->localeCompare == nullptr);
MOZ_ASSERT(lc->localeToUnicode == nullptr);
const XPCLocaleCallbacks* ths = static_cast<const XPCLocaleCallbacks*>(lc);
ths->AssertThreadSafety();
return const_cast<XPCLocaleCallbacks*>(ths);
}
static bool
LocaleToUnicode(JSContext* cx, const char* src, MutableHandleValue rval)
{
return This(cx)->ToUnicode(cx, src, rval);
}
static bool
LocaleCompare(JSContext* cx, HandleString src1, HandleString src2, MutableHandleValue rval)
{
return This(cx)->Compare(cx, src1, src2, rval);
}
private:
bool
Compare(JSContext* cx, HandleString src1, HandleString src2, MutableHandleValue rval)
{
nsresult rv;
if (!mCollation) {
nsCOMPtr<nsICollationFactory> colFactory =
do_CreateInstance(NS_COLLATIONFACTORY_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = colFactory->CreateCollation(getter_AddRefs(mCollation));
}
if (NS_FAILED(rv)) {
xpc::Throw(cx, rv);
return false;
}
}
nsAutoJSString autoStr1, autoStr2;
if (!autoStr1.init(cx, src1) || !autoStr2.init(cx, src2)) {
return false;
}
int32_t result;
rv = mCollation->CompareString(nsICollation::kCollationStrengthDefault,
autoStr1, autoStr2, &result);
if (NS_FAILED(rv)) {
xpc::Throw(cx, rv);
return false;
}
rval.setInt32(result);
return true;
}
bool
ToUnicode(JSContext* cx, const char* src, MutableHandleValue rval)
{
// This code is only used by our prioprietary toLocaleFormat method
// and should be removed once we get rid of it.
// toLocaleFormat is used in non-ICU scenarios where we don't have
// access to any other date/time than the OS one, so we have to also
// use the OS locale for unicode conversions.
// See bug 1349470 for more details.
nsAutoString result;
NS_CopyNativeToUnicode(nsDependentCString(src), result);
JSString* ucstr =
JS_NewUCStringCopyN(cx, result.get(), result.Length());
if (ucstr) {
rval.setString(ucstr);
return true;
}
xpc::Throw(cx, NS_ERROR_OUT_OF_MEMORY);
return false;
}
void AssertThreadSafety() const
{
NS_ASSERT_OWNINGTHREAD(XPCLocaleCallbacks);
}
nsCOMPtr<nsICollation> mCollation;
NS_DECL_OWNINGTHREAD
};

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

@ -182,7 +182,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681
"setYear", "setFullYear", "setUTCFullYear", "setMonth", "setUTCMonth",
"setDate", "setUTCDate", "setHours", "setUTCHours", "setMinutes",
"setUTCMinutes", "setSeconds", "setUTCSeconds", "setMilliseconds",
"setUTCMilliseconds", "toUTCString", "toLocaleFormat", "toLocaleString",
"setUTCMilliseconds", "toUTCString", "toLocaleString",
"toLocaleDateString", "toLocaleTimeString", "toDateString", "toTimeString",
"toISOString", "toJSON", "toSource", "toString", "valueOf", "constructor",
"toGMTString", Symbol.toPrimitive];

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

@ -279,7 +279,7 @@ nsDisplayTextOverflowMarker::PaintTextToContext(gfxContext* aCtx,
if (textRun) {
NS_ASSERTION(!textRun->IsRightToLeft(),
"Ellipsis textruns should always be LTR!");
gfxPoint gfxPt(pt.x, pt.y);
gfx::Point gfxPt(pt.x, pt.y);
textRun->Draw(gfxTextRun::Range(textRun), gfxPt,
gfxTextRun::DrawParams(aCtx));
}

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

@ -5196,7 +5196,7 @@ nsDisplayText::RenderToContext(gfxContext* aCtx, nsDisplayListBuilder* aBuilder,
}
}
nsTextFrame::PaintTextParams params(aCtx);
params.framePt = gfxPoint(framePt.x, framePt.y);
params.framePt = gfx::Point(framePt.x, framePt.y);
params.dirtyRect = extraVisible;
if (aBuilder->IsForGenerateGlyphMask()) {
@ -6271,7 +6271,7 @@ nsTextFrame::PaintOneShadow(const PaintShadowParams& aParams,
{
AUTO_PROFILER_LABEL("nsTextFrame::PaintOneShadow", GRAPHICS);
gfxPoint shadowOffset(aShadowDetails->mXOffset, aShadowDetails->mYOffset);
gfx::Point shadowOffset(aShadowDetails->mXOffset, aShadowDetails->mYOffset);
nscoord blurRadius = std::max(aShadowDetails->mRadius, 0);
nscolor shadowColor = aShadowDetails->mHasColor ? aShadowDetails->mColor
@ -6312,7 +6312,7 @@ nsTextFrame::PaintOneShadow(const PaintShadowParams& aParams,
aBoundingBox + gfxPoint(aParams.framePt.x + aParams.leftSideOffset,
aParams.textBaselinePt.y);
}
shadowGfxRect += shadowOffset;
shadowGfxRect += gfxPoint(shadowOffset.x, shadowOffset.y);
nsRect shadowRect(NSToCoordRound(shadowGfxRect.X()),
NSToCoordRound(shadowGfxRect.Y()),
@ -6497,9 +6497,9 @@ nsTextFrame::PaintTextWithSelectionColors(
rangeStyle, &foreground, &background);
}
gfxPoint textBaselinePt = vertical ?
gfxPoint(aParams.textBaselinePt.x, aParams.framePt.y + iOffset) :
gfxPoint(aParams.framePt.x + iOffset, aParams.textBaselinePt.y);
gfx::Point textBaselinePt = vertical ?
gfx::Point(aParams.textBaselinePt.x, aParams.framePt.y + iOffset) :
gfx::Point(aParams.framePt.x + iOffset, aParams.textBaselinePt.y);
// Determine what shadow, if any, to draw - either from textStyle
// or from the ::-moz-selection pseudo-class if specified there
@ -6667,8 +6667,8 @@ nsTextFrame::PaintTextWithSelection(
void
nsTextFrame::DrawEmphasisMarks(gfxContext* aContext,
WritingMode aWM,
const gfxPoint& aTextBaselinePt,
const gfxPoint& aFramePt, Range aRange,
const gfx::Point& aTextBaselinePt,
const gfx::Point& aFramePt, Range aRange,
const nscolor* aDecorationOverrideColor,
PropertyProvider* aProvider)
{
@ -6681,7 +6681,7 @@ nsTextFrame::DrawEmphasisMarks(gfxContext* aContext,
nscolor color = aDecorationOverrideColor ? *aDecorationOverrideColor :
nsLayoutUtils::GetColor(this, &nsStyleText::mTextEmphasisColor);
aContext->SetColor(Color::FromABGR(color));
gfxPoint pt;
gfx::Point pt;
if (!isTextCombined) {
pt = aTextBaselinePt;
} else {
@ -6987,9 +6987,9 @@ nsTextFrame::PaintText(const PaintTextParams& aParams,
const bool reversed = mTextRun->IsInlineReversed();
const bool verticalRun = mTextRun->IsVertical();
WritingMode wm = GetWritingMode();
const gfxFloat frameWidth = GetSize().width;
const gfxFloat frameHeight = GetSize().height;
gfxPoint textBaselinePt;
const float frameWidth = GetSize().width;
const float frameHeight = GetSize().height;
gfx::Point textBaselinePt;
if (verticalRun) {
if (wm.IsVerticalLR()) {
textBaselinePt.x = nsLayoutUtils::GetSnappedBaselineX(
@ -7003,9 +7003,9 @@ nsTextFrame::PaintText(const PaintTextParams& aParams,
: aParams.framePt.y;
} else {
textBaselinePt =
gfxPoint(reversed ? aParams.framePt.x + frameWidth : aParams.framePt.x,
nsLayoutUtils::GetSnappedBaselineY(
this, aParams.context, aParams.framePt.y, mAscent));
gfx::Point(reversed ? aParams.framePt.x + frameWidth : aParams.framePt.x,
nsLayoutUtils::GetSnappedBaselineY(
this, aParams.context, aParams.framePt.y, mAscent));
}
Range range = ComputeTransformedRange(provider);
uint32_t startOffset = range.start;
@ -7100,7 +7100,7 @@ nsTextFrame::PaintText(const PaintTextParams& aParams,
static void
DrawTextRun(const gfxTextRun* aTextRun,
const gfxPoint& aTextBaselinePt,
const gfx::Point& aTextBaselinePt,
gfxTextRun::Range aRange,
const nsTextFrame::DrawTextRunParams& aParams)
{
@ -7141,7 +7141,7 @@ DrawTextRun(const gfxTextRun* aTextRun,
}
void
nsTextFrame::DrawTextRun(Range aRange, const gfxPoint& aTextBaselinePt,
nsTextFrame::DrawTextRun(Range aRange, const gfx::Point& aTextBaselinePt,
const DrawTextRunParams& aParams)
{
MOZ_ASSERT(aParams.advanceWidth, "Must provide advanceWidth");
@ -7156,14 +7156,14 @@ nsTextFrame::DrawTextRun(Range aRange, const gfxPoint& aTextBaselinePt,
if (hyphenTextRun) {
// For right-to-left text runs, the soft-hyphen is positioned at the left
// of the text, minus its own width
gfxFloat hyphenBaselineX = aTextBaselinePt.x +
float hyphenBaselineX = aTextBaselinePt.x +
mTextRun->GetDirection() * (*aParams.advanceWidth) -
(mTextRun->IsRightToLeft() ? hyphenTextRun->GetAdvanceWidth() : 0);
DrawTextRunParams params = aParams;
params.provider = nullptr;
params.advanceWidth = nullptr;
::DrawTextRun(hyphenTextRun.get(),
gfxPoint(hyphenBaselineX, aTextBaselinePt.y),
gfx::Point(hyphenBaselineX, aTextBaselinePt.y),
Range(hyphenTextRun.get()), params);
}
}
@ -7171,7 +7171,7 @@ nsTextFrame::DrawTextRun(Range aRange, const gfxPoint& aTextBaselinePt,
void
nsTextFrame::DrawTextRunAndDecorations(Range aRange,
const gfxPoint& aTextBaselinePt,
const gfx::Point& aTextBaselinePt,
const DrawTextParams& aParams,
const TextDecorations& aDecorations)
{
@ -7312,7 +7312,7 @@ nsTextFrame::DrawTextRunAndDecorations(Range aRange,
}
void
nsTextFrame::DrawText(Range aRange, const gfxPoint& aTextBaselinePt,
nsTextFrame::DrawText(Range aRange, const gfx::Point& aTextBaselinePt,
const DrawTextParams& aParams)
{
TextDecorations decorations;

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

@ -441,7 +441,7 @@ public:
struct PaintTextParams
{
gfxContext* context;
gfxPoint framePt;
mozilla::gfx::Point framePt;
LayoutDeviceRect dirtyRect;
mozilla::SVGContextPaint* contextPaint = nullptr;
DrawPathCallbacks* callbacks = nullptr;
@ -468,7 +468,7 @@ public:
struct PaintTextSelectionParams : PaintTextParams
{
gfxPoint textBaselinePt;
mozilla::gfx::Point textBaselinePt;
PropertyProvider* provider = nullptr;
Range contentRange;
nsTextPaintStyle* textPaintStyle = nullptr;
@ -495,7 +495,7 @@ public:
struct DrawTextParams : DrawTextRunParams
{
gfxPoint framePt;
mozilla::gfx::Point framePt;
LayoutDeviceRect dirtyRect;
const nsTextPaintStyle* textStyle = nullptr;
const nsCharClipDisplayItem::ClipEdges* clipEdges = nullptr;
@ -535,8 +535,8 @@ public:
void DrawEmphasisMarks(gfxContext* aContext,
mozilla::WritingMode aWM,
const gfxPoint& aTextBaselinePt,
const gfxPoint& aFramePt,
const mozilla::gfx::Point& aTextBaselinePt,
const mozilla::gfx::Point& aFramePt,
Range aRange,
const nscolor* aDecorationOverrideColor,
PropertyProvider* aProvider);
@ -703,8 +703,8 @@ protected:
{
gfxTextRun::Range range;
LayoutDeviceRect dirtyRect;
gfxPoint framePt;
gfxPoint textBaselinePt;
mozilla::gfx::Point framePt;
mozilla::gfx::Point textBaselinePt;
gfxContext* context;
nscolor foregroundColor = NS_RGBA(0, 0, 0, 0);
const nsCharClipDisplayItem::ClipEdges* clipEdges = nullptr;
@ -801,16 +801,16 @@ protected:
TextDecorations& aDecorations);
void DrawTextRun(Range aRange,
const gfxPoint& aTextBaselinePt,
const mozilla::gfx::Point& aTextBaselinePt,
const DrawTextRunParams& aParams);
void DrawTextRunAndDecorations(Range aRange,
const gfxPoint& aTextBaselinePt,
const mozilla::gfx::Point& aTextBaselinePt,
const DrawTextParams& aParams,
const TextDecorations& aDecorations);
void DrawText(Range aRange,
const gfxPoint& aTextBaselinePt,
const mozilla::gfx::Point& aTextBaselinePt,
const DrawTextParams& aParams);
// Set non empty rect to aRect, it should be overflow rect or frame rect.

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

@ -2079,7 +2079,8 @@ nsMathMLChar::PaintForeground(nsIFrame* aForFrame,
// draw a single glyph (base size or size variant)
// XXXfredw verify if mGlyphs[0] is non-null to workaround bug 973322.
if (mGlyphs[0]) {
mGlyphs[0]->Draw(Range(mGlyphs[0].get()), gfxPoint(0.0, mUnscaledAscent),
mGlyphs[0]->Draw(Range(mGlyphs[0].get()),
gfx::Point(0.0, mUnscaledAscent),
gfxTextRun::DrawParams(&aRenderingContext));
}
break;
@ -2237,7 +2238,7 @@ nsMathMLChar::PaintVertically(nsPresContext* aPresContext,
}
if (!clipRect.IsEmpty()) {
AutoPushClipRect clip(aThebesContext, oneDevPixel, clipRect);
mGlyphs[i]->Draw(Range(mGlyphs[i].get()), gfxPoint(dx, dy), params);
mGlyphs[i]->Draw(Range(mGlyphs[i].get()), gfx::Point(dx, dy), params);
}
}
}
@ -2303,7 +2304,7 @@ nsMathMLChar::PaintVertically(nsPresContext* aPresContext,
clipRect.height = std::min(bm.ascent + bm.descent, fillEnd - dy);
AutoPushClipRect clip(aThebesContext, oneDevPixel, clipRect);
dy += bm.ascent;
mGlyphs[3]->Draw(Range(mGlyphs[3].get()), gfxPoint(dx, dy), params);
mGlyphs[3]->Draw(Range(mGlyphs[3].get()), gfx::Point(dx, dy), params);
dy += bm.descent;
}
}
@ -2407,7 +2408,7 @@ nsMathMLChar::PaintHorizontally(nsPresContext* aPresContext,
}
if (!clipRect.IsEmpty()) {
AutoPushClipRect clip(aThebesContext, oneDevPixel, clipRect);
mGlyphs[i]->Draw(Range(mGlyphs[i].get()), gfxPoint(dx, dy), params);
mGlyphs[i]->Draw(Range(mGlyphs[i].get()), gfx::Point(dx, dy), params);
}
}
}
@ -2471,7 +2472,7 @@ nsMathMLChar::PaintHorizontally(nsPresContext* aPresContext,
clipRect.width = std::min(bm.rightBearing - bm.leftBearing, fillEnd - dx);
AutoPushClipRect clip(aThebesContext, oneDevPixel, clipRect);
dx -= bm.leftBearing;
mGlyphs[3]->Draw(Range(mGlyphs[3].get()), gfxPoint(dx, dy), params);
mGlyphs[3]->Draw(Range(mGlyphs[3].get()), gfx::Point(dx, dy), params);
dx += bm.rightBearing;
}
}

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

@ -0,0 +1,2 @@
<!doctype html>
<div style="background-color: blue; width: 100px; height: 100px; padding: 10px"></div>

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

@ -0,0 +1,17 @@
<!doctype html>
<div></div>
<script>
let setStyle = (el, props) => {
for (prop in props)
el.style.setProperty(prop, props[prop]);
};
setStyle(document.querySelector('div'), {
all: 'initial',
'background-color': 'blue',
display: 'block',
width: '100px',
height: '100px',
padding: '10px'
});
</script>

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

@ -2046,3 +2046,4 @@ needs-focus != 1377447-1.html 1377447-2.html
== 1404057.html 1404057-ref.html
!= 1404057.html 1404057-noref.html
== 1406183-1.html 1406183-1-ref.html
== 1410028.html 1410028-ref.html

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

@ -31,7 +31,7 @@ public:
NS_IMETHOD GetParentRule(nsIDOMCSSRule** aParent) final
{
*aParent = mRule;
NS_IF_ADDREF(*aParent = mRule);
return NS_OK;
}

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

@ -3691,7 +3691,7 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
if (drawMode != DrawMode(0)) {
bool paintSVGGlyphs;
nsTextFrame::PaintTextParams params(&aContext);
params.framePt = gfxPoint();
params.framePt = gfx::Point();
params.dirtyRect = LayoutDevicePixel::
FromAppUnits(frame->GetVisualOverflowRect(), auPerDevPx);
params.contextPaint = contextPaint;

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

@ -92,7 +92,7 @@ public:
CSFLogDebug(LOGTAG, "%s %p", __FUNCTION__, this);
}
void HandleOutput(Sample::Param aSample)
void HandleOutput(Sample::Param aSample) override
{
CSFLogDebug(LOGTAG, "%s %p", __FUNCTION__, this);
BufferInfo::LocalRef info = aSample->Info();

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

@ -35,7 +35,9 @@ function Prompt(aOptions) {
if (this.window) {
let window = getRootWindow(this.window);
var tab = window &&
let tab = window &&
window.document.documentElement
.getAttribute("windowtype") === "navigator:browser" &&
window.BrowserApp &&
window.BrowserApp.getTabForWindow(this.window);
if (tab) {

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

@ -5,4 +5,4 @@
from __future__ import absolute_import, print_function, unicode_literals
WINDOWS = 'win64-clang-cl'
LINUX = 'linux64-clang'
LINUX = 'linux64-clang-3.9'

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

@ -372,9 +372,9 @@ ARCHIVE_FILES = {
},
{
'source': buildconfig.topsrcdir,
'base': 'third_party/speedometer',
'base': 'third_party/webkit/PerformanceTests',
'pattern': '**',
'dest': 'talos/talos/tests/speedometer/',
'dest': 'talos/talos/tests/webkit/PerformanceTests/',
},
],
'awsy': [

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

@ -1 +1 @@
% http://localhost/tests/speedometer/index.html?gecko
% http://localhost/tests/webkit/PerformanceTests/Speedometer/index.html?gecko

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

@ -1,4 +1,5 @@
[SpeechSynthesis-speak-ownership.html]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1410248
[Using the same SpeechSynthesisUtterance with two SpeechSynthesis instances]
expected: FAIL

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

@ -0,0 +1,3 @@
[historical.html]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1410248

2
third_party/moz.build поставляемый
Просмотреть файл

@ -7,5 +7,5 @@ with Files('aom/**'):
with Files('rust/**'):
BUG_COMPONENT = ('Core', 'Build Config')
with Files('speedometer/**'):
with Files('webkit/**'):
BUG_COMPONENT = ('Core', 'Build Config')

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

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

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше