зеркало из https://github.com/mozilla/gecko-dev.git
Bug 830230: Move SVGPatternElement to mozilla::dom r=bz
--HG-- rename : content/svg/content/src/nsSVGPatternElement.cpp => content/svg/content/src/SVGPatternElement.cpp rename : content/svg/content/src/nsSVGPatternElement.h => content/svg/content/src/SVGPatternElement.h
This commit is contained in:
Родитель
8ff56e186f
Коммит
f10e03cdcf
|
@ -55,7 +55,6 @@ CPPSRCS = \
|
|||
nsSVGNumberPair.cpp \
|
||||
nsSVGPathDataParser.cpp \
|
||||
nsSVGPathGeometryElement.cpp \
|
||||
nsSVGPatternElement.cpp \
|
||||
nsSVGPolyElement.cpp \
|
||||
nsSVGString.cpp \
|
||||
nsSVGRect.cpp \
|
||||
|
@ -109,6 +108,7 @@ CPPSRCS = \
|
|||
SVGPathElement.cpp \
|
||||
SVGPathSegUtils.cpp \
|
||||
SVGPathSegListSMILType.cpp \
|
||||
SVGPatternElement.cpp \
|
||||
SVGPointList.cpp \
|
||||
SVGPointListSMILType.cpp \
|
||||
SVGPolygonElement.cpp \
|
||||
|
@ -177,6 +177,7 @@ EXPORTS_mozilla/dom = \
|
|||
SVGMetadataElement.h \
|
||||
SVGMPathElement.h \
|
||||
SVGPathElement.h \
|
||||
SVGPatternElement.h \
|
||||
SVGPolygonElement.h \
|
||||
SVGPolylineElement.h \
|
||||
SVGRectElement.h \
|
||||
|
|
|
@ -9,14 +9,18 @@
|
|||
#include "nsIDOMMutationEvent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsSVGPatternElement.h"
|
||||
#include "mozilla/dom/SVGPatternElement.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Pattern)
|
||||
|
||||
DOMCI_NODE_DATA(SVGPatternElement, mozilla::dom::SVGPatternElement)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
//--------------------- Patterns ------------------------
|
||||
|
||||
nsSVGElement::LengthInfo nsSVGPatternElement::sLengthInfo[4] =
|
||||
nsSVGElement::LengthInfo SVGPatternElement::sLengthInfo[4] =
|
||||
{
|
||||
{ &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
|
||||
{ &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
|
@ -24,7 +28,7 @@ nsSVGElement::LengthInfo nsSVGPatternElement::sLengthInfo[4] =
|
|||
{ &nsGkAtoms::height, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
};
|
||||
|
||||
nsSVGElement::EnumInfo nsSVGPatternElement::sEnumInfo[2] =
|
||||
nsSVGElement::EnumInfo SVGPatternElement::sEnumInfo[2] =
|
||||
{
|
||||
{ &nsGkAtoms::patternUnits,
|
||||
sSVGUnitTypesMap,
|
||||
|
@ -36,55 +40,51 @@ nsSVGElement::EnumInfo nsSVGPatternElement::sEnumInfo[2] =
|
|||
}
|
||||
};
|
||||
|
||||
nsSVGElement::StringInfo nsSVGPatternElement::sStringInfo[1] =
|
||||
nsSVGElement::StringInfo SVGPatternElement::sStringInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::href, kNameSpaceID_XLink, true }
|
||||
};
|
||||
|
||||
NS_IMPL_NS_NEW_SVG_ELEMENT(Pattern)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsSVGPatternElement,nsSVGPatternElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSVGPatternElement,nsSVGPatternElementBase)
|
||||
NS_IMPL_ADDREF_INHERITED(SVGPatternElement,SVGPatternElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(SVGPatternElement,SVGPatternElementBase)
|
||||
|
||||
DOMCI_NODE_DATA(SVGPatternElement, nsSVGPatternElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsSVGPatternElement)
|
||||
NS_NODE_INTERFACE_TABLE7(nsSVGPatternElement, nsIDOMNode, nsIDOMElement,
|
||||
NS_INTERFACE_TABLE_HEAD(SVGPatternElement)
|
||||
NS_NODE_INTERFACE_TABLE7(SVGPatternElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement,
|
||||
nsIDOMSVGFitToViewBox, nsIDOMSVGURIReference,
|
||||
nsIDOMSVGPatternElement, nsIDOMSVGUnitTypes)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGPatternElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSVGPatternElementBase)
|
||||
NS_INTERFACE_MAP_END_INHERITING(SVGPatternElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
nsSVGPatternElement::nsSVGPatternElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsSVGPatternElementBase(aNodeInfo)
|
||||
SVGPatternElement::SVGPatternElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: SVGPatternElementBase(aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode method
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGPatternElement)
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPatternElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGFitToViewBox methods
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedRect viewBox; */
|
||||
NS_IMETHODIMP nsSVGPatternElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
|
||||
NS_IMETHODIMP SVGPatternElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
|
||||
{
|
||||
return mViewBox.ToDOMAnimatedRect(aViewBox, this);
|
||||
}
|
||||
|
||||
/* readonly attribute SVGPreserveAspectRatio preserveAspectRatio; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGPatternElement::GetPreserveAspectRatio(nsISupports
|
||||
**aPreserveAspectRatio)
|
||||
SVGPatternElement::GetPreserveAspectRatio(nsISupports
|
||||
**aPreserveAspectRatio)
|
||||
{
|
||||
nsRefPtr<DOMSVGAnimatedPreserveAspectRatio> ratio;
|
||||
mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(getter_AddRefs(ratio), this);
|
||||
|
@ -96,19 +96,19 @@ nsSVGPatternElement::GetPreserveAspectRatio(nsISupports
|
|||
// nsIDOMSVGPatternElement methods
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedEnumeration patternUnits; */
|
||||
NS_IMETHODIMP nsSVGPatternElement::GetPatternUnits(nsIDOMSVGAnimatedEnumeration * *aPatternUnits)
|
||||
NS_IMETHODIMP SVGPatternElement::GetPatternUnits(nsIDOMSVGAnimatedEnumeration * *aPatternUnits)
|
||||
{
|
||||
return mEnumAttributes[PATTERNUNITS].ToDOMAnimatedEnum(aPatternUnits, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedEnumeration patternContentUnits; */
|
||||
NS_IMETHODIMP nsSVGPatternElement::GetPatternContentUnits(nsIDOMSVGAnimatedEnumeration * *aPatternUnits)
|
||||
NS_IMETHODIMP SVGPatternElement::GetPatternContentUnits(nsIDOMSVGAnimatedEnumeration * *aPatternUnits)
|
||||
{
|
||||
return mEnumAttributes[PATTERNCONTENTUNITS].ToDOMAnimatedEnum(aPatternUnits, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsISupports patternTransform; */
|
||||
NS_IMETHODIMP nsSVGPatternElement::GetPatternTransform(nsISupports * *aPatternTransform)
|
||||
NS_IMETHODIMP SVGPatternElement::GetPatternTransform(nsISupports * *aPatternTransform)
|
||||
{
|
||||
// We're creating a DOM wrapper, so we must tell GetAnimatedTransformList
|
||||
// to allocate the SVGAnimatedTransformList if it hasn't already done so:
|
||||
|
@ -118,25 +118,25 @@ NS_IMETHODIMP nsSVGPatternElement::GetPatternTransform(nsISupports * *aPatternTr
|
|||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLength x; */
|
||||
NS_IMETHODIMP nsSVGPatternElement::GetX(nsIDOMSVGAnimatedLength * *aX)
|
||||
NS_IMETHODIMP SVGPatternElement::GetX(nsIDOMSVGAnimatedLength * *aX)
|
||||
{
|
||||
return mLengthAttributes[X].ToDOMAnimatedLength(aX, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLength y; */
|
||||
NS_IMETHODIMP nsSVGPatternElement::GetY(nsIDOMSVGAnimatedLength * *aY)
|
||||
NS_IMETHODIMP SVGPatternElement::GetY(nsIDOMSVGAnimatedLength * *aY)
|
||||
{
|
||||
return mLengthAttributes[Y].ToDOMAnimatedLength(aY, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLength width; */
|
||||
NS_IMETHODIMP nsSVGPatternElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth)
|
||||
NS_IMETHODIMP SVGPatternElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth)
|
||||
{
|
||||
return mLengthAttributes[WIDTH].ToDOMAnimatedLength(aWidth, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedLength height; */
|
||||
NS_IMETHODIMP nsSVGPatternElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight)
|
||||
NS_IMETHODIMP SVGPatternElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight)
|
||||
{
|
||||
return mLengthAttributes[HEIGHT].ToDOMAnimatedLength(aHeight, this);
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ NS_IMETHODIMP nsSVGPatternElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight)
|
|||
|
||||
/* readonly attribute nsIDOMSVGAnimatedString href; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGPatternElement::GetHref(nsIDOMSVGAnimatedString * *aHref)
|
||||
SVGPatternElement::GetHref(nsIDOMSVGAnimatedString * *aHref)
|
||||
{
|
||||
return mStringAttributes[HREF].ToDOMAnimatedString(aHref, this);
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ nsSVGPatternElement::GetHref(nsIDOMSVGAnimatedString * *aHref)
|
|||
// nsIContent methods
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsSVGPatternElement::IsAttributeMapped(const nsIAtom* name) const
|
||||
SVGPatternElement::IsAttributeMapped(const nsIAtom* name) const
|
||||
{
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
sFEFloodMap,
|
||||
|
@ -170,14 +170,14 @@ nsSVGPatternElement::IsAttributeMapped(const nsIAtom* name) const
|
|||
};
|
||||
|
||||
return FindAttributeDependence(name, map) ||
|
||||
nsSVGPatternElementBase::IsAttributeMapped(name);
|
||||
SVGPatternElementBase::IsAttributeMapped(name);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
SVGAnimatedTransformList*
|
||||
nsSVGPatternElement::GetAnimatedTransformList(uint32_t aFlags)
|
||||
SVGPatternElement::GetAnimatedTransformList(uint32_t aFlags)
|
||||
{
|
||||
if (!mPatternTransform && (aFlags & DO_ALLOCATE)) {
|
||||
mPatternTransform = new SVGAnimatedTransformList();
|
||||
|
@ -186,7 +186,7 @@ nsSVGPatternElement::GetAnimatedTransformList(uint32_t aFlags)
|
|||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsSVGPatternElement::HasValidDimensions() const
|
||||
SVGPatternElement::HasValidDimensions() const
|
||||
{
|
||||
return mLengthAttributes[WIDTH].IsExplicitlySet() &&
|
||||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
|
||||
|
@ -195,35 +195,37 @@ nsSVGPatternElement::HasValidDimensions() const
|
|||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
nsSVGPatternElement::GetLengthInfo()
|
||||
SVGPatternElement::GetLengthInfo()
|
||||
{
|
||||
return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
|
||||
ArrayLength(sLengthInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::EnumAttributesInfo
|
||||
nsSVGPatternElement::GetEnumInfo()
|
||||
SVGPatternElement::GetEnumInfo()
|
||||
{
|
||||
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
|
||||
ArrayLength(sEnumInfo));
|
||||
}
|
||||
|
||||
nsSVGViewBox *
|
||||
nsSVGPatternElement::GetViewBox()
|
||||
SVGPatternElement::GetViewBox()
|
||||
{
|
||||
return &mViewBox;
|
||||
}
|
||||
|
||||
SVGAnimatedPreserveAspectRatio *
|
||||
nsSVGPatternElement::GetPreserveAspectRatio()
|
||||
SVGPatternElement::GetPreserveAspectRatio()
|
||||
{
|
||||
return &mPreserveAspectRatio;
|
||||
}
|
||||
|
||||
nsSVGElement::StringAttributesInfo
|
||||
nsSVGPatternElement::GetStringInfo()
|
||||
SVGPatternElement::GetStringInfo()
|
||||
{
|
||||
return StringAttributesInfo(mStringAttributes, sStringInfo,
|
||||
ArrayLength(sStringInfo));
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
|
@ -3,8 +3,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef __NS_SVGPATTERNELEMENT_H__
|
||||
#define __NS_SVGPATTERNELEMENT_H__
|
||||
#ifndef mozilla_dom_SVGPatternElement_h
|
||||
#define mozilla_dom_SVGPatternElement_h
|
||||
|
||||
#include "nsIDOMSVGFitToViewBox.h"
|
||||
#include "nsIDOMSVGPatternElement.h"
|
||||
|
@ -18,22 +18,28 @@
|
|||
#include "SVGAnimatedPreserveAspectRatio.h"
|
||||
#include "SVGAnimatedTransformList.h"
|
||||
|
||||
//--------------------- Patterns ------------------------
|
||||
class nsSVGPatternFrame;
|
||||
|
||||
typedef nsSVGElement nsSVGPatternElementBase;
|
||||
nsresult NS_NewSVGPatternElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
class nsSVGPatternElement : public nsSVGPatternElementBase,
|
||||
public nsIDOMSVGPatternElement,
|
||||
public nsIDOMSVGURIReference,
|
||||
public nsIDOMSVGFitToViewBox,
|
||||
public nsIDOMSVGUnitTypes
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
typedef nsSVGElement SVGPatternElementBase;
|
||||
|
||||
class SVGPatternElement MOZ_FINAL : public SVGPatternElementBase,
|
||||
public nsIDOMSVGPatternElement,
|
||||
public nsIDOMSVGURIReference,
|
||||
public nsIDOMSVGFitToViewBox,
|
||||
public nsIDOMSVGUnitTypes
|
||||
{
|
||||
friend class nsSVGPatternFrame;
|
||||
friend class ::nsSVGPatternFrame;
|
||||
|
||||
protected:
|
||||
friend nsresult NS_NewSVGPatternElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
nsSVGPatternElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
friend nsresult (::NS_NewSVGPatternElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo));
|
||||
SVGPatternElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
public:
|
||||
typedef mozilla::SVGAnimatedPreserveAspectRatio SVGAnimatedPreserveAspectRatio;
|
||||
|
@ -100,4 +106,7 @@ protected:
|
|||
SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
|
||||
};
|
||||
|
||||
#endif
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_SVGPatternElement_h
|
|
@ -18,7 +18,7 @@
|
|||
#include "nsStyleContext.h"
|
||||
#include "nsSVGEffects.h"
|
||||
#include "nsSVGGeometryFrame.h"
|
||||
#include "nsSVGPatternElement.h"
|
||||
#include "mozilla/dom/SVGPatternElement.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "SVGAnimatedTransformList.h"
|
||||
#include "SVGContentUtils.h"
|
||||
|
@ -243,9 +243,9 @@ nsSVGPatternFrame::PaintPattern(gfxASurface** surface,
|
|||
const nsSVGViewBox& viewBox = GetViewBox();
|
||||
|
||||
uint16_t patternContentUnits =
|
||||
GetEnumValue(nsSVGPatternElement::PATTERNCONTENTUNITS);
|
||||
GetEnumValue(SVGPatternElement::PATTERNCONTENTUNITS);
|
||||
uint16_t patternUnits =
|
||||
GetEnumValue(nsSVGPatternElement::PATTERNUNITS);
|
||||
GetEnumValue(SVGPatternElement::PATTERNUNITS);
|
||||
|
||||
/*
|
||||
* Get the content geometry information. This is a little tricky --
|
||||
|
@ -430,7 +430,7 @@ uint16_t
|
|||
nsSVGPatternFrame::GetEnumValue(uint32_t aIndex, nsIContent *aDefault)
|
||||
{
|
||||
nsSVGEnum& thisEnum =
|
||||
static_cast<nsSVGPatternElement *>(mContent)->mEnumAttributes[aIndex];
|
||||
static_cast<SVGPatternElement *>(mContent)->mEnumAttributes[aIndex];
|
||||
|
||||
if (thisEnum.IsExplicitlySet())
|
||||
return thisEnum.GetAnimValue();
|
||||
|
@ -439,7 +439,7 @@ nsSVGPatternFrame::GetEnumValue(uint32_t aIndex, nsIContent *aDefault)
|
|||
|
||||
nsSVGPatternFrame *next = GetReferencedPatternIfNotInUse();
|
||||
return next ? next->GetEnumValue(aIndex, aDefault) :
|
||||
static_cast<nsSVGPatternElement *>(aDefault)->
|
||||
static_cast<SVGPatternElement *>(aDefault)->
|
||||
mEnumAttributes[aIndex].GetAnimValue();
|
||||
}
|
||||
|
||||
|
@ -447,7 +447,7 @@ SVGAnimatedTransformList*
|
|||
nsSVGPatternFrame::GetPatternTransformList(nsIContent* aDefault)
|
||||
{
|
||||
SVGAnimatedTransformList *thisTransformList =
|
||||
static_cast<nsSVGPatternElement *>(mContent)->GetAnimatedTransformList();
|
||||
static_cast<SVGPatternElement *>(mContent)->GetAnimatedTransformList();
|
||||
|
||||
if (thisTransformList && thisTransformList->IsExplicitlySet())
|
||||
return thisTransformList;
|
||||
|
@ -456,7 +456,7 @@ nsSVGPatternFrame::GetPatternTransformList(nsIContent* aDefault)
|
|||
|
||||
nsSVGPatternFrame *next = GetReferencedPatternIfNotInUse();
|
||||
return next ? next->GetPatternTransformList(aDefault) :
|
||||
static_cast<nsSVGPatternElement *>(aDefault)->mPatternTransform.get();
|
||||
static_cast<SVGPatternElement *>(aDefault)->mPatternTransform.get();
|
||||
}
|
||||
|
||||
gfxMatrix
|
||||
|
@ -474,7 +474,7 @@ const nsSVGViewBox &
|
|||
nsSVGPatternFrame::GetViewBox(nsIContent* aDefault)
|
||||
{
|
||||
const nsSVGViewBox &thisViewBox =
|
||||
static_cast<nsSVGPatternElement *>(mContent)->mViewBox;
|
||||
static_cast<SVGPatternElement *>(mContent)->mViewBox;
|
||||
|
||||
if (thisViewBox.IsExplicitlySet())
|
||||
return thisViewBox;
|
||||
|
@ -483,14 +483,14 @@ nsSVGPatternFrame::GetViewBox(nsIContent* aDefault)
|
|||
|
||||
nsSVGPatternFrame *next = GetReferencedPatternIfNotInUse();
|
||||
return next ? next->GetViewBox(aDefault) :
|
||||
static_cast<nsSVGPatternElement *>(aDefault)->mViewBox;
|
||||
static_cast<SVGPatternElement *>(aDefault)->mViewBox;
|
||||
}
|
||||
|
||||
const SVGAnimatedPreserveAspectRatio &
|
||||
nsSVGPatternFrame::GetPreserveAspectRatio(nsIContent *aDefault)
|
||||
{
|
||||
const SVGAnimatedPreserveAspectRatio &thisPar =
|
||||
static_cast<nsSVGPatternElement *>(mContent)->mPreserveAspectRatio;
|
||||
static_cast<SVGPatternElement *>(mContent)->mPreserveAspectRatio;
|
||||
|
||||
if (thisPar.IsExplicitlySet())
|
||||
return thisPar;
|
||||
|
@ -499,14 +499,14 @@ nsSVGPatternFrame::GetPreserveAspectRatio(nsIContent *aDefault)
|
|||
|
||||
nsSVGPatternFrame *next = GetReferencedPatternIfNotInUse();
|
||||
return next ? next->GetPreserveAspectRatio(aDefault) :
|
||||
static_cast<nsSVGPatternElement *>(aDefault)->mPreserveAspectRatio;
|
||||
static_cast<SVGPatternElement *>(aDefault)->mPreserveAspectRatio;
|
||||
}
|
||||
|
||||
const nsSVGLength2 *
|
||||
nsSVGPatternFrame::GetLengthValue(uint32_t aIndex, nsIContent *aDefault)
|
||||
{
|
||||
const nsSVGLength2 *thisLength =
|
||||
&static_cast<nsSVGPatternElement *>(mContent)->mLengthAttributes[aIndex];
|
||||
&static_cast<SVGPatternElement *>(mContent)->mLengthAttributes[aIndex];
|
||||
|
||||
if (thisLength->IsExplicitlySet())
|
||||
return thisLength;
|
||||
|
@ -515,7 +515,7 @@ nsSVGPatternFrame::GetLengthValue(uint32_t aIndex, nsIContent *aDefault)
|
|||
|
||||
nsSVGPatternFrame *next = GetReferencedPatternIfNotInUse();
|
||||
return next ? next->GetLengthValue(aIndex, aDefault) :
|
||||
&static_cast<nsSVGPatternElement *>(aDefault)->mLengthAttributes[aIndex];
|
||||
&static_cast<SVGPatternElement *>(aDefault)->mLengthAttributes[aIndex];
|
||||
}
|
||||
|
||||
// Private (helper) methods
|
||||
|
@ -530,9 +530,9 @@ nsSVGPatternFrame::GetReferencedPattern()
|
|||
|
||||
if (!property) {
|
||||
// Fetch our pattern element's xlink:href attribute
|
||||
nsSVGPatternElement *pattern = static_cast<nsSVGPatternElement *>(mContent);
|
||||
SVGPatternElement *pattern = static_cast<SVGPatternElement *>(mContent);
|
||||
nsAutoString href;
|
||||
pattern->mStringAttributes[nsSVGPatternElement::HREF].GetAnimValue(href, pattern);
|
||||
pattern->mStringAttributes[SVGPatternElement::HREF].GetAnimValue(href, pattern);
|
||||
if (href.IsEmpty()) {
|
||||
mNoHRefURI = true;
|
||||
return nullptr; // no URL
|
||||
|
@ -588,10 +588,10 @@ nsSVGPatternFrame::GetPatternRect(uint16_t aPatternUnits,
|
|||
|
||||
// Get the pattern x,y,width, and height
|
||||
const nsSVGLength2 *tmpX, *tmpY, *tmpHeight, *tmpWidth;
|
||||
tmpX = GetLengthValue(nsSVGPatternElement::X);
|
||||
tmpY = GetLengthValue(nsSVGPatternElement::Y);
|
||||
tmpHeight = GetLengthValue(nsSVGPatternElement::HEIGHT);
|
||||
tmpWidth = GetLengthValue(nsSVGPatternElement::WIDTH);
|
||||
tmpX = GetLengthValue(SVGPatternElement::X);
|
||||
tmpY = GetLengthValue(SVGPatternElement::Y);
|
||||
tmpHeight = GetLengthValue(SVGPatternElement::HEIGHT);
|
||||
tmpWidth = GetLengthValue(SVGPatternElement::WIDTH);
|
||||
|
||||
if (aPatternUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
|
||||
x = nsSVGUtils::ObjectSpace(aTargetBBox, tmpX);
|
||||
|
@ -647,15 +647,15 @@ nsSVGPatternFrame::ConstructCTM(const nsSVGViewBox& aViewBox,
|
|||
// Calling the nsIFrame* variant of GetAnimValue would look it up on
|
||||
// every call.
|
||||
viewportWidth =
|
||||
GetLengthValue(nsSVGPatternElement::WIDTH)->GetAnimValue(ctx);
|
||||
GetLengthValue(SVGPatternElement::WIDTH)->GetAnimValue(ctx);
|
||||
viewportHeight =
|
||||
GetLengthValue(nsSVGPatternElement::HEIGHT)->GetAnimValue(ctx);
|
||||
GetLengthValue(SVGPatternElement::HEIGHT)->GetAnimValue(ctx);
|
||||
} else {
|
||||
// No SVG target, call the nsIFrame* variant of GetAnimValue.
|
||||
viewportWidth =
|
||||
GetLengthValue(nsSVGPatternElement::WIDTH)->GetAnimValue(aTarget);
|
||||
GetLengthValue(SVGPatternElement::WIDTH)->GetAnimValue(aTarget);
|
||||
viewportHeight =
|
||||
GetLengthValue(nsSVGPatternElement::HEIGHT)->GetAnimValue(aTarget);
|
||||
GetLengthValue(SVGPatternElement::HEIGHT)->GetAnimValue(aTarget);
|
||||
}
|
||||
|
||||
if (viewportWidth <= 0.0f || viewportHeight <= 0.0f) {
|
||||
|
@ -663,7 +663,7 @@ nsSVGPatternFrame::ConstructCTM(const nsSVGViewBox& aViewBox,
|
|||
}
|
||||
|
||||
gfxMatrix tm = SVGContentUtils::GetViewBoxTransform(
|
||||
static_cast<nsSVGPatternElement*>(mContent),
|
||||
static_cast<SVGPatternElement*>(mContent),
|
||||
viewportWidth, viewportHeight,
|
||||
viewBoxRect.x, viewBoxRect.y,
|
||||
viewBoxRect.width, viewBoxRect.height,
|
||||
|
|
Загрузка…
Ссылка в новой задаче