Bug 509940 - Images with fill=none are not displayed. r=jwatt

This commit is contained in:
Robert Longson 2009-08-31 12:26:23 +01:00
parent 65aad9ef5c
commit 7186fd81c3
4 changed files with 37 additions and 3 deletions

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" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Testcase to ensure that fill is ignored for images</title>
<rect width="100%" height="100%" fill="lime"/>
<rect width="64" height="64" fill="red"/>
<image fill="none" width="64" height="64" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAJFJREFUaEPt1UEOg0AMBEHz/0ez8IY5zFqqKFdLkGrHz7yz/PO9wOrv7qf/81n983uBCwAl1EYgQCD8H5eQhCTUboAAgbCBcNwdaBdIgIAlbjdAgEDYQDjuDrQLJEDAErcbIEAgbCAcdwfaBRIgYInbDRAgEDYQjrsD7QIJELDE7QYIEAgbCMfdgXaBBAhkS3wAXsqyIo0zj4gAAAAASUVORK5CYII="/>
</svg>

After

Width:  |  Height:  |  Size: 823 B

View File

@ -79,6 +79,7 @@ include moz-only/reftest.list
== gradient-live-01c.svg gradient-live-01-ref.svg
== gradient-live-01d.svg gradient-live-01-ref.svg
fails == inline-in-xul-basic-01.xul pass.svg
== image-fill-01.svg pass.svg
== image-scaling-01.svg pass.svg
== image-scaling-02.svg pass.svg
== invalid-text-01.svg pass.svg

View File

@ -85,6 +85,7 @@ public:
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint);
// nsSVGPathGeometryFrame methods:
NS_IMETHOD UpdateCoveredRegion();
virtual PRUint16 GetHittestMask();
// nsIFrame interface:
@ -306,7 +307,26 @@ nsSVGImageFrame::GetType() const
//----------------------------------------------------------------------
// nsSVGPathGeometryFrame methods:
// Lie about our fill/stroke so that hit detection works properly
// Lie about our fill/stroke so that covered region and hit detection work properly
NS_IMETHODIMP
nsSVGImageFrame::UpdateCoveredRegion()
{
mRect.Empty();
gfxContext context(nsSVGUtils::GetThebesComputationalSurface());
GeneratePath(&context);
context.IdentityMatrix();
gfxRect extent = context.GetUserPathExtent();
if (!extent.IsEmpty()) {
mRect = nsSVGUtils::ToAppPixelRect(PresContext(), extent);
}
return NS_OK;
}
PRUint16
nsSVGImageFrame::GetHittestMask()

View File

@ -112,11 +112,11 @@ protected:
protected:
virtual PRUint16 GetHittestMask();
void GeneratePath(gfxContext *aContext,
const gfxMatrix *aOverrideTransform = nsnull);
private:
void Render(nsSVGRenderState *aContext);
void GeneratePath(gfxContext *aContext,
const gfxMatrix *aOverrideTransform = nsnull);
struct MarkerProperties {
nsSVGMarkerProperty* mMarkerStart;