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=271034
rdar://124659985

Reviewed by Sihui Liu.

This is in preparation for moving PageConfiguration initialization to platform-independent
WebPageProxy::createNewPage.

* Source/WebKit/UIProcess/API/APIPageConfiguration.h:
(API::PageConfiguration::legacyEncryptedMediaAPIEnabled const):
(API::PageConfiguration::setLegacyEncryptedMediaAPIEnabled):
(API::PageConfiguration::allowMediaContentTypesRequiringHardwareSupportAsFallback const):
(API::PageConfiguration::setAllowMediaContentTypesRequiringHardwareSupportAsFallback):
(API::PageConfiguration::colorFilterEnabled const):
(API::PageConfiguration::setColorFilterEnabled):
(API::PageConfiguration::incompleteImageBorderEnabled const):
(API::PageConfiguration::setIncompleteImageBorderEnabled):
(API::PageConfiguration::shouldDeferAsynchronousScriptsUntilAfterDocumentLoad const):
(API::PageConfiguration::setShouldDeferAsynchronousScriptsUntilAfterDocumentLoad):
(API::PageConfiguration::undoManagerAPIEnabled const):
(API::PageConfiguration::setUndoManagerAPIEnabled):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _colorFilterEnabled]):
(-[WKWebViewConfiguration _setColorFilterEnabled:]):
(-[WKWebViewConfiguration _incompleteImageBorderEnabled]):
(-[WKWebViewConfiguration _setIncompleteImageBorderEnabled:]):
(-[WKWebViewConfiguration _shouldDeferAsynchronousScriptsUntilAfterDocumentLoad]):
(-[WKWebViewConfiguration _setShouldDeferAsynchronousScriptsUntilAfterDocumentLoad:]):
(-[WKWebViewConfiguration _drawsBackground]):
(-[WKWebViewConfiguration _setDrawsBackground:]):
(-[WKWebViewConfiguration _setLegacyEncryptedMediaAPIEnabled:]):
(-[WKWebViewConfiguration _legacyEncryptedMediaAPIEnabled]):
(-[WKWebViewConfiguration _setAllowMediaContentTypesRequiringHardwareSupportAsFallback:]):
(-[WKWebViewConfiguration _allowMediaContentTypesRequiringHardwareSupportAsFallback]):
(-[WKWebViewConfiguration _setUndoManagerAPIEnabled:]):
(-[WKWebViewConfiguration _undoManagerAPIEnabled]):

Canonical link: https://commits.webkit.org/276178@main
  • Loading branch information
