Backout Bug 730658 - reftest failure possibly intermittent but certainly new

This commit is contained in:
Robert Longson 2012-02-28 16:04:57 +00:00
Родитель 1647e9cd3e
Коммит 2ff5247730
36 изменённых файлов: 59 добавлений и 244 удалений

Просмотреть файл

@ -392,9 +392,9 @@ void
SMILPreserveAspectRatio::ClearAnimValue()
{
if (mVal->mIsAnimated) {
mVal->SetAnimValue(PackPreserveAspectRatio(mVal->GetBaseValue()),
mSVGElement);
mVal->mIsAnimated = false;
mVal->mAnimVal = mVal->mBaseVal;
mSVGElement->DidAnimatePreserveAspectRatio();
}
}

Просмотреть файл

@ -510,10 +510,8 @@ nsSVGAngle::SMILOrient::ClearAnimValue()
{
if (mAngle->mIsAnimated) {
mOrientType->SetAnimValue(mOrientType->GetBaseValue());
mAngle->SetAnimValue(mAngle->mBaseVal, mAngle->mBaseValUnit, mSVGElement);
mAngle->mIsAnimated = false;
mAngle->mAnimVal = mAngle->mBaseVal;
mAngle->mAnimValUnit = mAngle->mBaseValUnit;
mSVGElement->DidAnimateAngle(mAngle->mAttrEnum);
}
}

Просмотреть файл

@ -190,9 +190,8 @@ void
nsSVGBoolean::SMILBool::ClearAnimValue()
{
if (mVal->mIsAnimated) {
mVal->SetAnimValue(mVal->mBaseVal, mSVGElement);
mVal->mIsAnimated = false;
mVal->mAnimVal = mVal->mBaseVal;
mSVGElement->DidAnimateBoolean(mVal->mAttrEnum);
}
}

Просмотреть файл

