Bug 1960605 - Check outer svg dimensions are valid r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D245570
This commit is contained in:
@@ -256,18 +256,14 @@ gfxMatrix SVGViewportElement::ChildToUserSpaceTransform() const {
|
|||||||
return ThebesMatrix(viewBox);
|
return ThebesMatrix(viewBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SVGViewportElement::AreWidthAndHeightUnsetOrPositive() const {
|
/* virtual */
|
||||||
|
bool SVGViewportElement::HasValidDimensions() const {
|
||||||
return (!mLengthAttributes[ATTR_WIDTH].IsExplicitlySet() ||
|
return (!mLengthAttributes[ATTR_WIDTH].IsExplicitlySet() ||
|
||||||
mLengthAttributes[ATTR_WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
|
mLengthAttributes[ATTR_WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
|
||||||
(!mLengthAttributes[ATTR_HEIGHT].IsExplicitlySet() ||
|
(!mLengthAttributes[ATTR_HEIGHT].IsExplicitlySet() ||
|
||||||
mLengthAttributes[ATTR_HEIGHT].GetAnimValInSpecifiedUnits() > 0);
|
mLengthAttributes[ATTR_HEIGHT].GetAnimValInSpecifiedUnits() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */
|
|
||||||
bool SVGViewportElement::HasValidDimensions() const {
|
|
||||||
return !IsInner() || AreWidthAndHeightUnsetOrPositive();
|
|
||||||
}
|
|
||||||
|
|
||||||
SVGAnimatedViewBox* SVGViewportElement::GetAnimatedViewBox() {
|
SVGAnimatedViewBox* SVGViewportElement::GetAnimatedViewBox() {
|
||||||
return &mViewBox;
|
return &mViewBox;
|
||||||
}
|
}
|
||||||
@@ -284,7 +280,7 @@ bool SVGViewportElement::ShouldSynthesizeViewBox() const {
|
|||||||
// document (and lack an explicit viewBox), as long as our width &
|
// document (and lack an explicit viewBox), as long as our width &
|
||||||
// height attributes wouldn't yield an empty synthesized viewbox.
|
// height attributes wouldn't yield an empty synthesized viewbox.
|
||||||
return IsRootSVGSVGElement() && OwnerDoc()->IsBeingUsedAsImage() &&
|
return IsRootSVGSVGElement() && OwnerDoc()->IsBeingUsedAsImage() &&
|
||||||
AreWidthAndHeightUnsetOrPositive();
|
HasValidDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|||||||
@@ -129,8 +129,6 @@ class SVGViewportElement : public SVGGraphicsElement {
|
|||||||
return !GetParent() && IsInUncomposedDoc() && IsSVGElement(nsGkAtoms::svg);
|
return !GetParent() && IsInUncomposedDoc() && IsSVGElement(nsGkAtoms::svg);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AreWidthAndHeightUnsetOrPositive() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the explicit or default preserveAspectRatio, unless we're
|
* Returns the explicit or default preserveAspectRatio, unless we're
|
||||||
* synthesizing a viewBox, in which case it returns the "none" value.
|
* synthesizing a viewBox, in which case it returns the "none" value.
|
||||||
|
|||||||
Reference in New Issue
Block a user