nsresult NS_NewSVGRect(nsIDOMSVGRect** result, const gfxRect& rect) { return NS_NewSVGRect(result, rect.X(), rect.Y(), rect.Width(), rect.Height()); }
nsresult NS_NewSVGRect(mozilla::dom::SVGRect** result, const gfxRect& rect) { return NS_NewSVGRect(result, rect.X(), rect.Y(), rect.Width(), rect.Height()); }
nsresult nsSVGPatternElement::Init() { nsresult rv = nsSVGPatternElementBase::Init(); NS_ENSURE_SUCCESS(rv,rv); // Create mapped attributes // DOM property: patternTransform , #IMPLIED attrib: patternTransform { nsCOMPtr<nsIDOMSVGTransformList> transformList; rv = nsSVGTransformList::Create(getter_AddRefs(transformList)); NS_ENSURE_SUCCESS(rv,rv); rv = NS_NewSVGAnimatedTransformList(getter_AddRefs(mPatternTransform), transformList); NS_ENSURE_SUCCESS(rv,rv); rv = AddMappedSVGValue(nsGkAtoms::patternTransform, mPatternTransform); NS_ENSURE_SUCCESS(rv,rv); } // nsIDOMSVGURIReference properties // DOM property: href , #IMPLIED attrib: xlink:href { rv = NS_NewSVGAnimatedString(getter_AddRefs(mHref)); NS_ENSURE_SUCCESS(rv,rv); rv = AddMappedSVGValue(nsGkAtoms::href, mHref, kNameSpaceID_XLink); NS_ENSURE_SUCCESS(rv,rv); } // nsIDOMSVGFitToViewBox properties // DOM property: viewBox { nsCOMPtr<nsIDOMSVGRect> viewbox; rv = NS_NewSVGRect(getter_AddRefs(viewbox)); NS_ENSURE_SUCCESS(rv,rv); rv = NS_NewSVGAnimatedRect(getter_AddRefs(mViewBox), viewbox); NS_ENSURE_SUCCESS(rv,rv); rv = AddMappedSVGValue(nsGkAtoms::viewBox, mViewBox); NS_ENSURE_SUCCESS(rv,rv); } // DOM property: preserveAspectRatio { nsCOMPtr<nsIDOMSVGPreserveAspectRatio> preserveAspectRatio; rv = NS_NewSVGPreserveAspectRatio(getter_AddRefs(preserveAspectRatio)); NS_ENSURE_SUCCESS(rv,rv); rv = NS_NewSVGAnimatedPreserveAspectRatio( getter_AddRefs(mPreserveAspectRatio), preserveAspectRatio); NS_ENSURE_SUCCESS(rv,rv); rv = AddMappedSVGValue(nsGkAtoms::preserveAspectRatio, mPreserveAspectRatio); NS_ENSURE_SUCCESS(rv,rv); } return NS_OK; }
nsresult nsSVGPatternFrame::GetPatternRect(nsIDOMSVGRect **patternRect, nsIDOMSVGRect *bbox, nsIDOMSVGMatrix *callerCTM, nsSVGElement *content) { // Get our type PRUint16 type = GetPatternUnits(); // We need to initialize our box float x,y,width,height; // Get the pattern x,y,width, and height nsSVGLength2 *tmpX, *tmpY, *tmpHeight, *tmpWidth; tmpX = GetX(); tmpY = GetY(); tmpHeight = GetHeight(); tmpWidth = GetWidth(); if (type == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { x = nsSVGUtils::ObjectSpace(bbox, tmpX); y = nsSVGUtils::ObjectSpace(bbox, tmpY); width = nsSVGUtils::ObjectSpace(bbox, tmpWidth); height = nsSVGUtils::ObjectSpace(bbox, tmpHeight); } else { float scale = nsSVGUtils::MaxExpansion(callerCTM); x = nsSVGUtils::UserSpace(content, tmpX) * scale; y = nsSVGUtils::UserSpace(content, tmpY) * scale; width = nsSVGUtils::UserSpace(content, tmpWidth) * scale; height = nsSVGUtils::UserSpace(content, tmpHeight) * scale; } return NS_NewSVGRect(patternRect, x, y, width, height); }
already_AddRefed<nsIDOMSVGRect> SVGLocatableElement::GetBBox(ErrorResult& rv) { nsIFrame* frame = GetPrimaryFrame(Flush_Layout); if (!frame || (frame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) { rv.Throw(NS_ERROR_FAILURE); return nullptr; } nsISVGChildFrame* svgframe = do_QueryFrame(frame); if (!svgframe) { rv.Throw(NS_ERROR_NOT_IMPLEMENTED); // XXX: outer svg return nullptr; } nsCOMPtr<nsIDOMSVGRect> rect; rv = NS_NewSVGRect(getter_AddRefs(rect), nsSVGUtils::GetBBox(frame)); return rect.forget(); }
already_AddRefed<mozilla::dom::SVGRect> NS_NewSVGRect(const gfxRect& rect) { return NS_NewSVGRect(rect.X(), rect.Y(), rect.Width(), rect.Height()); }
already_AddRefed<mozilla::dom::SVGRect> NS_NewSVGRect(nsIContent* aParent, const gfxRect& aRect) { return NS_NewSVGRect(aParent, aRect.X(), aRect.Y(), aRect.Width(), aRect.Height()); }