Merged backout of bug 471551
This commit is contained in:
Коммит
a14c61d4be
|
@ -253,9 +253,8 @@ nsSVGAElement::IsLink(nsIURI** aURI) const
|
|||
nsIContent::ATTR_VALUE_NO_MATCH) {
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
// Get absolute URI
|
||||
nsAutoString str;
|
||||
mStringAttributes[HREF].GetAnimValue(str, this);
|
||||
nsContentUtils::NewURIWithDocumentCharset(aURI, str,
|
||||
nsContentUtils::NewURIWithDocumentCharset(aURI,
|
||||
mStringAttributes[HREF].GetAnimValue(),
|
||||
GetOwnerDoc(), baseURI);
|
||||
// must promise out param is non-null if we return true
|
||||
return !!*aURI;
|
||||
|
@ -268,7 +267,7 @@ nsSVGAElement::IsLink(nsIURI** aURI) const
|
|||
void
|
||||
nsSVGAElement::GetLinkTarget(nsAString& aTarget)
|
||||
{
|
||||
mStringAttributes[TARGET].GetAnimValue(aTarget, this);
|
||||
aTarget = mStringAttributes[TARGET].GetAnimValue();
|
||||
if (aTarget.IsEmpty()) {
|
||||
|
||||
static nsIContent::AttrValuesArray sShowVals[] =
|
||||
|
|
|
@ -620,7 +620,7 @@ nsSVGElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
|||
if (aNamespaceID == stringInfo.mStringInfo[i].mNamespaceID &&
|
||||
aName == *stringInfo.mStringInfo[i].mName) {
|
||||
stringInfo.Reset(i);
|
||||
DidChangeString(i);
|
||||
DidChangeString(i, PR_FALSE);
|
||||
foundMatch = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -1502,30 +1502,22 @@ void nsSVGElement::StringAttributesInfo::Reset(PRUint8 aAttrEnum)
|
|||
mStrings[aAttrEnum].Init(aAttrEnum);
|
||||
}
|
||||
|
||||
void nsSVGElement::GetStringBaseValue(PRUint8 aAttrEnum, nsAString& aResult) const
|
||||
void
|
||||
nsSVGElement::DidChangeString(PRUint8 aAttrEnum, PRBool aDoSetAttr)
|
||||
{
|
||||
nsSVGElement::StringAttributesInfo info = const_cast<nsSVGElement*>(this)->GetStringInfo();
|
||||
if (!aDoSetAttr)
|
||||
return;
|
||||
|
||||
StringAttributesInfo info = GetStringInfo();
|
||||
|
||||
NS_ASSERTION(info.mStringCount > 0,
|
||||
"GetBaseValue on element with no string attribs");
|
||||
|
||||
NS_ASSERTION(aAttrEnum < info.mStringCount, "aAttrEnum out of range");
|
||||
|
||||
GetAttr(info.mStringInfo[aAttrEnum].mNamespaceID,
|
||||
*info.mStringInfo[aAttrEnum].mName, aResult);
|
||||
}
|
||||
|
||||
void nsSVGElement::SetStringBaseValue(PRUint8 aAttrEnum, const nsAString& aValue)
|
||||
{
|
||||
nsSVGElement::StringAttributesInfo info = GetStringInfo();
|
||||
|
||||
NS_ASSERTION(info.mStringCount > 0,
|
||||
"SetBaseValue on element with no string attribs");
|
||||
"DidChangeString on element with no string attribs");
|
||||
|
||||
NS_ASSERTION(aAttrEnum < info.mStringCount, "aAttrEnum out of range");
|
||||
|
||||
SetAttr(info.mStringInfo[aAttrEnum].mNamespaceID,
|
||||
*info.mStringInfo[aAttrEnum].mName, aValue, PR_TRUE);
|
||||
*info.mStringInfo[aAttrEnum].mName,
|
||||
info.mStrings[aAttrEnum].GetBaseValue(), PR_TRUE);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -145,7 +145,7 @@ public:
|
|||
virtual void DidChangeBoolean(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangeEnum(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangePreserveAspectRatio(PRBool aDoSetAttr);
|
||||
virtual void DidChangeString(PRUint8 aAttrEnum) {}
|
||||
virtual void DidChangeString(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
|
||||
void DidAnimateLength(PRUint8 aAttrEnum);
|
||||
|
||||
|
@ -159,9 +159,6 @@ public:
|
|||
|
||||
virtual void RecompileScriptEventListeners();
|
||||
|
||||
void GetStringBaseValue(PRUint8 aAttrEnum, nsAString& aResult) const;
|
||||
void SetStringBaseValue(PRUint8 aAttrEnum, const nsAString& aValue);
|
||||
|
||||
protected:
|
||||
virtual nsresult BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||
const nsAString* aValue, PRBool aNotify);
|
||||
|
|
|
@ -5256,8 +5256,7 @@ nsSVGFEImageElement::LoadSVGImage(PRBool aForce, PRBool aNotify)
|
|||
// resolve href attribute
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
|
||||
nsAutoString href;
|
||||
mStringAttributes[HREF].GetAnimValue(href, this);
|
||||
nsAutoString href(mStringAttributes[HREF].GetAnimValue());
|
||||
href.Trim(" \t\n\r");
|
||||
|
||||
if (baseURI && !href.IsEmpty())
|
||||
|
|
|
@ -146,8 +146,7 @@ nsSVGImageElement::LoadSVGImage(PRBool aForce, PRBool aNotify)
|
|||
// resolve href attribute
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
|
||||
nsAutoString href;
|
||||
mStringAttributes[HREF].GetAnimValue(href, this);
|
||||
nsAutoString href(mStringAttributes[HREF].GetAnimValue());
|
||||
href.Trim(" \t\n\r");
|
||||
|
||||
if (baseURI && !href.IsEmpty())
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
virtual PRBool HasScriptContent();
|
||||
|
||||
// nsSVGElement specializations:
|
||||
virtual void DidChangeString(PRUint8 aAttrEnum);
|
||||
virtual void DidChangeString(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
|
||||
// nsIContent specializations:
|
||||
virtual nsresult DoneAddingChildren(PRBool aHaveNotified);
|
||||
|
@ -204,8 +204,7 @@ already_AddRefed<nsIURI>
|
|||
nsSVGScriptElement::GetScriptURI()
|
||||
{
|
||||
nsIURI *uri = nsnull;
|
||||
nsAutoString src;
|
||||
mStringAttributes[HREF].GetAnimValue(src, this);
|
||||
const nsString &src = mStringAttributes[HREF].GetAnimValue();
|
||||
if (!src.IsEmpty()) {
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
NS_NewURI(&uri, src, nsnull, baseURI);
|
||||
|
@ -237,9 +236,7 @@ nsSVGScriptElement::GetScriptDeferred()
|
|||
PRBool
|
||||
nsSVGScriptElement::HasScriptContent()
|
||||
{
|
||||
nsAutoString str;
|
||||
mStringAttributes[HREF].GetAnimValue(str, this);
|
||||
return !str.IsEmpty() ||
|
||||
return !mStringAttributes[HREF].GetAnimValue().IsEmpty() ||
|
||||
nsContentUtils::HasNonEmptyTextContent(this);
|
||||
}
|
||||
|
||||
|
@ -247,9 +244,9 @@ nsSVGScriptElement::HasScriptContent()
|
|||
// nsSVGElement methods
|
||||
|
||||
void
|
||||
nsSVGScriptElement::DidChangeString(PRUint8 aAttrEnum)
|
||||
nsSVGScriptElement::DidChangeString(PRUint8 aAttrEnum, PRBool aDoSetAttr)
|
||||
{
|
||||
nsSVGScriptElementBase::DidChangeString(aAttrEnum);
|
||||
nsSVGScriptElementBase::DidChangeString(aAttrEnum, aDoSetAttr);
|
||||
|
||||
if (aAttrEnum == HREF) {
|
||||
MaybeProcessScript();
|
||||
|
@ -289,4 +286,3 @@ nsSVGScriptElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,24 +54,8 @@ nsSVGString::SetBaseValue(const nsAString& aValue,
|
|||
nsSVGElement *aSVGElement,
|
||||
PRBool aDoSetAttr)
|
||||
{
|
||||
NS_ASSERTION(aSVGElement, "Null element passed to SetBaseValue");
|
||||
|
||||
mAnimVal = nsnull;
|
||||
|
||||
if (aDoSetAttr) {
|
||||
aSVGElement->SetStringBaseValue(mAttrEnum, aValue);
|
||||
}
|
||||
|
||||
aSVGElement->DidChangeString(mAttrEnum);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGString::GetAnimValue(nsAString& aResult, const nsSVGElement* aSVGElement) const
|
||||
{
|
||||
if (mAnimVal)
|
||||
aResult = *mAnimVal;
|
||||
|
||||
aSVGElement->GetStringBaseValue(mAttrEnum, aResult);
|
||||
mAnimVal = mBaseVal = aValue;
|
||||
aSVGElement->DidChangeString(mAttrEnum, aDoSetAttr);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -46,24 +46,26 @@ class nsSVGString
|
|||
|
||||
public:
|
||||
void Init(PRUint8 aAttrEnum) {
|
||||
mAnimVal = nsnull;
|
||||
mAnimVal.Truncate();
|
||||
mBaseVal.Truncate();
|
||||
mAttrEnum = aAttrEnum;
|
||||
}
|
||||
|
||||
void SetBaseValue(const nsAString& aValue,
|
||||
nsSVGElement *aSVGElement,
|
||||
PRBool aDoSetAttr);
|
||||
void GetBaseValue(nsAString& aValue, nsSVGElement* aSVGElement) const
|
||||
{ aSVGElement->GetStringBaseValue(mAttrEnum, aValue); }
|
||||
|
||||
void GetAnimValue(nsAString& aValue, const nsSVGElement* aSVGElement) const;
|
||||
const nsString &GetBaseValue() const
|
||||
{ return mBaseVal; }
|
||||
const nsString &GetAnimValue() const
|
||||
{ return mAnimVal; }
|
||||
|
||||
nsresult ToDOMAnimatedString(nsIDOMSVGAnimatedString **aResult,
|
||||
nsSVGElement* aSVGElement);
|
||||
|
||||
private:
|
||||
|
||||
nsAutoPtr<nsString> mAnimVal;
|
||||
nsString mAnimVal;
|
||||
nsString mBaseVal;
|
||||
PRUint8 mAttrEnum; // element specified tracking for attribute
|
||||
|
||||
struct DOMAnimatedString : public nsIDOMSVGAnimatedString
|
||||
|
@ -78,12 +80,12 @@ private:
|
|||
nsRefPtr<nsSVGElement> mSVGElement;
|
||||
|
||||
NS_IMETHOD GetBaseVal(nsAString & aResult)
|
||||
{ mVal->GetBaseValue(aResult, mSVGElement); return NS_OK; }
|
||||
{ aResult = mVal->GetBaseValue(); return NS_OK; }
|
||||
NS_IMETHOD SetBaseVal(const nsAString & aValue)
|
||||
{ mVal->SetBaseValue(aValue, mSVGElement, PR_TRUE); return NS_OK; }
|
||||
|
||||
NS_IMETHOD GetAnimVal(nsAString & aResult)
|
||||
{ mVal->GetAnimValue(aResult, mSVGElement); return NS_OK; }
|
||||
{ aResult = mVal->GetAnimValue(); return NS_OK; }
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
@ -238,8 +238,7 @@ nsIContent*
|
|||
nsSVGUseElement::CreateAnonymousContent()
|
||||
{
|
||||
#ifdef DEBUG_tor
|
||||
nsAutoString href;
|
||||
mStringAttributes[HREF].GetAnimValue(href, this);
|
||||
const nsString &href = mStringAttributes[HREF].GetAnimValue();
|
||||
fprintf(stderr, "<svg:use> reclone of \"%s\"\n", ToNewCString(href));
|
||||
#endif
|
||||
|
||||
|
@ -422,8 +421,7 @@ nsSVGUseElement::SyncWidthHeight(PRUint8 aAttrEnum)
|
|||
void
|
||||
nsSVGUseElement::LookupHref()
|
||||
{
|
||||
nsAutoString href;
|
||||
mStringAttributes[HREF].GetAnimValue(href, this);
|
||||
const nsString &href = mStringAttributes[HREF].GetAnimValue();
|
||||
if (href.IsEmpty())
|
||||
return;
|
||||
|
||||
|
@ -473,9 +471,9 @@ nsSVGUseElement::GetLengthInfo()
|
|||
}
|
||||
|
||||
void
|
||||
nsSVGUseElement::DidChangeString(PRUint8 aAttrEnum)
|
||||
nsSVGUseElement::DidChangeString(PRUint8 aAttrEnum, PRBool aDoSetAttr)
|
||||
{
|
||||
nsSVGUseElementBase::DidChangeString(aAttrEnum);
|
||||
nsSVGUseElementBase::DidChangeString(aAttrEnum, aDoSetAttr);
|
||||
|
||||
if (aAttrEnum == HREF) {
|
||||
// we're changing our nature, clear out the clone information
|
||||
|
@ -512,4 +510,3 @@ nsSVGUseElement::IsAttributeMapped(const nsIAtom* name) const
|
|||
return FindAttributeDependence(name, map, NS_ARRAY_LENGTH(map)) ||
|
||||
nsSVGUseElementBase::IsAttributeMapped(name);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public:
|
|||
|
||||
// nsSVGElement specializations:
|
||||
virtual void DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
virtual void DidChangeString(PRUint8 aAttrEnum);
|
||||
virtual void DidChangeString(PRUint8 aAttrEnum, PRBool aDoSetAttr);
|
||||
|
||||
// nsIContent interface
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
|
|
@ -204,8 +204,7 @@ nsSVGFilterInstance::BuildPrimitives()
|
|||
filter->GetSourceImageNames(&sources);
|
||||
|
||||
for (PRUint32 j=0; j<sources.Length(); ++j) {
|
||||
nsAutoString str;
|
||||
sources[j]->GetAnimValue(str, filter);
|
||||
const nsString& str = sources[j]->GetAnimValue();
|
||||
PrimitiveInfo* sourceInfo;
|
||||
|
||||
if (str.EqualsLiteral("SourceGraphic")) {
|
||||
|
@ -232,10 +231,8 @@ nsSVGFilterInstance::BuildPrimitives()
|
|||
|
||||
ComputeFilterPrimitiveSubregion(info);
|
||||
|
||||
nsAutoString str;
|
||||
filter->GetResultImageName()->GetAnimValue(str, filter);
|
||||
|
||||
ImageAnalysisEntry* entry = imageTable.PutEntry(str);
|
||||
ImageAnalysisEntry* entry =
|
||||
imageTable.PutEntry(filter->GetResultImageName()->GetAnimValue());
|
||||
if (entry) {
|
||||
entry->mInfo = info;
|
||||
}
|
||||
|
|
|
@ -282,8 +282,7 @@ nsSVGGradientFrame::GetReferencedGradient()
|
|||
if (!property) {
|
||||
// Fetch our gradient element's xlink:href attribute
|
||||
nsSVGGradientElement *grad = static_cast<nsSVGGradientElement *>(mContent);
|
||||
nsAutoString href;
|
||||
grad->mStringAttributes[nsSVGGradientElement::HREF].GetAnimValue(href, grad);
|
||||
const nsString &href = grad->mStringAttributes[nsSVGGradientElement::HREF].GetAnimValue();
|
||||
if (href.IsEmpty()) {
|
||||
mNoHRefURI = PR_TRUE;
|
||||
return nsnull; // no URL
|
||||
|
|
|
@ -431,8 +431,7 @@ nsSVGPatternFrame::GetReferencedPattern()
|
|||
if (!property) {
|
||||
// Fetch our pattern element's xlink:href attribute
|
||||
nsSVGPatternElement *pattern = static_cast<nsSVGPatternElement *>(mContent);
|
||||
nsAutoString href;
|
||||
pattern->mStringAttributes[nsSVGPatternElement::HREF].GetAnimValue(href, pattern);
|
||||
const nsString &href = pattern->mStringAttributes[nsSVGPatternElement::HREF].GetAnimValue();
|
||||
if (href.IsEmpty()) {
|
||||
mNoHRefURI = PR_TRUE;
|
||||
return nsnull; // no URL
|
||||
|
|
|
@ -107,8 +107,7 @@ nsSVGTextPathFrame::GetPathFrame()
|
|||
|
||||
if (!property) {
|
||||
nsSVGTextPathElement *tp = static_cast<nsSVGTextPathElement*>(mContent);
|
||||
nsAutoString href;
|
||||
tp->mStringAttributes[nsSVGTextPathElement::HREF].GetAnimValue(href, tp);
|
||||
const nsString &href = tp->mStringAttributes[nsSVGTextPathElement::HREF].GetAnimValue();
|
||||
if (href.IsEmpty()) {
|
||||
return nsnull; // no URL
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче