Bug 620144 - clip paths and masks that cannot be resolved should be ignored r=jwatt,a=roc

This commit is contained in:
Robert Longson 2010-12-19 17:47:01 +00:00
parent 9bf199b4a1
commit 92cc187ed5
6 changed files with 39 additions and 31 deletions

View File

@ -1,22 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<svg xmlns="http://www.w3.org/2000/svg" >
<title>Testcase for basic clipPath on foreignObject</title>
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=578309 -->
<title>Testcase for clipPath that can't be resolved</title>
<defs>
<clipPath id="clip">
<rect x="20" y="20" width="100" height="100"/>
</clipPath>
</defs>
<rect width="100%" height="100%" fill="lime"/>
<rect x="20" y="20" width="100" height="100" fill="red"/>
<foreignObject x="20" y="20" width="100" height="100" clip-path="url(#clip)">
<svg>
<rect width="100" height="100" fill="lime"/>
</svg>
</foreignObject>
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=620144 -->
<rect width="100%" height="100%" fill="red"/>
<rect width="100%" height="100%" fill="lime" clipPath="url(#null)"/>
</svg>

Before

Width:  |  Height:  |  Size: 593 B

After

Width:  |  Height:  |  Size: 419 B

View File

@ -0,0 +1,13 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<svg xmlns="http://www.w3.org/2000/svg" >
<title>Testcase for mask that can't be resolved</title>
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=620144 -->
<rect width="100%" height="100%" fill="red"/>
<rect width="100%" height="100%" fill="lime" mask="url(#null)"/>
</svg>

After

Width:  |  Height:  |  Size: 411 B

View File

@ -30,6 +30,7 @@ include svg-integration/reftest.list
== clipPath-basic-02.svg pass.svg
== clipPath-basic-03.svg pass.svg
== clipPath-basic-04.svg pass.svg
== clipPath-basic-05.svg pass.svg
== clipPath-winding-01.svg pass.svg
== clip-surface-clone-01.svg clip-surface-clone-01-ref.svg
== conditions-01.svg pass.svg
@ -124,6 +125,7 @@ fails == inline-in-xul-basic-01.xul pass.svg
== markers-and-group-opacity-01.svg markers-and-group-opacity-01-ref.svg
== marker-attribute-01.svg pass.svg
== marker-viewBox-01.svg marker-viewBox-01-ref.svg
== mask-basic-01.svg pass.svg
== mask-containing-masked-content-01.svg pass.svg
# Bug 456323
# == mask-transformed-01.svg mask-transformed-01-ref.svg

View File

@ -158,10 +158,12 @@ nsIFrame*
nsSVGRenderingObserver::GetReferencedFrame(nsIAtom* aFrameType, PRBool* aOK)
{
nsIFrame* frame = GetReferencedFrame();
if (frame && frame->GetType() == aFrameType)
return frame;
if (aOK) {
*aOK = PR_FALSE;
if (frame) {
if (frame->GetType() == aFrameType)
return frame;
if (aOK) {
*aOK = PR_FALSE;
}
}
return nsnull;
}

View File

@ -86,12 +86,12 @@ public:
// react.
void NotifyEvictedFromRenderingObserverList();
nsIFrame* GetReferencedFrame();
PRBool IsInObserverList() const { return mInObserverList; }
nsIFrame* GetReferencedFrame();
/**
* @param aOK this is only for the convenience of callers. We set *aOK to false
* if this function returns null.
* if the frame is the wrong type
*/
nsIFrame* GetReferencedFrame(nsIAtom* aFrameType, PRBool* aOK);
@ -307,16 +307,16 @@ public:
/**
* @return the clip-path frame, or null if there is no clip-path frame
* @param aOK if a clip-path was specified but the designated element
* does not exist or is an element of the wrong type, *aOK is set
* to false. Otherwise *aOK is untouched.
* @param aOK if a clip-path was specified and the designated element
* exists but is an element of the wrong type, *aOK is set to false.
* Otherwise *aOK is untouched.
*/
nsSVGClipPathFrame *GetClipPathFrame(PRBool *aOK);
/**
* @return the mask frame, or null if there is no mask frame
* @param aOK if a mask was specified but the designated element
* does not exist or is an element of the wrong type, *aOK is set
* to false. Otherwise *aOK is untouched.
* @param aOK if a mask was specified and the designated element
* exists but is an element of the wrong type, *aOK is set to false.
* Otherwise *aOK is untouched.
*/
nsSVGMaskFrame *GetMaskFrame(PRBool *aOK);
/**

View File

@ -1013,7 +1013,7 @@ nsSVGUtils::PaintFrameWithEffects(nsSVGRenderState *aContext,
PRBool isTrivialClip = clipPathFrame ? clipPathFrame->IsTrivial() : PR_TRUE;
if (!isOK) {
// Some resource is missing. We shouldn't paint anything.
// Some resource is invalid. We shouldn't paint anything.
return;
}