зеркало из https://github.com/mozilla/pjs.git
Bug 435525 - Setting viewBox to empty string on a referenced SVG document from script does not cause an update. r+sr=roc
This commit is contained in:
Родитель
d99e002200
Коммит
ad0a959cd8
|
@ -202,6 +202,7 @@ nsSVGPreserveAspectRatio::SetBaseValueString(const nsAString &aValueAsString,
|
|||
}
|
||||
|
||||
mAnimVal = mBaseVal = val;
|
||||
aSVGElement->DidChangePreserveAspectRatio(aDoSetAttr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1292,7 +1292,7 @@ nsSVGSVGElement::GetViewboxToViewportTransform(nsIDOMSVGMatrix **_retval)
|
|||
}
|
||||
|
||||
nsSVGViewBoxRect viewbox;
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::viewBox)) {
|
||||
if (mViewBox.IsValid()) {
|
||||
viewbox = mViewBox.GetAnimValue();
|
||||
} else {
|
||||
viewbox.x = viewbox.y = 0.0f;
|
||||
|
@ -1461,7 +1461,7 @@ nsSVGSVGElement::GetLength(PRUint8 aCtxType)
|
|||
{
|
||||
float h, w;
|
||||
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::viewBox)) {
|
||||
if (mViewBox.IsValid()) {
|
||||
const nsSVGViewBoxRect& viewbox = mViewBox.GetAnimValue();
|
||||
w = viewbox.width;
|
||||
h = viewbox.height;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jonathan Watt <jonathan.watt@strath.ac.uk> (original author)
|
||||
* Craig Topper <craig.topper@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -78,6 +78,7 @@ nsSVGViewBox::Init()
|
|||
{
|
||||
mBaseVal = nsSVGViewBoxRect();
|
||||
mAnimVal = nsnull;
|
||||
mHasBaseVal = PR_FALSE;
|
||||
}
|
||||
|
||||
const nsSVGViewBoxRect&
|
||||
|
@ -94,10 +95,8 @@ nsSVGViewBox::SetBaseValue(float aX, float aY, float aWidth, float aHeight,
|
|||
nsSVGElement *aSVGElement, PRBool aDoSetAttr)
|
||||
{
|
||||
mAnimVal = nsnull;
|
||||
mBaseVal.x = aX;
|
||||
mBaseVal.y = aY;
|
||||
mBaseVal.width = aWidth;
|
||||
mBaseVal.height = aHeight;
|
||||
mBaseVal = nsSVGViewBoxRect(aX, aY, aWidth, aHeight);
|
||||
mHasBaseVal = PR_TRUE;
|
||||
|
||||
aSVGElement->DidChangeViewBox(aDoSetAttr);
|
||||
}
|
||||
|
@ -128,11 +127,7 @@ nsSVGViewBox::SetBaseValueString(const nsAString& aValue,
|
|||
// there was a parse error.
|
||||
rv = NS_ERROR_FAILURE;
|
||||
} else {
|
||||
mAnimVal = nsnull;
|
||||
mBaseVal.x = vals[0];
|
||||
mBaseVal.y = vals[1];
|
||||
mBaseVal.width = vals[2];
|
||||
mBaseVal.height = vals[3];
|
||||
SetBaseValue(vals[0], vals[1], vals[2], vals[3], aSVGElement, aDoSetAttr);
|
||||
}
|
||||
|
||||
nsMemory::Free(str);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jonathan Watt <jonathan.watt@strath.ac.uk> (original author)
|
||||
* Craig Topper <craig.topper@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -61,6 +61,10 @@ public:
|
|||
|
||||
void Init();
|
||||
|
||||
// Used by element to tell if viewbox is defined
|
||||
PRBool IsValid() const
|
||||
{ return (mHasBaseVal || mAnimVal); }
|
||||
|
||||
const nsSVGViewBoxRect& GetBaseValue() const
|
||||
{ return mBaseVal; }
|
||||
void SetBaseValue(float aX, float aY, float aWidth, float aHeight,
|
||||
|
@ -80,6 +84,7 @@ private:
|
|||
|
||||
nsSVGViewBoxRect mBaseVal;
|
||||
nsAutoPtr<nsSVGViewBoxRect> mAnimVal;
|
||||
PRPackedBool mHasBaseVal;
|
||||
|
||||
struct DOMBaseVal : public nsIDOMSVGRect
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче