Bug 1258843 - Don't build SVG display items if their visibility is hidden. r=dholbert
☠☠ backed out by 16620f50a937 ☠ ☠
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 24 Mar 2016 18:15:40 +1300
changeset 290248 e3853bd7905106f0ad6674ff9fd1b62713a58333
parent 290247 41de0b26ddd2349c616815788c1ed10c3dc43789
child 290249 3e56c2c501974d6f141f87e4d43c5c111b71c16c
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1258843
milestone48.0a1
Bug 1258843 - Don't build SVG display items if their visibility is hidden. r=dholbert
layout/svg/SVGTextFrame.cpp
layout/svg/nsSVGOuterSVGFrame.cpp
layout/svg/nsSVGPathGeometryFrame.cpp
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -3245,16 +3245,19 @@ SVGTextFrame::BuildDisplayList(nsDisplay
                                const nsDisplayListSet& aLists)
 {
   if (NS_SUBTREE_DIRTY(this)) {
     // We can sometimes be asked to paint before reflow happens and we
     // have updated mPositions, etc.  In this case, we just avoid
     // painting.
     return;
   }
+  if (!IsVisibleForPainting(aBuilder)) {
+    return;
+  }
   aLists.Content()->AppendNewToTop(
     new (aBuilder) nsDisplaySVGText(aBuilder, this));
 }
 
 nsresult
 SVGTextFrame::AttributeChanged(int32_t aNameSpaceID,
                                nsIAtom* aAttribute,
                                int32_t aModType)
--- a/layout/svg/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/nsSVGOuterSVGFrame.cpp
@@ -741,17 +741,17 @@ nsSVGOuterSVGFrame::BuildDisplayList(nsD
   if ((aBuilder->IsForEventDelivery() &&
        NS_SVGDisplayListHitTestingEnabled()) ||
       (!aBuilder->IsForEventDelivery() &&
        NS_SVGDisplayListPaintingEnabled())) {
     nsDisplayList *contentList = aLists.Content();
     nsDisplayListSet set(contentList, contentList, contentList,
                          contentList, contentList, contentList);
     BuildDisplayListForNonBlockChildren(aBuilder, aDirtyRect, set);
-  } else {
+  } else if (IsVisibleForPainting(aBuilder)) {
     aLists.Content()->AppendNewToTop(
       new (aBuilder) nsDisplayOuterSVG(aBuilder, this));
   }
 }
 
 nsSplittableType
 nsSVGOuterSVGFrame::GetSplittableType() const
 {
--- a/layout/svg/nsSVGPathGeometryFrame.cpp
+++ b/layout/svg/nsSVGPathGeometryFrame.cpp
@@ -226,17 +226,18 @@ nsSVGPathGeometryFrame::IsSVGTransformed
   return foundTransform;
 }
 
 void
 nsSVGPathGeometryFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                          const nsRect&           aDirtyRect,
                                          const nsDisplayListSet& aLists)
 {
-  if (!static_cast<const nsSVGElement*>(mContent)->HasValidDimensions()) {
+  if (!static_cast<const nsSVGElement*>(mContent)->HasValidDimensions() ||
+      !IsVisibleForPainting(aBuilder)) {
     return;
   }
   aLists.Content()->AppendNewToTop(
     new (aBuilder) nsDisplaySVGPathGeometry(aBuilder, this));
 }
 
 //----------------------------------------------------------------------
 // nsISVGChildFrame methods