Skip to content

Commit

Permalink
Move more ivars from WKWebViewConfiguration to API::PageConfiguration
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=271282
rdar://125046091

Reviewed by Charlie Wolfe.

* Source/WebKit/UIProcess/API/APIPageConfiguration.h:
(API::PageConfiguration::mainContentUserGestureOverrideEnabled const):
(API::PageConfiguration::setMainContentUserGestureOverrideEnabled):
(API::PageConfiguration::invisibleAutoplayNotPermitted const):
(API::PageConfiguration::setInvisibleAutoplayForbidden):
(API::PageConfiguration::attachmentElementEnabled const):
(API::PageConfiguration::setAttachmentElementEnabled):
(API::PageConfiguration::attachmentWideLayoutEnabled const):
(API::PageConfiguration::setAttachmentWideLayoutEnabled):
(API::PageConfiguration::allowsInlinePredictions const):
(API::PageConfiguration::setAllowsInlinePredictions):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration setAllowsInlinePredictions:]):
(-[WKWebViewConfiguration allowsInlinePredictions]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _invisibleAutoplayNotPermitted]):
(-[WKWebViewConfiguration _setInvisibleAutoplayNotPermitted:]):
(-[WKWebViewConfiguration _attachmentElementEnabled]):
(-[WKWebViewConfiguration _setAttachmentElementEnabled:]):
(-[WKWebViewConfiguration _attachmentWideLayoutEnabled]):
(-[WKWebViewConfiguration _setAttachmentWideLayoutEnabled:]):
(-[WKWebViewConfiguration _mainContentUserGestureOverrideEnabled]):
(-[WKWebViewConfiguration _setMainContentUserGestureOverrideEnabled:]):
(-[WKWebViewConfiguration _waitsForPaintAfterViewDidMoveToWindow]):
(-[WKWebViewConfiguration _setWaitsForPaintAfterViewDidMoveToWindow:]):
(-[WKWebViewConfiguration _setMarkedTextInputEnabled:]):
(-[WKWebViewConfiguration _markedTextInputEnabled]):

Canonical link: https://commits.webkit.org/276383@main
  • Loading branch information
