[webkit-changes] [WebKit/WebKit] f075e7: Add SPI to allow excluding elements when saving we...
Sihui
noreply at github.com
Wed Nov 15 13:51:28 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f075e7c9a1eddbb83bb123b1926f531817488c87
https://github.com/WebKit/WebKit/commit/f075e7c9a1eddbb83bb123b1926f531817488c87
Author: Sihui Liu <sihui_liu at apple.com>
Date: 2023-11-15 (Wed, 15 Nov 2023)
Changed paths:
M Source/WebCore/Headers.cmake
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/editing/MarkupAccumulator.cpp
M Source/WebCore/editing/MarkupAccumulator.h
A Source/WebCore/editing/MarkupExclusionRule.h
M Source/WebCore/editing/markup.cpp
M Source/WebCore/editing/markup.h
M Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
M Source/WebCore/loader/archive/cf/LegacyWebArchive.h
M Source/WebCore/xml/XMLSerializer.cpp
M Source/WebKit/Modules/OSX_Private.modulemap
M Source/WebKit/Modules/iOS_Private.modulemap
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Source/WebKit/SourcesCocoa.txt
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
A Source/WebKit/UIProcess/API/Cocoa/_WKArchiveConfiguration.h
A Source/WebKit/UIProcess/API/Cocoa/_WKArchiveConfiguration.mm
A Source/WebKit/UIProcess/API/Cocoa/_WKArchiveExclusionRule.h
A Source/WebKit/UIProcess/API/Cocoa/_WKArchiveExclusionRule.mm
M Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm
M Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm
M Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm
M Source/WebKit/UIProcess/SystemPreviewController.h
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
M Source/WebKit/WebProcess/WebPage/WebFrame.h
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
M Tools/TestWebKitAPI/Tests/WebKitCocoa/CreateWebArchive.mm
Log Message:
-----------
Add SPI to allow excluding elements when saving web page resources
https://bugs.webkit.org/show_bug.cgi?id=264771
rdar://118342918
Reviewed by Ryosuke Niwa.
Sometimes client needs to exclude elements from saved page. For example, script could run automatically when saved page
is loaded, so client may need to exclude scripts from saved page so it does not change web content unexpectedly.
Test: WebArchive.SaveResourcesExclusionRules
* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::MarkupAccumulator):
(WebCore::MarkupAccumulator::serializeNodes):
(WebCore::MarkupAccumulator::serializeNodesWithNamespaces):
(WebCore::isElementExcludedByRule):
(WebCore::MarkupAccumulator::shouldExcludeElement):
* Source/WebCore/editing/MarkupAccumulator.h:
(WebCore::MarkupAccumulator::MarkupAccumulator):
* Source/WebCore/editing/MarkupExclusionRule.h: Added.
* Source/WebCore/editing/markup.cpp:
(WebCore::serializeFragment):
* Source/WebCore/editing/markup.h:
(WebCore::serializeFragment):
* Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
* Source/WebCore/loader/archive/cf/LegacyWebArchive.h:
* Source/WebCore/xml/XMLSerializer.cpp:
(WebCore::XMLSerializer::serializeToString):
* Source/WebKit/Modules/OSX_Private.modulemap:
* Source/WebKit/Modules/iOS_Private.modulemap:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _saveResources:suggestedFileName:completionHandler:]):
(-[WKWebView _archiveWithConfiguration:completionHandler:]):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKArchiveConfiguration.h: Added.
* Source/WebKit/UIProcess/API/Cocoa/_WKArchiveConfiguration.mm: Added.
(-[_WKArchiveConfiguration dealloc]):
* Source/WebKit/UIProcess/API/Cocoa/_WKArchiveExclusionRule.h: Added.
* Source/WebKit/UIProcess/API/Cocoa/_WKArchiveExclusionRule.mm: Added.
(-[_WKArchiveExclusionRule initWithElementLocalName:attributeLocalNames:attributeValues:]):
(-[_WKArchiveExclusionRule elementLocalName]):
(-[_WKArchiveExclusionRule attributeLocalNames]):
(-[_WKArchiveExclusionRule attributeValues]):
* Source/WebKit/UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
* Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm:
* Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
* Source/WebKit/UIProcess/SystemPreviewController.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::saveResources):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::webArchiveData):
* Source/WebKit/WebProcess/WebPage/WebFrame.h:
(WebKit::WebFrame::webArchiveData):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::getWebArchiveOfFrameWithFileName):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/CreateWebArchive.mm:
Canonical link: https://commits.webkit.org/270787@main
More information about the webkit-changes
mailing list