Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: d10b5ad2c28f6657737d54517e5d8486568c35c9 https://github.com/WebKit/WebKit/commit/d10b5ad2c28f6657737d54517e5d8486568c35c9 Author: Sihui Liu <sihui_...@apple.com> Date: 2024-04-24 (Wed, 24 Apr 2024)
Changed paths: A LayoutTests/http/tests/dom/resources/simple-iframe.html A LayoutTests/http/tests/dom/serialize-fragment-attributes-order-expected.txt A LayoutTests/http/tests/dom/serialize-fragment-attributes-order.html M Source/WebCore/dom/Element.cpp M Source/WebCore/dom/ShadowRoot.cpp 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/loader/archive/cf/LegacyWebArchive.cpp Log Message: ----------- Avoid changing the ordering of attributes when markup is not created for saving page https://bugs.webkit.org/show_bug.cgi?id=273130 rdar://126120490 Reviewed by Ryosuke Niwa. URL replacement mode in MarkupAccumulator is introduced specifically for saving web page, and it should not affect result of other cases; otherwise it might break existing usecases. 276043@main accidentally changes the ordering of attributes by appending crossorigin attribute to the end -- even when MarkupAccumulator is not created with URL replacement mode. This patch fixes that by appending attributes in original order when URL replacement is not enabled. (see MarkupAccumulator::appendStartTag). Also, to make it easier to distinguish between URL replacement mode and others, this patch adds two functions: serializeFragmentWithURLReplacement and MarkupAccumulator::enableURLReplacement. * LayoutTests/http/tests/dom/resources/simple-iframe.html: Added. * LayoutTests/http/tests/dom/serialize-fragment-attributes-order-expected.txt: Added. * LayoutTests/http/tests/dom/serialize-fragment-attributes-order.html: Added. * Source/WebCore/dom/Element.cpp: (WebCore::Element::getHTML const): * Source/WebCore/dom/ShadowRoot.cpp: (WebCore::ShadowRoot::getHTML const): * Source/WebCore/editing/MarkupAccumulator.cpp: (WebCore::MarkupAccumulator::MarkupAccumulator): (WebCore::MarkupAccumulator::enableURLReplacement): (WebCore::MarkupAccumulator::appendContentsForNode): (WebCore::MarkupAccumulator::resolveURLIfNeeded const): (WebCore::MarkupAccumulator::appendStartTagWithURLReplacement): (WebCore::MarkupAccumulator::appendStartTag): (WebCore::MarkupAccumulator::frameForAttributeReplacement const): (WebCore::MarkupAccumulator::replaceAttributeIfNecessary): (WebCore::MarkupAccumulator::appendURLAttributeForReplacementIfNecessary): * Source/WebCore/editing/MarkupAccumulator.h: (WebCore::MarkupAccumulator::MarkupAccumulator): * Source/WebCore/editing/markup.cpp: (WebCore::serializeFragment): (WebCore::serializeFragmentWithURLReplacement): * Source/WebCore/editing/markup.h: (WebCore::serializeFragment): (WebCore::serializeFragmentWithURLReplacement): * Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp: (WebCore::LegacyWebArchive::create): Canonical link: https://commits.webkit.org/277944@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes