summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPale Moon <git-repo@palemoon.org>2018-05-15 22:28:02 +0200
committerPale Moon <git-repo@palemoon.org>2018-05-15 22:28:02 +0200
commite98258a892cf2320b9bc327d65bae6b8e5bf16f5 (patch)
tree1a5bd02c71f281a74d072e349d3f9fba590d4ed4
parentbe37ea5143c40f620ec8aa788a2209f2b07edb33 (diff)
downloadpalemoon-e98258a892cf2320b9bc327d65bae6b8e5bf16f5.tar.gz
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.
-rw-r--r--dom/svg/SVGClipPathElement.cpp7
-rw-r--r--dom/svg/SVGClipPathElement.h4
-rw-r--r--layout/svg/nsSVGUtils.cpp3
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<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 };
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<SVGClipPathElement*>(clipPathFrame->GetContent());
- nsRefPtr<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) {