haikuwebkit/LayoutTests/svg/dom/SVGViewSpec-multiple-views-...

104 lines
3.8 KiB
Plaintext
Raw Permalink Normal View History

This test checks the SVGViewSpec API using multiple elements
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Loading external SVG resources/multiple-view-elements.svg#view1...
Check transform value
PASS currentView.transformString is ""
PASS currentView.transform.numberOfItems is 0
Check viewTarget value
PASS currentView.viewTargetString is ""
PASS currentView.viewTarget is null
Check zoomAndPan value
PASS currentView.zoomAndPan is SVGViewElement.SVG_ZOOMANDPAN_MAGNIFY
Check viewBox value
PASS currentView.viewBox.baseVal.x is 0
PASS currentView.viewBox.baseVal.y is 0
PASS currentView.viewBox.baseVal.width is 10
PASS currentView.viewBox.baseVal.height is 10
PASS currentView.viewBoxString is "0 0 10 10"
Check preserveAspectRatio value
PASS currentView.preserveAspectRatioString is "xMidYMid meet"
PASS currentView.preserveAspectRatio.baseVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMID
PASS currentView.preserveAspectRatio.baseVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET
Loading external SVG resources/multiple-view-elements.svg#view2...
Verify that no load was performed, but only a different view was set on the same document
PASS iframeElement.contentDocument.documentElement is firstDocumentElement
Check transform value
PASS currentView.transformString is ""
PASS currentView.transform.numberOfItems is 0
Check viewTarget value
PASS currentView.viewTargetString is ""
PASS currentView.viewTarget is null
Check zoomAndPan value
PASS currentView.zoomAndPan is SVGViewElement.SVG_ZOOMANDPAN_MAGNIFY
Check viewBox value
PASS currentView.viewBox.baseVal.x is 40
PASS currentView.viewBox.baseVal.y is 0
PASS currentView.viewBox.baseVal.width is 20
PASS currentView.viewBox.baseVal.height is 10
PASS currentView.viewBoxString is "40 0 20 10"
Check preserveAspectRatio value
PASS currentView.preserveAspectRatioString is "xMidYMax slice"
PASS currentView.preserveAspectRatio.baseVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMIDYMAX
PASS currentView.preserveAspectRatio.baseVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE
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
Test dynamic modifications of the 'view2' element
Check viewBox value after modification
PASS currentView.viewBox.baseVal.x is 10
PASS currentView.viewBox.baseVal.y is 10
PASS currentView.viewBox.baseVal.width is 30
PASS currentView.viewBox.baseVal.height is 30
PASS currentView.viewBoxString is "10 10 30 30"
Loading external SVG resources/multiple-view-elements.svg#svgView(viewBox(0 0 10 15);transform(scale(2 2));preserveAspectRatio(xMinYMax meet))...
Verify that no load was performed, but only a different view was set on the same document
PASS iframeElement.contentDocument.documentElement is firstDocumentElement
Check transform value
PASS currentView.transformString is "scale(2 2)"
PASS currentView.transform.numberOfItems is 1
PASS currentView.transform.getItem(0).type is SVGTransform.SVG_TRANSFORM_SCALE
PASS currentView.transform.getItem(0).angle is 0
PASS matrixToString(currentView.transform.getItem(0).matrix) is "[2.00 0.00 0.00 2.00 0.00 0.00]"
Check viewTarget value
PASS currentView.viewTargetString is ""
PASS currentView.viewTarget is null
Check zoomAndPan value
PASS currentView.zoomAndPan is SVGViewElement.SVG_ZOOMANDPAN_MAGNIFY
Check viewBox value
PASS currentView.viewBox.baseVal.x is 0
PASS currentView.viewBox.baseVal.y is 0
PASS currentView.viewBox.baseVal.width is 10
PASS currentView.viewBox.baseVal.height is 15
PASS currentView.viewBoxString is "0 0 10 15"
Check preserveAspectRatio value
PASS currentView.preserveAspectRatioString is "xMinYMax meet"
PASS currentView.preserveAspectRatio.baseVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_XMINYMAX
PASS currentView.preserveAspectRatio.baseVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET
PASS successfullyParsed is true
TEST COMPLETE