Merge mozilla-central to mozilla-inbound.

This commit is contained in:
Mihai Alexandru Michis 2019-08-21 06:51:22 +03:00
commit 248b072642
301 changed files with 5813 additions and 3270 deletions

View File

@ -54,7 +54,7 @@ static AtkObject* RefAccessibleAtPoint(AtkComponent* aComponent, gint aX,
static void GetExtents(AtkComponent* aComponent, gint* aX, gint* aY,
gint* aWidth, gint* aHeight, AtkCoordType aCoordType) {
*aX = *aY = *aWidth = *aHeight = 0;
*aX = *aY = *aWidth = *aHeight = -1;
if (!MAI_IS_ATK_SOCKET(aComponent)) return;

View File

@ -130,7 +130,7 @@ AtkObject* refAccessibleAtPointHelper(AtkObject* aAtkObj, gint aX, gint aY,
void getExtentsHelper(AtkObject* aAtkObj, gint* aX, gint* aY, gint* aWidth,
gint* aHeight, AtkCoordType aCoordType) {
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
*aX = *aY = *aWidth = *aHeight = 0;
*aX = *aY = *aWidth = *aHeight = -1;
if (accWrap) {
if (accWrap->IsDefunct()) {

View File

@ -22,7 +22,7 @@ const gchar* getDescriptionCB(AtkObject* aAtkObj);
static void getImagePositionCB(AtkImage* aImage, gint* aAccX, gint* aAccY,
AtkCoordType aCoordType) {
nsIntPoint pos;
nsIntPoint pos = nsIntPoint(-1, -1);
uint32_t geckoCoordType =
(aCoordType == ATK_XY_WINDOW)
? nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE
@ -46,7 +46,7 @@ static const gchar* getImageDescriptionCB(AtkImage* aImage) {
static void getImageSizeCB(AtkImage* aImage, gint* aAccWidth,
gint* aAccHeight) {
nsIntSize size;
nsIntSize size = nsIntSize(-1, -1);
AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImage));
if (accWrap && accWrap->IsImage()) {
size = accWrap->AsImage()->Size();

View File

@ -364,6 +364,7 @@ static void getCharacterExtentsCB(AtkText* aText, gint aOffset, gint* aX,
if (!aX || !aY || !aWidth || !aHeight) {
return;
}
*aX = *aY = *aWidth = *aHeight = -1;
nsIntRect rect;
uint32_t geckoCoordType;
@ -399,6 +400,7 @@ static void getRangeExtentsCB(AtkText* aText, gint aStartOffset,
if (!aRect) {
return;
}
aRect->x = aRect->y = aRect->width = aRect->height = -1;
nsIntRect rect;
uint32_t geckoCoordType;

View File

@ -23,11 +23,9 @@
testCSSAttrs("display_mozbox");
testCSSAttrs("display_mozinlinebox");
testCSSAttrs("display_mozgrid");
testCSSAttrs("display_mozinlinegrid");
testCSSAttrs("display_mozgridgroup");
testCSSAttrs("display_mozgridline");
testCSSAttrs("display_mozstack");
testCSSAttrs("display_mozinlinestack");
testCSSAttrs("display_mozdeck");
testCSSAttrs("display_mozpopup");
testCSSAttrs("display_mozgroupbox");
@ -58,11 +56,9 @@
<vbox id="display_mozbox" style="display: -moz-box;" role="img"/>
<vbox id="display_mozinlinebox" style="display: -moz-inline-box;" role="img"/>
<vbox id="display_mozgrid" style="display: -moz-grid;" role="img"/>
<vbox id="display_mozinlinegrid" style="display: -moz-inline-grid;" role="img"/>
<vbox id="display_mozgridgroup" style="display: -moz-grid-group;" role="img"/>
<vbox id="display_mozgridline" style="display: -moz-grid-line;" role="img"/>
<vbox id="display_mozstack" style="display: -moz-stack;" role="img"/>
<vbox id="display_mozinlinestack" style="display: -moz-inline-stack;" role="img"/>
<vbox id="display_mozdeck" style="display: -moz-deck;" role="img"/>
<vbox id="display_mozpopup" style="display: -moz-popup;" role="img"/>
<vbox id="display_mozgroupbox" style="display: -moz-groupbox;" role="img"/>

View File

@ -109,10 +109,7 @@ static mozilla::LauncherFlags ProcessCmdLine(int& aArgc, wchar_t* aArgv[]) {
result |= mozilla::LauncherFlags::eWaitForBrowser;
}
if (mozilla::CheckArg(
aArgc, aArgv, L"no-deelevate", static_cast<const wchar_t**>(nullptr),
mozilla::CheckArgFlag::CheckOSInt |
mozilla::CheckArgFlag::RemoveArg) == mozilla::ARG_FOUND) {
if (mozilla::CheckArg(aArgc, aArgv, L"no-deelevate") == mozilla::ARG_FOUND) {
result |= mozilla::LauncherFlags::eNoDeelevate;
}
@ -216,6 +213,8 @@ namespace mozilla {
Maybe<int> LauncherMain(int& argc, wchar_t* argv[],
const StaticXREAppData& aAppData) {
EnsureCommandlineSafe(argc, argv);
SetLauncherErrorAppData(aAppData);
if (CheckArg(argc, argv, L"log-launcher-error",

View File

@ -843,17 +843,16 @@ nsBrowserContentHandler.prototype = {
/* nsICommandLineValidator */
validate: function bch_validate(cmdLine) {
// Other handlers may use osint so only handle the osint flag if the url
// flag is also present and the command line is valid.
var osintFlagIdx = cmdLine.findFlag("osint", false);
var urlFlagIdx = cmdLine.findFlag("url", false);
if (
urlFlagIdx > -1 &&
(osintFlagIdx > -1 ||
cmdLine.state == Ci.nsICommandLine.STATE_REMOTE_EXPLICIT)
cmdLine.state == Ci.nsICommandLine.STATE_REMOTE_EXPLICIT
) {
var urlParam = cmdLine.getArgument(urlFlagIdx + 1);
if (cmdLine.length != urlFlagIdx + 2 || /firefoxurl:/i.test(urlParam)) {
if (
cmdLine.length != urlFlagIdx + 2 ||
/firefoxurl(-[a-f0-9]+)?:/i.test(urlParam)
) {
throw Cr.NS_ERROR_ABORT;
}
var isDefault = false;
@ -870,7 +869,6 @@ nsBrowserContentHandler.prototype = {
// We don't have to show the instruction page.
throw Cr.NS_ERROR_ABORT;
}
cmdLine.handleFlag("osint", false);
}
},
};

View File

@ -560,12 +560,6 @@ menuitem.bookmark-item {
}
}
#urlbar-input:-moz-lwtheme::placeholder,
.searchbar-textbox:-moz-lwtheme > moz-input-box > html|*.textbox-input::placeholder {
opacity: 1.0;
color: #777;
}
/* ::::: URL Bar Zoom Reset Button ::::: */
@keyframes urlbar-zoom-reset-pulse {
0% {

View File

@ -47,8 +47,8 @@ add_task(async () => {
info("Check the state of redux");
ok(
panelWin.dbg.store.getState().debuggee.isWebExtension,
"isWebExtension flag in debuggee is true"
panelWin.dbg.store.getState().threads.isWebExtension,
"isWebExtension flag in threads is true"
);
info("Check whether the element displays correctly");

View File

@ -1,4 +1,4 @@
{
module.exports = {
"parser": "babel-eslint",
"plugins": [
"react",
@ -43,7 +43,14 @@
"parserOptions": {
"ecmaVersion": 2016,
"sourceType": "module",
"ecmaFeatures": { "jsx": true }
"ecmaFeatures": { "jsx": true },
// When the linter runs from the MC root, it won't pick up this project's
// babel.config.js, so we explicitly set Babel's root location so that
// it knows where to look.
"babelOptions": {
"root": __dirname,
},
},
"env": {
"es6": true,

View File

@ -17148,8 +17148,6 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = createSimplePath;
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/* 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/>. */
@ -17170,14 +17168,6 @@ function createSimplePath(ancestors) {
*/
class SimplePath {
constructor(ancestors, index = ancestors.length - 1) {
_defineProperty(this, "_index", void 0);
_defineProperty(this, "_ancestors", void 0);
_defineProperty(this, "_ancestor", void 0);
_defineProperty(this, "_parentPath", void 0);
if (index < 0 || index >= ancestors.length) {
console.error(ancestors);
throw new Error("Created invalid path");

View File

@ -99,17 +99,17 @@
"main": "src/main.js",
"author": "Jason Laster <jlaster@mozilla.com>",
"devDependencies": {
"@sucrase/webpack-object-rest-spread-plugin": "^1.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-loader": "^8.0.6",
"babel-eslint": "^11.0.0-beta.0",
"babel-jest": "^23.0.0",
"@babel/plugin-transform-flow-strip-types": "^7.4.4",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-transform-flow-strip-types": "^7.4.4",
"@babel/plugin-transform-modules-commonjs": "^7.5.0",
"@babel/preset-env": "^7.5.5",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"@sucrase/webpack-object-rest-spread-plugin": "^1.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^11.0.0-beta.0",
"babel-jest": "^23.0.0",
"babel-loader": "^8.0.6",
"babel-plugin-module-resolver": "^3.2.0",
"chalk": "^2.1.0",
"copy-paste": "^1.3.0",
@ -119,7 +119,7 @@
"enzyme-adapter-react-16": "^1.14.0",
"enzyme-to-json": "3.3.5",
"eslint": "^5.0.0",
"eslint-config-prettier": "^4.0.0",
"eslint-config-prettier": "4.2.0",
"eslint-plugin-babel": "^5.0.0",
"eslint-plugin-file-header": "0.0.1",
"eslint-plugin-flowtype": "^3.0.0",
@ -127,7 +127,7 @@
"eslint-plugin-jest": "^21.15.1",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-mozilla": "1.2.1",
"eslint-plugin-prettier": "^3.0.0",
"eslint-plugin-prettier": "3.0.1",
"eslint-plugin-react": "^7.2.1",
"expect.js": "^0.3.1",
"flow-bin": "0.97.0",
@ -144,7 +144,7 @@
"mock-require": "^3.0.0",
"node-emoji": "^1.8.1",
"npm-run-all": "^4.0.2",
"prettier": "^1.12.1",
"prettier": "1.17.0",
"pretty-quick": "^1.4.1",
"remark-cli": "^6.0.0",
"remark-lint": "^6.0.1",

View File

@ -3,9 +3,6 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
const { LocalizationHelper } = require("devtools/shared/l10n");
const {
gDevToolsBrowser,
} = require("devtools/client/framework/devtools-browser");
loader.lazyRequireGetter(
this,
"openContentLink",
@ -79,10 +76,6 @@ DebuggerPanel.prototype = {
openContentLink(url);
},
openWorkerToolbox: function(workerTargetFront) {
return gDevToolsBrowser.openWorkerToolbox(workerTargetFront, "jsdebugger");
},
openConsoleAndEvaluate: async function(input) {
const { hud } = await this.toolbox.selectTool("webconsole");
hud.ui.wrapper.dispatchEvaluateExpression(input);

View File

@ -18,7 +18,7 @@ import * as sourceTree from "./source-tree";
import * as sources from "./sources";
import * as sourcesActors from "./source-actors";
import * as tabs from "./tabs";
import * as debuggee from "./debuggee";
import * as threads from "./threads";
import * as toolbox from "./toolbox";
import * as preview from "./preview";
@ -37,7 +37,7 @@ export default {
...projectTextSearch,
...quickOpen,
...sourceTree,
...debuggee,
...threads,
...toolbox,
...preview,
};

View File

@ -12,7 +12,6 @@ DIRS += [
]
CompiledModules(
'debuggee.js',
'event-listeners.js',
'expressions.js',
'file-search.js',
@ -25,5 +24,6 @@ CompiledModules(
'source-tree.js',
'tabs.js',
'toolbox.js',
'threads.js',
'ui.js',
)

View File

@ -7,7 +7,7 @@
import { clearDocuments } from "../utils/editor";
import sourceQueue from "../utils/source-queue";
import { updateThreads } from "./debuggee";
import { updateThreads } from "./threads";
import { clearWasmStates } from "../utils/wasm";
import { getMainThread } from "../selectors";

View File

@ -17,19 +17,19 @@ export function updateThreads() {
const currentThreads = getThreads(getState());
const addedThreads = differenceBy(threads, currentThreads, w => w.actor);
const removedThreads = differenceBy(currentThreads, threads, w => w.actor);
const addedThreads = differenceBy(threads, currentThreads, t => t.actor);
const removedThreads = differenceBy(currentThreads, threads, t => t.actor);
if (removedThreads.length > 0) {
const sourceActors = getSourceActorsForThread(
getState(),
removedThreads.map(w => w.actor)
removedThreads.map(t => t.actor)
);
dispatch(removeSourceActors(sourceActors));
dispatch(
({
type: "REMOVE_THREADS",
cx,
threads: removedThreads.map(w => w.actor),
threads: removedThreads.map(t => t.actor),
}: Action)
);
}

View File

@ -5,7 +5,7 @@
// @flow
import type { ThunkArgs } from "./types";
import type { Worker, Grip } from "../types";
import type { Grip } from "../types";
/**
* @memberof actions/toolbox
@ -17,12 +17,6 @@ export function openLink(url: string) {
};
}
export function openWorkerToolbox(worker: Worker) {
return async function({ getState, panel }: ThunkArgs) {
return panel.openWorkerToolbox(worker);
};
}
export function evaluateInConsole(inputString: string) {
return async ({ panel }: ThunkArgs) => {
return panel.openConsoleAndEvaluate(inputString);

View File

@ -1,37 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// @flow
import { setupCommands, clientCommands } from "./chrome/commands";
import { setupEvents, clientEvents, pageEvents } from "./chrome/events";
export async function onConnect(connection: any, actions: Object): Object {
const {
tabConnection,
connTarget: { type },
} = connection;
const { Debugger, Runtime, Page } = tabConnection;
Debugger.enable();
Debugger.setPauseOnExceptions({ state: "none" });
Debugger.setAsyncCallStackDepth({ maxDepth: 0 });
if (type == "chrome") {
Page.frameNavigated(pageEvents.frameNavigated);
Page.frameStartedLoading(pageEvents.frameStartedLoading);
Page.frameStoppedLoading(pageEvents.frameStoppedLoading);
}
Debugger.scriptParsed(clientEvents.scriptParsed);
Debugger.scriptFailedToParse(clientEvents.scriptFailedToParse);
Debugger.paused(clientEvents.paused);
Debugger.resumed(clientEvents.resumed);
setupCommands({ Debugger, Runtime, Page });
setupEvents({ actions, Page, type, Runtime });
return {};
}
export { clientCommands, clientEvents };

View File

@ -1,141 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// @flow
import {
toServerLocation,
fromServerLocation,
createLoadedObject,
} from "./create";
import type { SourceLocation } from "../../types";
import type { ServerLocation, Agents } from "./types";
type setBreakpointResponseType = {
breakpointId: string,
serverLocation?: ServerLocation,
};
let debuggerAgent;
let runtimeAgent;
let pageAgent;
function setupCommands({ Debugger, Runtime, Page }: Agents) {
debuggerAgent = Debugger;
runtimeAgent = Runtime;
pageAgent = Page;
}
function resume() {
return debuggerAgent.resume();
}
function stepIn() {
return debuggerAgent.stepInto();
}
function stepOver() {
return debuggerAgent.stepOver();
}
function stepOut() {
return debuggerAgent.stepOut();
}
function pauseOnExceptions(
shouldPauseOnExceptions: boolean,
shouldIgnoreCaughtExceptions: boolean
) {
if (!shouldPauseOnExceptions) {
return debuggerAgent.setPauseOnExceptions({ state: "none" });
}
const state = shouldIgnoreCaughtExceptions ? "uncaught" : "all";
return debuggerAgent.setPauseOnExceptions({ state });
}
function breakOnNext() {
return debuggerAgent.pause();
}
function sourceContents(sourceId: string) {
return debuggerAgent
.getScriptSource({ scriptId: sourceId })
.then(({ scriptSource }) => ({
source: scriptSource,
contentType: null,
}));
}
async function setBreakpoint(location: SourceLocation, condition: string) {
const {
breakpointId,
serverLocation,
}: setBreakpointResponseType = await debuggerAgent.setBreakpoint({
location: toServerLocation(location),
columnNumber: location.column,
});
const actualLocation = fromServerLocation(serverLocation) || location;
return {
id: breakpointId,
actualLocation: actualLocation,
};
}
function removeBreakpoint(breakpointId: string) {
return debuggerAgent.removeBreakpoint({ breakpointId });
}
async function getProperties(object: any) {
const { result } = await runtimeAgent.getProperties({
objectId: object.objectId,
});
const loadedObjects = result.map(createLoadedObject);
return { loadedObjects };
}
function evaluate(script: string) {
return runtimeAgent.evaluate({ expression: script });
}
function debuggeeCommand(script: string): Promise<void> {
evaluate(script);
return Promise.resolve();
}
function navigate(url: string) {
return pageAgent.navigate({ url });
}
function getBreakpointByLocation(location: SourceLocation) {}
function getFrameScopes() {}
function evaluateInFrame() {}
function evaluateExpressions() {}
const clientCommands = {
resume,
stepIn,
stepOut,
stepOver,
pauseOnExceptions,
breakOnNext,
sourceContents,
setBreakpoint,
removeBreakpoint,
evaluate,
debuggeeCommand,
navigate,
getProperties,
getBreakpointByLocation,
getFrameScopes,
evaluateInFrame,
evaluateExpressions,
};
export { setupCommands, clientCommands };

View File

@ -1,57 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// @flow
import type { ChromeFrame, SourceLocation, LoadedObject } from "../../types";
import type { ServerLocation } from "./types";
export function fromServerLocation(
serverLocation?: ServerLocation
): ?SourceLocation {
if (serverLocation) {
return {
sourceId: serverLocation.scriptId,
line: serverLocation.lineNumber + 1,
column: serverLocation.columnNumber,
sourceUrl: "",
};
}
}
export function toServerLocation(location: SourceLocation): ServerLocation {
return {
scriptId: location.sourceId,
lineNumber: location.line - 1,
};
}
export function createFrame(frame: any): ?ChromeFrame {
const location = fromServerLocation(frame.location);
if (!location) {
return null;
}
return {
id: frame.callFrameId,
displayName: frame.functionName,
scopeChain: frame.scopeChain,
generatedLocation: location,
location,
};
}
export function createLoadedObject(
serverObject: any,
parentId: string
): LoadedObject {
const { value, name } = serverObject;
return {
objectId: value.objectId,
parentId,
name,
value,
};
}

View File

@ -1,123 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// @flow
import { createFrame, createLoadedObject } from "./create";
import sourceQueue from "../../utils/source-queue";
let actions;
let pageAgent;
let clientType;
let runtimeAgent;
function setupEvents(dependencies: any) {
actions = dependencies.actions;
pageAgent = dependencies.Page;
clientType = dependencies.clientType;
runtimeAgent = dependencies.Runtime;
sourceQueue.initialize(actions);
}
// Debugger Events
function scriptParsed({
scriptId,
url,
startLine,
startColumn,
endLine,
endColumn,
executionContextId,
hash,
isContentScript,
isInternalScript,
isLiveEdit,
sourceMapURL,
hasSourceURL,
deprecatedCommentWasUsed,
}: any) {
if (isContentScript) {
return;
}
if (clientType == "node") {
sourceMapURL = undefined;
}
actions.newSource({
id: scriptId,
url,
sourceMapURL,
isPrettyPrinted: false,
});
}
function scriptFailedToParse() {}
async function paused({
callFrames,
reason,
data,
hitBreakpoints,
asyncStackTrace,
}: any) {
const frames = callFrames.map(createFrame);
const frame = frames[0];
const why = { type: reason, ...data };
const objectId = frame.scopeChain[0].object.objectId;
const { result } = await runtimeAgent.getProperties({
objectId,
});
const loadedObjects = result.map(createLoadedObject);
if (clientType == "chrome") {
pageAgent.configureOverlay({ message: "Paused in debugger.html" });
}
await actions.paused({ thread: "root", frame, why, frames, loadedObjects });
}
function resumed() {
if (clientType == "chrome") {
pageAgent.configureOverlay({ suspended: false });
}
actions.resumed();
}
function globalObjectCleared() {}
// Page Events
function frameNavigated(frame: any) {
actions.navigated();
}
function frameStartedLoading() {
actions.willNavigate();
}
function domContentEventFired() {}
function loadEventFired() {}
function frameStoppedLoading() {}
const clientEvents = {
scriptParsed,
scriptFailedToParse,
paused,
resumed,
globalObjectCleared,
};
const pageEvents = {
frameNavigated,
frameStartedLoading,
domContentEventFired,
loadEventFired,
frameStoppedLoading,
};
export { setupEvents, pageEvents, clientEvents };

View File

@ -1,14 +0,0 @@
# 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 += [
]
CompiledModules(
'commands.js',
'create.js',
'events.js',
)

View File

@ -1,22 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// @flow
export type ServerLocation = {
scriptId: string,
lineNumber: number,
columnNumber?: number,
};
export type Agents = {
Debugger: any,
Runtime: any,
Page: any,
};
export type ChromeClientConnection = {
connectNodeClient: () => void,
connectNode: () => void,
};

View File

@ -21,8 +21,8 @@ import type {
Script,
SourceId,
SourceActor,
Worker,
Range,
Thread,
} from "../../types";
import type {
@ -405,7 +405,7 @@ function getSourceForActor(actor: ActorId) {
return sourceActors[actor];
}
async function fetchThreads(): Promise<Worker[]> {
async function fetchThreads(): Promise<Thread[]> {
const options = {
breakpoints,
eventBreakpoints,

View File

@ -5,7 +5,7 @@
// @flow
// This module converts Firefox specific types to the generic types
import type { Frame, ThreadId, GeneratedSourceData, Worker } from "../../types";
import type { Frame, ThreadId, GeneratedSourceData, Thread } from "../../types";
import type {
PausedPacket,
FramesResponse,
@ -73,7 +73,7 @@ export function createPause(
};
}
export function createThread(actor: string, target: Target): Worker {
export function createThread(actor: string, target: Target): Thread {
return {
actor,
url: target.url || "",

View File

@ -21,7 +21,6 @@ import type {
Frame,
SourceId,
QueuedSourceData,
Worker,
Range,
} from "../../types";
@ -381,7 +380,6 @@ export type ThreadFront = {
export type Panel = {|
emit: (eventName: string) => void,
openLink: (url: string) => void,
openWorkerToolbox: (worker: Worker) => void,
openElementInInspector: (grip: Object) => void,
openConsoleAndEvaluate: (input: string) => void,
highlightDomElement: (grip: Object) => void,

View File

@ -5,7 +5,6 @@
// @flow
import * as firefox from "./firefox";
import * as chrome from "./chrome";
import { asyncStore, verifyPrefSchema } from "../utils/prefs";
import { setupHelper } from "../utils/dbg";
@ -57,10 +56,7 @@ async function loadInitialState() {
}
function getClient(connection: any) {
const {
tab: { clientType },
} = connection;
return clientType == "firefox" ? firefox : chrome;
return firefox;
}
export async function onConnect(

View File

@ -4,12 +4,10 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += [
'chrome',
'firefox',
]
CompiledModules(
'chrome.js',
'firefox.js',
'index.js',
)

View File

@ -13,17 +13,17 @@ import { getCurrentThread, getIsPaused, getContext } from "../../selectors";
import { getDisplayName, isWorker } from "../../utils/threads";
import AccessibleImage from "../shared/AccessibleImage";
import type { Context, Thread } from "../../types";
import type { Context, Thread as ThreadType } from "../../types";
type Props = {
cx: Context,
selectThread: typeof actions.selectThread,
isPaused: boolean,
thread: Thread,
thread: ThreadType,
currentThread: string,
};
export class Worker extends Component<Props> {
export class Thread extends Component<Props> {
onSelectThread = () => {
const { thread } = this.props;
this.props.selectThread(this.props.cx, thread.actor);
@ -37,7 +37,7 @@ export class Worker extends Component<Props> {
return (
<div
className={classnames("worker", {
className={classnames("thread", {
selected: thread.actor == currentThread,
})}
key={thread.actor}
@ -68,4 +68,4 @@ export default connect(
{
selectThread: actions.selectThread,
}
)(Worker);
)(Thread);

View File

@ -2,16 +2,16 @@
* 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/>. */
.workers-list {
.threads-list {
padding: 4px 0;
}
.workers-list * {
.threads-list * {
-moz-user-select: none;
user-select: none;
}
.workers-list > .worker {
.threads-list > .thread {
font-size: inherit;
color: var(--theme-text-color-strong);
padding: 2px 6px;
@ -23,24 +23,24 @@
align-items: center;
}
.workers-list > .worker:hover {
.threads-list > .thread:hover {
background-color: var(--search-overlays-semitransparent);
}
.workers-list > .worker.selected {
.threads-list > .thread.selected {
background-color: var(--tab-line-selected-color);
}
.workers-list .icon {
.threads-list .icon {
flex: none;
margin-inline-end: 4px;
}
.workers-list .img {
.threads-list .img {
display: block;
}
.workers-list .label {
.threads-list .label {
display: inline-block;
flex-grow: 1;
flex-shrink: 1;
@ -49,16 +49,16 @@
text-overflow: ellipsis;
}
.workers-list .pause-badge {
.threads-list .pause-badge {
flex: none;
margin-inline-start: 4px;
}
.workers-list > .worker.selected {
.threads-list > .thread.selected {
background: var(--theme-selection-background);
color: var(--theme-selection-color);
}
.workers-list > .worker.selected .img {
.threads-list > .thread.selected .img {
background-color: currentColor;
}

View File

@ -0,0 +1,39 @@
/* 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/>. */
// @flow
import React, { Component } from "react";
import { connect } from "../../utils/connect";
import { getAllThreads } from "../../selectors";
import Thread from "./Thread";
import type { Thread as ThreadType } from "../../types";
import "./Threads.css";
type Props = {
threads: ThreadType[],
};
export class Threads extends Component<Props> {
render() {
const { threads } = this.props;
return (
<div className="pane threads-list">
{threads.map(thread => (
<Thread thread={thread} key={thread.actor} />
))}
</div>
);
}
}
const mapStateToProps = state => ({
threads: getAllThreads(state),
});
export default connect(mapStateToProps)(Threads);

View File

@ -1,66 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// @flow
import React, { Component } from "react";
import { connect } from "../../utils/connect";
import actions from "../../actions";
import { getAllThreads } from "../../selectors";
import { getDisplayName } from "../../utils/threads";
import { features } from "../../utils/prefs";
import Worker from "./Worker";
import AccessibleImage from "../shared/AccessibleImage";
import type { Thread, Worker as WorkerType } from "../../types";
import "./Workers.css";
type Props = {
threads: Thread[],
openWorkerToolbox: typeof actions.openWorkerToolbox,
};
export class Workers extends Component<Props> {
renderWorker(thread: WorkerType) {
const { openWorkerToolbox } = this.props;
return (
<div
className="worker"
key={thread.actor}
onClick={() => openWorkerToolbox(thread)}
>
<div className="icon">
<AccessibleImage className="worker" />
</div>
<div className="label">{getDisplayName(thread)}</div>
</div>
);
}
render() {
const { threads } = this.props;
const workerList = features.windowlessWorkers
? threads.map(thread => <Worker thread={thread} key={thread.actor} />)
: threads
.filter((thread: any) => thread.actorID)
.map(worker => this.renderWorker((worker: any)));
return <div className="pane workers-list">{workerList}</div>;
}
}
const mapStateToProps = state => ({
threads: getAllThreads(state),
});
export default connect(
mapStateToProps,
{
openWorkerToolbox: actions.openWorkerToolbox,
}
)(Workers);

View File

@ -34,7 +34,7 @@ import Breakpoints from "./Breakpoints";
import Expressions from "./Expressions";
import SplitBox from "devtools-splitter";
import Frames from "./Frames";
import Workers from "./Workers";
import Threads from "./Threads";
import Accordion from "../shared/Accordion";
import CommandBar from "./CommandBar";
import UtilsBar from "./UtilsBar";
@ -322,13 +322,11 @@ class SecondaryPanes extends Component<Props, State> {
};
}
getWorkersItem(): AccordionPaneItem {
getThreadsItem(): AccordionPaneItem {
return {
header: features.windowlessWorkers
? L10N.getStr("threadsHeader")
: L10N.getStr("workersHeader"),
className: "workers-pane",
component: <Workers />,
header: L10N.getStr("threadsHeader"),
className: "threads-pane",
component: <Threads />,
opened: prefs.workersVisible,
onToggle: opened => {
prefs.workersVisible = opened;
@ -393,7 +391,7 @@ class SecondaryPanes extends Component<Props, State> {
if (horizontal) {
if (features.workers && this.props.workers.length > 0) {
items.push(this.getWorkersItem());
items.push(this.getThreadsItem());
}
items.push(this.getWatchItem());
@ -430,7 +428,7 @@ class SecondaryPanes extends Component<Props, State> {
const items: AccordionPaneItem[] = [];
if (features.workers && this.props.workers.length > 0) {
items.push(this.getWorkersItem());
items.push(this.getThreadsItem());
}
items.push(this.getWatchItem());

View File

@ -15,10 +15,10 @@ CompiledModules(
'Expressions.js',
'index.js',
'Scopes.js',
'Thread.js',
'Threads.js',
'UtilsBar.js',
'WhyPaused.js',
'Worker.js',
'Workers.js',
'XHRBreakpoints.js',
)
@ -29,7 +29,7 @@ DevToolsModules(
'Expressions.css',
'Scopes.css',
'SecondaryPanes.css',
'Threads.css',
'WhyPaused.css',
'Workers.css',
'XHRBreakpoints.css',
)

View File

@ -46,7 +46,7 @@
@import url("./components/SecondaryPanes/Scopes.css");
@import url("./components/SecondaryPanes/SecondaryPanes.css");
@import url("./components/SecondaryPanes/WhyPaused.css");
@import url("./components/SecondaryPanes/Workers.css");
@import url("./components/SecondaryPanes/Threads.css");
@import url("./components/SecondaryPanes/XHRBreakpoints.css");
@import url("./components/ShortcutsModal.css");
@import url("./components/WelcomeBox.css");

View File

@ -22,7 +22,6 @@ bootstrap(React, ReactDOM).then(connection => {
const win = window.open(url, "_blank");
win.focus();
},
openWorkerToolbox: worker => alert(worker.url),
openElementInInspector: grip =>
alert(`Opening node in Inspector: ${grip.class}`),
openConsoleAndEvaluate: input => alert(`console.log: ${input}`),

View File

@ -24,7 +24,7 @@ import preview from "./preview";
import projectTextSearch from "./project-text-search";
import quickOpen from "./quick-open";
import sourceTree from "./source-tree";
import debuggee from "./debuggee";
import threads from "./threads";
import eventListenerBreakpoints from "./event-listeners";
// eslint-disable-next-line import/named
@ -45,7 +45,7 @@ export default {
projectTextSearch,
quickOpen,
sourceTree,
debuggee,
threads,
objectInspector: objectInspector.reducer.default,
eventListenerBreakpoints,
preview,

View File

@ -11,7 +11,6 @@ CompiledModules(
'ast.js',
'async-requests.js',
'breakpoints.js',
'debuggee.js',
'event-listeners.js',
'expressions.js',
'file-search.js',
@ -25,5 +24,6 @@ CompiledModules(
'source-tree.js',
'sources.js',
'tabs.js',
'threads.js',
'ui.js',
)

View File

@ -65,7 +65,7 @@ import type {
import type { PendingSelectedLocation, Selector } from "./types";
import type { Action, DonePromiseAction, FocusItem } from "../actions/types";
import type { LoadSourceAction } from "../actions/types/SourceAction";
import type { DebuggeeState } from "./debuggee";
import type { ThreadsState } from "./threads";
import { uniq } from "lodash";
export type SourcesMap = { [SourceId]: Source };
@ -519,7 +519,7 @@ export function getBlackBoxList() {
// pick off the piece of state we're interested in. It's impossible
// (right now) to type those wrapped functions.
type OuterState = { sources: SourcesState };
type DebuggeeOuterState = { debuggee: DebuggeeState };
type ThreadsOuterState = { threads: ThreadsState };
const getSourcesState = (state: OuterState) => state.sources;
@ -718,7 +718,7 @@ export function getSourceList(state: OuterState): Source[] {
}
export function getDisplayedSourcesList(
state: OuterState & SourceActorOuterState & DebuggeeOuterState
state: OuterState & SourceActorOuterState & ThreadsOuterState
): Source[] {
return ((Object.values(getDisplayedSources(state)): any).flatMap(
Object.values
@ -838,17 +838,17 @@ const queryAllDisplayedSources: ReduceQuery<
);
function getAllDisplayedSources(
state: OuterState & DebuggeeOuterState
state: OuterState & ThreadsOuterState
): Array<SourceId> {
return queryAllDisplayedSources(state.sources.sources, {
projectDirectoryRoot: state.sources.projectDirectoryRoot,
chromeAndExtensionsEnabled: state.sources.chromeAndExtenstionsEnabled,
debuggeeIsWebExtension: state.debuggee.isWebExtension,
debuggeeIsWebExtension: state.threads.isWebExtension,
});
}
type GetDisplayedSourceIDsSelector = (
OuterState & SourceActorOuterState & DebuggeeOuterState
OuterState & SourceActorOuterState & ThreadsOuterState
) => { [ThreadId]: Set<SourceId> };
const getDisplayedSourceIDs: GetDisplayedSourceIDsSelector = createSelector(
getAllThreadsBySource,
@ -874,7 +874,7 @@ const getDisplayedSourceIDs: GetDisplayedSourceIDsSelector = createSelector(
);
type GetDisplayedSourcesSelector = (
OuterState & SourceActorOuterState & DebuggeeOuterState
OuterState & SourceActorOuterState & ThreadsOuterState
) => SourcesMapByThread;
export const getDisplayedSources: GetDisplayedSourcesSelector = createSelector(
state => state.sources.sources,

View File

@ -8,7 +8,7 @@ declare var it: (desc: string, func: () => void) => void;
declare var expect: (value: any) => any;
import update, { initialSourcesState, getDisplayedSources } from "../sources";
import { initialDebuggeeState } from "../debuggee";
import { initialThreadsState } from "../threads";
import updateSourceActors from "../source-actors";
import type { SourceActor } from "../../types";
import { prefs } from "../../utils/prefs";
@ -93,7 +93,7 @@ describe("sources selectors", () => {
state = {
sources: update(state.sources, insertAction),
sourceActors: updateSourceActors(state.sourceActors, insertAction),
debuggee: initialDebuggeeState(),
threads: initialThreadsState(),
};
const threadSources = getDisplayedSources(state);
expect(Object.values(threadSources.foo)).toHaveLength(3);
@ -119,7 +119,7 @@ describe("sources selectors", () => {
state = {
sources: update(state.sources, insertAction),
sourceActors: updateSourceActors(state.sourceActors, insertAction),
debuggee: initialDebuggeeState(),
threads: initialThreadsState(),
};
const threadSources = getDisplayedSources(state);
expect(Object.values(threadSources.foo)).toHaveLength(1);

View File

@ -5,26 +5,24 @@
// @flow
/**
* Debuggee reducer
* @module reducers/debuggee
* Threads reducer
* @module reducers/threads
*/
import { sortBy } from "lodash";
import { createSelector } from "reselect";
import { getDisplayName } from "../utils/threads";
import type { Selector, State } from "./types";
import type { Thread, ThreadList } from "../types";
import type { Action } from "../actions/types";
export type DebuggeeState = {
export type ThreadsState = {
threads: ThreadList,
mainThread: Thread,
isWebExtension: boolean,
};
export function initialDebuggeeState(): DebuggeeState {
export function initialThreadsState(): ThreadsState {
return {
threads: [],
mainThread: { actor: "", url: "", type: -1, name: "" },
@ -32,10 +30,10 @@ export function initialDebuggeeState(): DebuggeeState {
};
}
export default function debuggee(
state: DebuggeeState = initialDebuggeeState(),
export default function update(
state: ThreadsState = initialThreadsState(),
action: Action
): DebuggeeState {
): ThreadsState {
switch (action.type) {
case "CONNECT":
return {
@ -44,7 +42,11 @@ export default function debuggee(
isWebExtension: action.isWebExtension,
};
case "INSERT_THREADS":
return insertThreads(state, action.threads);
return {
...state,
threads: [...state.threads, ...action.threads],
};
case "REMOVE_THREADS":
const { threads } = action;
return {
@ -53,7 +55,7 @@ export default function debuggee(
};
case "NAVIGATE":
return {
...initialDebuggeeState(),
...initialThreadsState(),
mainThread: action.mainThread,
};
default:
@ -61,19 +63,7 @@ export default function debuggee(
}
}
function insertThreads(state, threads) {
const formatedThreads = threads.map(thread => ({
...thread,
name: getDisplayName(thread),
}));
return {
...state,
threads: [...state.threads, ...formatedThreads],
};
}
export const getThreads = (state: OuterState) => state.debuggee.threads;
export const getThreads = (state: OuterState) => state.threads.threads;
export const getWorkerCount = (state: OuterState) => getThreads(state).length;
@ -82,7 +72,7 @@ export function getWorkerByThread(state: OuterState, thread: string) {
}
export function getMainThread(state: OuterState): Thread {
return state.debuggee.mainThread;
return state.threads.mainThread;
}
export function getDebuggeeUrl(state: OuterState): string {
@ -92,7 +82,10 @@ export function getDebuggeeUrl(state: OuterState): string {
export const getAllThreads: Selector<Thread[]> = createSelector(
getMainThread,
getThreads,
(mainThread, threads) => [mainThread, ...sortBy(threads, getDisplayName)]
(mainThread, threads) => [
mainThread,
...sortBy(threads, thread => thread.name),
]
);
// checks if a path begins with a thread actor
@ -104,4 +97,4 @@ export function startsWithThreadActor(state: State, path: string) {
return match && match[1];
}
type OuterState = { debuggee: DebuggeeState };
type OuterState = { threads: ThreadsState };

View File

@ -12,7 +12,7 @@
import type { ASTState } from "./ast";
import type { BreakpointsState } from "./breakpoints";
import type { ExpressionState } from "./expressions";
import type { DebuggeeState } from "./debuggee";
import type { ThreadsState } from "./threads";
import type { FileSearchState } from "./file-search";
import type { PauseState } from "./pause";
import type { PreviewState } from "./preview";
@ -31,7 +31,7 @@ export type State = {
breakpoints: BreakpointsState,
expressions: Record<ExpressionState>,
eventListenerBreakpoints: EventListenersState,
debuggee: DebuggeeState,
threads: ThreadsState,
fileSearch: FileSearchState,
pause: PauseState,
preview: PreviewState,

View File

@ -9,7 +9,7 @@ export * from "../reducers/sources";
export * from "../reducers/tabs";
export * from "../reducers/event-listeners";
export * from "../reducers/pause";
export * from "../reducers/debuggee";
export * from "../reducers/threads";
export * from "../reducers/breakpoints";
export * from "../reducers/pending-breakpoints";
export * from "../reducers/ui";

View File

@ -65,7 +65,6 @@ if (isDevelopment()) {
pref("devtools.debugger.features.map-await-expression", true);
pref("devtools.debugger.features.xhr-breakpoints", true);
pref("devtools.debugger.features.original-blackbox", true);
pref("devtools.debugger.features.windowless-workers", true);
pref("devtools.debugger.features.event-listeners-breakpoints", true);
pref("devtools.debugger.features.dom-mutation-breakpoints", true);
pref("devtools.debugger.features.log-points", true);

View File

@ -37,8 +37,6 @@ function getValue(dbg, index) {
// Test basic windowless worker functionality: the main thread and worker can be
// separately controlled from the same debugger.
add_task(async function() {
await pushPref("devtools.debugger.features.windowless-workers", true);
const dbg = await initDebugger("doc-windowless-workers.html");
const mainThread = dbg.toolbox.threadFront.actor;

View File

@ -1281,8 +1281,8 @@ const selectors = {
blackbox: ".action.black-box",
projectSearchCollapsed: ".project-text-search .arrow:not(.expanded)",
projectSerchExpandedResults: ".project-text-search .result",
threadsPaneItems: ".workers-pane .worker",
threadsPaneItem: i => `.workers-pane .worker:nth-child(${i})`,
threadsPaneItems: ".threads-pane .thread",
threadsPaneItem: i => `.threads-pane .thread:nth-child(${i})`,
threadsPaneItemPause: i => `${selectors.threadsPaneItem(i)} .pause-badge`,
CodeMirrorLines: ".CodeMirror-lines",
inlinePreviewLables: ".CodeMirror-linewidget .inline-preview-label",

View File

@ -433,7 +433,7 @@
"@babel/helper-builder-binary-assignment-operator-visitor" "^7.1.0"
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-transform-flow-strip-types@^7.0.0", "@babel/plugin-transform-flow-strip-types@^7.4.4":
"@babel/plugin-transform-flow-strip-types@^7.4.4":
version "7.4.4"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.4.4.tgz#d267a081f49a8705fc9146de0768c6b58dccd8f7"
integrity sha512-WyVedfeEIILYEaWGAUWzVNyqG4sfsNooMhXWsu/YzOvVGcsnPb5PguysjJqI3t3qiaYj0BR8T2f5njdjTGe44Q==
@ -692,14 +692,6 @@
js-levenshtein "^1.1.3"
semver "^5.5.0"
"@babel/preset-flow@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2"
integrity sha512-bJOHrYOPqJZCkPVbG1Lot2r5OSsB+iUOaxiHdlOeB1yPWS6evswVHwvkDLZ54WTaTRIk89ds0iHmGZSnxlPejQ==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-transform-flow-strip-types" "^7.0.0"
"@babel/preset-react@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.0.0.tgz#e86b4b3d99433c7b3e9e91747e2653958bc6b3c0"
@ -4612,9 +4604,10 @@ escope@^3.6.0:
esrecurse "^4.1.0"
estraverse "^4.1.1"
eslint-config-prettier@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-4.0.0.tgz#16cedeea0a56e74de60dcbbe3be0ab2c645405b9"
eslint-config-prettier@4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-4.2.0.tgz#70b946b629cd0e3e98233fd9ecde4cb9778de96c"
integrity sha512-y0uWc/FRfrHhpPZCYflWC8aE0KRJRY04rdZVfl8cL3sEZmOYyaBdhdlQPjKZBnuRMyLVK+JUZr7HaZFClQiH4w==
dependencies:
get-stdin "^6.0.0"
@ -4696,9 +4689,10 @@ eslint-plugin-mozilla@1.2.1:
ini-parser "0.0.2"
sax "1.2.4"
eslint-plugin-prettier@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.0.0.tgz#f6b823e065f8c36529918cdb766d7a0e975ec30c"
eslint-plugin-prettier@3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.0.1.tgz#19d521e3981f69dd6d14f64aec8c6a6ac6eb0b0d"
integrity sha512-/PMttrarPAY78PLvV3xfWibMOdMDl57hmlQ2XqFeA37wd+CJ7WSxV7txqjVPHi/AAFKd2lX0ZqfsOc/i5yFCSQ==
dependencies:
prettier-linter-helpers "^1.0.0"
@ -9637,9 +9631,10 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"
prettier@^1.12.1:
version "1.14.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.0.tgz#847c235522035fd988100f1f43cf20a7d24f9372"
prettier@1.17.0:
version "1.17.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.17.0.tgz#53b303676eed22cc14a9f0cec09b477b3026c008"
integrity sha512-sXe5lSt2WQlCbydGETgfm1YBShgOX4HxQkFPvbxkcwgDvGDeqVau8h+12+lmSVlP3rHPz0oavfddSZg/q+Szjw==
pretty-error@^2.0.2:
version "2.1.1"

View File

@ -74,7 +74,6 @@ pref("devtools.debugger.features.autocomplete-expressions", false);
pref("devtools.debugger.features.map-expression-bindings", true);
pref("devtools.debugger.features.xhr-breakpoints", true);
pref("devtools.debugger.features.original-blackbox", true);
pref("devtools.debugger.features.windowless-workers", true);
pref("devtools.debugger.features.event-listeners-breakpoints", true);
pref("devtools.debugger.features.dom-mutation-breakpoints", false);
pref("devtools.debugger.features.log-points", true);

View File

@ -7415,8 +7415,6 @@ var _devtoolsComponents = _interopRequireDefault(__webpack_require__(108));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/* 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/>. */
@ -7486,11 +7484,6 @@ const {
class ObjectInspector extends Component {
constructor(props) {
super();
_defineProperty(this, "props", void 0);
_defineProperty(this, "cachedNodes", void 0);
this.cachedNodes = new Map();
const self = this;
self.getItemChildren = this.getItemChildren.bind(this);
@ -7714,8 +7707,6 @@ class ObjectInspector extends Component {
}
_defineProperty(ObjectInspector, "defaultProps", void 0);
function mapStateToProps(state, props) {
return {
expandedPaths: selectors.getExpandedPaths(state),

View File

@ -4169,8 +4169,6 @@ module.exports = {
/***/ 513:
/***/ (function(module, exports, __webpack_require__) {
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/* 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/>. */
@ -4349,10 +4347,6 @@ function filterScopes(items, pc, lastItem, index) {
class XScope {
constructor(xScopeData, sourceMapContext) {
_defineProperty(this, "xScope", void 0);
_defineProperty(this, "sourceMapContext", void 0);
this.xScope = xScopeData;
this.sourceMapContext = sourceMapContext;
}
@ -4416,8 +4410,6 @@ module.exports = {
/***/ 514:
/***/ (function(module, exports) {
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/* 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/>. */
@ -4427,8 +4419,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
/* eslint-disable no-inline-comments */
class Value {
constructor(val) {
_defineProperty(this, "val", void 0);
this.val = val;
}

View File

@ -324,6 +324,9 @@ NetworkResponseListener.prototype = {
// was a redirect from http to https, the request object seems to contain
// security info for the https request after redirect.
const secinfo = this.httpActivity.channel.securityInfo;
if (secinfo) {
secinfo.QueryInterface(Ci.nsITransportSecurityInfo);
}
const info = NetworkHelper.parseSecurityInfo(secinfo, this.httpActivity);
let isRacing = false;

View File

@ -594,8 +594,6 @@ var NetworkHelper = {
* => state === "weak"
*/
securityInfo.QueryInterface(Ci.nsITransportSecurityInfo);
const wpl = Ci.nsIWebProgressListener;
const NSSErrorsService = Cc["@mozilla.org/nss_errors_service;1"].getService(
Ci.nsINSSErrorsService

View File

@ -31,8 +31,10 @@ const MockCertificate = {
},
};
// This *cannot* be used as an nsITransportSecurityInfo (since that interface is
// builtinclass) but the methods being tested aren't defined by XPCOM and aren't
// calling QueryInterface, so this usage is fine.
const MockSecurityInfo = {
QueryInterface: ChromeUtils.generateQI([Ci.nsITransportSecurityInfo]),
securityState: wpl.STATE_IS_SECURE,
errorCode: 0,
cipherName: "TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",

View File

@ -17,8 +17,11 @@ Object.defineProperty(this, "NetworkHelper", {
});
const wpl = Ci.nsIWebProgressListener;
// This *cannot* be used as an nsITransportSecurityInfo (since that interface is
// builtinclass) but the methods being tested aren't defined by XPCOM and aren't
// calling QueryInterface, so this usage is fine.
const MockSecurityInfo = {
QueryInterface: ChromeUtils.generateQI([Ci.nsITransportSecurityInfo]),
securityState: wpl.STATE_IS_BROKEN,
errorCode: 0,
// nsISSLStatus.TLS_VERSION_1_2

View File

@ -18,8 +18,10 @@ Object.defineProperty(this, "NetworkHelper", {
const wpl = Ci.nsIWebProgressListener;
// This *cannot* be used as an nsITransportSecurityInfo (since that interface is
// builtinclass) but the methods being tested aren't defined by XPCOM and aren't
// calling QueryInterface, so this usage is fine.
const MockSecurityInfo = {
QueryInterface: ChromeUtils.generateQI([Ci.nsITransportSecurityInfo]),
securityState: wpl.STATE_IS_SECURE,
errorCode: 0,
cipherName: "TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256",

View File

@ -3573,8 +3573,14 @@ void Document::NoteScriptTrackingStatus(const nsACString& aURL,
}
}
bool Document::IsScriptTracking(const nsACString& aURL) const {
return mTrackingScripts.Contains(aURL);
bool Document::IsScriptTracking(JSContext* aCx) const {
JS::AutoFilename filename;
uint32_t line = 0;
uint32_t column = 0;
if (!JS::DescribeScriptedCaller(aCx, &filename, &line, &column)) {
return false;
}
return mTrackingScripts.Contains(nsDependentCString(filename.get()));
}
NS_IMETHODIMP

View File

@ -3904,11 +3904,13 @@ class Document : public nsINode,
virtual AbstractThread* AbstractMainThreadFor(
TaskCategory aCategory) override;
// The URLs passed to these functions should match what
// JS::DescribeScriptedCaller() returns, since these APIs are used to
// The URLs passed to this function should match what
// JS::DescribeScriptedCaller() returns, since this API is used to
// determine whether some code is being called from a tracking script.
void NoteScriptTrackingStatus(const nsACString& aURL, bool isTracking);
bool IsScriptTracking(const nsACString& aURL) const;
// The JSContext passed to this method represents the context that we want to
// determine if it belongs to a tracker.
bool IsScriptTracking(JSContext* aCx) const;
// For more information on Flash classification, see
// toolkit/components/url-classifier/flash-block-lists.rst

View File

@ -59,9 +59,8 @@ nsISupports* Pose::GetParentObject() const { return mParent; }
void Pose::SetFloat32Array(JSContext* aJSContext, nsWrapperCache* creator,
JS::MutableHandle<JSObject*> aRetVal,
JS::Heap<JSObject*>& aObj, float* aVal,
uint32_t aValLength, bool bCreate,
ErrorResult& aRv) {
if (!bCreate || !aVal) {
uint32_t aValLength, ErrorResult& aRv) {
if (!aVal) {
aRetVal.set(nullptr);
return;
}

View File

@ -43,8 +43,7 @@ class Pose : public nsWrapperCache {
static void SetFloat32Array(JSContext* aJSContext, nsWrapperCache* creator,
JS::MutableHandle<JSObject*> aRetVal,
JS::Heap<JSObject*>& aObj, float* aVal,
uint32_t aValLength, bool bCreate,
ErrorResult& aRv);
uint32_t aValLength, ErrorResult& aRv);
protected:
virtual ~Pose();

View File

@ -2,7 +2,7 @@
<head>
</head>
<body style="direction: rtl; visibility: collapse; white-space: pre;"><span style="display: -moz-inline-stack;"><span><span style="font-size: 0pt; border: 1px dotted red; white-space: -moz-pre-wrap;">
<body style="direction: rtl; visibility: collapse; white-space: pre;"><span style="display: -moz-inline-box;"><span><span style="font-size: 0pt; border: 1px dotted red; white-space: -moz-pre-wrap;">
X X }

View File

@ -49,8 +49,7 @@ bool nsJSUtils::GetCallingLocation(JSContext* aContext, nsACString& aFilename,
return false;
}
aFilename.Assign(filename.get());
return true;
return aFilename.Assign(filename.get(), fallible);
}
bool nsJSUtils::GetCallingLocation(JSContext* aContext, nsAString& aFilename,
@ -60,8 +59,7 @@ bool nsJSUtils::GetCallingLocation(JSContext* aContext, nsAString& aFilename,
return false;
}
aFilename.Assign(NS_ConvertUTF8toUTF16(filename.get()));
return true;
return aFilename.Assign(NS_ConvertUTF8toUTF16(filename.get()), fallible);
}
uint64_t nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(JSContext* aContext) {

View File

@ -479,10 +479,7 @@ already_AddRefed<Promise> FetchRequest(nsIGlobalObject* aGlobal,
loadGroup = doc->GetDocumentLoadGroup();
cookieSettings = doc->CookieSettings();
nsAutoCString fileNameString;
if (nsJSUtils::GetCallingLocation(cx, fileNameString)) {
isTrackingFetch = doc->IsScriptTracking(fileNameString);
}
isTrackingFetch = doc->IsScriptTracking(cx);
} else {
principal = aGlobal->PrincipalOrNull();
if (NS_WARN_IF(!principal)) {

View File

@ -42,58 +42,61 @@ bool GamepadPose::HasPosition() const {
void GamepadPose::GetPosition(JSContext* aJSContext,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
const bool valid =
mPoseState.isPositionValid &&
bool(mPoseState.flags & GamepadCapabilityFlags::Cap_Position);
SetFloat32Array(aJSContext, this, aRetval, mPosition,
mPoseState.isPositionValid ? mPoseState.position : nullptr, 3,
bool(mPoseState.flags & GamepadCapabilityFlags::Cap_Position),
aRv);
valid ? mPoseState.position : nullptr, 3, aRv);
}
void GamepadPose::GetLinearVelocity(JSContext* aJSContext,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
SetFloat32Array(
aJSContext, this, aRetval, mLinearVelocity,
mPoseState.isPositionValid ? mPoseState.linearVelocity : nullptr, 3,
bool(mPoseState.flags & GamepadCapabilityFlags::Cap_Position), aRv);
const bool valid =
mPoseState.isPositionValid &&
bool(mPoseState.flags & GamepadCapabilityFlags::Cap_Position);
SetFloat32Array(aJSContext, this, aRetval, mLinearVelocity,
valid ? mPoseState.linearVelocity : nullptr, 3, aRv);
}
void GamepadPose::GetLinearAcceleration(JSContext* aJSContext,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
SetFloat32Array(
aJSContext, this, aRetval, mLinearAcceleration,
mPoseState.isPositionValid ? mPoseState.linearAcceleration : nullptr, 3,
bool(mPoseState.flags & GamepadCapabilityFlags::Cap_LinearAcceleration),
aRv);
const bool valid =
mPoseState.isPositionValid &&
bool(mPoseState.flags & GamepadCapabilityFlags::Cap_LinearAcceleration);
SetFloat32Array(aJSContext, this, aRetval, mLinearAcceleration,
valid ? mPoseState.linearAcceleration : nullptr, 3, aRv);
}
void GamepadPose::GetOrientation(JSContext* aJSContext,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
SetFloat32Array(
aJSContext, this, aRetval, mOrientation,
mPoseState.isOrientationValid ? mPoseState.orientation : nullptr, 4,
bool(mPoseState.flags & GamepadCapabilityFlags::Cap_Orientation), aRv);
const bool valid =
mPoseState.isOrientationValid &&
bool(mPoseState.flags & GamepadCapabilityFlags::Cap_Orientation);
SetFloat32Array(aJSContext, this, aRetval, mOrientation,
valid ? mPoseState.orientation : nullptr, 4, aRv);
}
void GamepadPose::GetAngularVelocity(JSContext* aJSContext,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
SetFloat32Array(
aJSContext, this, aRetval, mAngularVelocity,
mPoseState.isOrientationValid ? mPoseState.angularVelocity : nullptr, 3,
bool(mPoseState.flags & GamepadCapabilityFlags::Cap_Orientation), aRv);
const bool valid =
mPoseState.isOrientationValid &&
bool(mPoseState.flags & GamepadCapabilityFlags::Cap_Orientation);
SetFloat32Array(aJSContext, this, aRetval, mAngularVelocity,
valid ? mPoseState.angularVelocity : nullptr, 3, aRv);
}
void GamepadPose::GetAngularAcceleration(JSContext* aJSContext,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
SetFloat32Array(
aJSContext, this, aRetval, mAngularAcceleration,
mPoseState.isOrientationValid ? mPoseState.angularAcceleration : nullptr,
3,
bool(mPoseState.flags & GamepadCapabilityFlags::Cap_AngularAcceleration),
aRv);
const bool valid =
mPoseState.isOrientationValid &&
bool(mPoseState.flags & GamepadCapabilityFlags::Cap_AngularAcceleration);
SetFloat32Array(aJSContext, this, aRetval, mAngularAcceleration,
valid ? mPoseState.angularAcceleration : nullptr, 3, aRv);
}
void GamepadPose::SetPoseState(const GamepadPoseState& aPose) {

View File

@ -243,67 +243,57 @@ VRPose::~VRPose() { mozilla::DropJSObjects(this); }
void VRPose::GetPosition(JSContext* aCx, JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
SetFloat32Array(
aCx, this, aRetval, mPosition, mVRState.pose.position, 3,
!mPosition &&
(bool(mVRState.flags & gfx::VRDisplayCapabilityFlags::Cap_Position) ||
bool(mVRState.flags &
gfx::VRDisplayCapabilityFlags::Cap_PositionEmulated)),
aRv);
const bool valid =
bool(mVRState.flags & gfx::VRDisplayCapabilityFlags::Cap_Position) ||
bool(mVRState.flags &
gfx::VRDisplayCapabilityFlags::Cap_PositionEmulated);
SetFloat32Array(aCx, this, aRetval, mPosition,
valid ? mVRState.pose.position : nullptr, 3, aRv);
}
void VRPose::GetLinearVelocity(JSContext* aCx,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
SetFloat32Array(
aCx, this, aRetval, mLinearVelocity, mVRState.pose.linearVelocity, 3,
!mLinearVelocity &&
bool(mVRState.flags & gfx::VRDisplayCapabilityFlags::Cap_Position),
aRv);
const bool valid =
bool(mVRState.flags & gfx::VRDisplayCapabilityFlags::Cap_Position);
SetFloat32Array(aCx, this, aRetval, mLinearVelocity,
valid ? mVRState.pose.linearVelocity : nullptr, 3, aRv);
}
void VRPose::GetLinearAcceleration(JSContext* aCx,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
SetFloat32Array(
aCx, this, aRetval, mLinearAcceleration, mVRState.pose.linearAcceleration,
3,
!mLinearAcceleration &&
bool(mVRState.flags &
gfx::VRDisplayCapabilityFlags::Cap_LinearAcceleration),
aRv);
const bool valid = bool(
mVRState.flags & gfx::VRDisplayCapabilityFlags::Cap_LinearAcceleration);
SetFloat32Array(aCx, this, aRetval, mLinearAcceleration,
valid ? mVRState.pose.linearAcceleration : nullptr, 3, aRv);
}
void VRPose::GetOrientation(JSContext* aCx,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
SetFloat32Array(
aCx, this, aRetval, mOrientation, mVRState.pose.orientation, 4,
!mOrientation &&
bool(mVRState.flags & gfx::VRDisplayCapabilityFlags::Cap_Orientation),
aRv);
const bool valid =
bool(mVRState.flags & gfx::VRDisplayCapabilityFlags::Cap_Orientation);
SetFloat32Array(aCx, this, aRetval, mOrientation,
valid ? mVRState.pose.orientation : nullptr, 4, aRv);
}
void VRPose::GetAngularVelocity(JSContext* aCx,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
SetFloat32Array(
aCx, this, aRetval, mAngularVelocity, mVRState.pose.angularVelocity, 3,
!mAngularVelocity &&
bool(mVRState.flags & gfx::VRDisplayCapabilityFlags::Cap_Orientation),
aRv);
const bool valid =
bool(mVRState.flags & gfx::VRDisplayCapabilityFlags::Cap_Orientation);
SetFloat32Array(aCx, this, aRetval, mAngularVelocity,
valid ? mVRState.pose.angularVelocity : nullptr, 3, aRv);
}
void VRPose::GetAngularAcceleration(JSContext* aCx,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
SetFloat32Array(
aCx, this, aRetval, mAngularAcceleration,
mVRState.pose.angularAcceleration, 3,
!mAngularAcceleration &&
bool(mVRState.flags &
gfx::VRDisplayCapabilityFlags::Cap_AngularAcceleration),
aRv);
const bool valid = bool(
mVRState.flags & gfx::VRDisplayCapabilityFlags::Cap_AngularAcceleration);
SetFloat32Array(aCx, this, aRetval, mAngularAcceleration,
valid ? mVRState.pose.angularAcceleration : nullptr, 3, aRv);
}
void VRPose::Update(const gfx::VRHMDSensorState& aState) { mVRState = aState; }
@ -704,28 +694,28 @@ void VRFrameData::GetLeftProjectionMatrix(JSContext* aCx,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
Pose::SetFloat32Array(aCx, this, aRetval, mLeftProjectionMatrix,
mFrameInfo.mLeftProjection.components, 16, true, aRv);
mFrameInfo.mLeftProjection.components, 16, aRv);
}
void VRFrameData::GetLeftViewMatrix(JSContext* aCx,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
Pose::SetFloat32Array(aCx, this, aRetval, mLeftViewMatrix,
mFrameInfo.mLeftView.components, 16, true, aRv);
mFrameInfo.mLeftView.components, 16, aRv);
}
void VRFrameData::GetRightProjectionMatrix(JSContext* aCx,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
Pose::SetFloat32Array(aCx, this, aRetval, mRightProjectionMatrix,
mFrameInfo.mRightProjection.components, 16, true, aRv);
mFrameInfo.mRightProjection.components, 16, aRv);
}
void VRFrameData::GetRightViewMatrix(JSContext* aCx,
JS::MutableHandle<JSObject*> aRetval,
ErrorResult& aRv) {
Pose::SetFloat32Array(aCx, this, aRetval, mRightViewMatrix,
mFrameInfo.mRightView.components, 16, true, aRv);
mFrameInfo.mRightView.components, 16, aRv);
}
void VRFrameData::Update(const VRFrameInfo& aFrameInfo) {

View File

@ -2426,12 +2426,8 @@ void XMLHttpRequestMainThread::MaybeLowerChannelPriority() {
}
JSContext* cx = jsapi.cx();
nsAutoCString fileNameString;
if (!nsJSUtils::GetCallingLocation(cx, fileNameString)) {
return;
}
if (!doc->IsScriptTracking(fileNameString)) {
if (!doc->IsScriptTracking(cx)) {
return;
}

View File

@ -1,3 +1,26 @@
Overview of changes leading to 2.6.0
Tuesday, August 13, 2019
====================================
- New OpenType metrics, baseline, and metadata table access APIs.
- New API to set font variations to a named-instance.
- New hb-gdi.h header and API for creating hb_face_t from HFONT.
- Amalgam: Provide a single-file harfbuzz.cc file for easier alternate building.
- More size-reduction configurable options, enabled by HB_TINY.
- New API:
+hb_font_set_var_named_instance()
+hb_gdi_face_create()
+hb_ot_layout_baseline_tag_t
+hb_ot_layout_get_baseline()
+hb_ot_meta_tag_t
+hb_ot_meta_get_entry_tags()
+hb_ot_meta_reference_entry()
+hb_ot_metrics_tag_t
+hb_ot_metrics_get_position()
+hb_ot_metrics_get_variation()
+hb_ot_metrics_get_x_variation()
+hb_ot_metrics_get_y_variation()
Overview of changes leading to 2.5.3
Wednesday, June 26, 2019
====================================

View File

@ -1,7 +1,7 @@
This directory contains the HarfBuzz source from the upstream repo:
https://github.com/harfbuzz/harfbuzz
Current version: 2.5.3 [commit b14e413fae8f14b75c5956e9b38e413c878ded0c]
Current version: 2.6.0 [commit 6461143b44f81a4190d3f1cb02238750536f08e4]
UPDATING:

View File

@ -1,6 +1,6 @@
AC_PREREQ([2.64])
AC_INIT([HarfBuzz],
[2.5.3],
[2.6.0],
[https://github.com/harfbuzz/harfbuzz/issues/new],
[harfbuzz],
[http://harfbuzz.org/])
@ -361,6 +361,28 @@ AM_CONDITIONAL(HAVE_UNISCRIBE, $have_uniscribe)
dnl ===========================================================================
AC_ARG_WITH(gdi,
[AS_HELP_STRING([--with-gdi=@<:@yes/no/auto@:>@],
[Provide GDI integration helpers @<:@default=no@:>@])],,
[with_gdi=no])
have_gdi=false
if test "x$with_gdi" = "xyes" -o "x$with_gdi" = "xauto"; then
AC_CHECK_HEADERS(windows.h, have_gdi=true)
fi
if test "x$with_gdi" = "xyes" -a "x$have_gdi" != "xtrue"; then
AC_MSG_ERROR([gdi support requested but not found])
fi
if $have_gdi; then
GDI_CFLAGS=
GDI_LIBS="-lgdi32"
AC_SUBST(GDI_CFLAGS)
AC_SUBST(GDI_LIBS)
AC_DEFINE(HAVE_GDI, 1, [Have GDI library])
fi
AM_CONDITIONAL(HAVE_GDI, $have_gdi)
dnl ===========================================================================
AC_ARG_WITH(directwrite,
[AS_HELP_STRING([--with-directwrite=@<:@yes/no/auto@:>@],
[Use the DirectWrite library (experimental) @<:@default=no@:>@])],,
@ -376,7 +398,7 @@ if test "x$with_directwrite" = "xyes" -a "x$have_directwrite" != "xtrue"; then
fi
if $have_directwrite; then
DIRECTWRITE_CXXFLAGS=
DIRECTWRITE_LIBS="-ldwrite"
DIRECTWRITE_LIBS=
AC_SUBST(DIRECTWRITE_CXXFLAGS)
AC_SUBST(DIRECTWRITE_LIBS)
AC_DEFINE(HAVE_DIRECTWRITE, 1, [Have DirectWrite library])
@ -510,6 +532,7 @@ Additional shapers (the more the merrier):
Platform shapers (not normally needed):
CoreText: ${have_coretext}
DirectWrite: ${have_directwrite}
GDI: ${have_gdi}
Uniscribe: ${have_uniscribe}
Other features:

View File

@ -12,9 +12,15 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-introspection
TESTS =
check_PROGRAMS =
EXTRA_DIST += harfbuzz.cc
# Convenience targets:
lib: $(BUILT_SOURCES) libharfbuzz.la
libs: $(BUILT_SOURCES) $(lib_LTLIBRARIES)
tiny:
$(MAKE) $(AM_MAKEFLAGS) CPPFLAGS="-Os -DHB_TINY $(CPPFLAGS)" libs
tinyz:
$(MAKE) $(AM_MAKEFLAGS) CPPFLAGS="-Oz -DHB_TINY $(CPPFLAGS)" libs
lib_LTLIBRARIES = libharfbuzz.la
@ -76,6 +82,13 @@ HBSOURCES += $(HB_DIRECTWRITE_sources)
HBHEADERS += $(HB_DIRECTWRITE_headers)
endif
if HAVE_GDI
HBCFLAGS += $(GDI_CXXFLAGS)
HBNONPCLIBS += $(GDI_LIBS)
HBSOURCES += $(HB_GDI_sources)
HBHEADERS += $(HB_GDI_headers)
endif
if HAVE_CORETEXT
HBCFLAGS += $(CORETEXT_CFLAGS)
HBNONPCLIBS += $(CORETEXT_LIBS)
@ -249,31 +262,38 @@ GENERATORS = \
$(NULL)
EXTRA_DIST += $(GENERATORS)
unicode-tables: arabic-table indic-table tag-table use-table emoji-table
unicode-tables: \
arabic-table \
emoji-table \
indic-table \
tag-table \
ucd-table \
use-table \
emoji-table \
$(NULL)
arabic-table: gen-arabic-table.py ArabicShaping.txt UnicodeData.txt Blocks.txt
$(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-ot-shape-complex-arabic-table.hh \
|| ($(RM) $(srcdir)/hb-ot-shape-complex-arabic-table.hh; false)
emoji-table: gen-emoji-table.py emoji-data.txt
$(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-unicode-emoji-table.hh \
|| ($(RM) $(srcdir)/hb-unicode-emoji-table.hh; false)
indic-table: gen-indic-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt Blocks.txt
$(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-ot-shape-complex-indic-table.cc \
|| ($(RM) $(srcdir)/hb-ot-shape-complex-indic-table.cc; false)
tag-table: gen-tag-table.py languagetags language-subtag-registry
$(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-ot-tag-table.hh \
|| ($(RM) $(srcdir)/hb-ot-tag-table.hh; false)
ucd-table: gen-ucd-table.py ucd.nounihan.grouped.zip hb-common.h
$(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-ucd-table.hh \
|| ($(RM) $(srcdir)/hb-ucd-table.hh; false)
use-table: gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt
$(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-ot-shape-complex-use-table.cc \
|| ($(RM) $(srcdir)/hb-ot-shape-complex-use-table.cc; false)
vowel-constraints: gen-vowel-constraints.py HBIndicVowelConstraints.txt Scripts.txt
$(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-ot-shape-complex-vowel-constraints.cc \
|| ($(RM) $(srcdir)/hb-ot-shape-complex-vowel-constraints.cc; false)
emoji-table: gen-emoji-table.py emoji-data.txt
$(AM_V_GEN) $(builddir)/$^ > $(srcdir)/hb-unicode-emoji-table.hh \
|| ($(RM) $(srcdir)/hb-unicode-emoji-table.hh; false)
built-sources: $(BUILT_SOURCES)
@ -292,10 +312,27 @@ $(srcdir)/%.hh: $(srcdir)/%.rl
$(AM_V_GEN)(cd $(srcdir) && $(RAGEL) -e -F1 -o "$*.hh" "$*.rl") \
|| ($(RM) "$@"; false)
harfbuzz.cc: Makefile.sources
$(AM_V_GEN) \
for f in \
$(HB_BASE_sources) \
$(HB_GLIB_sources) \
$(HB_FT_sources) \
$(HB_GRAPHITE2_sources) \
$(HB_UNISCRIBE_sources) \
$(HB_GDI_sources) \
$(HB_DIRECTWRITE_sources) \
$(HB_CORETEXT_sources) \
; do echo '#include "'$$f'"'; done | \
grep '[.]cc"' > $(srcdir)/harfbuzz.cc \
|| ($(RM) $(srcdir)/harfbuzz.cc; false)
BUILT_SOURCES += harfbuzz.cc
noinst_PROGRAMS = \
main \
test \
test-buffer-serialize \
test-ot-meta \
test-ot-name \
test-gpos-size-params \
test-gsub-would-substitute \
@ -314,6 +351,10 @@ test_buffer_serialize_SOURCES = test-buffer-serialize.cc
test_buffer_serialize_CPPFLAGS = $(HBCFLAGS)
test_buffer_serialize_LDADD = libharfbuzz.la $(HBLIBS)
test_ot_meta_SOURCES = test-ot-meta.cc
test_ot_meta_CPPFLAGS = $(HBCFLAGS)
test_ot_meta_LDADD = libharfbuzz.la $(HBLIBS)
test_ot_name_SOURCES = test-ot-name.cc
test_ot_name_CPPFLAGS = $(HBCFLAGS)
test_ot_name_LDADD = libharfbuzz.la $(HBLIBS)
@ -370,7 +411,7 @@ dump_use_data_SOURCES = dump-use-data.cc hb-ot-shape-complex-use-table.cc
dump_use_data_CPPFLAGS = $(HBCFLAGS)
dump_use_data_LDADD = libharfbuzz.la $(HBLIBS)
COMPILED_TESTS = test-algs test-iter test-meta test-ot-tag test-unicode-ranges
COMPILED_TESTS = test-algs test-iter test-meta test-ot-tag test-unicode-ranges test-bimap
COMPILED_TESTS_CPPFLAGS = $(HBCFLAGS) -DMAIN -UNDEBUG
COMPILED_TESTS_LDADD = libharfbuzz.la $(HBLIBS)
check_PROGRAMS += $(COMPILED_TESTS)
@ -396,6 +437,10 @@ test_unicode_ranges_SOURCES = test-unicode-ranges.cc
test_unicode_ranges_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS)
test_unicode_ranges_LDADD = $(COMPILED_TESTS_LDADD)
test_bimap_SOURCES = test-bimap.cc hb-static.cc
test_bimap_CPPFLAGS = $(COMPILED_TESTS_CPPFLAGS)
test_bimap_LDADD = $(COMPILED_TESTS_LDADD)
TESTS_ENVIRONMENT = \
srcdir="$(srcdir)" \
MAKE="$(MAKE) $(AM_MAKEFLAGS)" \

View File

@ -10,6 +10,7 @@ HB_BASE_sources = \
hb-aat-layout-kerx-table.hh \
hb-aat-layout-lcar-table.hh \
hb-aat-layout-morx-table.hh \
hb-aat-layout-opbd-table.hh \
hb-aat-layout-trak-table.hh \
hb-aat-layout.cc \
hb-aat-layout.hh \
@ -88,6 +89,10 @@ HB_BASE_sources = \
hb-ot-math-table.hh \
hb-ot-math.cc \
hb-ot-maxp-table.hh \
hb-ot-meta-table.hh \
hb-ot-meta.cc \
hb-ot-metrics.cc \
hb-ot-metrics.hh \
hb-ot-name-language-static.hh \
hb-ot-name-language.hh \
hb-ot-name-table.hh \
@ -191,6 +196,8 @@ HB_BASE_headers = \
hb-ot-font.h \
hb-ot-layout.h \
hb-ot-math.h \
hb-ot-meta.h \
hb-ot-metrics.h \
hb-ot-name.h \
hb-ot-shape.h \
hb-ot-var.h \
@ -222,6 +229,9 @@ HB_CORETEXT_headers = hb-coretext.h
HB_DIRECTWRITE_sources = hb-directwrite.cc
HB_DIRECTWRITE_headers = hb-directwrite.h
HB_GDI_sources = hb-gdi.cc
HB_GDI_headers = hb-gdi.h
HB_UNISCRIBE_sources = hb-uniscribe.cc
HB_UNISCRIBE_headers = hb-uniscribe.h

View File

@ -4,6 +4,7 @@ from __future__ import print_function, division, absolute_import
import sys
import os.path
from collections import OrderedDict
import packTab
if len (sys.argv) != 2:
print("usage: ./gen-emoji-table.py emoji-data.txt", file=sys.stderr)
@ -52,14 +53,19 @@ print ()
print ('#include "hb-unicode.hh"')
print ()
for typ,s in ranges.items():
for typ, s in ranges.items():
if typ != "Extended_Pictographic": continue
arr = dict()
for start,end in s:
for i in range(start,end):
arr[i] = 1
sol = packTab.pack_table(arr, 0, compression=3)
code = packTab.Code('_hb_emoji')
sol.genCode(code, 'is_'+typ)
code.print_c(linkage='static inline')
print()
print("static const struct hb_unicode_range_t _hb_unicode_emoji_%s_table[] =" % typ)
print("{")
for pair in sorted(s):
print(" {0x%04X, 0x%04X}," % pair)
print("};")
print ()
print ("#endif /* HB_UNICODE_EMOJI_TABLE_HH */")

View File

@ -98,6 +98,10 @@ for h in headers:
print (" * %s" % (l.strip()))
print (" */")
print ()
print ('#include "hb.hh"')
print ()
print ('#ifndef HB_NO_OT_SHAPE')
print ()
print ('#include "hb-ot-shape-complex-indic.hh"')
print ()
@ -245,12 +249,14 @@ print ("}")
print ()
print ("#undef _")
for i in range (2):
print()
print
vv = sorted (values[i].keys ())
for v in vv:
print ("#undef %s_%s" %
(what_short[i], short[i][v]))
print ()
print ()
print ('#endif')
print ("/* == End of generated table == */")
# Maintain at least 30% occupancy in the table */

View File

@ -6,8 +6,8 @@ import io, os.path, sys, re
import logging
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
if len (sys.argv) != 2:
print("usage: ./gen-ucd-table ucd.nounihan.grouped.xml", file=sys.stderr)
if len (sys.argv) not in (2, 3):
print("usage: ./gen-ucd-table ucd.nounihan.grouped.xml [/path/to/hb-common.h]", file=sys.stderr)
sys.exit(1)
# https://github.com/harfbuzz/packtab
@ -18,6 +18,8 @@ logging.info('Loading UCDXML...')
ucdxml = packTab.ucdxml.load_ucdxml(sys.argv[1])
ucd = packTab.ucdxml.ucdxml_get_repertoire(ucdxml)
hb_common_h = 'hb-common.h' if len (sys.argv) < 3 else sys.argv[2]
logging.info('Preparing data tables...')
gc = [u['gc'] for u in ucd]
@ -68,7 +70,7 @@ for i,v in enumerate(('Cc', 'Cf', 'Cn', 'Co', 'Cs', 'Ll', 'Lm', 'Lo', 'Lt', 'Lu'
sc_order = dict()
sc_array = []
sc_re = re.compile(r"\b(HB_SCRIPT_[_A-Z]*).*HB_TAG [(]'(.)','(.)','(.)','(.)'[)]")
for line in open('hb-common.h'):
for line in open(hb_common_h):
m = sc_re.search (line)
if not m: continue
name = m.group(1)

View File

@ -419,6 +419,10 @@ for h in headers:
print (" * %s" % (l.strip()))
print (" */")
print ()
print ('#include "hb.hh"')
print ()
print ('#ifndef HB_NO_OT_SHAPE')
print ()
print ('#include "hb-ot-shape-complex-use.hh"')
print ()
@ -533,6 +537,8 @@ for k,v in sorted(use_positions.items()):
tag = k + suf
print ("#undef %s" % tag)
print ()
print ()
print ('#endif')
print ("/* == End of generated table == */")
# Maintain at least 50% occupancy in the table */

View File

@ -157,6 +157,11 @@ print (' *')
for line in scripts_header:
print (' * %s' % line.strip ())
print (' */')
print ()
print ('#include "hb.hh"')
print ()
print ('#ifndef HB_NO_OT_SHAPE')
print ()
print ('#include "hb-ot-shape-complex-vowel-constraints.hh"')
print ()
@ -223,4 +228,6 @@ print (' }')
print ('}')
print ()
print ()
print ('#endif')
print ('/* == End of generated functions == */')

View File

@ -0,0 +1,53 @@
#include "hb-aat-layout.cc"
#include "hb-aat-map.cc"
#include "hb-blob.cc"
#include "hb-buffer-serialize.cc"
#include "hb-buffer.cc"
#include "hb-common.cc"
#include "hb-face.cc"
#include "hb-fallback-shape.cc"
#include "hb-font.cc"
#include "hb-map.cc"
#include "hb-ot-cff1-table.cc"
#include "hb-ot-cff2-table.cc"
#include "hb-ot-color.cc"
#include "hb-ot-face.cc"
#include "hb-ot-font.cc"
#include "hb-ot-layout.cc"
#include "hb-ot-map.cc"
#include "hb-ot-math.cc"
#include "hb-ot-meta.cc"
#include "hb-ot-metrics.cc"
#include "hb-ot-name.cc"
#include "hb-ot-shape-complex-arabic.cc"
#include "hb-ot-shape-complex-default.cc"
#include "hb-ot-shape-complex-hangul.cc"
#include "hb-ot-shape-complex-hebrew.cc"
#include "hb-ot-shape-complex-indic-table.cc"
#include "hb-ot-shape-complex-indic.cc"
#include "hb-ot-shape-complex-khmer.cc"
#include "hb-ot-shape-complex-myanmar.cc"
#include "hb-ot-shape-complex-thai.cc"
#include "hb-ot-shape-complex-use-table.cc"
#include "hb-ot-shape-complex-use.cc"
#include "hb-ot-shape-complex-vowel-constraints.cc"
#include "hb-ot-shape-fallback.cc"
#include "hb-ot-shape-normalize.cc"
#include "hb-ot-shape.cc"
#include "hb-ot-tag.cc"
#include "hb-ot-var.cc"
#include "hb-set.cc"
#include "hb-shape-plan.cc"
#include "hb-shape.cc"
#include "hb-shaper.cc"
#include "hb-static.cc"
#include "hb-ucd.cc"
#include "hb-unicode.cc"
#include "hb-warning.cc"
#include "hb-glib.cc"
#include "hb-ft.cc"
#include "hb-graphite2.cc"
#include "hb-uniscribe.cc"
#include "hb-gdi.cc"
#include "hb-directwrite.cc"
#include "hb-coretext.cc"

View File

@ -47,17 +47,16 @@ struct SettingName
hb_aat_layout_feature_selector_t get_selector () const
{ return (hb_aat_layout_feature_selector_t) (unsigned) setting; }
void get_info (hb_aat_layout_feature_selector_info_t *s,
hb_aat_layout_feature_selector_t default_selector) const
hb_aat_layout_feature_selector_info_t get_info (hb_aat_layout_feature_selector_t default_selector) const
{
s->name_id = nameIndex;
s->enable = (hb_aat_layout_feature_selector_t) (unsigned int) setting;
s->disable = default_selector == HB_AAT_LAYOUT_FEATURE_SELECTOR_INVALID ?
(hb_aat_layout_feature_selector_t) (s->enable + 1) :
default_selector;
s->reserved = 0;
return {
nameIndex,
(hb_aat_layout_feature_selector_t) (unsigned int) setting,
default_selector == HB_AAT_LAYOUT_FEATURE_SELECTOR_INVALID
? (hb_aat_layout_feature_selector_t) (setting + 1)
: default_selector,
0
};
}
bool sanitize (hb_sanitize_context_t *c) const
@ -117,9 +116,10 @@ struct FeatureName
if (selectors_count)
{
hb_array_t<const SettingName> arr = settings_table.sub_array (start_offset, selectors_count);
for (unsigned int i = 0; i < arr.length; i++)
settings_table[start_offset + i].get_info (&selectors[i], default_selector);
+ settings_table.sub_array (start_offset, selectors_count)
| hb_map ([=] (const SettingName& setting) { return setting.get_info (default_selector); })
| hb_sink (hb_array (selectors, *selectors_count))
;
}
return settings_table.length;
}
@ -162,21 +162,18 @@ struct feat
unsigned int *count,
hb_aat_layout_feature_type_t *features) const
{
unsigned int feature_count = featureNameCount;
if (count && *count)
if (count)
{
unsigned int len = hb_min (feature_count - start_offset, *count);
for (unsigned int i = 0; i < len; i++)
features[i] = namesZ[i + start_offset].get_feature_type ();
*count = len;
+ namesZ.as_array (featureNameCount).sub_array (start_offset, count)
| hb_map (&FeatureName::get_feature_type)
| hb_sink (hb_array (features, *count))
;
}
return featureNameCount;
}
const FeatureName& get_feature (hb_aat_layout_feature_type_t feature_type) const
{
return namesZ.bsearch (featureNameCount, feature_type);
}
{ return namesZ.bsearch (featureNameCount, feature_type); }
hb_ot_name_id_t get_feature_name_id (hb_aat_layout_feature_type_t feature) const
{ return get_feature (feature).get_feature_name_id (); }

View File

@ -55,17 +55,21 @@ struct lcar
if (caret_count)
{
hb_array_t<const HBINT16> arr = array.sub_array (start_offset, caret_count);
unsigned int count = arr.length;
for (unsigned int i = 0; i < count; ++i)
switch (format)
switch (format)
{
case 0:
for (unsigned int i = 0; i < arr.length; ++i)
caret_array[i] = font->em_scale_dir (arr[i], direction);
break;
case 1:
for (unsigned int i = 0; i < arr.length; ++i)
{
case 0: caret_array[i] = font->em_scale_dir (arr[i], direction); break;
case 1:
hb_position_t x, y;
font->get_glyph_contour_point_for_origin (glyph, arr[i], direction, &x, &y);
caret_array[i] = HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y;
break;
}
break;
}
}
return array.len;
}

View File

@ -0,0 +1,111 @@
/*
* Copyright © 2019 Ebrahim Byagowi
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef HB_AAT_LAYOUT_OPBD_TABLE_HH
#define HB_AAT_LAYOUT_OPBD_TABLE_HH
#include "hb-aat-layout-common.hh"
#include "hb-open-type.hh"
/*
* opbd -- Optical Bounds
* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6opbd.html
*/
#define HB_AAT_TAG_opbd HB_TAG('o','p','b','d')
namespace AAT {
struct OpticalBounds
{
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this)));
}
HBINT16 leftSide;
HBINT16 topSide;
HBINT16 rightSide;
HBINT16 bottomSide;
public:
DEFINE_SIZE_STATIC (8);
};
struct opbd
{
static constexpr hb_tag_t tableTag = HB_AAT_TAG_opbd;
bool get_optical_bounds (hb_font_t *font, hb_codepoint_t glyph_id,
hb_position_t *left, hb_position_t *top,
hb_position_t *right, hb_position_t *bottom) const
{
const OffsetTo<OpticalBounds> *bounds_offset = lookupTable.get_value (glyph_id, font->face->get_num_glyphs ());
if (!bounds_offset) return false;
const OpticalBounds &bounds = this+*bounds_offset;
switch (format)
{
case 0:
*left = font->em_scale_x (bounds.leftSide);
*top = font->em_scale_y (bounds.topSide);
*right = font->em_scale_x (bounds.rightSide);
*bottom = font->em_scale_y (bounds.bottomSide);
return true;
case 1:
hb_position_t ignore;
return font->get_glyph_contour_point (glyph_id, bounds.leftSide, left, &ignore) &&
font->get_glyph_contour_point (glyph_id, bounds.topSide, &ignore, top) &&
font->get_glyph_contour_point (glyph_id, bounds.rightSide, right, &ignore) &&
font->get_glyph_contour_point (glyph_id, bounds.bottomSide, &ignore, bottom);
default:
return false;
}
}
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
version.major == 1 &&
lookupTable.sanitize (c, this)));
}
protected:
FixedVersion<>version; /* Version number of the optical bounds
* table (0x00010000 for the current version). */
HBUINT16 format; /* Format of the optical bounds table.
* Format 0 indicates distance and Format 1 indicates
* control point. */
Lookup<OffsetTo<OpticalBounds>>
lookupTable; /* Lookup table associating glyphs with the four
* int16 values for the left-side, top-side,
* right-side, and bottom-side optical bounds. */
public:
DEFINE_SIZE_MIN (8);
};
} /* namespace AAT */
#endif /* HB_AAT_LAYOUT_OPBD_TABLE_HH */

View File

@ -75,9 +75,6 @@ AAT::hb_aat_apply_context_t::set_ankr_table (const AAT::ankr *ankr_table_)
#endif
#ifndef HB_NO_AAT
/**
* SECTION:hb-aat-layout
* @title: hb-aat-layout
@ -88,6 +85,8 @@ AAT::hb_aat_apply_context_t::set_ankr_table (const AAT::ankr *ankr_table_)
**/
#if !defined(HB_NO_AAT) || defined(HAVE_CORETEXT)
/* Table data courtesy of Apple. Converted from mnemonics to integers
* when moving to this file. */
static const hb_aat_feature_mapping_t feature_mappings[] =
@ -179,8 +178,11 @@ hb_aat_layout_find_feature_mapping (hb_tag_t tag)
sizeof (feature_mappings[0]),
hb_aat_feature_mapping_t::cmp);
}
#endif
#ifndef HB_NO_AAT
/*
* mort/morx/kerx/trak
*/

View File

@ -85,7 +85,7 @@ typedef enum
HB_AAT_LAYOUT_FEATURE_TYPE_LANGUAGE_TAG_TYPE = 39,
HB_AAT_LAYOUT_FEATURE_TYPE_CJK_ROMAN_SPACING_TYPE = 103,
_HB_AAT_LAYOUT_FEATURE_TYPE_MAX_VALUE= 0x7FFFFFFFu, /*< skip >*/
_HB_AAT_LAYOUT_FEATURE_TYPE_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/
} hb_aat_layout_feature_type_t;
/**
@ -424,7 +424,7 @@ typedef enum
HB_AAT_LAYOUT_FEATURE_SELECTOR_DEFAULT_CJK_ROMAN = 2,
HB_AAT_LAYOUT_FEATURE_SELECTOR_FULL_WIDTH_CJK_ROMAN = 3,
_HB_AAT_LAYOUT_FEATURE_SELECTOR_MAX_VALUE= 0x7FFFFFFFu, /*< skip >*/
_HB_AAT_LAYOUT_FEATURE_SELECTOR_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/
} hb_aat_layout_feature_selector_t;
HB_EXTERN unsigned int

View File

@ -28,7 +28,7 @@
#include "hb.hh"
#ifndef HB_NO_SHAPE_AAT
#ifndef HB_NO_AAT_SHAPE
#include "hb-aat-map.hh"

View File

@ -50,31 +50,31 @@
struct
{
/* Note. This is dangerous in that if it's passed an rvalue, it returns rvalue-reference. */
template <typename T> auto
template <typename T> constexpr auto
operator () (T&& v) const HB_AUTO_RETURN ( hb_forward<T> (v) )
}
HB_FUNCOBJ (hb_identity);
struct
{
/* Like identity(), but only retains lvalue-references. Rvalues are returned as rvalues. */
template <typename T> T&
template <typename T> constexpr T&
operator () (T& v) const { return v; }
template <typename T> hb_remove_reference<T>
template <typename T> constexpr hb_remove_reference<T>
operator () (T&& v) const { return v; }
}
HB_FUNCOBJ (hb_lidentity);
struct
{
/* Like identity(), but always returns rvalue. */
template <typename T> hb_remove_reference<T>
template <typename T> constexpr hb_remove_reference<T>
operator () (T&& v) const { return v; }
}
HB_FUNCOBJ (hb_ridentity);
struct
{
template <typename T> bool
template <typename T> constexpr bool
operator () (T&& v) const { return bool (hb_forward<T> (v)); }
}
HB_FUNCOBJ (hb_bool);
@ -82,11 +82,11 @@ HB_FUNCOBJ (hb_bool);
struct
{
private:
template <typename T> auto
template <typename T> constexpr auto
impl (const T& v, hb_priority<1>) const HB_RETURN (uint32_t, hb_deref (v).hash ())
template <typename T,
hb_enable_if (hb_is_integral (T))> auto
hb_enable_if (hb_is_integral (T))> constexpr auto
impl (const T& v, hb_priority<0>) const HB_AUTO_RETURN
(
/* Knuth's multiplicative method: */
@ -95,7 +95,7 @@ struct
public:
template <typename T> auto
template <typename T> constexpr auto
operator () (const T& v) const HB_RETURN (uint32_t, impl (v, hb_prioritize))
}
HB_FUNCOBJ (hb_hash);
@ -328,14 +328,14 @@ hb_pair (T1&& a, T2&& b) { return hb_pair_t<T1, T2> (a, b); }
struct
{
template <typename Pair> typename Pair::first_t
template <typename Pair> constexpr typename Pair::first_t
operator () (const Pair& pair) const { return pair.first; }
}
HB_FUNCOBJ (hb_first);
struct
{
template <typename Pair> typename Pair::second_t
template <typename Pair> constexpr typename Pair::second_t
operator () (const Pair& pair) const { return pair.second; }
}
HB_FUNCOBJ (hb_second);
@ -346,14 +346,14 @@ HB_FUNCOBJ (hb_second);
* comparing integers of different signedness. */
struct
{
template <typename T, typename T2> auto
template <typename T, typename T2> constexpr auto
operator () (T&& a, T2&& b) const HB_AUTO_RETURN
(hb_forward<T> (a) <= hb_forward<T2> (b) ? hb_forward<T> (a) : hb_forward<T2> (b))
}
HB_FUNCOBJ (hb_min);
struct
{
template <typename T, typename T2> auto
template <typename T, typename T2> constexpr auto
operator () (T&& a, T2&& b) const HB_AUTO_RETURN
(hb_forward<T> (a) >= hb_forward<T2> (b) ? hb_forward<T> (a) : hb_forward<T2> (b))
}
@ -917,7 +917,7 @@ struct hb_bitwise_and
{ HB_PARTIALIZE(2);
static constexpr bool passthru_left = false;
static constexpr bool passthru_right = false;
template <typename T> auto
template <typename T> constexpr auto
operator () (const T &a, const T &b) const HB_AUTO_RETURN (a & b)
}
HB_FUNCOBJ (hb_bitwise_and);
@ -925,7 +925,7 @@ struct hb_bitwise_or
{ HB_PARTIALIZE(2);
static constexpr bool passthru_left = true;
static constexpr bool passthru_right = true;
template <typename T> auto
template <typename T> constexpr auto
operator () (const T &a, const T &b) const HB_AUTO_RETURN (a | b)
}
HB_FUNCOBJ (hb_bitwise_or);
@ -933,7 +933,7 @@ struct hb_bitwise_xor
{ HB_PARTIALIZE(2);
static constexpr bool passthru_left = true;
static constexpr bool passthru_right = true;
template <typename T> auto
template <typename T> constexpr auto
operator () (const T &a, const T &b) const HB_AUTO_RETURN (a ^ b)
}
HB_FUNCOBJ (hb_bitwise_xor);
@ -941,56 +941,56 @@ struct hb_bitwise_sub
{ HB_PARTIALIZE(2);
static constexpr bool passthru_left = true;
static constexpr bool passthru_right = false;
template <typename T> auto
template <typename T> constexpr auto
operator () (const T &a, const T &b) const HB_AUTO_RETURN (a & ~b)
}
HB_FUNCOBJ (hb_bitwise_sub);
struct
{
template <typename T> auto
template <typename T> constexpr auto
operator () (const T &a) const HB_AUTO_RETURN (~a)
}
HB_FUNCOBJ (hb_bitwise_neg);
struct
{ HB_PARTIALIZE(2);
template <typename T, typename T2> auto
template <typename T, typename T2> constexpr auto
operator () (const T &a, const T2 &b) const HB_AUTO_RETURN (a + b)
}
HB_FUNCOBJ (hb_add);
struct
{ HB_PARTIALIZE(2);
template <typename T, typename T2> auto
template <typename T, typename T2> constexpr auto
operator () (const T &a, const T2 &b) const HB_AUTO_RETURN (a - b)
}
HB_FUNCOBJ (hb_sub);
struct
{ HB_PARTIALIZE(2);
template <typename T, typename T2> auto
template <typename T, typename T2> constexpr auto
operator () (const T &a, const T2 &b) const HB_AUTO_RETURN (a * b)
}
HB_FUNCOBJ (hb_mul);
struct
{ HB_PARTIALIZE(2);
template <typename T, typename T2> auto
template <typename T, typename T2> constexpr auto
operator () (const T &a, const T2 &b) const HB_AUTO_RETURN (a / b)
}
HB_FUNCOBJ (hb_div);
struct
{ HB_PARTIALIZE(2);
template <typename T, typename T2> auto
template <typename T, typename T2> constexpr auto
operator () (const T &a, const T2 &b) const HB_AUTO_RETURN (a % b)
}
HB_FUNCOBJ (hb_mod);
struct
{
template <typename T> auto
template <typename T> constexpr auto
operator () (const T &a) const HB_AUTO_RETURN (+a)
}
HB_FUNCOBJ (hb_pos);
struct
{
template <typename T> auto
template <typename T> constexpr auto
operator () (const T &a) const HB_AUTO_RETURN (-a)
}
HB_FUNCOBJ (hb_neg);

View File

@ -28,6 +28,7 @@
#define HB_BIMAP_HH
#include "hb.hh"
#include "hb-map.hh"
/* Bi-directional map */
struct hb_bimap_t
@ -57,6 +58,8 @@ struct hb_bimap_t
void set (hb_codepoint_t lhs, hb_codepoint_t rhs)
{
if (unlikely (lhs == HB_MAP_VALUE_INVALID)) return;
if (unlikely (rhs == HB_MAP_VALUE_INVALID)) { del (lhs); return; }
forw_map.set (lhs, rhs);
back_map.set (rhs, lhs);
}
@ -131,6 +134,7 @@ struct hb_inc_bimap_t : hb_bimap_t
work.qsort (cmp_id);
clear ();
for (hb_codepoint_t rhs = 0; rhs < count; rhs++)
set (work[rhs], rhs);
}

View File

@ -226,7 +226,7 @@ struct number_t
void set_fixed (int32_t v) { value = v / 65536.0; }
int32_t to_fixed () const { return (int32_t) (value * 65536.0); }
void set_real (double v) { value = v; }
void set_real (double v) { value = v; }
double to_real () const { return value; }
int ceil () const { return (int) ::ceil (value); }
@ -235,17 +235,10 @@ struct number_t
bool in_int_range () const
{ return ((double) (int16_t) to_int () == value); }
bool operator > (const number_t &n) const
{ return value > n.to_real (); }
bool operator < (const number_t &n) const
{ return n > *this; }
bool operator >= (const number_t &n) const
{ return !(*this < n); }
bool operator <= (const number_t &n) const
{ return !(*this > n); }
bool operator > (const number_t &n) const { return value > n.to_real (); }
bool operator < (const number_t &n) const { return n > *this; }
bool operator >= (const number_t &n) const { return !(*this < n); }
bool operator <= (const number_t &n) const { return !(*this > n); }
const number_t &operator += (const number_t &n)
{
@ -255,7 +248,7 @@ struct number_t
}
protected:
double value;
double value;
};
/* byte string */
@ -308,7 +301,7 @@ struct byte_str_t : hb_ubytes_t
: hb_ubytes_t (s, l) {}
byte_str_t (const hb_ubytes_t &ub) /* conversion from hb_ubytes_t */
: hb_ubytes_t (ub) {}
/* sub-string */
byte_str_t sub_str (unsigned int offset, unsigned int len_) const
{ return byte_str_t (hb_ubytes_t::sub_array (offset, len_)); }
@ -320,8 +313,7 @@ struct byte_str_t : hb_ubytes_t
/* A byte string associated with the current offset and an error condition */
struct byte_str_ref_t
{
byte_str_ref_t ()
{ init (); }
byte_str_ref_t () { init (); }
void init ()
{
@ -343,13 +335,12 @@ struct byte_str_ref_t
}
const unsigned char& operator [] (int i) {
if (unlikely ((unsigned int)(offset + i) >= str.length))
if (unlikely ((unsigned int) (offset + i) >= str.length))
{
set_error ();
return Null(unsigned char);
return Null (unsigned char);
}
else
return str[offset + i];
return str[offset + i];
}
/* Conversion to byte_str_t */
@ -359,9 +350,7 @@ struct byte_str_ref_t
{ return str.sub_str (offset_, len_); }
bool avail (unsigned int count=1) const
{
return (!in_error () && str.check_limit (offset, count));
}
{ return (!in_error () && str.check_limit (offset, count)); }
void inc (unsigned int count=1)
{
if (likely (!in_error () && (offset <= str.length) && (offset + count <= str.length)))
@ -389,7 +378,7 @@ typedef hb_vector_t<byte_str_t> byte_str_array_t;
/* stack */
template <typename ELEM, int LIMIT>
struct stack_t
struct cff_stack_t
{
void init ()
{
@ -400,11 +389,7 @@ struct stack_t
for (unsigned int i = 0; i < elements.length; i++)
elements[i].init ();
}
void fini ()
{
elements.fini_deep ();
}
void fini () { elements.fini_deep (); }
ELEM& operator [] (unsigned int i)
{
@ -419,7 +404,6 @@ struct stack_t
else
set_error ();
}
ELEM &push ()
{
if (likely (count < elements.length))
@ -441,7 +425,6 @@ struct stack_t
return Crap(ELEM);
}
}
void pop (unsigned int n)
{
if (likely (count >= n))
@ -452,13 +435,12 @@ struct stack_t
const ELEM& peek ()
{
if (likely (count > 0))
return elements[count-1];
else
if (unlikely (count < 0))
{
set_error ();
return Null(ELEM);
}
return elements[count - 1];
}
void unpop ()
@ -475,7 +457,7 @@ struct stack_t
void set_error () { error = true; }
unsigned int get_count () const { return count; }
bool is_empty () const { return count == 0; }
bool is_empty () const { return !count; }
static constexpr unsigned kSizeLimit = LIMIT;
@ -487,7 +469,7 @@ struct stack_t
/* argument stack */
template <typename ARG=number_t>
struct arg_stack_t : stack_t<ARG, 513>
struct arg_stack_t : cff_stack_t<ARG, 513>
{
void push_int (int v)
{
@ -519,7 +501,7 @@ struct arg_stack_t : stack_t<ARG, 513>
i = 0;
S::set_error ();
}
return (unsigned)i;
return (unsigned) i;
}
void push_longint_from_substr (byte_str_ref_t& str_ref)
@ -538,12 +520,10 @@ struct arg_stack_t : stack_t<ARG, 513>
}
hb_array_t<const ARG> get_subarray (unsigned int start) const
{
return S::elements.sub_array (start);
}
{ return S::elements.sub_array (start); }
private:
typedef stack_t<ARG, 513> S;
typedef cff_stack_t<ARG, 513> S;
};
/* an operator prefixed by its operands in a byte string */
@ -605,7 +585,7 @@ struct parsed_values_t
}
unsigned get_count () const { return values.length; }
const VAL &get_value (unsigned int i) const { return values[i]; }
const VAL &get_value (unsigned int i) const { return values[i]; }
const VAL &operator [] (unsigned int i) const { return get_value (i); }
unsigned int opStart;
@ -644,30 +624,19 @@ struct interp_env_t
return op;
}
const ARG& eval_arg (unsigned int i)
{
return argStack[i];
}
const ARG& eval_arg (unsigned int i) { return argStack[i]; }
ARG& pop_arg ()
{
return argStack.pop ();
}
ARG& pop_arg () { return argStack.pop (); }
void pop_n_args (unsigned int n) { argStack.pop (n); }
void pop_n_args (unsigned int n)
{
argStack.pop (n);
}
void clear_args () { pop_n_args (argStack.get_count ()); }
void clear_args ()
{
pop_n_args (argStack.get_count ());
}
byte_str_ref_t str_ref;
arg_stack_t<ARG> argStack;
byte_str_ref_t
str_ref;
arg_stack_t<ARG>
argStack;
protected:
bool error;
bool error;
};
typedef interp_env_t<> num_interp_env_t;
@ -711,8 +680,8 @@ struct opset_t
};
template <typename ENV>
struct interpreter_t {
struct interpreter_t
{
~interpreter_t() { fini (); }
void fini () { env.fini (); }

View File

@ -57,14 +57,14 @@ struct call_context_t
/* call stack */
const unsigned int kMaxCallLimit = 10;
struct call_stack_t : stack_t<call_context_t, kMaxCallLimit> {};
struct call_stack_t : cff_stack_t<call_context_t, kMaxCallLimit> {};
template <typename SUBRS>
struct biased_subrs_t
{
void init (const SUBRS &subrs_)
void init (const SUBRS *subrs_)
{
subrs = &subrs_;
subrs = subrs_;
unsigned int nSubrs = get_count ();
if (nSubrs < 1240)
bias = 107;
@ -118,7 +118,7 @@ struct point_t
template <typename ARG, typename SUBRS>
struct cs_interp_env_t : interp_env_t<ARG>
{
void init (const byte_str_t &str, const SUBRS &globalSubrs_, const SUBRS &localSubrs_)
void init (const byte_str_t &str, const SUBRS *globalSubrs_, const SUBRS *localSubrs_)
{
interp_env_t<ARG>::init (str);

View File

@ -40,7 +40,7 @@ struct cff1_cs_interp_env_t : cs_interp_env_t<number_t, CFF1Subrs>
template <typename ACC>
void init (const byte_str_t &str, ACC &acc, unsigned int fd)
{
SUPER::init (str, *acc.globalSubrs, *acc.privateDicts[fd].localSubrs);
SUPER::init (str, acc.globalSubrs, acc.privateDicts[fd].localSubrs);
processed_width = false;
has_width = false;
arg_start = 0;

View File

@ -82,7 +82,7 @@ struct cff2_cs_interp_env_t : cs_interp_env_t<blend_arg_t, CFF2Subrs>
void init (const byte_str_t &str, ACC &acc, unsigned int fd,
const int *coords_=nullptr, unsigned int num_coords_=0)
{
SUPER::init (str, *acc.globalSubrs, *acc.privateDicts[fd].localSubrs);
SUPER::init (str, acc.globalSubrs, acc.privateDicts[fd].localSubrs);
coords = coords_;
num_coords = num_coords_;

View File

@ -66,6 +66,8 @@
#define HB_NO_LAYOUT_COLLECT_GLYPHS
#define HB_NO_LAYOUT_UNUSED
#define HB_NO_MATH
#define HB_NO_META
#define HB_NO_METRICS
#define HB_NO_MMAP
#define HB_NO_NAME
#define HB_NO_OPEN
@ -93,7 +95,7 @@
#ifdef HB_NO_AAT
#define HB_NO_OT_NAME_LANGUAGE_AAT
#define HB_NO_SHAPE_AAT
#define HB_NO_AAT_SHAPE
#endif
#ifdef HB_NO_BITMAP
@ -121,6 +123,17 @@
#define HB_NO_OT_NAME_LANGUAGE
#endif
#ifdef HB_NO_OT
#define HB_NO_OT_FONT
#define HB_NO_OT_LAYOUT
#define HB_NO_OT_TAG
#define HB_NO_OT_SHAPE
#endif
#ifdef HB_NO_OT_SHAPE
#define HB_NO_AAT_SHAPE
#endif
#ifdef HB_NO_OT_SHAPE_FALLBACK
#define HB_NO_OT_SHAPE_COMPLEX_ARABIC_FALLBACK
#define HB_NO_OT_SHAPE_COMPLEX_HEBREW_FALLBACK

View File

@ -75,7 +75,7 @@ release_table_data (void *user_data)
}
static hb_blob_t *
reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
_hb_cg_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
{
CGFontRef cg_font = reinterpret_cast<CGFontRef> (user_data);
CFDataRef cf_data = CGFontCopyTableForTag (cg_font, tag);
@ -299,7 +299,7 @@ _hb_coretext_shaper_face_data_destroy (hb_coretext_face_data_t *data)
hb_face_t *
hb_coretext_face_create (CGFontRef cg_font)
{
return hb_face_create_for_tables (reference_table, CGFontRetain (cg_font), _hb_cg_font_release);
return hb_face_create_for_tables (_hb_cg_reference_table, CGFontRetain (cg_font), _hb_cg_font_release);
}
/*

View File

@ -28,11 +28,18 @@
#include "hb-shaper-impl.hh"
#include <DWrite_1.h>
#include <dwrite_1.h>
#include "hb-directwrite.h"
/* Declare object creator for dynamic support of DWRITE */
typedef HRESULT (* WINAPI t_DWriteCreateFactory)(
DWRITE_FACTORY_TYPE factoryType,
REFIID iid,
IUnknown **factory
);
/*
* hb-directwrite uses new/delete syntatically but as we let users
* to override malloc/free, we will redefine new/delete so users
@ -138,6 +145,7 @@ public:
struct hb_directwrite_face_data_t
{
HMODULE dwrite_dll;
IDWriteFactory *dwriteFactory;
IDWriteFontFile *fontFile;
DWriteFontFileStream *fontFileStream;
@ -153,12 +161,43 @@ _hb_directwrite_shaper_face_data_create (hb_face_t *face)
if (unlikely (!data))
return nullptr;
// TODO: factory and fontFileLoader should be cached separately
IDWriteFactory* dwriteFactory;
DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory),
(IUnknown**) &dwriteFactory);
#define FAIL(...) \
HB_STMT_START { \
DEBUG_MSG (DIRECTWRITE, nullptr, __VA_ARGS__); \
return nullptr; \
} HB_STMT_END
data->dwrite_dll = LoadLibrary (TEXT ("DWRITE"));
if (unlikely (!data->dwrite_dll))
FAIL ("Cannot find DWrite.DLL");
t_DWriteCreateFactory p_DWriteCreateFactory;
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
p_DWriteCreateFactory = (t_DWriteCreateFactory)
GetProcAddress (data->dwrite_dll, "DWriteCreateFactory");
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
if (unlikely (!p_DWriteCreateFactory))
FAIL ("Cannot find DWriteCreateFactory().");
HRESULT hr;
// TODO: factory and fontFileLoader should be cached separately
IDWriteFactory* dwriteFactory;
hr = p_DWriteCreateFactory (DWRITE_FACTORY_TYPE_SHARED, __uuidof (IDWriteFactory),
(IUnknown**) &dwriteFactory);
if (unlikely (hr != S_OK))
FAIL ("Failed to run DWriteCreateFactory().");
hb_blob_t *blob = hb_face_reference_blob (face);
DWriteFontFileStream *fontFileStream;
fontFileStream = new DWriteFontFileStream ((uint8_t *) hb_blob_get_data (blob, nullptr),
@ -172,12 +211,6 @@ _hb_directwrite_shaper_face_data_create (hb_face_t *face)
hr = dwriteFactory->CreateCustomFontFileReference (&fontFileKey, sizeof (fontFileKey),
fontFileLoader, &fontFile);
#define FAIL(...) \
HB_STMT_START { \
DEBUG_MSG (DIRECTWRITE, nullptr, __VA_ARGS__); \
return nullptr; \
} HB_STMT_END
if (FAILED (hr))
FAIL ("Failed to load font file from data!");
@ -224,6 +257,8 @@ _hb_directwrite_shaper_face_data_destroy (hb_directwrite_face_data_t *data)
delete data->fontFileStream;
if (data->faceBlob)
hb_blob_destroy (data->faceBlob);
if (data->dwrite_dll)
FreeLibrary (data->dwrite_dll);
if (data)
delete data;
}
@ -504,11 +539,6 @@ protected:
Run mRunHead;
};
static inline uint16_t hb_uint16_swap (const uint16_t v)
{ return (v >> 8) | (v << 8); }
static inline uint32_t hb_uint32_swap (const uint32_t v)
{ return (hb_uint16_swap (v) << 16) | hb_uint16_swap (v >> 16); }
/*
* shaper
*/
@ -899,7 +929,7 @@ _hb_directwrite_table_data_release (void *data)
}
static hb_blob_t *
reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
_hb_directwrite_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
{
IDWriteFontFace *dw_face = ((IDWriteFontFace *) user_data);
const void *data;
@ -944,7 +974,7 @@ hb_directwrite_face_create (IDWriteFontFace *font_face)
{
if (font_face)
font_face->AddRef ();
return hb_face_create_for_tables (reference_table, font_face,
return hb_face_create_for_tables (_hb_directwrite_reference_table, font_face,
_hb_directwrite_font_release);
}

View File

@ -1300,6 +1300,8 @@ DEFINE_NULL_INSTANCE (hb_font_t) =
1000, /* x_scale */
1000, /* y_scale */
1<<16, /* x_mult */
1<<16, /* y_mult */
0, /* x_ppem */
0, /* y_ppem */
@ -1330,6 +1332,7 @@ _hb_font_create (hb_face_t *face)
font->klass = hb_font_funcs_get_empty ();
font->data.init0 (font);
font->x_scale = font->y_scale = hb_face_get_upem (face);
font->x_mult = font->y_mult = 1 << 16;
return font;
}
@ -1601,7 +1604,9 @@ hb_font_set_face (hb_font_t *font,
hb_face_t *old = font->face;
hb_face_make_immutable (face);
font->face = hb_face_reference (face);
font->mults_changed ();
hb_face_destroy (old);
}
@ -1711,6 +1716,7 @@ hb_font_set_scale (hb_font_t *font,
font->x_scale = x_scale;
font->y_scale = y_scale;
font->mults_changed ();
}
/**
@ -1855,6 +1861,7 @@ hb_font_set_variations (hb_font_t *font,
normalized, coords_length);
_hb_font_adopt_var_coords_normalized (font, normalized, coords_length);
}
/**
* hb_font_set_var_coords_design:
*
@ -1875,6 +1882,33 @@ hb_font_set_var_coords_design (hb_font_t *font,
hb_ot_var_normalize_coords (font->face, coords_length, coords, normalized);
_hb_font_adopt_var_coords_normalized (font, normalized, coords_length);
}
/**
* hb_font_set_var_named_instance:
* @font: a font.
* @instance_index: named instance index.
*
* Sets design coords of a font from a named instance index.
*
* Since: 2.6.0
*/
void
hb_font_set_var_named_instance (hb_font_t *font,
unsigned instance_index)
{
if (hb_object_is_immutable (font))
return;
unsigned int coords_length = hb_ot_var_named_instance_get_design_coords (font->face, instance_index, nullptr, nullptr);
float *coords = coords_length ? (float *) calloc (coords_length, sizeof (float)) : nullptr;
if (unlikely (coords_length && !coords))
return;
hb_ot_var_named_instance_get_design_coords (font->face, instance_index, &coords_length, coords);
hb_font_set_var_coords_design (font, coords, coords_length);
free (coords);
}
#endif
/**

View File

@ -705,6 +705,10 @@ HB_EXTERN const int *
hb_font_get_var_coords_normalized (hb_font_t *font,
unsigned int *length);
HB_EXTERN void
hb_font_set_var_named_instance (hb_font_t *font,
unsigned instance_index);
HB_END_DECLS
#endif /* HB_FONT_H */

View File

@ -107,8 +107,10 @@ struct hb_font_t
hb_font_t *parent;
hb_face_t *face;
int x_scale;
int y_scale;
int32_t x_scale;
int32_t y_scale;
int64_t x_mult;
int64_t y_mult;
unsigned int x_ppem;
unsigned int y_ppem;
@ -127,16 +129,16 @@ struct hb_font_t
/* Convert from font-space to user-space */
int dir_scale (hb_direction_t direction)
{ return HB_DIRECTION_IS_VERTICAL(direction) ? y_scale : x_scale; }
hb_position_t em_scale_x (int16_t v) { return em_scale (v, x_scale); }
hb_position_t em_scale_y (int16_t v) { return em_scale (v, y_scale); }
hb_position_t em_scalef_x (float v) { return em_scalef (v, this->x_scale); }
hb_position_t em_scalef_y (float v) { return em_scalef (v, this->y_scale); }
int64_t dir_mult (hb_direction_t direction)
{ return HB_DIRECTION_IS_VERTICAL(direction) ? y_mult : x_mult; }
hb_position_t em_scale_x (int16_t v) { return em_mult (v, x_mult); }
hb_position_t em_scale_y (int16_t v) { return em_mult (v, y_mult); }
hb_position_t em_scalef_x (float v) { return em_scalef (v, x_scale); }
hb_position_t em_scalef_y (float v) { return em_scalef (v, y_scale); }
float em_fscale_x (int16_t v) { return em_fscale (v, x_scale); }
float em_fscale_y (int16_t v) { return em_fscale (v, y_scale); }
hb_position_t em_scale_dir (int16_t v, hb_direction_t direction)
{ return em_scale (v, dir_scale (direction)); }
{ return em_mult (v, dir_mult (direction)); }
/* Convert from parent-font user-space to our user-space */
hb_position_t parent_scale_x_distance (hb_position_t v)
@ -607,12 +609,16 @@ struct hb_font_t
return false;
}
hb_position_t em_scale (int16_t v, int scale)
void mults_changed ()
{
int upem = face->get_upem ();
int64_t scaled = v * (int64_t) scale;
scaled += scaled >= 0 ? upem/2 : -upem/2; /* Round. */
return (hb_position_t) (scaled / upem);
signed upem = face->get_upem ();
x_mult = ((int64_t) x_scale << 16) / upem;
y_mult = ((int64_t) y_scale << 16) / upem;
}
hb_position_t em_mult (int16_t v, int64_t mult)
{
return (hb_position_t) ((v * mult) >> 16);
}
hb_position_t em_scalef (float v, int scale)
{ return (hb_position_t) roundf (v * scale / face->get_upem ()); }

View File

@ -564,7 +564,7 @@ _hb_ft_font_set_funcs (hb_font_t *font, FT_Face ft_face, bool unref)
static hb_blob_t *
reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
_hb_ft_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
{
FT_Face ft_face = (FT_Face) user_data;
FT_Byte *buffer;
@ -619,7 +619,7 @@ hb_ft_face_create (FT_Face ft_face,
face = hb_face_create (blob, ft_face->face_index);
hb_blob_destroy (blob);
} else {
face = hb_face_create_for_tables (reference_table, ft_face, destroy);
face = hb_face_create_for_tables (_hb_ft_reference_table, ft_face, destroy);
}
hb_face_set_index (face, ft_face->face_index);

View File

@ -0,0 +1,73 @@
/*
* Copyright © 2019 Ebrahim Byagowi
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#include "hb.hh"
#ifdef HAVE_GDI
#include "hb-gdi.h"
static hb_blob_t *
_hb_gdi_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
{
char *buffer = nullptr;
DWORD length = 0;
HDC hdc = GetDC (nullptr);
if (unlikely (!SelectObject (hdc, (HFONT) user_data))) goto fail;
length = GetFontData (hdc, hb_uint32_swap (tag), 0, buffer, length);
if (unlikely (length == GDI_ERROR)) goto fail_with_releasedc;
buffer = (char *) malloc (length);
if (unlikely (!buffer)) goto fail_with_releasedc;
length = GetFontData (hdc, hb_uint32_swap (tag), 0, buffer, length);
if (unlikely (length == GDI_ERROR)) goto fail_with_releasedc_and_free;
ReleaseDC (nullptr, hdc);
return hb_blob_create ((const char *) buffer, length, HB_MEMORY_MODE_WRITABLE, buffer, free);
fail_with_releasedc_and_free:
free (buffer);
fail_with_releasedc:
ReleaseDC (nullptr, hdc);
fail:
return hb_blob_get_empty ();
}
/**
* hb_gdi_face_create:
* @hdc: a HFONT object.
*
* Return value: #hb_face_t object corresponding to the given input
*
* Since: 2.6.0
**/
hb_face_t *
hb_gdi_face_create (HFONT hfont)
{
return hb_face_create_for_tables (_hb_gdi_reference_table, (void *) hfont, nullptr);
}
#endif

39
gfx/harfbuzz/src/hb-gdi.h Normal file
View File

@ -0,0 +1,39 @@
/*
* Copyright © 2019 Ebrahim Byagowi
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef HB_GDI_H
#define HB_GDI_H
#include "hb.h"
#include <windows.h>
HB_BEGIN_DECLS
HB_EXTERN hb_face_t *
hb_gdi_face_create (HFONT hfont);
HB_END_DECLS
#endif /* HB_GDI_H */

View File

@ -106,32 +106,6 @@ retry:
return d;
}
static void hb_graphite2_release_table(const void *data, const void *table_buffer)
{
hb_graphite2_face_data_t *face_data = (hb_graphite2_face_data_t *) data;
hb_graphite2_tablelist_t *tlist = face_data->tlist;
hb_graphite2_tablelist_t *prev = nullptr;
hb_graphite2_tablelist_t *curr = tlist;
while (curr)
{
if (hb_blob_get_data(curr->blob, nullptr) == table_buffer)
{
if (prev == nullptr)
face_data->tlist.cmpexch(tlist, curr->next);
else
prev->next = curr->next;
hb_blob_destroy(curr->blob);
free(curr);
break;
}
prev = curr;
curr = curr->next;
}
}
static gr_face_ops hb_graphite2_face_ops = { sizeof(gr_face_ops), hb_graphite2_get_table, hb_graphite2_release_table };
hb_graphite2_face_data_t *
_hb_graphite2_shaper_face_data_create (hb_face_t *face)
{
@ -150,7 +124,7 @@ _hb_graphite2_shaper_face_data_create (hb_face_t *face)
return nullptr;
data->face = face;
data->grface = gr_make_face_with_ops (data, &hb_graphite2_face_ops, gr_face_preloadAll);
data->grface = gr_make_face (data, &hb_graphite2_get_table, gr_face_preloadAll);
if (unlikely (!data->grface)) {
free (data);

View File

@ -480,7 +480,7 @@ struct hb_reduce_t
template <typename Iter,
hb_requires (hb_is_iterator (Iter)),
typename AccuT = decltype (hb_declval (Redu) (hb_declval (InitT), hb_declval (typename Iter::item_t)))>
typename AccuT = hb_decay<decltype (hb_declval (Redu) (hb_declval (InitT), hb_declval (typename Iter::item_t)))>>
AccuT
operator () (Iter it)
{

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