Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 563c795b80f1c0de51382050f74087012e70b4db
https://github.com/WebKit/WebKit/commit/563c795b80f1c0de51382050f74087012e70b4db
Author: Sihui Liu <[email protected]>
Date: 2024-05-22 (Wed, 22 May 2024)
Changed paths:
M Source/WebCore/css/CSSFontFaceSrcValue.cpp
M Source/WebCore/css/CSSFontFaceSrcValue.h
M Source/WebCore/css/CSSImageValue.cpp
M Source/WebCore/css/CSSImageValue.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/CreateWebArchive.mm
Log Message:
-----------
Resolve non-replaced URLs in style sheets when saving web page resources
https://bugs.webkit.org/show_bug.cgi?id=270960
rdar://120498768
Reviewed by Ryosuke Niwa.
Some CSS rules allow developers to specify multiple resources so that browser
could pick the most suitable one to use
(e.g. @font-face). In our current implementation, when saving web page
resources, we only save the resource that is
loaded. That means, URLs of other candidate resources will not be replaced with
local file path in saved web page. It is
common that style sheets use relative path for subresource URL, and the result
is the relative paths in saved style
sheets now point to non-existent files (as the candidate resources are not
saved). To fix that problem, we now resolve
the non-replaced URLs in saved style sheets. With this change, when browser
loads the saved web page and decides to load
candidate resource, it could send the request to correct server.
API test: WebArchive.SaveResourcesStyle
* Source/WebCore/css/CSSFontFaceSrcValue.cpp:
(WebCore::CSSFontFaceSrcResourceValue::customSetReplacementURLForSubresources):
(WebCore::CSSFontFaceSrcResourceValue::customClearReplacementURLForSubresources):
(WebCore::CSSFontFaceSrcResourceValue::customCSSText const):
* Source/WebCore/css/CSSFontFaceSrcValue.h:
* Source/WebCore/css/CSSImageValue.cpp:
(WebCore::CSSImageValue::customSetReplacementURLForSubresources):
(WebCore::CSSImageValue::customClearReplacementURLForSubresources):
(WebCore::CSSImageValue::customCSSText const):
* Source/WebCore/css/CSSImageValue.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/CreateWebArchive.mm:
(TestWebKitAPI::(WebArchive, SaveResourcesStyleWithUnloadedResources)):
Canonical link: https://commits.webkit.org/279168@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes