haikuwebkit/LayoutTests/svg/custom/marker-auto-start-reverse.html

15 lines
709 B
HTML
Raw Permalink Normal View History

[SVG2] Implement marker orient='auto-start-reverse' https://bugs.webkit.org/show_bug.cgi?id=138456 Patch by Nikos Andronikos <nikos.andronikos-webkit@cisra.canon.com.au> on 2016-03-08 Reviewed by Darin Adler. Source/WebCore: https://www.w3.org/TR/SVG2/painting.html#OrientAttribute marker-start markers must be oriented at 180 degrees to the direction of the path when the orient attribute of the marker is set to 'auto-start-reverse'. To acheive this the SVGMarkerData class which calculates the angles for each marker on a path must know whether the orient type is set to reverse the start marker. Tests: svg/animations/animate-marker-orient-from-angle-to-autostartreverse.html svg/animations/animate-marker-orienttype-4.html svg/custom/marker-auto-start-reverse.html * rendering/svg/RenderSVGShape.cpp: (WebCore::RenderSVGShape::processMarkerPositions): Create marker data, using animated value of orient to determine if first marker should be reversed. * rendering/svg/SVGMarkerData.h: (WebCore::SVGMarkerData::SVGMarkerData): Constructor now requires boolean indicating if start marker is reversed. (WebCore::SVGMarkerData::currentAngle): Take into account whether start marker should be reversed. * rendering/svg/SVGResources.cpp: (WebCore::SVGResources::markerReverseStart): New function to query whether start marker should be reversed. * rendering/svg/SVGResources.h: Add declaration for new function. * svg/SVGAnimatedAngle.cpp: (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue): Support animation including the value auto-start-reverse. * svg/SVGMarkerElement.cpp: (WebCore::SVGMarkerElement::setOrient): Combine duplicated functionality into one private method (WebCore::SVGMarkerElement::setOrientToAuto): Set orient type and angle correctly for orient=auto. Uses setOrient. (WebCore::SVGMarkerElement::setOrientToAngle): Set orient type and angle correctly for orient=<angle>. Uses setOrient. (WebCore::SVGMarkerElement::synchronizeOrientType): Support auto-start-reverse as a possible case. * svg/SVGMarkerElement.h: (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Limit the orient DOM property so that the new enum value required for auto-start-reverse is not exposed. (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): Support auto-start-reverse. (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Support auto-start-reverse. LayoutTests: * svg/animations/animate-marker-orient-from-angle-to-autostartreverse-expected.txt: Added. * svg/animations/animate-marker-orient-from-angle-to-autostartreverse.html: Added. * svg/animations/animate-marker-orienttype-4-expected.html: Added. * svg/animations/animate-marker-orienttype-4.html: Added. Verify output after animation has run - ensure animation reflected in visual result. * svg/animations/script-tests/animate-marker-orient-from-angle-to-autostartreverse.js: Added. Test DOM values at various snap-shot times throughout the animation. (sample1): (sample2): (sample3): (executeTest): * svg/custom/marker-auto-start-reverse-expected.html: Added. * svg/custom/marker-auto-start-reverse.html: Added. Verify static result - start marker is oriented at 180 degrees to direction of path. * svg/dom/SVGAnimatedEnumeration-SVGMarkerElement-expected.txt: * svg/dom/script-tests/SVGAnimatedEnumeration-SVGMarkerElement.js: Check attributes are treated as case sensitive. Check UNKNOWN is returned for enum value when auto-start-reverse set. Canonical link: https://commits.webkit.org/173246@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197738 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-08 08:20:22 +00:00
<!doctype html>
<!--
Reftest for auto-start-reverse value for orient property of marker element.
Markers at each end of the path should point outwards. Middle marker should point along the direction of the path.
-->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="300" height="300">
<defs>
<!-- Correct definition - uses lower case -->
<marker id="arrow" orient="auto-start-reverse" markerWidth="10" markerHeight="10" style="overflow:visible">
<path d="M5,0 L 0,-5 L0,5 z" fill="green"/>
</marker>
</defs>
<path d="M 20,20 l30,30 30,30" marker-start="url(#arrow)" marker-mid="url(#arrow)" marker-end="url(#arrow)" stroke="black"/>
</svg>