achristensen07 committed Mar 15, 2024
1 parent 1294f70 commit 5512680
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 37 deletions.
24 changes: 24 additions & 0 deletions Source/WebKit/UIProcess/API/APIPageConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,24 @@ class PageConfiguration : public ObjectImpl<Object::Type::PageConfiguration> {
bool needsStorageAccessFromFileURLsQuirk() const { return m_data.needsStorageAccessFromFileURLsQuirk; }
void setNeedsStorageAccessFromFileURLsQuirk(bool needs) { m_data.needsStorageAccessFromFileURLsQuirk = needs; }

bool legacyEncryptedMediaAPIEnabled() const { return m_data.legacyEncryptedMediaAPIEnabled; }
void setLegacyEncryptedMediaAPIEnabled(bool enabled) { m_data.legacyEncryptedMediaAPIEnabled = enabled; }

bool allowMediaContentTypesRequiringHardwareSupportAsFallback() const { return m_data.allowMediaContentTypesRequiringHardwareSupportAsFallback; }
void setAllowMediaContentTypesRequiringHardwareSupportAsFallback(bool allow) { m_data.allowMediaContentTypesRequiringHardwareSupportAsFallback = allow; }

bool colorFilterEnabled() const { return m_data.colorFilterEnabled; }
void setColorFilterEnabled(bool enabled) { m_data.colorFilterEnabled = enabled; }

bool incompleteImageBorderEnabled() const { return m_data.incompleteImageBorderEnabled; }
void setIncompleteImageBorderEnabled(bool enabled) { m_data.incompleteImageBorderEnabled = enabled; }

bool shouldDeferAsynchronousScriptsUntilAfterDocumentLoad() const { return m_data.shouldDeferAsynchronousScriptsUntilAfterDocumentLoad; }
void setShouldDeferAsynchronousScriptsUntilAfterDocumentLoad(bool defer) { m_data.shouldDeferAsynchronousScriptsUntilAfterDocumentLoad = defer; }

bool undoManagerAPIEnabled() const { return m_data.undoManagerAPIEnabled; }
void setUndoManagerAPIEnabled(bool enabled) { m_data.undoManagerAPIEnabled = enabled; }

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

Expand Down Expand Up @@ -348,6 +366,12 @@ class PageConfiguration : public ObjectImpl<Object::Type::PageConfiguration> {
bool allowUniversalAccessFromFileURLs { false };
bool allowTopNavigationToDataURLs { false };
bool needsStorageAccessFromFileURLsQuirk { true };
bool legacyEncryptedMediaAPIEnabled { true };
bool allowMediaContentTypesRequiringHardwareSupportAsFallback { true };
bool colorFilterEnabled { false };
bool incompleteImageBorderEnabled { false };
bool shouldDeferAsynchronousScriptsUntilAfterDocumentLoad { true };
bool undoManagerAPIEnabled { false };

WebCore::ShouldRelaxThirdPartyCookieBlocking shouldRelaxThirdPartyCookieBlocking { WebCore::ShouldRelaxThirdPartyCookieBlocking::No };
WTF::String attributedBundleIdentifier { };
Expand Down
51 changes: 14 additions & 37 deletions Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,6 @@ @implementation WKWebViewConfiguration {
#if ENABLE(APPLE_PAY)
BOOL _applePayEnabled;
#endif
BOOL _legacyEncryptedMediaAPIEnabled;
BOOL _allowMediaContentTypesRequiringHardwareSupportAsFallback;
BOOL _colorFilterEnabled;
BOOL _incompleteImageBorderEnabled;
BOOL _shouldDeferAsynchronousScriptsUntilAfterDocumentLoad;
BOOL _drawsBackground;
BOOL _undoManagerAPIEnabled;
#if ENABLE(APP_HIGHLIGHTS)
BOOL _appHighlightsEnabled;
#endif
Expand Down Expand Up @@ -207,7 +200,6 @@ - (instancetype)init
_mediaDataLoadsAutomatically = YES;
_userInterfaceDirectionPolicy = WKUserInterfaceDirectionPolicyContent;
#endif
_legacyEncryptedMediaAPIEnabled = YES;
_mainContentUserGestureOverrideEnabled = NO;
_invisibleAutoplayNotPermitted = NO;
_attachmentElementEnabled = NO;
Expand All @@ -234,14 +226,6 @@ - (instancetype)init
#endif // PLATFORM(IOS_FAMILY)

_mediaContentTypesRequiringHardwareSupport = @"";
_allowMediaContentTypesRequiringHardwareSupportAsFallback = YES;

_colorFilterEnabled = NO;
_incompleteImageBorderEnabled = NO;
_shouldDeferAsynchronousScriptsUntilAfterDocumentLoad = YES;
_drawsBackground = YES;

_undoManagerAPIEnabled = NO;

#if ENABLE(APPLE_PAY)
_applePayEnabled = DEFAULT_VALUE_FOR_ApplePayEnabled;
Expand Down Expand Up @@ -416,16 +400,9 @@ - (id)copyWithZone:(NSZone *)zone

configuration->_mediaContentTypesRequiringHardwareSupport = adoptNS([self._mediaContentTypesRequiringHardwareSupport copyWithZone:zone]);
configuration->_additionalSupportedImageTypes = adoptNS([self->_additionalSupportedImageTypes copyWithZone:zone]);
configuration->_legacyEncryptedMediaAPIEnabled = self->_legacyEncryptedMediaAPIEnabled;
configuration->_allowMediaContentTypesRequiringHardwareSupportAsFallback = self->_allowMediaContentTypesRequiringHardwareSupportAsFallback;

configuration->_groupIdentifier = adoptNS([self->_groupIdentifier copyWithZone:zone]);
configuration->_colorFilterEnabled = self->_colorFilterEnabled;
configuration->_incompleteImageBorderEnabled = self->_incompleteImageBorderEnabled;
configuration->_shouldDeferAsynchronousScriptsUntilAfterDocumentLoad = self->_shouldDeferAsynchronousScriptsUntilAfterDocumentLoad;
configuration->_drawsBackground = self->_drawsBackground;

configuration->_undoManagerAPIEnabled = self->_undoManagerAPIEnabled;
#if ENABLE(APP_HIGHLIGHTS)
configuration->_appHighlightsEnabled = self->_appHighlightsEnabled;
#endif
Expand Down Expand Up @@ -987,32 +964,32 @@ - (void)_setAttachmentFileWrapperClass:(Class)attachmentFileWrapperClass

- (BOOL)_colorFilterEnabled
{
return _colorFilterEnabled;
return _pageConfiguration->colorFilterEnabled();
}

- (void)_setColorFilterEnabled:(BOOL)colorFilterEnabled
{
_colorFilterEnabled = colorFilterEnabled;
_pageConfiguration->setColorFilterEnabled(colorFilterEnabled);
}

- (BOOL)_incompleteImageBorderEnabled
{
return _incompleteImageBorderEnabled;
return _pageConfiguration->incompleteImageBorderEnabled();
}

- (void)_setIncompleteImageBorderEnabled:(BOOL)incompleteImageBorderEnabled
{
_incompleteImageBorderEnabled = incompleteImageBorderEnabled;
_pageConfiguration->setIncompleteImageBorderEnabled(incompleteImageBorderEnabled);
}

- (BOOL)_shouldDeferAsynchronousScriptsUntilAfterDocumentLoad
{
return _shouldDeferAsynchronousScriptsUntilAfterDocumentLoad;
return _pageConfiguration->shouldDeferAsynchronousScriptsUntilAfterDocumentLoad();
}

- (void)_setShouldDeferAsynchronousScriptsUntilAfterDocumentLoad:(BOOL)shouldDeferAsynchronousScriptsUntilAfterDocumentLoad
{
_shouldDeferAsynchronousScriptsUntilAfterDocumentLoad = shouldDeferAsynchronousScriptsUntilAfterDocumentLoad;
_pageConfiguration->setShouldDeferAsynchronousScriptsUntilAfterDocumentLoad(shouldDeferAsynchronousScriptsUntilAfterDocumentLoad);
}

- (WKWebsiteDataStore *)_websiteDataStoreIfExists
Expand Down Expand Up @@ -1110,12 +1087,12 @@ - (BOOL)_crossOriginAccessControlCheckEnabled

- (BOOL)_drawsBackground
{
return _drawsBackground;
return _pageConfiguration->drawsBackground();
}

- (void)_setDrawsBackground:(BOOL)drawsBackground
{
_drawsBackground = drawsBackground;
_pageConfiguration->setDrawsBackground(drawsBackground);
}

- (BOOL)_requiresUserActionForVideoPlayback
Expand Down Expand Up @@ -1324,22 +1301,22 @@ - (void)_setAdditionalSupportedImageTypes:(NSArray<NSString *> *)additionalSuppo

- (void)_setLegacyEncryptedMediaAPIEnabled:(BOOL)enabled
{
_legacyEncryptedMediaAPIEnabled = enabled;
_pageConfiguration->setLegacyEncryptedMediaAPIEnabled(enabled);
}

- (BOOL)_legacyEncryptedMediaAPIEnabled
{
return _legacyEncryptedMediaAPIEnabled;
return _pageConfiguration->legacyEncryptedMediaAPIEnabled();
}

- (void)_setAllowMediaContentTypesRequiringHardwareSupportAsFallback:(BOOL)allow
{
_allowMediaContentTypesRequiringHardwareSupportAsFallback = allow;
_pageConfiguration->setAllowMediaContentTypesRequiringHardwareSupportAsFallback(allow);
}

- (BOOL)_allowMediaContentTypesRequiringHardwareSupportAsFallback
{
return _allowMediaContentTypesRequiringHardwareSupportAsFallback;
return _pageConfiguration->allowMediaContentTypesRequiringHardwareSupportAsFallback();
}

- (BOOL)_mediaCaptureEnabled
Expand All @@ -1354,12 +1331,12 @@ - (void)_setMediaCaptureEnabled:(BOOL)enabled

- (void)_setUndoManagerAPIEnabled:(BOOL)enabled
{
_undoManagerAPIEnabled = enabled;
_pageConfiguration->setUndoManagerAPIEnabled(enabled);
}

- (BOOL)_undoManagerAPIEnabled
{
return _undoManagerAPIEnabled;
return _pageConfiguration->undoManagerAPIEnabled();
}

- (void)_setAppHighlightsEnabled:(BOOL)enabled
Expand Down

0 comments on commit 5512680

Please sign in to comment.