haikuwebkit/LayoutTests/svg/custom/use-recursion-3-expected.svg

5 lines
209 B
XML
Raw Permalink Normal View History

Make SVGUseElement work without creating any SVGElementInstance objects https://bugs.webkit.org/show_bug.cgi?id=141374 Reviewed by Sam Weinig. Source/WebCore: * dom/ElementIterator.h: Changed the * and -> operators to be const. There is no need for the iterator itself to be modified just to dereference it. * dom/TypedElementDescendantIterator.h: Added DoubleTypedElementDescendantIterator. This allows callers to call descendantsOfType on two elements, as long as the caller can guarantee that both have the same number of descendants of that type. It's handy for walking a tree of cloned elements to set up something between each original and its clone. In the future we might instead change the cloning machinery so it can do this work as we clone, and if so, we could consider deleting this. * svg/SVGElement.cpp: (WebCore::SVGElement::correspondingElement): Made this const. (WebCore::SVGElement::invalidateInstances): Got rid of the rule that said "this can only be done for an element in a document", since it's useful to do this on an element that has just been removed from a document. Removed the "updateStyleIfNeeded" call here now that the other changes make it no longer needed. Removed an unimportant assertion that we only invalidate use elements that are in a document; that's not a necessary restriction. Streamlined the logic a bit. * svg/SVGElement.h: Made correspondingElement const. * svg/SVGUseElement.cpp: (WebCore::SVGUseElement::insertedInto): Removed an assertion about m_targetElementInstance since that's gone now. (WebCore::SVGUseElement::svgAttributeChanged): Changed code that transfers size attributes to the shadow tree to use shadowTreeTargetClone instead of m_targetElementInstance. (WebCore::SVGUseElement::clearResourceReferences): Removed code to detach m_targetElementInstance, and also the call to removeAllTargetReferencesForElement, because we no longer use those. (WebCore::SVGUseElement::buildPendingResource): Moved the code to build the shadow tree in here and deleted the buildShadowAndInstanceTree function. Also changed logic so that we use a pending resource any time the target is not a valid one. That helps us correctly handle cases where we initially have an invalid target, but later get a value one (WebCore::SVGUseElement::buildShadowAndInstanceTree): Deleted. The code here was greatly simplified and moved into buildPendingResource. (WebCore::SVGUseElement::buildInstanceTree): Deleted. (WebCore::SVGUseElement::hasCycleUseReferencing): Deleted. Cycles are now detected by the new isValidTarget function and so there's no need for a separate explicit check for a cycle. (WebCore::associateClonesWithOriginals): Added. Helper that makes functions that build the shadow tree simpler and easier to read. (WebCore::associateReplacementCloneWithOriginal): Added. Helper to make associateReplacementClonesWithOriginals simple. (WebCore::associateReplacementClonesWithOriginals): Added. Helper that makes functions that build the shadow tree simpler and easier to read. (WebCore::SVGUseElement::buildShadowTree): Call associateClonesWithOriginals since associateInstancesWithShadowTreeElements no longer does this. (WebCore::SVGUseElement::isValidTarget): Added. Covers all the different reasons a target might not be valid: type of element, reference cycles, and also "not in document" (refactored in here; not sure when that can happen in practice, might be possible to remove it later). (WebCore::SVGUseElement::expandUseElementsInShadowTree): Add checks for documents that are still loading; this used to be checked when building the instance tree. Added calls to associateReplacementClonesWithOriginals and associateClonesWithOriginals; that used to be done by later in the associateInstancesWithShadowTreeElements function. Use isValidTarget so we handle cycles as well as invalid target types. (WebCore::SVGUseElement::expandSymbolElementsInShadowTree): Added a call to associateReplacementClonesWithOriginals, since we can no longer do that in associateInstancesWithShadowTreeElements. (WebCore::SVGUseElement::associateInstancesWithShadowTreeElements): Deleted. (WebCore::SVGUseElement::instanceForShadowTreeElement): Deleted. (WebCore::SVGUseElement::invalidateDependentShadowTrees): Removed a comment that simply restated the name of the function. * svg/SVGUseElement.h: Removed instanceForShadowTreeElement, buildShadowAndInstanceTree, detachInstance, buildInstanceTree, hasCycleUseReferencing, associateInstancesWithShadowTreeElements, instanceForShadowTreeElement, and m_targetElementInstance. Added isValidTarget. LayoutTests: Results changed on some tests that expected the old "remove all content if a cycle is detected" behavior from the <use> element. The new behavior is to inhibit cycles, but render everything else, which is much easier to implement correctly and also makes logical sense. Changed all those tests to be reference tests, which makes sense since they are focusing on what gets rendered in these complex cases, and the expected results are a lot easier to understand in SVG form than they were in txt/png form. This also means we can remove a lot of platform-specific results since reference tests aren't sensitive to small platform differences in rendering. * platform/efl/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-01-t-expected.png: Removed. * platform/efl/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.png: Removed. * platform/efl/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.png: Removed. * platform/efl/svg/hixie/error/017-expected.png: Removed. * platform/gtk/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-01-t-expected.png: Removed. * platform/gtk/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.png: Removed. * platform/gtk/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.png: Removed. * platform/gtk/svg/custom/use-on-disallowed-foreign-object-3-expected.png: Removed. * platform/gtk/svg/custom/use-on-disallowed-foreign-object-3-expected.txt: Removed. * platform/gtk/svg/custom/use-recursion-1-expected.png: Removed. * platform/gtk/svg/custom/use-recursion-1-expected.txt: Removed. * platform/gtk/svg/custom/use-recursion-2-expected.png: Removed. * platform/gtk/svg/custom/use-recursion-2-expected.txt: Removed. * platform/gtk/svg/custom/use-recursion-3-expected.png: Removed. * platform/gtk/svg/custom/use-recursion-3-expected.txt: Removed. * platform/gtk/svg/custom/use-recursion-4-expected.png: Removed. * platform/gtk/svg/custom/use-recursion-4-expected.txt: Removed. * platform/gtk/svg/hixie/error/017-expected.png: Removed. * platform/ios-sim-deprecated/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-01-t-expected.txt: Removed. * platform/ios-sim-deprecated/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.txt: Removed. * platform/ios-sim-deprecated/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.txt: Removed. * platform/ios-sim-deprecated/svg/custom/use-on-disallowed-foreign-object-3-expected.txt: Removed. * platform/ios-sim-deprecated/svg/custom/use-recursion-1-expected.txt: Removed. * platform/ios-sim-deprecated/svg/custom/use-recursion-2-expected.txt: Removed. * platform/ios-sim-deprecated/svg/custom/use-recursion-3-expected.txt: Removed. * platform/ios-sim-deprecated/svg/custom/use-recursion-4-expected.txt: Removed. * platform/ios-sim-deprecated/svg/hixie/error/017-expected.txt: Removed. * platform/ios-simulator/svg/custom/use-on-disallowed-foreign-object-3-expected.txt: Removed. * platform/ios-simulator/svg/custom/use-recursion-1-expected.txt: Removed. * platform/ios-simulator/svg/custom/use-recursion-2-expected.txt: Removed. * platform/ios-simulator/svg/custom/use-recursion-3-expected.txt: Removed. * platform/ios-simulator/svg/custom/use-recursion-4-expected.txt: Removed. * platform/mac-mountainlion/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-01-t-expected.txt: Removed. * platform/mac-mountainlion/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.txt: Removed. * platform/mac-mountainlion/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.txt: Removed. * platform/mac-mountainlion/svg/custom/use-on-disallowed-foreign-object-3-expected.txt: Removed. * platform/mac-mountainlion/svg/custom/use-recursion-1-expected.txt: Removed. * platform/mac-mountainlion/svg/custom/use-recursion-2-expected.txt: Removed. * platform/mac-mountainlion/svg/custom/use-recursion-3-expected.txt: Removed. * platform/mac-mountainlion/svg/custom/use-recursion-4-expected.txt: Removed. * platform/mac-mountainlion/svg/hixie/error/017-expected.txt: Removed. * platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-01-t-expected.png: Removed. * platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-01-t-expected.txt: Removed. * platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.png: Removed. * platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.txt: Removed. * platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.png: Removed. * platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.txt: Removed. * platform/mac/svg/custom/use-on-disallowed-foreign-object-3-expected.png: Removed. * platform/mac/svg/custom/use-on-disallowed-foreign-object-3-expected.txt: Removed. * platform/mac/svg/custom/use-recursion-1-expected.png: Removed. * platform/mac/svg/custom/use-recursion-1-expected.txt: Removed. * platform/mac/svg/custom/use-recursion-2-expected.png: Removed. * platform/mac/svg/custom/use-recursion-2-expected.txt: Removed. * platform/mac/svg/custom/use-recursion-3-expected.png: Removed. * platform/mac/svg/custom/use-recursion-3-expected.txt: Removed. * platform/mac/svg/custom/use-recursion-4-expected.png: Removed. * platform/mac/svg/custom/use-recursion-4-expected.txt: Removed. * platform/mac/svg/hixie/error/017-expected.png: Removed. * platform/mac/svg/hixie/error/017-expected.txt: Removed. * svg/W3C-SVG-1.2-Tiny/struct-use-recursion-01-t-expected.svg: Added. Made this be a reference test, and made it expect more of the recursion to work. * svg/W3C-SVG-1.2-Tiny/struct-use-recursion-01-t-expected.txt: Removed. * svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.svg: Added. More of the same. * svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.txt: Removed. * svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.svg: Added. More of the same. * svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.txt: Removed. * svg/custom/use-on-disallowed-foreign-object-3-expected.svg: Added. More of the same. * svg/custom/use-recursion-1-expected.svg: Added. More of the same. * svg/custom/use-recursion-2-expected.svg: Added. More of the same. * svg/custom/use-recursion-3-expected.svg: Added. More of the same. * svg/custom/use-recursion-4-expected.svg: Added. More of the same. * svg/hixie/error/017-expected.txt: Removed. * svg/hixie/error/017-expected.xml: Added. More of the same. * svg/in-html/defs-after-use.html: Updated incorrect bug number in this test. Canonical link: https://commits.webkit.org/159414@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179807 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-02-08 23:22:24 +00:00
<svg viewBox="0 0 400 300" xmlns="http://www.w3.org/2000/svg">
<text x="10" y="60">This should not crash.</text>
<rect x="25" y="25" stroke-width="5px" fill="red" stroke="navy" width="60" height="10"/>
</svg>