Bug 815591. Don't build nsDisplayBackgroundColor if there is no background color and we're not going to do hit-testing. r=mattwoodrow
☠☠ backed out by 66eaee2d8885 ☠ ☠
authorRobert O'Callahan <robert@ocallahan.org>
Wed, 28 Nov 2012 01:50:09 +1300
changeset 114456 7aceff7124d9fed368c636dcdf7f4a99a5160611
parent 114455 12c06dee84cb27eb12ca7266ef598d0e95b73ca1
child 114457 c94aecc61d74bef4029dd0b80746742ac22813a4
push id23917
push useremorley@mozilla.com
push dateThu, 29 Nov 2012 14:20:29 +0000
treeherdermozilla-central@c72d38e7a212 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs815591
milestone20.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 815591. Don't build nsDisplayBackgroundColor if there is no background color and we're not going to do hit-testing. r=mattwoodrow
layout/base/nsDisplayList.cpp
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -1560,21 +1560,23 @@ nsDisplayBackgroundImage::AppendBackgrou
   nscolor color;
   if (!nsCSSRendering::IsCanvasFrame(aFrame) && bg) {
     bool drawBackgroundImage;
     color =
       nsCSSRendering::DetermineBackgroundColor(presContext, bgSC, aFrame,
                                                drawBackgroundImage, drawBackgroundColor);
   }
 
-  // Even if we don't actually have a background color to paint, we still need
-  // to create the item because it's used for hit testing.
-  aList->AppendNewToTop(
-      new (aBuilder) nsDisplayBackgroundColor(aBuilder, aFrame, bg,
-                                              drawBackgroundColor ? color : NS_RGBA(0, 0, 0, 0)));
+  // Even if we don't actually have a background color to paint, we may still need
+  // to create an item for hit testing.
+  if (color != NS_RGBA(0,0,0,0) || aBuilder->IsForEventDelivery()) {
+    aList->AppendNewToTop(
+        new (aBuilder) nsDisplayBackgroundColor(aBuilder, aFrame, bg,
+                                                drawBackgroundColor ? color : NS_RGBA(0, 0, 0, 0)));
+  }
  
   // Passing bg == nullptr in this macro will result in one iteration with
   // i = 0.
   bool backgroundSet = !aBackground;
   NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, bg) {
     nsDisplayBackgroundImage* bgItem =
       new (aBuilder) nsDisplayBackgroundImage(aBuilder, aFrame, i, isThemed, bg);
     nsresult rv = aList->AppendNewToTop(bgItem);