Bug 735898. Part 5: Simple tweaks to avoid wrapping empty lists and to reorder boolean tests. r=mattwoodrow
authorRobert O'Callahan <robert@ocallahan.org>
Mon, 16 Apr 2012 17:43:47 +1200
changeset 95058 7b426ec26c0a18f773e6be65da41462e8b9a3dd2
parent 95057 1bb71108f4ded6a1bacfd1cf45770f2cb799c61f
child 95059 2f8fbd24bde1a0ce3110573e35438083110f9f4d
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs735898
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 735898. Part 5: Simple tweaks to avoid wrapping empty lists and to reorder boolean tests. r=mattwoodrow
layout/generic/nsFrame.cpp
layout/generic/nsFrame.h
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2150,23 +2150,27 @@ nsIFrame::BuildDisplayListForChild(nsDis
 #endif
   }
   NS_ENSURE_SUCCESS(rv, rv);
     
   if (isPositioned || isVisuallyAtomic ||
       (aFlags & DISPLAY_CHILD_FORCE_STACKING_CONTEXT)) {
     // Genuine stacking contexts, and positioned pseudo-stacking-contexts,
     // go in this level.
-    rv = aLists.PositionedDescendants()->AppendNewToTop(new (aBuilder)
-        nsDisplayWrapList(aBuilder, child, &list));
-    NS_ENSURE_SUCCESS(rv, rv);
+    if (!list.IsEmpty()) {
+      rv = aLists.PositionedDescendants()->AppendNewToTop(new (aBuilder)
+          nsDisplayWrapList(aBuilder, child, &list));
+      NS_ENSURE_SUCCESS(rv, rv);
+    }
   } else if (disp->IsFloating()) {
-    rv = aLists.Floats()->AppendNewToTop(new (aBuilder)
-        nsDisplayWrapList(aBuilder, child, &list));
-    NS_ENSURE_SUCCESS(rv, rv);
+    if (!list.IsEmpty()) {
+      rv = aLists.Floats()->AppendNewToTop(new (aBuilder)
+          nsDisplayWrapList(aBuilder, child, &list));
+      NS_ENSURE_SUCCESS(rv, rv);
+    }
   } else {
     aLists.Content()->AppendToTop(&list);
   }
   // We delay placing the positioned descendants of positioned frames to here,
   // because in the absence of z-index this is the correct order for them.
   // This doesn't affect correctness because the positioned descendants list
   // is sorted by z-order and content in BuildDisplayListForStackingContext,
   // but it means that sort routine needs to do less work.
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -607,18 +607,18 @@ public:
           type == nsGkAtoms::bcTableCellFrame) {
         return true;
       }
     }
     
     // If we're paginated and a block, and have NS_BLOCK_CLIP_PAGINATED_OVERFLOW
     // set, then we want to clip our overflow.
     return
+      (aFrame->GetStateBits() & NS_BLOCK_CLIP_PAGINATED_OVERFLOW) != 0 &&
       aFrame->PresContext()->IsPaginated() &&
-      (aFrame->GetStateBits() & NS_BLOCK_CLIP_PAGINATED_OVERFLOW) != 0 &&
       aFrame->GetType() == nsGkAtoms::blockFrame;
   }
 
 protected:
 
   // Test if we are selecting a table object:
   //  Most table/cell selection requires that Ctrl (Cmd on Mac) key is down 
   //   during a mouse click or drag. Exception is using Shift+click when