Skip to content

Commit

Permalink
[iOS] Fix the internal build
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=255834
rdar://108413602

Unreviewed build fix.

Fix the build following recent deprecations in UIKit.

* Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:

`UIBacklightLevelChangedNotification` has been deprecated in favor of
`UIScreenBrightnessDidChangeNotification`. However, the change is not
a simple replacement, since it also requires replacing the use of
`CFNotificationCenter` with `NSNotificationCenter`.

(WebKit::WebProcessPool::registerNotificationObservers):
(WebKit::WebProcessPool::unregisterNotificationObservers):
* Source/WebKit/UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
(-[WKDataListSuggestionsPicker initWithInformation:inView:]):

Mechanical change to set a view's frame's size.

* Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKMultipleSelectPicker initWithView:]):

Mechanical change to set a view's frame's size.

(-[WKMultipleSelectPicker pickerView:row:column:checked:]):

There is no known replacement for the deprecated method.

(-[WKMultipleSelectPicker selectRow:inComponent:extendingSelection:]):

There is no known replacement for the deprecated method.

* Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(-[WebKitTestRunnerWindow setFrameOrigin:]):

This override may be unnecessary, and should be evaluated separately.

Canonical link: https://commits.webkit.org/263285@main
  • Loading branch information
pxlcoder committed Apr 22, 2023
1 parent 0aa6c90 commit ee7888e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Expand Up @@ -779,7 +779,10 @@ static void logProcessPoolState(const WebProcessPool& pool)
m_openDirectoryNotifyTokens.append(notifyToken);
}
#elif !PLATFORM(MACCATALYST)
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
// FIXME: <https://webkit.org/b/246488> Adopt UIScreenBrightnessDidChangeNotification.
addCFNotificationObserver(backlightLevelDidChangeCallback, (__bridge CFStringRef)UIBacklightLevelChangedNotification);
ALLOW_DEPRECATED_DECLARATIONS_END
#if PLATFORM(IOS)
#if ENABLE(REMOTE_INSPECTOR)
addCFNotificationObserver(remoteWebInspectorEnabledCallback, CFSTR(WIRServiceEnabledNotification));
Expand Down Expand Up @@ -851,7 +854,10 @@ static void logProcessPoolState(const WebProcessPool& pool)
for (auto token : m_openDirectoryNotifyTokens)
notify_cancel(token);
#elif !PLATFORM(MACCATALYST)
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
// FIXME: <https://webkit.org/b/255833> Adopt UIScreenBrightnessDidChangeNotification.
removeCFNotificationObserver((__bridge CFStringRef)UIBacklightLevelChangedNotification);
ALLOW_DEPRECATED_DECLARATIONS_END
#if PLATFORM(IOS)
#if ENABLE(REMOTE_INSPECTOR)
removeCFNotificationObserver(CFSTR(WIRServiceEnabledNotification));
Expand Down
Expand Up @@ -231,7 +231,10 @@ - (instancetype)initWithInformation:(WebCore::DataListSuggestionInformation&&)in
[_pickerView setDataSource:self];
[_pickerView setDelegate:self];
[_pickerView setControl:self];
[_pickerView setSize:[UIKeyboard defaultSizeForInterfaceOrientation:view.interfaceOrientation]];

CGRect frame = [_pickerView frame];
frame.size = [UIKeyboard defaultSizeForInterfaceOrientation:view.interfaceOrientation];
[_pickerView setFrame:frame];

return self;
}
Expand Down
10 changes: 9 additions & 1 deletion Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm
Expand Up @@ -164,7 +164,11 @@ - (instancetype)initWithView:(WKContentView *)view
ALLOW_DEPRECATED_DECLARATIONS_END

[self setAllowsMultipleSelection:_allowsMultipleSelection];
[self setSize:[UIKeyboard defaultSizeForInterfaceOrientation:view.interfaceOrientation]];

CGRect frame = self.frame;
frame.size = [UIKeyboard defaultSizeForInterfaceOrientation:view.interfaceOrientation];
[self setFrame:frame];

[self reloadAllComponents];

if (!_allowsMultipleSelection) {
Expand Down Expand Up @@ -277,7 +281,9 @@ - (NSInteger)findItemIndexAt:(int)rowIndex
return itemIndex;
}

ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN
- (void)pickerView:(UIPickerView *)pickerView row:(int)rowIndex column:(int)columnIndex checked:(BOOL)isChecked
ALLOW_DEPRECATED_IMPLEMENTATIONS_END
{
auto numberOfOptions = static_cast<NSUInteger>([_view focusedSelectElementOptions].size());
if (numberOfOptions <= static_cast<NSUInteger>(rowIndex))
Expand Down Expand Up @@ -321,7 +327,9 @@ - (void)selectRow:(NSInteger)rowIndex inComponent:(NSInteger)componentIndex exte
// FIXME: handle extendingSelection.
[self selectRow:rowIndex inComponent:0 animated:NO];
// Progammatic selection changes don't call the delegate, so do that manually.
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
[self pickerView:self row:rowIndex column:0 checked:YES];
ALLOW_DEPRECATED_DECLARATIONS_END
}

- (BOOL)selectFormAccessoryHasCheckedItemAtRow:(long)rowIndex
Expand Down
3 changes: 3 additions & 0 deletions Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
Expand Up @@ -91,7 +91,10 @@ - (void)dealloc
[super dealloc];
}

// FIXME: <https://webkit.org/b/255832> Is this override really necessary?
ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN
- (void)setFrameOrigin:(CGPoint)point
ALLOW_DEPRECATED_IMPLEMENTATIONS_END
{
_fakeOrigin = point;
}
Expand Down

0 comments on commit ee7888e

Please sign in to comment.