[webkit-changes] [WebKit/WebKit] 04a136: Save style sheet resources with same URL in differ...

Sihui noreply at github.com
Fri Nov 10 12:35:48 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 04a136a53bf6b2e2dc118536618fd00b41fc65f3
      https://github.com/WebKit/WebKit/commit/04a136a53bf6b2e2dc118536618fd00b41fc65f3
  Author: Sihui Liu <sihui_liu at apple.com>
  Date:   2023-11-10 (Fri, 10 Nov 2023)

  Changed paths:
    M Source/WebCore/css/CSSFontFaceRule.cpp
    M Source/WebCore/css/CSSFontFaceRule.h
    M Source/WebCore/css/CSSGroupingRule.cpp
    M Source/WebCore/css/CSSImportRule.cpp
    M Source/WebCore/css/CSSImportRule.h
    M Source/WebCore/css/CSSRule.h
    M Source/WebCore/css/CSSStyleRule.cpp
    M Source/WebCore/css/CSSStyleRule.h
    M Source/WebCore/css/CSSStyleSheet.cpp
    M Source/WebCore/css/CSSStyleSheet.h
    M Source/WebCore/editing/MarkupAccumulator.cpp
    M Source/WebCore/editing/MarkupAccumulator.h
    M Source/WebCore/editing/markup.cpp
    M Source/WebCore/editing/markup.h
    M Source/WebCore/html/HTMLLinkElement.cpp
    M Source/WebCore/html/HTMLLinkElement.h
    M Source/WebCore/html/HTMLStyleElement.cpp
    M Source/WebCore/html/HTMLStyleElement.h
    M Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/CreateWebArchive.mm

  Log Message:
  -----------
  Save style sheet resources with same URL in different files
https://bugs.webkit.org/show_bug.cgi?id=264520
rdar://118199671

Reviewed by Ryosuke Niwa.

In current implementation, if two link elements have the same url, we only create one file for storing the resource.
However, two link elements corresponds to two CSSStyleSheet objects, which can be modified independently by script. To
ensure the changes from script are captured, now we store content of CSSStyleSheet object in its own file.

API tests: WebArchive.SaveResourcesLink
           WebArchive.SaveResourcesLinksWithSameURL
           WebArchive.SaveResourcesCSSImportRule

* Source/WebCore/css/CSSFontFaceRule.cpp:
(WebCore::CSSFontFaceRule::cssTextWithReplacementURLs const):
* Source/WebCore/css/CSSFontFaceRule.h:
* Source/WebCore/css/CSSGroupingRule.cpp:
(WebCore::CSSGroupingRule::cssTextForDeclsAndRules const):
* Source/WebCore/css/CSSImportRule.cpp:
(WebCore::CSSImportRule::cssTextInternal const):
(WebCore::CSSImportRule::cssText const):
(WebCore::CSSImportRule::cssTextWithReplacementURLs const):
(WebCore::CSSImportRule::getChildStyleSheets):
* Source/WebCore/css/CSSImportRule.h:
* Source/WebCore/css/CSSRule.h:
(WebCore::CSSRule::cssTextWithReplacementURLs const):
(WebCore::CSSRule::getChildStyleSheets):
* Source/WebCore/css/CSSStyleRule.cpp:
(WebCore::CSSStyleRule::cssTextForRules const):
(WebCore::CSSStyleRule::cssTextWithReplacementURLs const):
(WebCore::CSSStyleRule::cssTextForRulesWithReplacementURLs const):
(WebCore::CSSStyleRule::getChildStyleSheets):
* Source/WebCore/css/CSSStyleRule.h:
* Source/WebCore/css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::cssTextWithReplacementURLs):
(WebCore::CSSStyleSheet::getChildStyleSheets):
* Source/WebCore/css/CSSStyleSheet.h:
* Source/WebCore/editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::MarkupAccumulator):
(WebCore::MarkupAccumulator::appendContentsForNode):
(WebCore::MarkupAccumulator::resolveURLIfNeeded const):
* Source/WebCore/editing/MarkupAccumulator.h:
(WebCore::MarkupAccumulator::MarkupAccumulator):
* Source/WebCore/editing/markup.cpp:
(WebCore::serializeFragment):
* Source/WebCore/editing/markup.h:
(WebCore::serializeFragment):
* Source/WebCore/html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::styleSheetContentWithReplacementURLs const): Deleted.
* Source/WebCore/html/HTMLLinkElement.h:
* Source/WebCore/html/HTMLStyleElement.cpp:
(WebCore::HTMLStyleElement::textContentWithReplacementURLs const): Deleted.
* Source/WebCore/html/HTMLStyleElement.h:
* Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
(WebCore::addSubresourcesForCSSStyleSheetsIfNecessary):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/CreateWebArchive.mm:

Canonical link: https://commits.webkit.org/270562@main




More information about the webkit-changes mailing list