Skip to content

Commit 6a3c164

Browse files
committed
Fix CSSOM.patch for compatibility with Embedded Swift
The CSSOM module has different context after previously applied changes for Embedded Swift support. `override` modifiers are not applicable with embedded Swift and need to be replaced with `final`. Similarly `Self` is replaced with explicit class names to avoid use of implicit metatypes currently incompatible with Embedded Swift. Certain initializers also had to become `public` to be usable in library clients.
1 parent a533f69 commit 6a3c164

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

Patches/CSSOM.patch

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
1+
diff --git a/Sources/CSSOM/Generated.swift b/Sources/CSSOM/Generated.swift
2+
index 9cd2fb3..7aec5a8 100644
13
--- a/Sources/CSSOM/Generated.swift
24
+++ b/Sources/CSSOM/Generated.swift
3-
@@ -379,7 +379,8 @@ public class CSSColorValue: CSSStyleValue {
4-
super.init(unsafelyWrapping: jsObject)
5-
}
5+
@@ -411,7 +411,7 @@ public class CSSColorValue: CSSStyleValue {
6+
7+
public required init(unsafelyWrapping jsObject: JSObject) { super.init(unsafelyWrapping: jsObject) }
68

79
- @inlinable override public class func parse(cssText: String) -> CSSColorValue_or_CSSStyleValue {
8-
+ // returns CSSStyleValue | CSSColorValue
9-
+ @inlinable public class func parse(cssText: String) -> CSSStyleValue {
10+
+ @inlinable public class func parse(cssText: String) -> CSSColorValue {
1011
let this = constructor!
1112
return this[Strings.parse].function!(this: this, arguments: [_toJSValue(cssText)]).fromJSValue()!
1213
}
13-
@@ -944,7 +945,7 @@ public class CSSNumericValue: CSSStyleValue {
14+
@@ -947,7 +947,7 @@ public class CSSNumericValue: CSSStyleValue {
1415
return this[Strings.type].function!(this: this, arguments: []).fromJSValue()!
1516
}
1617

17-
- @inlinable override public class func parse(cssText: String) -> Self {
18-
+ @inlinable public class func parse(cssText: String) -> Self {
18+
- @inlinable override public class func parse(cssText: String) -> CSSNumericValue {
19+
+ @inlinable public class func parse(cssText: String) -> CSSNumericValue {
1920
let this = constructor!
2021
return this[Strings.parse].function!(this: this, arguments: [_toJSValue(cssText)]).fromJSValue()!
2122
}
22-
@@ -1974,9 +1975,10 @@ public class StylePropertyMapReadOnly: JSBridgedClass, Sequence {
23+
@@ -2072,9 +2072,10 @@ public class StylePropertyMapReadOnly: JSBridgedClass, Sequence {
2324
ValueIterableIterator(sequence: self)
2425
}
2526

26-
- @inlinable public func get(property: String) -> CSSStyleValue_or_Void {
27+
- @inlinable final public func get(property: String) -> CSSStyleValue_or_Void {
2728
+ // TODO: remove patch once https://github.com/w3c/css-houdini-drafts/issues/1095 is fixed
28-
+ @inlinable public func get(property: String) -> CSSStyleValue? {
29+
+ @inlinable final public func get(property: String) -> CSSStyleValue? {
2930
let this = jsObject
3031
- return this[Strings.get].function!(this: this, arguments: [_toJSValue(property)]).fromJSValue()!
3132
+ return this[Strings.get].function!(this: this, arguments: [_toJSValue(property)]).fromJSValue()
3233
}
3334

34-
@inlinable public func getAll(property: String) -> [CSSStyleValue] {
35-
@@ -2646,58 +2648,6 @@ public enum CSSStyleValue_or_String: JSValueCompatible, Any_CSSStyleValue_or_Str
35+
@inlinable final public func getAll(property: String) -> [CSSStyleValue] {
36+
@@ -2706,49 +2707,6 @@ public enum CSSStyleValue_or_String: JSValueCompatible, Any_CSSStyleValue_or_Str
37+
}
3638
}
3739
}
38-
3940
-public protocol Any_CSSStyleValue_or_Void: ConvertibleToJSValue {}
4041
-extension CSSStyleValue: Any_CSSStyleValue_or_Void {}
4142
-extension Void: Any_CSSStyleValue_or_Void {}
@@ -44,12 +45,11 @@
4445
- case cssStyleValue(CSSStyleValue)
4546
- case void(Void)
4647
-
47-
- init(_ cssStyleValue: CSSStyleValue) {
48+
- public init(_ cssStyleValue: CSSStyleValue) {
4849
- let val: CSSStyleValue_or_Void = .cssStyleValue(cssStyleValue)
4950
- self = val
5051
- }
51-
-
52-
- init(_ void: Void) {
52+
- public init(_ void: Void) {
5353
- let val: CSSStyleValue_or_Void = .void(void)
5454
- self = val
5555
- }
@@ -60,7 +60,6 @@
6060
- default: return nil
6161
- }
6262
- }
63-
-
6463
- public var void: Void? {
6564
- switch self {
6665
- case let .void(void): return void

0 commit comments

Comments
 (0)