The default bug view has changed. See this FAQ.

Percent attribute values in userSpace gradients don't work

RESOLVED FIXED

Status

()

Core
SVG
RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: tor, Assigned: tor)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

394 bytes, image/svg+xml
Details
6.39 KB, patch
Scooter Morris
: review+
Details | Diff | Splinter Review
(Assignee)

Description

11 years ago
The attached example which has a userspace radial gradient without a radius specified (and thus gets the default value of 50%) doesn't draw properly.  This is due to CairoRadialGradient getting a value of 0.5 back from GetR() and handing this off to cairo.
(Assignee)

Comment 1

11 years ago
Created attachment 208670 [details]
testcase
(Assignee)

Comment 2

11 years ago
Created attachment 208886 [details] [diff] [review]
patch
Assignee: general → tor
Status: NEW → ASSIGNED
Attachment #208886 - Flags: review?(scootermorris)

Comment 3

11 years ago
Comment on attachment 208886 [details] [diff] [review]
patch

>Index: nsSVGGradientFrame.cpp
>===================================================================
>RCS file: /cvsroot/mozilla/layout/svg/base/src/nsSVGGradientFrame.cpp,v
>retrieving revision 1.21
>diff -u -8 -p -r1.21 nsSVGGradientFrame.cpp
>--- nsSVGGradientFrame.cpp	13 Jan 2006 18:20:00 -0000	1.21
>+++ nsSVGGradientFrame.cpp	18 Jan 2006 19:47:11 -0000
>@@ -148,16 +148,17 @@ protected:
>   PRBool checkURITarget();
>   //
>   NS_IMETHOD PrivateGetGradientUnits(nsIDOMSVGAnimatedEnumeration * *aEnum);
>   NS_IMETHOD PrivateGetSpreadMethod(nsIDOMSVGAnimatedEnumeration * *aValue);
>   //
> 
>   nsSVGGradientFrame                     *mNextGrad;
>   PRBool                                  mLoopFlag;
>+  nsCOMPtr<nsIContent>                    mSourceContent;
> 
> private:
>   // Cached values
>   nsCOMPtr<nsIDOMSVGAnimatedEnumeration>  mGradientUnits;
>   nsCOMPtr<nsIDOMSVGAnimatedEnumeration>  mSpreadMethod;
> 
>   nsAutoString                            mNextGradStr;
> 
>@@ -529,16 +530,20 @@ nsSVGGradientFrame::GetGradientTransform
>       float x, y, width, height;
>       rect->GetX(&x);
>       rect->GetY(&y);
>       rect->GetWidth(&width);
>       rect->GetHeight(&height);
>       NS_NewSVGMatrix(getter_AddRefs(bboxTransform),
>                       width, 0, 0, height, x, y);
>     }
>+  } else {
>+    nsIFrame *frame = nsnull;
>+    CallQueryInterface(aSource, &frame);
>+    mSourceContent = frame->GetContent();
>   }
> 
>   if (!bboxTransform)
>     NS_NewSVGMatrix(getter_AddRefs(bboxTransform));
> 
>   nsCOMPtr<nsIDOMSVGMatrix> gradientTransform;
>   // See if we need to get the value from another gradient
>   if (!checkURITarget(nsSVGAtoms::gradientTransform)) {
>@@ -860,56 +865,80 @@ NS_IMETHODIMP
> nsSVGLinearGradientFrame::GetX1(float *aX1)
> {
>   if (!mX1) {
>     PrivateGetX1(getter_AddRefs(mX1));
>     if (!mX1)
>       return NS_ERROR_FAILURE;
>     NS_ADD_SVGVALUE_OBSERVER(mX1);
>   }
>-  mX1->GetValue(aX1);

Could you comment this here?  Something along the lines of
  // We handle object bounding box units as part of GetGradientTransform,
  // but we need handle user space units as part of the individual get
  // routines.  Fixes bug 323669
>+  PRUint16 bbox;
>+  GetGradientUnits(&bbox);
>+  if (bbox == nsIDOMSVGGradientElement::SVG_GRUNITS_OBJECTBOUNDINGBOX) {
>+    mX1->GetValue(aX1);
>+  } else {
>+    *aX1 = nsSVGUtils::UserSpace(mSourceContent, mX1, nsSVGUtils::X);
>+  }
>   return NS_OK;
> }
>

Comment 4

11 years ago
Comment on attachment 208886 [details] [diff] [review]
patch

r=scooter with comment
Attachment #208886 - Flags: review?(scootermorris) → review+
(Assignee)

Comment 5

11 years ago
Checked in with comment.
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.