haikuwebkit/LayoutTests/svg/animations/css-animation-hover-svg.html

45 lines
1.3 KiB
HTML
Raw Permalink Normal View History

REGRESSION: CSS animations inside an embedded SVG image do not animate https://bugs.webkit.org/show_bug.cgi?id=209370 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2020-04-09 Reviewed by Simon Fraser. Source/WebCore: If WebAnimation is enabled and the SVGImage includes CSS animations, the DocumentTimeline is added to the SVGDocument of the embedded SVGImage. Because the SVGImage has its own Page the RenderingUpdate is scheduled and the updateRendering steps run in this Page. The Page of the SVGImage is inactive such that scheduling RenderingUpdate fails; therefore the updateRendering steps never run and the CSS animation never advances. The fix is: 1) Scheduling the RenderingUpdate: This has to happen in the Page which contains the renderer of the SVGImage. Because DocumentTimeline is added to SVGDocument, this scheduling will go through these hubs: - DocumentTimeline - Page - ChromeClient -> SVGImageChromeClient - SVGImage - ImageObserver -> CachedImageObserver - CachedImage - CachedImageClient -> RenderElement - Page 2) Running the updateRendering steps: Each document in the Page will enumerate its cached SVGImages. The updateRendering of the Page of each SVGImage will be called. To make enumerating the cached SVGImages of a Document faster, the URL of the cached SVGImage will be added to the cachedSVGImagesURLs of CachedResourceLoader when notifyFinished() is called for associated CachedImage. Tests: svg/animations/css-animation-background-svg.html svg/animations/css-animation-embedded-svg.html svg/animations/css-animation-hover-svg.html * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::scheduleAnimationResolution): (WebCore::DocumentTimeline::updateAnimationsAndSendEvents): * html/ImageBitmap.cpp: * loader/cache/CachedImage.cpp: (WebCore::CachedImage::hasSVGImage const): (WebCore::CachedImage::CachedImageObserver::scheduleTimedRenderingUpdate): (WebCore::CachedImage::scheduleTimedRenderingUpdate): * loader/cache/CachedImage.h: * loader/cache/CachedImageClient.h: (WebCore::CachedImageClient::scheduleTimedRenderingUpdate): * loader/cache/CachedResourceLoader.cpp: (WebCore::isSVGImageCachedResource): (WebCore::cachedResourceSVGImage): (WebCore::CachedResourceLoader::notifyFinished): (WebCore:: const): * loader/cache/CachedResourceLoader.h: * page/ChromeClient.h: (WebCore::ChromeClient::scheduleTimedRenderingUpdate): * page/Page.cpp: (WebCore::Page::scheduleTimedRenderingUpdate): (WebCore::Page::updateRendering): * page/Page.h: * platform/graphics/ImageObserver.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::notifyFinished): (WebCore::RenderElement::scheduleTimedRenderingUpdate): * rendering/RenderElement.h: * rendering/RenderImage.cpp: (WebCore::RenderImage::notifyFinished): * svg/graphics/SVGImage.h: * svg/graphics/SVGImageClients.h: LayoutTests: * svg/animations/css-animation-background-svg-expected.html: Added. * svg/animations/css-animation-background-svg.html: Added. * svg/animations/css-animation-embedded-svg-expected.html: Added. * svg/animations/css-animation-embedded-svg.html: Added. * svg/animations/css-animation-hover-svg-expected.html: Added. * svg/animations/css-animation-hover-svg.html: Added. Canonical link: https://commits.webkit.org/223189@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-09 21:45:57 +00:00
<style>
.box {
width: 100px;
height: 100px;
background-color: red;
}
.hover {
background: url("data:image/svg+xml;charset=utf8, \
%3Csvg xmlns='http://www.w3.org/2000/svg'%3E \
%3Cstyle%3E \
@keyframes fadein { \
from { opacity:0; } \
to { opacity:1; } \
} \
WebKit doesn't parse "#" as delimiter for fragment identifier in data URIs https://bugs.webkit.org/show_bug.cgi?id=68089 Patch by Rob Buis <rbuis@igalia.com> on 2020-10-05 Reviewed by Alex Christensen, Ryosuke Niwa, and Darin Adler. LayoutTests/imported/w3c: Update improved test results. * web-platform-tests/fetch/data-urls/processing.any-expected.txt: * web-platform-tests/fetch/data-urls/processing.any.worker-expected.txt: * web-platform-tests/url/data-uri-fragment-expected.txt: Source/WebCore: To maintain compatibility with existing iOS and macOS apps, we only do this for apps linked with the SDK after the change. Covered by newly passing web platform tests (which Chrome and Firefox already passed). * loader/ResourceLoader.cpp: (WebCore::shouldStripFragmentIdentifier): (WebCore::ResourceLoader::loadDataURL): * platform/cocoa/VersionChecks.h: Source/WTF: * wtf/URL.h: * wtf/spi/darwin/dyldSPI.h: LayoutTests: Adjusts tests thats use data URIs to escape the # character. * accessibility/ios-simulator/iframe-access.html: * accessibility/ios-simulator/unobscured-content-rect.html: * accessibility/resources/iframe.html: * accessibility/scroll-to-global-point-iframe.html: * accessibility/scroll-to-make-visible-iframe-offscreen.html: * accessibility/scroll-to-make-visible-iframe.html: * css3/blending/background-blend-mode-crossfade-image.html: * css3/blending/background-blend-mode-data-uri-svg-image.html: * css3/blending/background-blend-mode-tiled-layers.html: * css3/flexbox/flexitem.html: * css3/shapes/shape-outside/shape-image/shape-image-002.html: * css3/shapes/shape-outside/shape-image/shape-image-005.html: * editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin.html: * editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin.html: * fast/css-grid-layout/grid-item-display.html: * fast/css/import-style-update.html: * fast/css/link-media-attr.html: * fast/dom/HTMLLinkElement/link-stylesheet-media-type.html: * fast/events/attribute-listener-cloned-from-frameless-doc-context-2.html: * fast/events/attribute-listener-cloned-from-frameless-doc-context.html: * fast/events/attribute-listener-extracted-from-frameless-doc-context-2.html: * fast/events/attribute-listener-extracted-from-frameless-doc-context.html: * fast/hidpi/image-srcset-data-escaped-srcset.html: * fast/html/link-rel-stylesheet.html: * fast/loader/data-url-encoding-html.html: * fast/loader/data-url-encoding-svg.html: * fast/spatial-navigation/resources/iframe.html: * http/tests/security/top-level-unique-origin.https.html: * platform/ios/css3/flexbox/flexitem-expected.txt: * platform/win/css3/flexbox/flexitem-expected.txt: * security/contentSecurityPolicy/link-with-data-url-allowed-by-style-src-star-with-AllowContentSecurityPolicySourceStarToMatchAnyProtocol-enabled.html: * svg/animations/css-animation-background-svg.html: * svg/animations/css-animation-embedded-svg.html: * svg/animations/css-animation-hover-svg.html: * svg/as-image/svg-canvas-data-url-svg-with-feimage-not-tainted.html: * svg/custom/object-data-href.html: Canonical link: https://commits.webkit.org/230098@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267995 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-05 19:36:22 +00:00
%23green { \
REGRESSION: CSS animations inside an embedded SVG image do not animate https://bugs.webkit.org/show_bug.cgi?id=209370 Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2020-04-09 Reviewed by Simon Fraser. Source/WebCore: If WebAnimation is enabled and the SVGImage includes CSS animations, the DocumentTimeline is added to the SVGDocument of the embedded SVGImage. Because the SVGImage has its own Page the RenderingUpdate is scheduled and the updateRendering steps run in this Page. The Page of the SVGImage is inactive such that scheduling RenderingUpdate fails; therefore the updateRendering steps never run and the CSS animation never advances. The fix is: 1) Scheduling the RenderingUpdate: This has to happen in the Page which contains the renderer of the SVGImage. Because DocumentTimeline is added to SVGDocument, this scheduling will go through these hubs: - DocumentTimeline - Page - ChromeClient -> SVGImageChromeClient - SVGImage - ImageObserver -> CachedImageObserver - CachedImage - CachedImageClient -> RenderElement - Page 2) Running the updateRendering steps: Each document in the Page will enumerate its cached SVGImages. The updateRendering of the Page of each SVGImage will be called. To make enumerating the cached SVGImages of a Document faster, the URL of the cached SVGImage will be added to the cachedSVGImagesURLs of CachedResourceLoader when notifyFinished() is called for associated CachedImage. Tests: svg/animations/css-animation-background-svg.html svg/animations/css-animation-embedded-svg.html svg/animations/css-animation-hover-svg.html * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::scheduleAnimationResolution): (WebCore::DocumentTimeline::updateAnimationsAndSendEvents): * html/ImageBitmap.cpp: * loader/cache/CachedImage.cpp: (WebCore::CachedImage::hasSVGImage const): (WebCore::CachedImage::CachedImageObserver::scheduleTimedRenderingUpdate): (WebCore::CachedImage::scheduleTimedRenderingUpdate): * loader/cache/CachedImage.h: * loader/cache/CachedImageClient.h: (WebCore::CachedImageClient::scheduleTimedRenderingUpdate): * loader/cache/CachedResourceLoader.cpp: (WebCore::isSVGImageCachedResource): (WebCore::cachedResourceSVGImage): (WebCore::CachedResourceLoader::notifyFinished): (WebCore:: const): * loader/cache/CachedResourceLoader.h: * page/ChromeClient.h: (WebCore::ChromeClient::scheduleTimedRenderingUpdate): * page/Page.cpp: (WebCore::Page::scheduleTimedRenderingUpdate): (WebCore::Page::updateRendering): * page/Page.h: * platform/graphics/ImageObserver.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::notifyFinished): (WebCore::RenderElement::scheduleTimedRenderingUpdate): * rendering/RenderElement.h: * rendering/RenderImage.cpp: (WebCore::RenderImage::notifyFinished): * svg/graphics/SVGImage.h: * svg/graphics/SVGImageClients.h: LayoutTests: * svg/animations/css-animation-background-svg-expected.html: Added. * svg/animations/css-animation-background-svg.html: Added. * svg/animations/css-animation-embedded-svg-expected.html: Added. * svg/animations/css-animation-embedded-svg.html: Added. * svg/animations/css-animation-hover-svg-expected.html: Added. * svg/animations/css-animation-hover-svg.html: Added. Canonical link: https://commits.webkit.org/223189@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-09 21:45:57 +00:00
animation: fadein 16ms; \
} \
%3C/style%3E \
%3Crect width='100%' height='100%' fill='red'/%3E \
%3Crect id='green' width='100%' height='100%' fill='green'/%3E \
%3C/svg%3E");
}
</style>
<body>
<div class="box"></div>
<script>
window.addEventListener('load', (event) => {
if (window.testRunner)
testRunner.waitUntilDone();
var rAFCount = 0;
function animate(timestamp) {
if (++rAFCount < 10)
window.requestAnimationFrame(animate);
else if (window.testRunner)
testRunner.notifyDone();
}
var box = document.querySelector(".box");
box.classList.add('hover');
window.requestAnimationFrame(animate);
});
</script>
</body>