Bug 664130 - avoid creating empty nsAbsPosClipWrapper items. r=roc.
authorJonathan Watt <jwatt@jwatt.org>
Thu, 08 Sep 2011 12:15:00 +0100
changeset 76722 24ba516de8f32db9f882076784cf95933465052f
parent 76721 0126d20e120fea346d42bd3faeb9407ab80ef80b
child 76723 e082a424c7fb5afe5ca83c63ce800efb36580f7e
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersroc
bugs664130
milestone9.0a1
Bug 664130 - avoid creating empty nsAbsPosClipWrapper items. r=roc.
layout/generic/nsFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -1647,17 +1647,21 @@ nsIFrame::BuildDisplayListForStackingCon
   set.Outlines()->SortByContentOrder(aBuilder, GetContent());
 #ifdef NS_DEBUG
   DisplayDebugBorders(aBuilder, this, set);
 #endif
   resultList.AppendToTop(set.Outlines());
   // 8, 9: non-negative z-index children
   resultList.AppendToTop(set.PositionedDescendants());
 
-  if (applyAbsPosClipping) {
+  /* If we have absolute position clipping and we have, or will have, items to
+   * be clipped, wrap the list in a clip wrapper.
+   */
+  if (applyAbsPosClipping &&
+      (!resultList.IsEmpty() || usingSVGEffects)) {
     nsAbsPosClipWrapper wrapper(absPosClip);
     nsDisplayItem* item = wrapper.WrapList(aBuilder, this, &resultList);
     if (!item)
       return NS_ERROR_OUT_OF_MEMORY;
     // resultList was emptied
     resultList.AppendToTop(item);
   }