haikuwebkit/LayoutTests/svg/custom/multiple-view-elements.html

23 lines
1.1 KiB
HTML
Raw Permalink Normal View History

SMIL animations of SVG <view> element have no effect https://bugs.webkit.org/show_bug.cgi?id=94469 Patch by Nikolas Zimmermann <zimmermann@kde.org> on 2019-09-13 Reviewed by Said Abou-Hallawa. Source/WebCore: SMIL animations of the attributes associated with SVGViewElement work fine, but without any visual effect. When loading an SVG document with a given fragment identifier (e.g. test.svg#customView) where 'customView' references to an embedded SVGViewElement, the viewBox/preserveAspectRatio settings should be taken from the SVGViewElement. Currently there is no link between the SVGViewElement and the SVGSVGElement. The settings from the SVGViewElement are only pasrsed onco in SVGSVGElement::scrollToFragment(). Dynamic updates of the 'viewBox' and 'preserveAspectRatio' attributes of the SVGViewElement thus have no visual effect, since the SVGSVGElement does not re-evaluates its viewBox. Store a RefPtr to the currently used SVGViewElement in SVGSVGElement, and a WeakPtr back to the SVGSVGElement that currently references the SVGViewElement. This allows us to propagate SVGViewElement attribute changes to SVGSVGElement and re-evaluate the viewBox stored in SVGSVGElement and trigger visual updates. Tests: svg/custom/animation-on-view-element.html svg/custom/multiple-view-elements.html * svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::scrollToFragment): * svg/SVGSVGElement.h: * svg/SVGViewElement.cpp: (WebCore::SVGViewElement::svgAttributeChanged): Add missing implementation, tracked by webkit.org/b/196554. Correctly handle SVGFitToViewBox property changes. Update the viewBox stored in the SVGSVGElement, that references the SVGViewElement. Afterwards invalidate the renderer associated with the SVGSVGElement, which properly triggers visual updates. * svg/SVGViewElement.h: LayoutTests: Add new layout tests to verify that dynamic modifications of the <view> element cause visual updates. Previously SVGSVGElement was never notified about changes of the SVGViewElement and thus did not update the stored viewBox. * svg/custom/animation-on-view-element-expected.html: Added. * svg/custom/animation-on-view-element.html: Added. This is a new reftest demonstrating that animations of SVG <view> elements now behave as expected. * svg/custom/multiple-view-elements-expected.html: Added. * svg/custom/multiple-view-elements.html: Added. * svg/dom/SVGViewSpec-multiple-views-expected.txt: * svg/dom/SVGViewSpec-multiple-views.html: Extend to cover dynamic modifications. Canonical link: https://commits.webkit.org/215399@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249843 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-13 18:21:14 +00:00
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
testRunner.waitUntilDone();
var elementsLoaded = 0;
function loaded() {
if (window.testRunner && ++elementsLoaded == 4)
testRunner.notifyDone();
}
</script>
</head>
<body>
<iframe id="svgFrame1" style="border: none" onload="loaded()" width='200' height='200' src='../dom/resources/multiple-view-elements.svg#view1'></iframe>
<iframe id="svgFrame2" style="border: none" onload="loaded()" width='200' height='200' src='../dom/resources/multiple-view-elements.svg#view2'></iframe>
<br/>
<iframe id="svgFrame3" style="border: none" onload="loaded()" width='200' height='200' src='../dom/resources/multiple-view-elements.svg#svgView(viewBox(5 0 10 15);transform(scale(2 2)))'></iframe>
<iframe id="svgFrame4" style="border: none" onload="loaded()" width='200' height='200' src='../dom/resources/multiple-view-elements.svg#svgView(viewBox(0 0 10 15);transform(scale(2 2));preserveAspectRatio(xMinYMax meet))'></iframe>
</body>
</html>