Bug 614265 - Make paint server references to elements within an unknown SVG element subtree work again. r=longsonr a=b

This commit is contained in:
Cameron McCormack 2010-11-26 16:49:08 +13:00
parent 4707a1b209
commit 5b55d58860
7 changed files with 79 additions and 13 deletions

View File

@ -4748,8 +4748,8 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent,
}
static const FrameConstructionData sSuppressData = SUPPRESS_FCDATA();
static const FrameConstructionData sGenericContainerData =
SIMPLE_SVG_FCDATA(NS_NewSVGGenericContainerFrame);
static const FrameConstructionData sContainerData =
SIMPLE_SVG_FCDATA(NS_NewSVGContainerFrame);
PRBool parentIsSVG = PR_FALSE;
nsIContent* parentContent =
@ -4792,17 +4792,11 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent,
return &sSuppressData;
}
// Reduce the number of frames we create unnecessarily. Note that this is not
// where we select which frame in a <switch> to render! That happens in
// nsSVGSwitchFrame::PaintSVG.
// Elements with failing conditional processing attributes never get
// rendered. Note that this is not where we select which frame in a
// <switch> to render! That happens in nsSVGSwitchFrame::PaintSVG.
if (!nsSVGFeatures::PassesConditionalProcessingTests(aContent)) {
// Note that just returning is probably not right. According
// to the spec, <use> is allowed to use an element that fails its
// conditional, but because we never actually create the frame when
// a conditional fails and when we use GetReferencedFrame to find the
// references, things don't work right.
// XXX FIXME XXX
return &sSuppressData;
return &sContainerData;
}
// Special case for aTag == nsGkAtoms::svg because we don't want to
@ -4860,6 +4854,7 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent,
SIMPLE_SVG_CREATE(rect, NS_NewSVGPathGeometryFrame),
SIMPLE_SVG_CREATE(path, NS_NewSVGPathGeometryFrame),
SIMPLE_SVG_CREATE(defs, NS_NewSVGContainerFrame),
SIMPLE_SVG_CREATE(generic, NS_NewSVGGenericContainerFrame),
{ &nsGkAtoms::foreignObject,
FULL_CTOR_FCDATA(FCDATA_DISALLOW_OUT_OF_FLOW,
&nsCSSFrameConstructor::ConstructSVGForeignObjectFrame) },
@ -4908,7 +4903,7 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent,
NS_ARRAY_LENGTH(sSVGData));
if (!data) {
data = &sSuppressData;
data = &sContainerData;
}
return data;

View File

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<svg xmlns="http://www.w3.org/2000/svg">
<title>Test that paint servers inside a failing conditional attribute subtree work</title>
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=614265 -->
<g requiredExtensions="http://example.org/hypothetical">
<linearGradient id="g">
<stop stop-color="lime" offset="0"/>
<stop stop-color="lime" offset="1"/>
</linearGradient>
</g>
<rect width="100%" height="100%" fill="url(#g) red"/>
</svg>

After

Width:  |  Height:  |  Size: 603 B

View File

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Test that 'use'ing elements inside a failing conditional attribute subtree works</title>
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=614265 -->
<g requiredExtensions="http://example.org/hypothetical">
<rect id="r" width="100%" height="100%" fill="lime"/>
</g>
<rect width="100%" height="100%" fill="red"/>
<use xlink:href="#r"/>
</svg>

After

Width:  |  Height:  |  Size: 595 B

View File

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Test that 'use'ing an element with a failing conditional fails</title>
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=614265 -->
<rect id="r1" width="100%" height="100%" fill="lime"/>
<rect requiredExtensions="http://example.org/hypothetical" id="r2" width="100%" height="100%" fill="red"/>
<use xlink:href="#r1"/>
<use xlink:href="#r2"/>
</svg>

After

Width:  |  Height:  |  Size: 598 B

View File

@ -2,6 +2,7 @@
# XBL tests
== xbl-basic-01.svg pass.svg
== xbl-basic-02.svg pass.svg
== xbl-basic-03.svg pass.svg
== xbl-grad-ref--grad-in-binding-01.svg pass.svg
== xbl-grad-ref--grad-in-binding-02.svg pass.svg
== xbl-grad-ref--grad-in-bound-01.svg pass.svg

View File

@ -0,0 +1,19 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:ex="http://example.org/">
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="b" extends="svg:generic">
<content>
<svg:rect width="100%" height="100%" fill="lime"/>
</content>
</binding>
</bindings>
<rect width="100%" height="100%" fill="red"/>
<g style="-moz-binding: url(#b)"/>
</svg>

After

Width:  |  Height:  |  Size: 545 B

View File

@ -32,6 +32,9 @@ include svg-integration/reftest.list
== clipPath-winding-01.svg pass.svg
== clip-surface-clone-01.svg clip-surface-clone-01-ref.svg
== conditions-01.svg pass.svg
== conditions-02.svg pass.svg
== conditions-03.svg pass.svg
== conditions-04.svg pass.svg
== currentColor-01.svg pass.svg
== currentColor-02.svg pass.svg
== currentColor-03.svg pass.svg