Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ packages/layout/vectors/dpr-*/** merge=dragon-generated
packages/layout/break-vectors/** merge=dragon-generated
packages/parity/expected-breaks/** merge=dragon-generated
packages/parity/expected-pixels/** merge=dragon-generated
packages/layout/paint-vectors/radius/inputs.jsonl merge=dragon-generated
packages/layout/paint-vectors/shadow/inputs.jsonl merge=dragon-generated
packages/layout/paint-vectors/*/vectors.json merge=dragon-generated
packages/layout/generated/** merge=dragon-generated
packages/translate/corpus.json merge=dragon-generated
Expand Down
32 changes: 32 additions & 0 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

- `third_party/skia/src/base/SkTSort.h`: Copyright 2006 The Android Open Source Project
- `third_party/skia/src/core/SkAnalyticEdge.cpp`: Copyright 2006 The Android Open Source Project
- `third_party/skia/src/core/SkBlitter_A8.cpp`: Copyright 2006 The Android Open Source Project
- `third_party/skia/src/core/SkBlurMask.cpp`: Copyright 2006 The Android Open Source Project
- `third_party/skia/src/core/SkBlurMaskFilterImpl.cpp`: Copyright 2006 The Android Open Source Project
- `third_party/skia/src/core/SkDraw.cpp`: Copyright 2006 The Android Open Source Project
Expand Down Expand Up @@ -435,6 +436,37 @@ software is freely granted, provided that this notice
is preserved.
```

## Blink geometry by Adobe Systems: BSD 2-Clause (in the file header) (adobe-bsd-2)

- `third_party/blink/renderer/platform/geometry/float_rounded_rect.cc`: Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.

```
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
```

## HarfBuzz: "Old MIT" (vendor/harfbuzz/COPYING)

```
Expand Down
38 changes: 36 additions & 2 deletions docs/ports.json
Original file line number Diff line number Diff line change
Expand Up @@ -898,11 +898,13 @@
"fileSha256": "24830dab3c718f430ed4938e24202dbc51a05c0ee8632ecf5e9ab47d51ef0cb6",
"headerSha256": "fc58abb313b0dbb837baebcadf633a83df109528c3a0516c4bb18b3c05ed3c69",
"ranges": [
{ "lines": "178-185", "symbol": "PixelSnappedContouredBorder", "source": "located" },
{ "lines": "207-231", "symbol": "PixelSnappedContouredInnerBorder", "source": "cited" }
],
"dragon": [
{ "file": "packages/layout/src/paint-dash.ts", "symbol": "innerBorderRect", "use": "port" },
{ "file": "packages/layout/test/paint-dash.test.ts", "symbol": null, "use": "reference" }
{ "file": "packages/layout/test/paint-dash.test.ts", "symbol": null, "use": "reference" },
{ "file": "packages/layout/src/paint-radius.ts", "symbol": null, "use": "port" }
]
},
{
Expand Down Expand Up @@ -1350,6 +1352,21 @@
{ "file": "packages/layout/src/calc.ts", "symbol": null, "use": "port" }
]
},
{
"upstream": "third_party/blink/renderer/platform/geometry/float_rounded_rect.cc",
"licence": "bsd-other",
"noticeText": "adobe-bsd-2",
"licencePhrase": "Redistributions of source code must retain the above copyright",
"copyright": "Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.",
"fileSha256": "d9bbdbeef344adb2570a9b4f7c5912e3206e6abda4ac82351f2f7bb7b8071875",
"headerSha256": "0e15d36c5dc6fe5be91e97a60bc1322478c65295d11b3910862cc6d8b940c656",
"ranges": [
{ "lines": "172-187", "symbol": "AdjustedRadiusDimension", "source": "located" }
],
"dragon": [
{ "file": "packages/layout/src/paint-shadow.ts", "symbol": "adjustedRadius", "use": "port" }
]
},
{
"upstream": "third_party/blink/renderer/platform/geometry/layout_unit.h",
"licence": "bsd-google",
Expand Down Expand Up @@ -1599,6 +1616,22 @@
{ "file": "packages/layout/src/paint-aa.ts", "symbol": "INVERSE_TABLE", "use": "port" }
]
},
{
"upstream": "third_party/skia/src/core/SkBlitter_A8.cpp",
"licence": "bsd-skia",
"noticeText": "skia-bsd",
"licencePhrase": "Use of this source code is governed by a BSD-style license",
"copyright": "Copyright 2006 The Android Open Source Project",
"fileSha256": "4a0dd8065eaa98dd44615f82b8311630fa5b11bf36aa06503702821000f44ea4",
"headerSha256": "97092871374832c18d6b4e768112377cbc928853bf18d6599adc7d9b69a05586",
"ranges": [
{ "lines": "116-116", "symbol": "srcover_p", "source": "located" },
{ "lines": "126-138", "symbol": "A8_row_aa", "source": "located" }
],
"dragon": [
{ "file": "packages/layout/src/paint-aa.ts", "symbol": "blend", "use": "port" }
]
},
{
"upstream": "third_party/skia/src/core/SkBlurMask.cpp",
"licence": "bsd-skia",
Expand Down Expand Up @@ -2039,6 +2072,7 @@
"header-bsd-7": "Redistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n1. Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n3. Neither the name of Apple Computer, Inc. (\"Apple\") nor the names of\n its contributors may be used to endorse or promote products derived\n from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS \"AS IS\" AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n",
"header-bsd-8": "Redistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n1. Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS\nBE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\nCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\nSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\nINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\nTHE POSSIBILITY OF SUCH DAMAGE.\n",
"rapidhash-bsd-2": "rapidhash - Very fast, high quality, platform-independent hashing algorithm.\n\nBased on 'wyhash', by Wang Yi <godspeed_china@yeah.net>\n\nBSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php)\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following disclaimer\n in the documentation and/or other materials provided with the\n distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nYou can contact the author at:\n - rapidhash source repository: https://github.com/Nicoshev/rapidhash\n",
"fdlibm-sun": "Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n\nDeveloped at SunSoft, a Sun Microsystems, Inc. business.\nPermission to use, copy, modify, and distribute this\nsoftware is freely granted, provided that this notice\nis preserved.\n"
"fdlibm-sun": "Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n\nDeveloped at SunSoft, a Sun Microsystems, Inc. business.\nPermission to use, copy, modify, and distribute this\nsoftware is freely granted, provided that this notice\nis preserved.\n",
"adobe-bsd-2": "Redistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n1. Redistributions of source code must retain the above\n copyright notice, this list of conditions and the following\n disclaimer.\n2. Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials\n provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\nFOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\nINDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\nHOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\nSTRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\nOF THE POSSIBILITY OF SUCH DAMAGE.\n"
}
}
11 changes: 7 additions & 4 deletions packages/dragon/src/emit/expected-dump.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { canonicalJson, sha256Hex } from '../digest.ts';
import type { Longhand } from '../css/properties.ts';
import type { NativeBackend, NativeProgram, ProgramNode, ProgramWrite } from '../lower/native-program.ts';
import { isPaintKind, paintAppliedValue } from './paint/registry.ts';
import type { PaintEngine } from './paint/types.ts';

export type JsonValue = null | boolean | number | string | readonly JsonValue[] | { readonly [k: string]: JsonValue };

Expand Down Expand Up @@ -39,13 +40,15 @@ export type ExpectedEngine = {
readonly platformFontSize: (px: number) => number;
readonly zoomFontSize: (px: number, zoom: number) => number;
readonly float32: (x: number) => number;
/** The TS paint references (paint-*.ts) whose translations the device runs. */
readonly paint: PaintEngine;
};