achristensen07 committed Mar 20, 2024
1 parent 71b9624 commit ac7e2c9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 35 deletions.
20 changes: 20 additions & 0 deletions Source/WebKit/UIProcess/API/APIPageConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,21 @@ class PageConfiguration : public ObjectImpl<Object::Type::PageConfiguration> {
bool undoManagerAPIEnabled() const { return m_data.undoManagerAPIEnabled; }
void setUndoManagerAPIEnabled(bool enabled) { m_data.undoManagerAPIEnabled = enabled; }

bool mainContentUserGestureOverrideEnabled() const { return m_data.mainContentUserGestureOverrideEnabled; }
void setMainContentUserGestureOverrideEnabled(bool enabled) { m_data.mainContentUserGestureOverrideEnabled = enabled; }

bool invisibleAutoplayForbidden() const { return m_data.invisibleAutoplayForbidden; }
void setInvisibleAutoplayForbidden(bool forbidden) { m_data.invisibleAutoplayForbidden = forbidden; }

bool attachmentElementEnabled() const { return m_data.attachmentElementEnabled; }
void setAttachmentElementEnabled(bool enabled) { m_data.attachmentElementEnabled = enabled; }

bool attachmentWideLayoutEnabled() const { return m_data.attachmentWideLayoutEnabled; }
void setAttachmentWideLayoutEnabled(bool enabled) { m_data.attachmentWideLayoutEnabled = enabled; }

bool allowsInlinePredictions() const { return m_data.allowsInlinePredictions; }
void setAllowsInlinePredictions(bool allows) { m_data.allowsInlinePredictions = allows; }

void setShouldRelaxThirdPartyCookieBlocking(WebCore::ShouldRelaxThirdPartyCookieBlocking value) { m_data.shouldRelaxThirdPartyCookieBlocking = value; }
WebCore::ShouldRelaxThirdPartyCookieBlocking shouldRelaxThirdPartyCookieBlocking() const { return m_data.shouldRelaxThirdPartyCookieBlocking; }

Expand Down Expand Up @@ -372,6 +387,11 @@ class PageConfiguration : public ObjectImpl<Object::Type::PageConfiguration> {
bool incompleteImageBorderEnabled { false };
bool shouldDeferAsynchronousScriptsUntilAfterDocumentLoad { true };
bool undoManagerAPIEnabled { false };
bool mainContentUserGestureOverrideEnabled { false };
bool invisibleAutoplayForbidden { false };
bool attachmentElementEnabled { false };
bool attachmentWideLayoutEnabled { false };
bool allowsInlinePredictions { false };

WebCore::ShouldRelaxThirdPartyCookieBlocking shouldRelaxThirdPartyCookieBlocking { WebCore::ShouldRelaxThirdPartyCookieBlocking::No };
WTF::String attributedBundleIdentifier { };
Expand Down
49 changes: 14 additions & 35 deletions Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,9 @@ @implementation WKWebViewConfiguration {
BOOL _shouldDecidePolicyBeforeLoadingQuickLookPreview;
#endif

BOOL _invisibleAutoplayNotPermitted;
BOOL _mediaDataLoadsAutomatically;
BOOL _attachmentElementEnabled;
BOOL _attachmentWideLayoutEnabled;
Class _attachmentFileWrapperClass;
BOOL _mainContentUserGestureOverrideEnabled;

BOOL _waitsForPaintAfterViewDidMoveToWindow;
BOOL _controlledByAutomation;

#if ENABLE(APPLE_PAY)
Expand All @@ -164,7 +159,6 @@ @implementation WKWebViewConfiguration {
#endif
double _sampledPageTopColorMaxDifference;
double _sampledPageTopColorMinHeight;
BOOL _allowsInlinePredictions;

RetainPtr<NSString> _mediaContentTypesRequiringHardwareSupport;
RetainPtr<NSArray<NSString *>> _additionalSupportedImageTypes;
Expand Down Expand Up @@ -200,12 +194,6 @@ - (instancetype)init
_mediaDataLoadsAutomatically = YES;
_userInterfaceDirectionPolicy = WKUserInterfaceDirectionPolicyContent;
#endif
_mainContentUserGestureOverrideEnabled = NO;
_invisibleAutoplayNotPermitted = NO;
_attachmentElementEnabled = NO;
_attachmentWideLayoutEnabled = NO;

_waitsForPaintAfterViewDidMoveToWindow = YES;

#if ENABLE(WIRELESS_PLAYBACK_TARGET)
_allowsAirPlayForMediaPlayback = YES;
Expand Down Expand Up @@ -238,19 +226,17 @@ - (instancetype)init
_sampledPageTopColorMaxDifference = DEFAULT_VALUE_FOR_SampledPageTopColorMaxDifference;
_sampledPageTopColorMinHeight = DEFAULT_VALUE_FOR_SampledPageTopColorMinHeight;

_allowsInlinePredictions = NO;

return self;
}

- (void)setAllowsInlinePredictions:(BOOL)enabled
{
_allowsInlinePredictions = enabled;
_pageConfiguration->setAllowsInlinePredictions(enabled);
}

- (BOOL)allowsInlinePredictions
{
return _allowsInlinePredictions;
return _pageConfiguration->allowsInlinePredictions();
}

- (NSString *)description
Expand Down Expand Up @@ -365,14 +351,9 @@ - (id)copyWithZone:(NSZone *)zone
configuration->_suppressesIncrementalRendering = self->_suppressesIncrementalRendering;
configuration->_applicationNameForUserAgent = self->_applicationNameForUserAgent;

configuration->_invisibleAutoplayNotPermitted = self->_invisibleAutoplayNotPermitted;
configuration->_mediaDataLoadsAutomatically = self->_mediaDataLoadsAutomatically;
configuration->_attachmentElementEnabled = self->_attachmentElementEnabled;
configuration->_attachmentWideLayoutEnabled = self->_attachmentWideLayoutEnabled;
configuration->_attachmentFileWrapperClass = self->_attachmentFileWrapperClass;
configuration->_mediaTypesRequiringUserActionForPlayback = self->_mediaTypesRequiringUserActionForPlayback;
configuration->_mainContentUserGestureOverrideEnabled = self->_mainContentUserGestureOverrideEnabled;
configuration->_waitsForPaintAfterViewDidMoveToWindow = self->_waitsForPaintAfterViewDidMoveToWindow;
configuration->_controlledByAutomation = self->_controlledByAutomation;

#if PLATFORM(IOS_FAMILY)
Expand Down Expand Up @@ -410,8 +391,6 @@ - (id)copyWithZone:(NSZone *)zone
configuration->_sampledPageTopColorMaxDifference = self->_sampledPageTopColorMaxDifference;
configuration->_sampledPageTopColorMinHeight = self->_sampledPageTopColorMinHeight;

configuration->_allowsInlinePredictions = self->_allowsInlinePredictions;

return configuration;
}

Expand Down Expand Up @@ -911,12 +890,12 @@ - (void)_setIgnoresAppBoundDomains:(BOOL)ignoresAppBoundDomains

- (BOOL)_invisibleAutoplayNotPermitted
{
return _invisibleAutoplayNotPermitted;
return _pageConfiguration->invisibleAutoplayForbidden();
}

- (void)_setInvisibleAutoplayNotPermitted:(BOOL)notPermitted
{
_invisibleAutoplayNotPermitted = notPermitted;
_pageConfiguration->setInvisibleAutoplayForbidden(notPermitted);
}

- (BOOL)_mediaDataLoadsAutomatically
Expand All @@ -931,22 +910,22 @@ - (void)_setMediaDataLoadsAutomatically:(BOOL)mediaDataLoadsAutomatically

- (BOOL)_attachmentElementEnabled
{
return _attachmentElementEnabled;
return _pageConfiguration->attachmentElementEnabled();
}

- (void)_setAttachmentElementEnabled:(BOOL)attachmentElementEnabled
{
_attachmentElementEnabled = attachmentElementEnabled;
_pageConfiguration->setAttachmentElementEnabled(attachmentElementEnabled);
}

- (BOOL)_attachmentWideLayoutEnabled
{
return _attachmentWideLayoutEnabled;
return _pageConfiguration->attachmentWideLayoutEnabled();
}

- (void)_setAttachmentWideLayoutEnabled:(BOOL)attachmentWideLayoutEnabled
{
_attachmentWideLayoutEnabled = attachmentWideLayoutEnabled;
_pageConfiguration->setAttachmentWideLayoutEnabled(attachmentWideLayoutEnabled);
}

- (Class)_attachmentFileWrapperClass
Expand Down Expand Up @@ -1123,12 +1102,12 @@ - (void)_setRequiresUserActionForAudioPlayback:(BOOL)requiresUserActionForAudioP

- (BOOL)_mainContentUserGestureOverrideEnabled
{
return _mainContentUserGestureOverrideEnabled;
return _pageConfiguration->mainContentUserGestureOverrideEnabled();
}

- (void)_setMainContentUserGestureOverrideEnabled:(BOOL)mainContentUserGestureOverrideEnabled
{
_mainContentUserGestureOverrideEnabled = mainContentUserGestureOverrideEnabled;
_pageConfiguration->setMainContentUserGestureOverrideEnabled(mainContentUserGestureOverrideEnabled);
}

- (BOOL)_initialCapitalizationEnabled
Expand All @@ -1143,12 +1122,12 @@ - (void)_setInitialCapitalizationEnabled:(BOOL)initialCapitalizationEnabled

- (BOOL)_waitsForPaintAfterViewDidMoveToWindow
{
return _waitsForPaintAfterViewDidMoveToWindow;
return _pageConfiguration->waitsForPaintAfterViewDidMoveToWindow();
}

- (void)_setWaitsForPaintAfterViewDidMoveToWindow:(BOOL)shouldSynchronize
{
_waitsForPaintAfterViewDidMoveToWindow = shouldSynchronize;
_pageConfiguration->setWaitsForPaintAfterViewDidMoveToWindow(shouldSynchronize);
}

- (BOOL)_isControlledByAutomation
Expand Down Expand Up @@ -1454,12 +1433,12 @@ - (_WKContentSecurityPolicyModeForExtension)_contentSecurityPolicyModeForExtensi
// FIXME: Remove this SPI once rdar://110277838 is resolved and all clients adopt the API.
- (void)_setMarkedTextInputEnabled:(BOOL)enabled
{
_allowsInlinePredictions = enabled;
_pageConfiguration->setAllowsInlinePredictions(enabled);
}

- (BOOL)_markedTextInputEnabled
{
return _allowsInlinePredictions;
return _pageConfiguration->allowsInlinePredictions();
}

@end
Expand Down

0 comments on commit ac7e2c9

Please sign in to comment.