gecko-dev/layout/svg
Emilio Cobos Álvarez 2dd6a71b3e Bug 1531333 - Fix <svg:use> cycle detection. r=longsonr
With the current code we'll eventually detect the cycle, but will take much
more, creating many shadow trees unnecessarily. Take for example the following:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="133" height="232774">
    <style>
      symbol { display: block }
    </style>
    <symbol id="svg-sprite" viewBox="0 0 133 230866">
        <title>svg-sprite</title>
        <symbol id="svg-sprite" viewBox="0 0 133 230866">
            <title>svg-sprite</title>
            <use xlink:href="#svg-sprite" width="500" height="500" />
        </symbol>
        <use xlink:href="#svg-sprite" y="1601" width="133" height="228958" />
    </symbol>
    <use xlink:href="#svg-sprite" y="1601" width="133" height="230866" />
</svg>

Before this patch, we'd create an svg use element subtree for #svg-sprite. That
subtree will contain two other <use> elements, one under the <symbol>, one not
under it.

Both point to #svg-sprite, but we fail to detect we're an ancestor since the
element #svg-sprite we're looking at is the clone of the #svg-sprite element.

Thus we need to take a look at mOriginal instead (which is the <use> element
under #svg-sprite) rather than at the clone.

Yeah, I had to draw the trees, it's messy :)

Blink and WebKit do something slightly different (they check the element id
directly[1]). That's not 100% correct, since you can have multiple elements with
the same ID.

[1]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/svg/svg_use_element.cc?l=560&rcl=861855dcb8c39ba8d42497247d433277858df79b

Differential Revision: https://phabricator.services.mozilla.com/D24565

--HG--
extra : moz-landing-system : lando
2019-03-22 22:26:53 +00:00
..
crashtests Bug 951904 - SVGTextFrame should always be reflowed even if it is inside a nonactive child of switch element r=longsonr 2019-03-21 21:17:18 +00:00
tests Bug 1531333 - Fix <svg:use> cycle detection. r=longsonr 2019-03-22 22:26:53 +00:00
AutoReferenceChainGuard.h Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug 2019-01-03 17:48:33 +01:00
moz.build
nsCSSClipPathInstance.cpp Bug 1523969 part 14 - Move method definition inline comments to new line in 'layout/'. r=dholbert 2019-02-25 16:09:24 -06:00
nsCSSClipPathInstance.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
nsCSSFilterInstance.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
nsCSSFilterInstance.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
nsFilterInstance.cpp Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan 2019-03-13 10:19:06 +01:00
nsFilterInstance.h Bug 1505871. C++ code to get component transfer filter data into webrender. r=jrmuizel 2019-02-26 00:16:36 -06:00
nsISVGSVGFrame.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
nsSVGAFrame.cpp Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGClipPathFrame.cpp Bug 1531890 - Take objectBoundingBox into account when a clipPath's child has its own clip-path. r=longsonr 2019-03-19 01:18:21 +00:00
nsSVGClipPathFrame.h Bug 1531890 - Take objectBoundingBox into account when a clipPath's child has its own clip-path. r=longsonr 2019-03-19 01:18:21 +00:00
nsSVGContainerFrame.cpp Bug 1537708 - Clean up NS_STATE_IS_OUTER_SVG flag in favor of IsSVGOuterSVGFrame r=longsonr 2019-03-22 02:23:35 +00:00
nsSVGContainerFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGDisplayableFrame.h Bug 1511854 - Part 1: Fix some formatting oddities in layout/ after the clang-format. r=TYLin 2018-12-05 18:44:03 +00:00
nsSVGFilterFrame.cpp Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGFilterFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGFilterInstance.cpp Bug 1528635 - Check urlExtraReferrer not null before dereference to avoid crash r=longsonr 2019-03-03 19:35:42 +00:00
nsSVGFilterInstance.h Bug 1517938 - Move nsSVGIntegerPair and nsSVGNumberPair to the mozilla namespace r=jwatt 2019-01-06 08:22:55 +00:00
nsSVGFilterPaintCallback.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
nsSVGForeignObjectFrame.cpp Bug 1533963 - Use a single RestyleHint representation. r=heycam 2019-03-14 11:47:50 +00:00
nsSVGForeignObjectFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGGenericContainerFrame.cpp Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGGenericContainerFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGGFrame.cpp Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGGFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGGradientFrame.cpp Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGGradientFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGImageFrame.cpp Bug 1533963 - Use a single RestyleHint representation. r=heycam 2019-03-14 11:47:50 +00:00
nsSVGImageFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGInnerSVGFrame.cpp Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGInnerSVGFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGIntegrationUtils.cpp Bug 1495170. Use CreateClippedDrawTarget more. r=mstange 2019-03-04 22:30:09 -05:00
nsSVGIntegrationUtils.h Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan 2019-03-13 10:19:06 +01:00
nsSVGMarkerFrame.cpp Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGMarkerFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGMaskFrame.cpp Bug 1495170. Use CreateClippedDrawTarget more. r=mstange 2019-03-04 22:30:09 -05:00
nsSVGMaskFrame.h Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan 2019-03-13 10:19:06 +01:00
nsSVGOuterSVGFrame.cpp Bug 1537708 - Clean up NS_STATE_IS_OUTER_SVG flag in favor of IsSVGOuterSVGFrame r=longsonr 2019-03-22 02:23:35 +00:00
nsSVGOuterSVGFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGPaintServerFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGPatternFrame.cpp Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGPatternFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGStopFrame.cpp Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGSwitchFrame.cpp Bug 951904 - SVGTextFrame should always be reflowed even if it is inside a nonactive child of switch element r=longsonr 2019-03-21 21:17:18 +00:00
nsSVGSymbolFrame.cpp Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGSymbolFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGUseFrame.cpp Bug 1533963 - Use a single RestyleHint representation. r=heycam 2019-03-14 11:47:50 +00:00
nsSVGUseFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
nsSVGUtils.cpp Bug 1537708 - Clean up NS_STATE_IS_OUTER_SVG flag in favor of IsSVGOuterSVGFrame r=longsonr 2019-03-22 02:23:35 +00:00
nsSVGUtils.h Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug 2019-01-03 17:48:33 +01:00
nsSVGViewportFrame.cpp Bug 1533963 - Use a single RestyleHint representation. r=heycam 2019-03-14 11:47:50 +00:00
nsSVGViewportFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
svg.css
SVGContextPaint.cpp Bug 1523969 part 14 - Move method definition inline comments to new line in 'layout/'. r=dholbert 2019-02-25 16:09:24 -06:00
SVGContextPaint.h Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug 2019-01-03 17:48:33 +01:00
SVGFEContainerFrame.cpp Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
SVGFEImageFrame.cpp Bug 1523969 part 14 - Move method definition inline comments to new line in 'layout/'. r=dholbert 2019-02-25 16:09:24 -06:00
SVGFELeafFrame.cpp Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
SVGFEUnstyledLeafFrame.cpp Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
SVGGeometryFrame.cpp Merge mozilla-inbound to mozilla-central. a=merge 2019-03-14 18:25:40 +02:00
SVGGeometryFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
SVGImageContext.cpp Bug 1523969 part 14 - Move method definition inline comments to new line in 'layout/'. r=dholbert 2019-02-25 16:09:24 -06:00
SVGImageContext.h Bug 1516921 - export things in the mozilla namespace properly r=jwatt 2018-12-31 11:56:52 +00:00
SVGObserverUtils.cpp Bug 1525372 - Add background-clip:text rendering observer so that we get notified of changes to the clipped contents. r=jwatt 2019-03-18 16:24:20 +00:00
SVGObserverUtils.h Bug 1525372 - Add background-clip:text rendering observer so that we get notified of changes to the clipped contents. r=jwatt 2019-03-18 16:24:20 +00:00
SVGTextFrame.cpp Bug 1537708 - Clean up NS_STATE_IS_OUTER_SVG flag in favor of IsSVGOuterSVGFrame r=longsonr 2019-03-22 02:23:35 +00:00
SVGTextFrame.h Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00
SVGViewFrame.cpp Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt 2019-02-07 11:15:36 +01:00