/**
* The device values of one node at one scale, from the engine: border widths in whole device px, the snapped border box, and a
* text run's computed font size in device px from the resolved input (null for a box).
* The device values of one node at one scale, from the engine: border widths in whole device px, the snapped border box, the
* layout border-box size before snapping, and a text run's computed font size in device px from the resolved input (null for a box).
*/
export type NodeGeometry = { readonly border: readonly [number, number, number, number]; readonly box: SnappedRect; readonly fontSize: number | null };
export type NodeGeometry = { readonly border: readonly [number, number, number, number]; readonly box: SnappedRect; readonly size: readonly [number, number]; readonly fontSize: number | null };

const rgba = (c: { r: number; g: number; b: number; alpha: number }): number[] => [c.r, c.g, c.b, c.alpha];

Expand Down Expand Up @@ -129,7 +132,7 @@ export function expectedDump(p: NativeProgram, caseId: string, viewport: { reado
if (isLine(r)) return;
const n = byId.get(r.id);
if (n === undefined) throw new Error(`${caseId}@${dpr}: the engine laid out ${r.id}, which the program does not have`);
const g: NodeGeometry = { border: borders.get(r.id) ?? [0, 0, 0, 0], box: snapped[i] as SnappedRect, fontSize: fontSizes.get(r.id) ?? null };
const g: NodeGeometry = { border: borders.get(r.id) ?? [0, 0, 0, 0], box: snapped[i] as SnappedRect, size: [r.width / engine.luPerPx, r.height / engine.luPerPx], fontSize: fontSizes.get(r.id) ?? null };
const applied: { [key: string]: JsonValue } = {};
for (const w of n.writes) applied[w.key] = appliedValue(engine, p.backend, w, dpr, g);
nodes.push({ id: n.id, kind: n.kind, native: n.native, applied });
Expand Down
9 changes: 9 additions & 0 deletions packages/dragon/src/emit/paint/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ export type NativePaint = {
readonly container: string | null;
};

/**
* The TS paint references the host passes in with the engine (the compiler core imports the engine for types only): the same
* functions the device runs translated, for the expected applied values.
*/
export type PaintEngine = {
/** paint-radius.ts roundedShape: the outer then the padding-edge radii of a snapped border box and its layout size, in device px. */
readonly roundedShape: (left: number, top: number, right: number, bottom: number, layoutWidth: number, layoutHeight: number, borders: readonly number[], lengths: readonly { readonly percent: boolean; readonly value: number }[], dpr: number, faults: { readonly radiusUnclamped: boolean; readonly innerRadiusNotReduced: boolean }) => number[];
};

export const NO_NATIVE_PAINT: NativePaint = { boxMembers: '', file: null, stages: {}, afterLayout: null, applied: null, roundedPath: null, container: null };

/** A raster plant a module declares: one text replacement in its support source per backend, proving a pixel lane sees it. */
Expand Down
4 changes: 2 additions & 2 deletions packages/dragon/src/profiles/native-lanes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
export type NativeLanesVerdict = { readonly recorded: boolean; readonly stale: readonly string[]; readonly notPassing: readonly string[] };

export const NATIVE_LANES: { readonly ios: NativeLanesVerdict; readonly android: NativeLanesVerdict } = {
ios: { recorded: true, stale: [], notPassing: ["device-pixels fail (57 failures (pixel 57))"] },
android: { recorded: true, stale: [], notPassing: ["device-pixels fail (86 failures (pixel 86))"] },
ios: { recorded: true, stale: [], notPassing: ["layout-vectors-device not run (run pnpm run parity:lanes -- --run-device (simulators and emulators); the tools are installed, so this is not blocked)", "device-frames not run (run pnpm run parity:lanes -- --run-device (simulators and emulators); the tools are installed, so this is not blocked)", "device-applied not run (run pnpm run parity:lanes -- --run-device (simulators and emulators); the tools are installed, so this is not blocked)", "device-lines not run (run pnpm run parity:lanes -- --run-device (simulators and emulators); the tools are installed, so this is not blocked)", "device-pixels not run (run pnpm run parity:lanes -- --run-device (simulators and emulators); the tools are installed, so this is not blocked)"] },
android: { recorded: true, stale: [], notPassing: ["layout-vectors-device not run (run pnpm run parity:lanes -- --run-device (simulators and emulators); the tools are installed, so this is not blocked)", "device-frames not run (run pnpm run parity:lanes -- --run-device (simulators and emulators); the tools are installed, so this is not blocked)", "device-applied not run (run pnpm run parity:lanes -- --run-device (simulators and emulators); the tools are installed, so this is not blocked)", "device-lines not run (run pnpm run parity:lanes -- --run-device (simulators and emulators); the tools are installed, so this is not blocked)", "device-pixels not run (run pnpm run parity:lanes -- --run-device (simulators and emulators); the tools are installed, so this is not blocked)"] },
};
4 changes: 2 additions & 2 deletions packages/dragon/test/expected-dump.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// are RGBA8; border widths come from the engine at the device scale (initial widths are 3 device px, R5); the clip is the padding
// box; both backends cover the same CSS longhands on every node; the digest is the sha256 of the canonical expected dump.
import { describe, expect, it } from 'vitest';
import { layout, LU_PER_PX, measurerFor, NO_ENGINE_FAULTS, platformFontSize, resolveBorder, snapEdges, zoomFontSize, zoomInput } from '@dragon/layout';
import { layout, LU_PER_PX, measurerFor, NO_ENGINE_FAULTS, platformFontSize, resolveBorder, roundedShape, snapEdges, zoomFontSize, zoomInput } from '@dragon/layout';
import type { ExpectedEngine } from '../src/internal.ts';
import { appliedKeyMap, createProjectWith, cssCoverage, expectedDigest, expectedDump, nativePrograms, NO_FAULTS } from '../src/internal.ts';
import { div, inputFor } from './helpers.ts';
Expand All @@ -12,7 +12,7 @@ const input = inputFor(CSS, (r) => [div(r, 'long', ['long']), div(r, 'thin', ['t
const m = measurerFor('darwin-arm64');
if (m.kind !== 'ok') throw new Error(m.code);
const VIEW = { width: 400, height: 300 };
const engine: ExpectedEngine = { layout, measurer: m.measurer, snapEdges, zoomInput, noFaults: NO_ENGINE_FAULTS, resolveBorder, luPerPx: LU_PER_PX, platformFontSize, zoomFontSize, float32: Math.fround };
const engine: ExpectedEngine = { layout, measurer: m.measurer, snapEdges, zoomInput, noFaults: NO_ENGINE_FAULTS, resolveBorder, luPerPx: LU_PER_PX, platformFontSize, zoomFontSize, float32: Math.fround, paint: { roundedShape } };

function programs() {
const c = createProjectWith({ projectId: 'test', targets: { ios: { minimum: '15.0' }, android: { minSdk: 31 } } }, { faults: NO_FAULTS, profiles: 'derive', direction: 'ltr' }).compile(input);
Expand Down
Loading
Loading