View Issue Details

IDProjectCategoryView StatusLast Update
0037441FPCPackagespublic2021-02-28 21:48
ReporterZoë Peterson Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version3.3.1 
Summary0037441: CocoaInt WKWebView support on macOS
DescriptionAccording to Apple's documentation, WKWebView was introduced in macOS 10.10, and the current FPC Cocoa header translations are based on that version, but the WebKit definitions are all disabled on macOS (and broken on iOS?).

The attached patch makes it work, though someone who knows the header parser better than me should fix it properly.

There's 3 issues I see:

1) WKFoundation.inc has an "{$if defined(TARGET_OS_IPHONE)}" block which disables it for macOS.

2) All of the .inc files use "{$if defined(WK_API_ENABLED)}" to check whether they should include their contents, but since WK_API_ENABLED is a const rather than a DEFINEd value, they always fail. Either the checks need to be switched to {$if declared(WK_API_ENABLED)} or WK_API_ENABLED needs to be $DEFINEd too. I chose the latter to keep the patch small. Might be worth removing the existing const as well.

3) WKWebView.inc has a weird garbage {$if} block (previously mentioned in issue 0035995) which should be corrected, but also collapses down to {$if defined(TARGET_OS_IPHONE)} so it's likewise unnecessarily disabled on macOS.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Zoë Peterson

2020-07-29 00:36

reporter  

FpcWebKit.patch (565 bytes)   
--- src/webkit/WKFoundation.inc
+++ src/webkit/WKFoundation.inc
@@ -2,13 +2,12 @@
 
 {$if  not (defined(WK_API_ENABLED))}
 
-{$if defined(TARGET_OS_IPHONE)}
+{$define WK_API_ENABLED}
+
 {$ifdef TYPES}
 const
   WK_API_ENABLED = 1;
 {$endif}
 
-{$else}
 {$endif}
-{$endif}
 
--- src/webkit/WKWebView.inc
+++ src/webkit/WKWebView.inc
@@ -13,9 +13,6 @@
   WKWebViewPtr = ^WKWebView;
 {$endif}
 
-{$if defined(TARGET_OS_IPHONE)defined(interface)defined(WKWebView)defined(UIView)}
-
-{$else}
 {$ifdef CLASSES}
 
 type
@@ -74,4 +71,4 @@
 {$endif}
 
 {$endif}
-{$endif}
+
FpcWebKit.patch (565 bytes)   

Issue History

Date Modified Username Field Change
2020-07-29 00:36 Zoë Peterson New Issue
2020-07-29 00:36 Zoë Peterson File Added: FpcWebKit.patch
2021-02-28 21:48 Juha Manninen Relationship added related to 0036912
2021-02-28 21:48 Juha Manninen Relationship deleted related to 0036912