Bug 1443092 - Avoid calling SVGAnimatedEnumeration::AnimVal() from nsSVGUtils::GetBBox(). r=jwatt, a=RyanVM

AnimVal() is a DOM getter, and it flushes animations, which we don't want
in GetBBox() which is called from display list building cide and
FrameLayerBuilder.

MozReview-Commit-ID: DWgm7wAV7C0
This commit is contained in:
Botond Ballo 2018-03-09 17:26:24 -05:00 committed by Roy Tam
commit 7f57b96c83
3 changed files with 12 additions and 2 deletions

View file

@ -50,6 +50,13 @@ SVGClipPathElement::GetEnumInfo()
ArrayLength(sEnumInfo));
}
bool
SVGClipPathElement::IsUnitsObjectBoundingBox() const
{
return mEnumAttributes[CLIPPATHUNITS].GetAnimValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
}
//----------------------------------------------------------------------
// nsIDOMNode methods

View file

@ -36,6 +36,10 @@ public:
// WebIDL
already_AddRefed<SVGAnimatedEnumeration> ClipPathUnits();
// This is an internal method that does not flush style, and thus
// the answer may be out of date if there's a pending style flush.
bool IsUnitsObjectBoundingBox() const;
protected:
enum { CLIPPATHUNITS };

View file

@ -1127,8 +1127,7 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags)
if (clipPathFrame && isOK) {
SVGClipPathElement *clipContent =
static_cast<SVGClipPathElement*>(clipPathFrame->GetContent());
RefPtr<SVGAnimatedEnumeration> units = clipContent->ClipPathUnits();
if (units->AnimVal() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
if (clipContent->IsUnitsObjectBoundingBox()) {
matrix.Translate(gfxPoint(x, y));
matrix.Scale(width, height);
} else if (aFrame->GetType() == nsGkAtoms::svgForeignObjectFrame) {