Skip to content

Commit

Permalink
Fix watchOS, tvOS, and macCatalyst builds after r283592
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=231300
rdar://83936867

Reviewed by Wenson Hsieh.

Source/WebKit:

* Platform/spi/ios/PhotosUISPI.h:
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel imagePickerController:didFinishPickingMultipleMediaWithInfo:]):

Source/WTF:

* wtf/PlatformEnableCocoa.h:
* wtf/PlatformHave.h:


Canonical link: https://commits.webkit.org/242605@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283662 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
pxlcoder committed Oct 6, 2021
1 parent 1e45d6d commit f0d83f3
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Source/WTF/ChangeLog
@@ -1,3 +1,14 @@
2021-10-06 Aditya Keerthi <akeerthi@apple.com>

Fix watchOS, tvOS, and macCatalyst builds after r283592
https://bugs.webkit.org/show_bug.cgi?id=231300
rdar://83936867

Reviewed by Wenson Hsieh.

* wtf/PlatformEnableCocoa.h:
* wtf/PlatformHave.h:

2021-10-06 Megan Gardner <megan_gardner@apple.com>

Allow text selection to flip.
Expand Down
5 changes: 5 additions & 0 deletions Source/WTF/wtf/PlatformEnableCocoa.h
Expand Up @@ -567,6 +567,11 @@
#define ENABLE_TOUCH_ACTION_REGIONS 1
#endif

// FIXME (rdar://49961589): Enable on macCatalyst.
#if !defined(ENABLE_TRANSCODE_UIIMAGEPICKERCONTROLLER_VIDEO) && PLATFORM(IOS)
#define ENABLE_TRANSCODE_UIIMAGEPICKERCONTROLLER_VIDEO 1
#endif

#if !defined(ENABLE_WHEEL_EVENT_REGIONS) && (PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(MACCATALYST))
#define ENABLE_WHEEL_EVENT_REGIONS 1
#endif
Expand Down
4 changes: 4 additions & 0 deletions Source/WTF/wtf/PlatformHave.h
Expand Up @@ -1061,3 +1061,7 @@
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000)
#define HAVE_AVSAMPLEBUFFERVIDEOOUTPUT 1
#endif

#if PLATFORM(IOS)
#define HAVE_PUACTIVITYPROGRESSCONTROLLER 1
#endif
12 changes: 12 additions & 0 deletions Source/WebKit/ChangeLog
@@ -1,3 +1,15 @@
2021-10-06 Aditya Keerthi <akeerthi@apple.com>

Fix watchOS, tvOS, and macCatalyst builds after r283592
https://bugs.webkit.org/show_bug.cgi?id=231300
rdar://83936867

Reviewed by Wenson Hsieh.

* Platform/spi/ios/PhotosUISPI.h:
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel imagePickerController:didFinishPickingMultipleMediaWithInfo:]):

2021-10-06 Megan Gardner <megan_gardner@apple.com>

Allow text selection to flip.
Expand Down
6 changes: 6 additions & 0 deletions Source/WebKit/Platform/spi/ios/PhotosUISPI.h
Expand Up @@ -25,12 +25,16 @@

#if USE(APPLE_INTERNAL_SDK)

#if HAVE(PUACTIVITYPROGRESSCONTROLLER)
#import <PhotosUI/PUActivityProgressController.h>
#endif

#else

#import "UIKitSPI.h"

#if HAVE(PUACTIVITYPROGRESSCONTROLLER)

@interface PUActivityProgressController : NSObject

@property (nonatomic, copy) NSString *title;
Expand All @@ -46,4 +50,6 @@

@end

#endif // HAVE(PUACTIVITYPROGRESSCONTROLLER)

#endif // USE(APPLE_INTERNAL_SDK)
18 changes: 18 additions & 0 deletions Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm
Expand Up @@ -54,8 +54,10 @@

#import <pal/cocoa/AVFoundationSoftLink.h>

#if HAVE(PUACTIVITYPROGRESSCONTROLLER)
SOFT_LINK_FRAMEWORK(PhotosUI)
SOFT_LINK_CLASS(PhotosUI, PUActivityProgressController)
#endif

using namespace WebKit;

Expand Down Expand Up @@ -166,6 +168,8 @@ - (BOOL)isVideo

#pragma mark - WKFileUploadMediaTranscoder

#if ENABLE(TRANSCODE_UIIMAGEPICKERCONTROLLER_VIDEO)

@interface WKFileUploadMediaTranscoder : NSObject

- (instancetype)initWithItems:(NSArray *)items videoCount:(NSUInteger)videoCount completionHandler:(WTF::Function<void(NSArray<_WKFileUploadItem *> *)>&&)completionHandler;
Expand Down Expand Up @@ -321,6 +325,8 @@ - (NSString *)_temporaryDirectoryCreateIfNecessary

@end

#endif // ENABLE(TRANSCODE_UIIMAGEPICKERCONTROLLER_VIDEO)

#pragma mark - WKFileUploadPanel

@interface WKFileUploadPanel () <UIPopoverControllerDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate, UIDocumentPickerDelegate, UIAdaptivePresentationControllerDelegate
Expand All @@ -338,7 +344,9 @@ @implementation WKFileUploadPanel {
CGPoint _interactionPoint;
BOOL _allowMultipleFiles;
BOOL _usingCamera;
#if ENABLE(TRANSCODE_UIIMAGEPICKERCONTROLLER_VIDEO)
RetainPtr<WKFileUploadMediaTranscoder> _mediaTranscoder;
#endif
RetainPtr<UIImagePickerController> _imagePicker;
RetainPtr<UIViewController> _presentationViewController; // iPhone always. iPad for Fullscreen Camera.
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
Expand Down Expand Up @@ -940,7 +948,13 @@ - (void)imagePickerController:(UIImagePickerController *)imagePicker didFinishPi
{
[self _processMediaInfoDictionaries:infos
successBlock:^(NSArray<_WKFileUploadItem *> *items) {
#if ENABLE(TRANSCODE_UIIMAGEPICKERCONTROLLER_VIDEO)
[self _uploadMediaItemsTranscodingVideo:items];
#else
ensureOnMainRunLoop([self, strongSelf = retainPtr(self), items = retainPtr(items)] {
[self _chooseMediaItems:items.get()];
});
#endif
}
failureBlock:^{
ensureOnMainRunLoop([self, strongSelf = retainPtr(self)] {
Expand Down Expand Up @@ -1086,6 +1100,8 @@ - (void)_uploadItemFromMediaInfo:(NSDictionary *)info successBlock:(void (^)(_WK
[self _uploadItemForJPEGRepresentationOfImage:originalImage successBlock:successBlock failureBlock:failureBlock];
}

#if ENABLE(TRANSCODE_UIIMAGEPICKERCONTROLLER_VIDEO)

- (void)_uploadMediaItemsTranscodingVideo:(NSArray<_WKFileUploadItem *> *)items
{
auto videoCount = [[items indexesOfObjectsPassingTest:^(_WKFileUploadItem *item, NSUInteger, BOOL*) {
Expand All @@ -1110,6 +1126,8 @@ - (void)_uploadMediaItemsTranscodingVideo:(NSArray<_WKFileUploadItem *> *)items
});
}

#endif

- (BOOL)platformSupportsPickerViewController
{
#if PLATFORM(WATCHOS)
Expand Down

0 comments on commit f0d83f3

Please sign in to comment.