Skip to content

Commit 37825cf

Browse files
committed
Refactor method signatures in cssom-view.kd to use long type for parameters and update return types for elementFromPoint and elementsFromPoint methods. Enhance method handling in patches.ts to accommodate nullable return types and array signatures.
1 parent e6da694 commit 37825cf

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

inputfiles/patches/cssom-view.kd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// Manually moved from Document
22
// See https://github.com/w3c/csswg-drafts/issues/5886 and https://github.com/w3c/csswg-drafts/issues/556
33
interface-mixin DocumentOrShadowRoot {
4-
method elementFromPoint returns="Element?" {
5-
param x type=number
6-
param y type=number
4+
method elementFromPoint returns=Element nullable=#true {
5+
param x type=long
6+
param y type=long
77
}
8-
method elementsFromPoint returns="sequence<Element>" {
9-
param x type=number
10-
param y type=number
8+
method elementsFromPoint returns="Element" array {
9+
param x type=long
10+
param y type=long
1111
}
1212
}

src/build/patches.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,21 @@ function handleProperty(child: Node): Partial<Property> {
138138
*/
139139
function handleMethod(child: Node): Partial<Method> {
140140
const name = child.values[0] as string;
141-
// Build the overrideSignatures array with the method signature string
142-
const signature = [
141+
const isArray = child.values[1] as boolean | undefined;
142+
const returnType = child.properties.returns as string;
143+
const nullable = child.properties.nullable as boolean;
144+
145+
const params = child.children.map((c) => ({
146+
name: c.values[0] as string,
147+
type: c.properties.type as string,
148+
}));
149+
150+
const signature: Method["signature"] = [
143151
{
144-
type: child.properties.returns as string,
145-
parameters: child.children.map((c) => ({
146-
name: c.values[0] as string,
147-
type: c.properties.type as string,
148-
})),
152+
type: isArray ? "sequence" : returnType,
153+
param: params,
154+
nullable,
155+
...(isArray ? { subtype: { type: returnType } } : {}),
149156
},
150157
];
151158
return { name, signature };

0 commit comments

Comments
 (0)