From 855dbe76b286b2b36e7924c940bde0881be8e5f1 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Fri, 1 Apr 2016 14:36:46 +1300 Subject: [PATCH] Bug 1258843 - Don't build SVG display items if their visibility is hidden. r=dholbert --HG-- extra : rebase_source : 733e628c70e6a0d73d4bb722c587b65752cef9bc --- layout/svg/SVGTextFrame.cpp | 4 ++++ layout/svg/nsSVGOuterSVGFrame.cpp | 2 +- layout/svg/nsSVGPathGeometryFrame.cpp | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp index f8e3a2ba2213..ccba52625a4e 100644 --- a/layout/svg/SVGTextFrame.cpp +++ b/layout/svg/SVGTextFrame.cpp @@ -3250,6 +3250,10 @@ SVGTextFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, // painting. return; } + if (!IsVisibleForPainting(aBuilder) && + aBuilder->IsForPainting()) { + return; + } aLists.Content()->AppendNewToTop( new (aBuilder) nsDisplaySVGText(aBuilder, this)); } diff --git a/layout/svg/nsSVGOuterSVGFrame.cpp b/layout/svg/nsSVGOuterSVGFrame.cpp index ae79f9c52446..b9935a14ffaf 100644 --- a/layout/svg/nsSVGOuterSVGFrame.cpp +++ b/layout/svg/nsSVGOuterSVGFrame.cpp @@ -746,7 +746,7 @@ nsSVGOuterSVGFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, nsDisplayListSet set(contentList, contentList, contentList, contentList, contentList, contentList); BuildDisplayListForNonBlockChildren(aBuilder, aDirtyRect, set); - } else { + } else if (IsVisibleForPainting(aBuilder) || !aBuilder->IsForPainting()) { aLists.Content()->AppendNewToTop( new (aBuilder) nsDisplayOuterSVG(aBuilder, this)); } diff --git a/layout/svg/nsSVGPathGeometryFrame.cpp b/layout/svg/nsSVGPathGeometryFrame.cpp index 8613c1fcfbf8..9a0fd24afde5 100644 --- a/layout/svg/nsSVGPathGeometryFrame.cpp +++ b/layout/svg/nsSVGPathGeometryFrame.cpp @@ -231,7 +231,8 @@ nsSVGPathGeometryFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { - if (!static_cast(mContent)->HasValidDimensions()) { + if (!static_cast(mContent)->HasValidDimensions() || + (!IsVisibleForPainting(aBuilder) && aBuilder->IsForPainting())) { return; } aLists.Content()->AppendNewToTop(