From e98258a892cf2320b9bc327d65bae6b8e5bf16f5 Mon Sep 17 00:00:00 2001 From: Pale Moon Date: Tue, 15 May 2018 22:28:02 +0200 Subject: Avoid calling SVGAnimatedEnumeration::AnimVal() from nsSVGUtils::GetBBox(). AnimVal() is a DOM getter and it flushes animations, which we don't want in GetBBox() which is called from display list building side and FrameLayerBuilder. --- dom/svg/SVGClipPathElement.cpp | 7 +++++++ dom/svg/SVGClipPathElement.h | 4 ++++ layout/svg/nsSVGUtils.cpp | 3 +-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/dom/svg/SVGClipPathElement.cpp b/dom/svg/SVGClipPathElement.cpp index b915a6189..9f430d11f 100644 --- a/dom/svg/SVGClipPathElement.cpp +++ b/dom/svg/SVGClipPathElement.cpp @@ -49,6 +49,13 @@ SVGClipPathElement::GetEnumInfo() ArrayLength(sEnumInfo)); } +bool +SVGClipPathElement::IsUnitsObjectBoundingBox() const +{ + return mEnumAttributes[CLIPPATHUNITS].GetAnimValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; +} + + //---------------------------------------------------------------------- // nsIDOMNode methods diff --git a/dom/svg/SVGClipPathElement.h b/dom/svg/SVGClipPathElement.h index 05aa2243c..ae141f359 100644 --- a/dom/svg/SVGClipPathElement.h +++ b/dom/svg/SVGClipPathElement.h @@ -35,6 +35,10 @@ public: // WebIDL already_AddRefed 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 }; diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index 2cf6ec811..f207faf77 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -946,8 +946,7 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags) if (clipPathFrame && isOK) { SVGClipPathElement *clipContent = static_cast(clipPathFrame->GetContent()); - nsRefPtr 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) { -- cgit v1.2.3