@ -67,9 +67,6 @@ public:
NS_FORWARD_NSIDOMELEMENT(nsSVGCircleElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGCircleElementBase::)
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const;
// nsSVGPathGeometryElement methods:
virtual void ConstructPath(gfxContext *aCtx);
@ -146,13 +143,6 @@ NS_IMETHODIMP nsSVGCircleElement::GetR(nsIDOMSVGAnimatedLength * *aR)
//----------------------------------------------------------------------
// nsSVGElement methods
/* virtual */ bool
nsSVGCircleElement::HasValidDimensions() const
{
return mLengthAttributes[R].IsExplicitlySet() &&
mLengthAttributes[R].GetAnimValInSpecifiedUnits() > 0;
}
nsSVGElement::LengthAttributesInfo
nsSVGCircleElement::GetLengthInfo()
{

Просмотреть файл

@ -195,9 +195,6 @@ public:
bool NumberAttrAllowsPercentage(PRUint8 aAttrEnum) {
return GetNumberInfo().mNumberInfo[aAttrEnum].mPercentagesAllowed;
}
virtual bool HasValidDimensions() const {
return true;
}
void SetLength(nsIAtom* aName, const nsSVGLength2 &aLength);
nsAttrValue WillChangeLength(PRUint8 aAttrEnum);

Просмотреть файл

@ -68,9 +68,6 @@ public:
NS_FORWARD_NSIDOMELEMENT(nsSVGEllipseElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGEllipseElementBase::)
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const;
// nsSVGPathGeometryElement methods:
virtual void ConstructPath(gfxContext *aCtx);
@ -154,15 +151,6 @@ NS_IMETHODIMP nsSVGEllipseElement::GetRy(nsIDOMSVGAnimatedLength * *aRy)
//----------------------------------------------------------------------
// nsSVGElement methods
/* virtual */ bool
nsSVGEllipseElement::HasValidDimensions() const
{
return mLengthAttributes[RX].IsExplicitlySet() &&
mLengthAttributes[RX].GetAnimValInSpecifiedUnits() > 0 &&
mLengthAttributes[RY].IsExplicitlySet() &&
mLengthAttributes[RY].GetAnimValInSpecifiedUnits() > 0;
}
nsSVGElement::LengthAttributesInfo
nsSVGEllipseElement::GetLengthInfo()
{

Просмотреть файл

@ -200,9 +200,8 @@ void
nsSVGEnum::SMILEnum::ClearAnimValue()
{
if (mVal->mIsAnimated) {
mVal->SetAnimValue(mVal->mBaseVal, mSVGElement);
mVal->mIsAnimated = false;
mVal->mAnimVal = mVal->mBaseVal;
mSVGElement->DidAnimateEnum(mVal->mAttrEnum);
}
}

Просмотреть файл

@ -219,15 +219,6 @@ nsSVGFilterElement::Invalidate()
//----------------------------------------------------------------------
// nsSVGElement methods
/* virtual */ bool
nsSVGFilterElement::HasValidDimensions() const
{
return (!mLengthAttributes[WIDTH].IsExplicitlySet() ||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
(!mLengthAttributes[HEIGHT].IsExplicitlySet() ||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0);
}
nsSVGElement::LengthAttributesInfo
nsSVGFilterElement::GetLengthInfo()
{

Просмотреть файл

@ -83,9 +83,6 @@ public:
void Invalidate();
virtual nsXPCClassInfo* GetClassInfo();
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const;
protected:
virtual LengthAttributesInfo GetLengthInfo();

Просмотреть файл

@ -310,15 +310,6 @@ nsSVGFE::IsAttributeMapped(const nsIAtom* name) const
//----------------------------------------------------------------------
// nsSVGElement methods
/* virtual */ bool
nsSVGFE::HasValidDimensions() const
{
return (!mLengthAttributes[WIDTH].IsExplicitlySet() ||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
(!mLengthAttributes[HEIGHT].IsExplicitlySet() ||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0);
}
nsSVGElement::LengthAttributesInfo
nsSVGFE::GetLengthInfo()
{

Просмотреть файл

@ -158,9 +158,6 @@ public:
// nsIContent interface
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
// nsSVGElement interface
virtual bool HasValidDimensions() const;
virtual nsSVGString& GetResultImageName() = 0;
// Return a list of all image names used as sources. Default is to
// return no sources.

Просмотреть файл

@ -136,15 +136,6 @@ nsSVGForeignObjectElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
return toUserSpace * fromUserSpace;
}
/* virtual */ bool
nsSVGForeignObjectElement::HasValidDimensions() const
{
return mLengthAttributes[WIDTH].IsExplicitlySet() &&
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
mLengthAttributes[HEIGHT].IsExplicitlySet() &&
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0;
}
//----------------------------------------------------------------------
// nsIContent methods

Просмотреть файл

@ -71,7 +71,6 @@ public:
// nsSVGElement specializations:
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich = eAllTransforms) const;
virtual bool HasValidDimensions() const;
// nsIContent interface
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const;

Просмотреть файл

@ -267,15 +267,6 @@ nsSVGImageElement::ConstructPath(gfxContext *aCtx)
//----------------------------------------------------------------------
// nsSVGElement methods
/* virtual */ bool
nsSVGImageElement::HasValidDimensions() const
{
return mLengthAttributes[WIDTH].IsExplicitlySet() &&
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
mLengthAttributes[HEIGHT].IsExplicitlySet() &&
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0;
}
nsSVGElement::LengthAttributesInfo
nsSVGImageElement::GetLengthInfo()
{

Просмотреть файл

@ -90,9 +90,6 @@ public:
// nsSVGPathGeometryElement methods:
virtual void ConstructPath(gfxContext *aCtx);
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
nsresult CopyInnerTo(nsGenericElement* aDest) const;

Просмотреть файл

@ -185,9 +185,8 @@ void
nsSVGInteger::SMILInteger::ClearAnimValue()
{
if (mVal->mIsAnimated) {
mVal->SetAnimValue(mVal->mBaseVal, mSVGElement);
mVal->mIsAnimated = false;
mVal->mAnimVal = mVal->mBaseVal;
mSVGElement->DidAnimateInteger(mVal->mAttrEnum);
}
}

Просмотреть файл

@ -241,10 +241,8 @@ void
nsSVGIntegerPair::SMILIntegerPair::ClearAnimValue()
{
if (mVal->mIsAnimated) {
mVal->SetAnimValue(mVal->mBaseVal, mSVGElement);
mVal->mIsAnimated = false;
mVal->mAnimVal[0] = mVal->mBaseVal[0];
mVal->mAnimVal[1] = mVal->mBaseVal[1];
mSVGElement->DidAnimateIntegerPair(mVal->mAttrEnum);
}
}

Просмотреть файл

@ -570,9 +570,8 @@ void
nsSVGLength2::SMILLength::ClearAnimValue()
{
if (mVal->mIsAnimated) {
mVal->SetAnimValueInSpecifiedUnits(mVal->mBaseVal, mSVGElement);
mVal->mIsAnimated = false;
mVal->mAnimVal = mVal->mBaseVal;
mSVGElement->DidAnimateLength(mVal->mAttrEnum);
}
}

Просмотреть файл

@ -306,15 +306,6 @@ nsSVGMarkerElement::SetParentCoordCtxProvider(nsSVGSVGElement *aContext)
mViewBoxToViewportTransform = nsnull;
}
/* virtual */ bool
nsSVGMarkerElement::HasValidDimensions() const
{
return (!mLengthAttributes[MARKERWIDTH].IsExplicitlySet() ||
mLengthAttributes[MARKERWIDTH].GetAnimValInSpecifiedUnits() > 0) &&
(!mLengthAttributes[MARKERHEIGHT].IsExplicitlySet() ||
mLengthAttributes[MARKERHEIGHT].GetAnimValInSpecifiedUnits() > 0);
}
nsSVGElement::LengthAttributesInfo
nsSVGMarkerElement::GetLengthInfo()
{

Просмотреть файл

@ -133,9 +133,6 @@ public:
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
bool aNotify);
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const;
// public helpers
gfxMatrix GetMarkerTransform(float aStrokeWidth,
float aX, float aY, float aAutoAngle);

Просмотреть файл

@ -136,15 +136,6 @@ NS_IMETHODIMP nsSVGMaskElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight)
//----------------------------------------------------------------------
// nsSVGElement methods
/* virtual */ bool
nsSVGMaskElement::HasValidDimensions() const
{
return (!mLengthAttributes[WIDTH].IsExplicitlySet() ||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
(!mLengthAttributes[HEIGHT].IsExplicitlySet() ||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0);
}
nsSVGElement::LengthAttributesInfo
nsSVGMaskElement::GetLengthInfo()
{

Просмотреть файл

@ -76,9 +76,6 @@ public:
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsXPCClassInfo* GetClassInfo();
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const;
protected:
virtual LengthAttributesInfo GetLengthInfo();

Просмотреть файл

@ -227,9 +227,8 @@ void
nsSVGNumber2::SMILNumber::ClearAnimValue()
{
if (mVal->mIsAnimated) {
mVal->SetAnimValue(mVal->mBaseVal, mSVGElement);
mVal->mIsAnimated = false;
mVal->mAnimVal = mVal->mBaseVal;
mSVGElement->DidAnimateNumber(mVal->mAttrEnum);
}
}

Просмотреть файл

@ -239,10 +239,8 @@ void
nsSVGNumberPair::SMILNumberPair::ClearAnimValue()
{
if (mVal->mIsAnimated) {
mVal->SetAnimValue(mVal->mBaseVal, mSVGElement);
mVal->mIsAnimated = false;
mVal->mAnimVal[0] = mVal->mBaseVal[0];
mVal->mAnimVal[1] = mVal->mBaseVal[1];
mSVGElement->DidAnimateNumberPair(mVal->mAttrEnum);
}
}

Просмотреть файл

@ -214,15 +214,6 @@ nsSVGPatternElement::GetAnimatedTransformList()
return mPatternTransform;
}
/* virtual */ bool
nsSVGPatternElement::HasValidDimensions() const
{
return mLengthAttributes[WIDTH].IsExplicitlySet() &&
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
mLengthAttributes[HEIGHT].IsExplicitlySet() &&
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0;
}
nsSVGElement::LengthAttributesInfo
nsSVGPatternElement::GetLengthInfo()
{

Просмотреть файл

@ -96,9 +96,6 @@ public:
virtual nsXPCClassInfo* GetClassInfo();
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const;
virtual mozilla::SVGAnimatedTransformList* GetAnimatedTransformList();
virtual nsIAtom* GetTransformListAttrName() const {
return nsGkAtoms::patternTransform;

Просмотреть файл

@ -67,9 +67,6 @@ public:
NS_FORWARD_NSIDOMELEMENT(nsSVGRectElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGRectElementBase::)
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const;
// nsSVGPathGeometryElement methods:
virtual void ConstructPath(gfxContext *aCtx);
@ -167,15 +164,6 @@ NS_IMETHODIMP nsSVGRectElement::GetRy(nsIDOMSVGAnimatedLength * *aRy)
//----------------------------------------------------------------------
// nsSVGElement methods
/* virtual */ bool
nsSVGRectElement::HasValidDimensions() const
{
return mLengthAttributes[WIDTH].IsExplicitlySet() &&
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
mLengthAttributes[HEIGHT].IsExplicitlySet() &&
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0;
}
nsSVGElement::LengthAttributesInfo
nsSVGRectElement::GetLengthInfo()
{

Просмотреть файл

@ -1189,16 +1189,6 @@ nsSVGSVGElement::GetLength(PRUint8 aCtxType)
return 0;
}
void
nsSVGSVGElement::SyncWidthOrHeight(nsIAtom* aName, nsSVGElement *aTarget) const
{
NS_ASSERTION(aName == nsGkAtoms::width || aName == nsGkAtoms::height,
"The clue is in the function name");
PRUint32 index = *sLengthInfo[WIDTH].mName == aName ? WIDTH : HEIGHT;
aTarget->SetLength(aName, mLengthAttributes[index]);
}
//----------------------------------------------------------------------
// nsSVGElement methods
@ -1239,16 +1229,6 @@ nsSVGSVGElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
return GetViewBoxTransform() * aMatrix;
}
/* virtual */ bool
nsSVGSVGElement::HasValidDimensions() const
{
return !IsInner() ||
((!mLengthAttributes[WIDTH].IsExplicitlySet() ||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
(!mLengthAttributes[HEIGHT].IsExplicitlySet() ||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0));
}
nsSVGElement::LengthAttributesInfo
nsSVGSVGElement::GetLengthInfo()
{

Просмотреть файл

@ -188,12 +188,9 @@ public:
// nsSVGElement specializations:
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich = eAllTransforms) const;
virtual bool HasValidDimensions() const;
// nsSVGSVGElement methods:
float GetLength(PRUint8 mCtxType);
// Copy our width or height to the target
void SyncWidthOrHeight(nsIAtom* aName, nsSVGElement *aTarget) const;
// public helpers:
gfxMatrix GetViewBoxTransform() const;

Просмотреть файл

@ -40,7 +40,7 @@
#include "nsIDOMSVGGElement.h"
#include "nsGkAtoms.h"
#include "nsIDOMDocument.h"
#include "nsSVGSVGElement.h"
#include "nsIDOMSVGSVGElement.h"
#include "nsIDOMSVGSymbolElement.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
@ -288,6 +288,10 @@ nsSVGUseElement::CreateAnonymousContent()
tag != nsGkAtoms::use)
return nsnull;
// Make sure the use attributes are valid
if (!HasValidDimensions())
return nsnull;
// circular loop detection
// check 1 - check if we're a document descendent of the target
@ -295,8 +299,8 @@ nsSVGUseElement::CreateAnonymousContent()
return nsnull;
// check 2 - check if we're a clone, and if we already exist in the hierarchy
if (GetParent() && mOriginal) {
for (nsCOMPtr<nsIContent> content = GetParent();
if (this->GetParent() && mOriginal) {
for (nsCOMPtr<nsIContent> content = this->GetParent();
content;
content = content->GetParent()) {
nsCOMPtr<nsIDOMSVGUseElement> useElement = do_QueryInterface(content);
@ -403,43 +407,43 @@ nsSVGUseElement::DestroyAnonymousContent()
//----------------------------------------------------------------------
// implementation helpers
bool nsSVGUseElement::HasValidDimensions()
{
nsSVGSVGElement *ctx = GetCtx();
return (!mLengthAttributes[WIDTH].IsExplicitlySet() ||
mLengthAttributes[WIDTH].GetAnimValue(ctx) > 0) &&
(!mLengthAttributes[HEIGHT].IsExplicitlySet() ||
mLengthAttributes[HEIGHT].GetAnimValue(ctx) > 0);
}
void
nsSVGUseElement::SyncWidthOrHeight(nsIAtom* aName)
nsSVGUseElement::SyncWidthHeight(nsIAtom* aName)
{
NS_ASSERTION(aName == nsGkAtoms::width || aName == nsGkAtoms::height,
"The clue is in the function name");
if (!mClone) {
if (HasValidDimensions() == !mClone) {
TriggerReclone();
return;
}
nsCOMPtr<nsIDOMSVGSymbolElement> symbol = do_QueryInterface(mClone);
nsCOMPtr<nsIDOMSVGSVGElement> svg = do_QueryInterface(mClone);
if (mClone) {
nsCOMPtr<nsIDOMSVGSymbolElement> symbol = do_QueryInterface(mClone);
nsCOMPtr<nsIDOMSVGSVGElement> svg = do_QueryInterface(mClone);
if (symbol || svg) {
nsSVGElement *target = static_cast<nsSVGElement*>(mClone.get());
PRUint32 index = *sLengthInfo[WIDTH].mName == aName ? WIDTH : HEIGHT;
if (mLengthAttributes[index].IsExplicitlySet()) {
target->SetLength(aName, mLengthAttributes[index]);
return;
if (symbol || svg) {
PRUint32 index = *sLengthInfo[WIDTH].mName == aName ? WIDTH : HEIGHT;
if (mLengthAttributes[index].IsExplicitlySet()) {
static_cast<nsSVGElement*>(mClone.get())->
SetLength(aName, mLengthAttributes[index]);
} else {
// Our width/height attribute is now no longer explicitly set, so we
// need to revert the clone's width/height to the width/height of the
// content that's being cloned.
TriggerReclone();
}
}
if (svg) {
// Our width/height attribute is now no longer explicitly set, so we
// need to revert the clone's width/height to the width/height of the
// content that's being cloned.
nsSVGSVGElement* svgElement =
static_cast<nsSVGSVGElement*>(mSource.get());
svgElement->SyncWidthOrHeight(aName, target);
return;
}
// Our width/height attribute is now no longer explicitly set, so we
// need to set the value to 100%
nsSVGLength2 length;
length.Init(nsSVGUtils::XY, 0xff,
100, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE);
target->SetLength(aName, length);
return;
}
}
@ -507,15 +511,6 @@ nsSVGUseElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
return toUserSpace * fromUserSpace;
}
/* virtual */ bool
nsSVGUseElement::HasValidDimensions() const
{
return (!mLengthAttributes[WIDTH].IsExplicitlySet() ||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
(!mLengthAttributes[HEIGHT].IsExplicitlySet() ||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0);
}
nsSVGElement::LengthAttributesInfo
nsSVGUseElement::GetLengthInfo()
{

Просмотреть файл

@ -105,7 +105,6 @@ public:
// nsSVGElement specializations:
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich = eAllTransforms) const;
virtual bool HasValidDimensions() const;
// nsIContent interface
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
@ -131,7 +130,8 @@ protected:
virtual LengthAttributesInfo GetLengthInfo();
virtual StringAttributesInfo GetStringInfo();
void SyncWidthOrHeight(nsIAtom *aName);
bool HasValidDimensions();
void SyncWidthHeight(nsIAtom *aName);
void LookupHref();
void TriggerReclone();
void UnlinkSource();

Просмотреть файл

@ -215,7 +215,6 @@ random-if(gtk2Widget) == objectBoundingBox-and-fePointLight-02.svg objectBoundin
== rect-01.svg pass.svg
== rect-02.svg pass.svg
== rect-03.svg pass.svg
== rect-04.svg pass.svg
== rect-with-rx-and-ry-01.svg pass.svg
== rect-with-rx-or-ry-01.svg rect-with-rx-or-ry-01-ref.svg
== rootElement-null-01.svg pass.svg

Просмотреть файл

@ -95,7 +95,6 @@ fails == anim-fillcolor-1.svg anim-standard-ref.svg # bug 436296
== anim-length-reset-01.svg lime.svg
== anim-nonpixel-length-reset-01.svg lime.svg
== anim-use-length-01.svg lime.svg
== anim-use-length-02.svg lime.svg
# animate some <number> attributes:
== anim-feComponentTransfer-01.svg lime.svg

Просмотреть файл

@ -320,8 +320,8 @@ nsSVGImageFrame::PaintSVG(nsSVGRenderState *aContext,
float x, y, width, height;
nsSVGImageElement *imgElem = static_cast<nsSVGImageElement*>(mContent);
imgElem->GetAnimatedLengthValues(&x, &y, &width, &height, nsnull);
NS_ASSERTION(width >= 0 && height >= 0,
"Should only be painting things with valid width/height");
if (width <= 0 || height <= 0)
return NS_OK;
if (!mImageContainer) {
nsCOMPtr<imgIRequest> currentRequest;

Просмотреть файл

@ -51,10 +51,7 @@ class nsSVGUseFrame : public nsSVGUseFrameBase,
NS_NewSVGUseFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
protected:
nsSVGUseFrame(nsStyleContext* aContext) :
nsSVGUseFrameBase(aContext),
mHasValidDimensions(true)
{}
nsSVGUseFrame(nsStyleContext* aContext) : nsSVGUseFrameBase(aContext) {}
public:
NS_DECL_QUERYFRAME
@ -62,9 +59,11 @@ public:
// nsIFrame interface:
#ifdef DEBUG
NS_IMETHOD Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow);
#endif
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
@ -95,9 +94,6 @@ public:
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements);
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
PRUint32 aFilter);
private:
bool mHasValidDimensions;
};
//----------------------------------------------------------------------
@ -127,21 +123,18 @@ NS_QUERYFRAME_TAIL_INHERITING(nsSVGUseFrameBase)
//----------------------------------------------------------------------
// nsIFrame methods:
#ifdef DEBUG
NS_IMETHODIMP
nsSVGUseFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow)
{
#ifdef DEBUG
nsCOMPtr<nsIDOMSVGUseElement> use = do_QueryInterface(aContent);
NS_ASSERTION(use, "Content is not an SVG use!");
#endif /* DEBUG */
mHasValidDimensions =
static_cast<nsSVGUseElement*>(aContent)->HasValidDimensions();
return nsSVGUseFrameBase::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
NS_IMETHODIMP
nsSVGUseFrame::AttributeChanged(PRInt32 aNameSpaceID,
@ -157,14 +150,7 @@ nsSVGUseFrame::AttributeChanged(PRInt32 aNameSpaceID,
nsSVGUtils::NotifyChildrenOfSVGChange(this, TRANSFORM_CHANGED);
} else if (aAttribute == nsGkAtoms::width ||
aAttribute == nsGkAtoms::height) {
static_cast<nsSVGUseElement*>(mContent)->SyncWidthOrHeight(aAttribute);
if (mHasValidDimensions !=
static_cast<nsSVGUseElement*>(mContent)->HasValidDimensions()) {
mHasValidDimensions = !mHasValidDimensions;
nsSVGUtils::UpdateGraphic(this);
}
static_cast<nsSVGUseElement*>(mContent)->SyncWidthHeight(aAttribute);
}
} else if (aNameSpaceID == kNameSpaceID_XLink &&
aAttribute == nsGkAtoms::href) {

Просмотреть файл

@ -1001,12 +1001,6 @@ nsSVGUtils::PaintFrameWithEffects(nsSVGRenderState *aContext,
if (opacity == 0.0f)
return;
const nsIContent* content = aFrame->GetContent();
if (content->IsSVG() &&
!static_cast<const nsSVGElement*>(content)->HasValidDimensions()) {
return;
}
/* Properties are added lazily and may have been removed by a restyle,
so make sure all applicable ones are set again. */
@ -1165,9 +1159,9 @@ nsSVGUtils::HitTestChildren(nsIFrame *aFrame, const nsPoint &aPoint)
current = current->GetPrevSibling()) {
nsISVGChildFrame* SVGFrame = do_QueryFrame(current);
if (SVGFrame) {
result = SVGFrame->GetFrameForPoint(aPoint);
if (result)
break;
result = SVGFrame->GetFrameForPoint(aPoint);
if (result)
break;
}
}
@ -1399,18 +1393,13 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, PRUint32 aFlags)
}
svg = do_QueryFrame(aFrame);
}
nsIContent* content = aFrame->GetContent();
if (content->IsSVG() &&
!static_cast<const nsSVGElement*>(content)->HasValidDimensions()) {
return bbox;
}
gfxMatrix matrix;
if (aFrame->GetType() == nsGkAtoms::svgForeignObjectFrame) {
// The spec says getBBox "Returns the tight bounding box in *current user
// space*". So we should really be doing this for all elements, but that
// needs investigation to check that we won't break too much content.
NS_ABORT_IF_FALSE(content->IsSVG(), "bad cast");
nsSVGElement *element = static_cast<nsSVGElement*>(content);
NS_ABORT_IF_FALSE(aFrame->GetContent()->IsSVG(), "bad cast");
nsSVGElement *element = static_cast<nsSVGElement*>(aFrame->GetContent());
matrix = element->PrependLocalTransformsTo(matrix,
nsSVGElement::eChildToUserSpace);
}