Skip to content

Commit 0fc3378

Browse files
committedMay 8, 2023
Update specs
1 parent 8dd037b commit 0fc3378

File tree

11 files changed

+675
-150
lines changed

11 files changed

+675
-150
lines changed
 

‎Patches/CSSOM.patch

+76-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,93 @@
11
--- a/Sources/CSSOM/Generated.swift
22
+++ b/Sources/CSSOM/Generated.swift
3-
@@ -378,7 +378,8 @@ public class CSSColorValue: CSSStyleValue {
3+
@@ -379,7 +379,8 @@ public class CSSColorValue: CSSStyleValue {
44
super.init(unsafelyWrapping: jsObject)
55
}
6-
6+
77
- @inlinable override public class func parse(cssText: String) -> CSSColorValue_or_CSSStyleValue {
88
+ // returns CSSStyleValue | CSSColorValue
99
+ @inlinable public class func parse(cssText: String) -> CSSStyleValue {
1010
let this = constructor!
1111
return this[Strings.parse].function!(this: this, arguments: [_toJSValue(cssText)]).fromJSValue()!
1212
}
13-
@@ -935,7 +936,7 @@ public class CSSNumericValue: CSSStyleValue {
13+
@@ -944,7 +945,7 @@ public class CSSNumericValue: CSSStyleValue {
1414
return this[Strings.type].function!(this: this, arguments: []).fromJSValue()!
1515
}
16-
16+
1717
- @inlinable override public class func parse(cssText: String) -> Self {
1818
+ @inlinable public class func parse(cssText: String) -> Self {
1919
let this = constructor!
2020
return this[Strings.parse].function!(this: this, arguments: [_toJSValue(cssText)]).fromJSValue()!
2121
}
22+
@@ -1974,9 +1975,10 @@ public class StylePropertyMapReadOnly: JSBridgedClass, Sequence {
23+
ValueIterableIterator(sequence: self)
24+
}
25+
26+
- @inlinable public func get(property: String) -> CSSStyleValue_or_Void {
27+
+ // TODO: remove patch once https://github.com/w3c/css-houdini-drafts/issues/1095 is fixed
28+
+ @inlinable public func get(property: String) -> CSSStyleValue? {
29+
let this = jsObject
30+
- return this[Strings.get].function!(this: this, arguments: [_toJSValue(property)]).fromJSValue()!
31+
+ return this[Strings.get].function!(this: this, arguments: [_toJSValue(property)]).fromJSValue()
32+
}
33+
34+
@inlinable public func getAll(property: String) -> [CSSStyleValue] {
35+
@@ -2646,58 +2648,6 @@ public enum CSSStyleValue_or_String: JSValueCompatible, Any_CSSStyleValue_or_Str
36+
}
37+
}
38+
39+
-public protocol Any_CSSStyleValue_or_Void: ConvertibleToJSValue {}
40+
-extension CSSStyleValue: Any_CSSStyleValue_or_Void {}
41+
-extension Void: Any_CSSStyleValue_or_Void {}
42+
-
43+
-public enum CSSStyleValue_or_Void: JSValueCompatible, Any_CSSStyleValue_or_Void {
44+
- case cssStyleValue(CSSStyleValue)
45+
- case void(Void)
46+
-
47+
- init(_ cssStyleValue: CSSStyleValue) {
48+
- let val: CSSStyleValue_or_Void = .cssStyleValue(cssStyleValue)
49+
- self = val
50+
- }
51+
-
52+
- init(_ void: Void) {
53+
- let val: CSSStyleValue_or_Void = .void(void)
54+
- self = val
55+
- }
56+
-
57+
- public var cssStyleValue: CSSStyleValue? {
58+
- switch self {
59+
- case let .cssStyleValue(cssStyleValue): return cssStyleValue
60+
- default: return nil
61+
- }
62+
- }
63+
-
64+
- public var void: Void? {
65+
- switch self {
66+
- case let .void(void): return void
67+
- default: return nil
68+
- }
69+
- }
70+
-
71+
- public static func construct(from value: JSValue) -> Self? {
72+
- if let cssStyleValue: CSSStyleValue = value.fromJSValue() {
73+
- return .cssStyleValue(cssStyleValue)
74+
- }
75+
- if let void: Void = value.fromJSValue() {
76+
- return .void(void)
77+
- }
78+
- return nil
79+
- }
80+
-
81+
- public var jsValue: JSValue {
82+
- switch self {
83+
- case let .cssStyleValue(cssStyleValue):
84+
- return cssStyleValue.jsValue
85+
- case let .void(void):
86+
- return void.jsValue
87+
- }
88+
- }
89+
-}
90+
-
91+
public protocol Any_CSSUnparsedSegment: ConvertibleToJSValue {}
92+
extension CSSVariableReferenceValue: Any_CSSUnparsedSegment {}
93+
extension String: Any_CSSUnparsedSegment {}

‎Patches/DOM.patch

+23-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- a/Sources/DOM/Generated.swift
22
+++ b/Sources/DOM/Generated.swift
3-
@@ -1006,8 +1006,15 @@ public class BeforeUnloadEvent: Event {
3+
@@ -1007,8 +1007,15 @@ public class BeforeUnloadEvent: Event {
44
super.init(unsafelyWrapping: jsObject)
55
}
66

@@ -17,7 +17,7 @@
1717
get { _returnValue.wrappedValue }
1818
set { _returnValue.wrappedValue = newValue }
1919
}
20-
@@ -7070,7 +7077,8 @@ public class HTMLFormControlsCollection: HTMLCollection {
20+
@@ -7095,7 +7102,8 @@ public class HTMLFormControlsCollection: HTMLCollection {
2121
jsObject[key].fromJSValue()
2222
}
2323

@@ -27,7 +27,26 @@
2727
let this = jsObject
2828
return this[Strings.namedItem].function!(this: this, arguments: [_toJSValue(name)]).fromJSValue()
2929
}
30-
@@ -20369,19 +20377,9 @@ public enum CanvasImageSource: JSValueCompatible, Any_CanvasImageSource {
30+
@@ -17153,7 +17161,6 @@ public class VisibilityStateEntry: PerformanceEntry {
31+
_name = ReadonlyAttribute(jsObject: jsObject, name: Strings.name)
32+
_entryType = ReadonlyAttribute(jsObject: jsObject, name: Strings.entryType)
33+
_startTime = ReadonlyAttribute(jsObject: jsObject, name: Strings.startTime)
34+
- _duration = ReadonlyAttribute(jsObject: jsObject, name: Strings.duration)
35+
super.init(unsafelyWrapping: jsObject)
36+
}
37+
38+
@@ -17166,8 +17173,8 @@ public class VisibilityStateEntry: PerformanceEntry {
39+
@usableFromInline let _startTime: ReadonlyAttribute<DOMHighResTimeStamp>
40+
@inlinable override public var startTime: DOMHighResTimeStamp { _startTime.wrappedValue }
41+
42+
- @usableFromInline let _duration: ReadonlyAttribute<UInt32>
43+
- @inlinable override public var duration: UInt32 { _duration.wrappedValue }
44+
+ // XXX: override of property `duration` removed because the type here is UInt32 but the
45+
+ // type in the superclass is DOMHighResTimestamp (Double).
46+
}
47+
48+
public class VisualViewport: EventTarget {
49+
@@ -20687,19 +20694,9 @@ public enum CanvasImageSource: JSValueCompatible, Any_CanvasImageSource {
3150
self = val
3251
}
3352

@@ -49,7 +68,7 @@
4968
}
5069

5170
init(_ htmlVideoElement: HTMLVideoElement) {
52-
@@ -21629,18 +21627,8 @@ public enum ImageBitmapSource: JSValueCompatible, Any_ImageBitmapSource {
71+
@@ -21947,18 +21944,8 @@ public enum ImageBitmapSource: JSValueCompatible, Any_ImageBitmapSource {
5372
self = .init(val)
5473
}
5574

‎Sources/CSSOM/Generated.swift

+14-3
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@ public class CSSImportRule: CSSRule {
479479
_href = ReadonlyAttribute(jsObject: jsObject, name: Strings.href)
480480
_media = ReadonlyAttribute(jsObject: jsObject, name: Strings.media)
481481
_styleSheet = ReadonlyAttribute(jsObject: jsObject, name: Strings.styleSheet)
482+
_layerName = ReadonlyAttribute(jsObject: jsObject, name: Strings.layerName)
483+
_supportsText = ReadonlyAttribute(jsObject: jsObject, name: Strings.supportsText)
482484
super.init(unsafelyWrapping: jsObject)
483485
}
484486

@@ -489,7 +491,13 @@ public class CSSImportRule: CSSRule {
489491
public var media: MediaList
490492

491493
@ReadonlyAttribute
492-
public var styleSheet: CSSStyleSheet
494+
public var styleSheet: CSSStyleSheet?
495+
496+
@ReadonlyAttribute
497+
public var layerName: String?
498+
499+
@ReadonlyAttribute
500+
public var supportsText: String?
493501
}
494502

495503
public class CSSKeywordValue: CSSStyleValue {
@@ -1967,9 +1975,10 @@ public class StylePropertyMapReadOnly: JSBridgedClass, Sequence {
19671975
ValueIterableIterator(sequence: self)
19681976
}
19691977

1970-
@inlinable public func get(property: String) -> JSValue {
1978+
// TODO: remove patch once https://github.com/w3c/css-houdini-drafts/issues/1095 is fixed
1979+
@inlinable public func get(property: String) -> CSSStyleValue? {
19711980
let this = jsObject
1972-
return this[Strings.get].function!(this: this, arguments: [_toJSValue(property)]).fromJSValue()!
1981+
return this[Strings.get].function!(this: this, arguments: [_toJSValue(property)]).fromJSValue()
19731982
}
19741983

19751984
@inlinable public func getAll(property: String) -> [CSSStyleValue] {
@@ -2243,6 +2252,7 @@ public class VisualViewport: EventTarget {
22432252
@usableFromInline static let item: JSString = "item"
22442253
@usableFromInline static let kHz: JSString = "kHz"
22452254
@usableFromInline static let l: JSString = "l"
2255+
@usableFromInline static let layerName: JSString = "layerName"
22462256
@usableFromInline static let left: JSString = "left"
22472257
@usableFromInline static let length: JSString = "length"
22482258
@usableFromInline static let lh: JSString = "lh"
@@ -2313,6 +2323,7 @@ public class VisualViewport: EventTarget {
23132323
@usableFromInline static let styleSheet: JSString = "styleSheet"
23142324
@usableFromInline static let styleSheets: JSString = "styleSheets"
23152325
@usableFromInline static let sub: JSString = "sub"
2326+
@usableFromInline static let supportsText: JSString = "supportsText"
23162327
@usableFromInline static let svb: JSString = "svb"
23172328
@usableFromInline static let svh: JSString = "svh"
23182329
@usableFromInline static let svi: JSString = "svi"

0 commit comments

Comments
 (0)