Bug 532721: follow-up tweaks and bustage fix. r=roc
authorZack Weinberg <zweinberg@mozilla.com>
Tue, 15 Dec 2009 19:01:01 -0800
changeset 36245 4b2811f446066c7c87ee38929561d773c570c82f
parent 36244 892d3eb10151b4eb375551f315989829cb35119a
child 36247 51d78e4dda1920354a2525ded13f02aeed67fbb4
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs532721
milestone1.9.3a1pre
Bug 532721: follow-up tweaks and bustage fix. r=roc
layout/reftests/css-gradients/height-dependence-1-ref.html
layout/reftests/css-gradients/height-dependence-1.html
layout/reftests/css-gradients/height-dependence-2-ref.html
layout/reftests/css-gradients/height-dependence-2.html
layout/reftests/css-gradients/height-dependence-3.html
layout/reftests/css-gradients/reftest.list
layout/style/nsStyleStruct.h
--- a/layout/reftests/css-gradients/height-dependence-1-ref.html
+++ b/layout/reftests/css-gradients/height-dependence-1-ref.html
@@ -1,13 +1,14 @@
 <!doctype html>
 <html><head>
 <style>
 html {
-  background-image: -moz-linear-gradient(black, white 20%)
+  background-image: -moz-linear-gradient(black, white 20%);
+  background-repeat: repeat-x;
 }
 body {
   font-size: 1em;
   padding: 2em;
   margin: 50px auto;
   width: 14em;
   border: 1px solid black;
   background-color: white;
--- a/layout/reftests/css-gradients/height-dependence-1.html
+++ b/layout/reftests/css-gradients/height-dependence-1.html
@@ -1,32 +1,29 @@
 <!doctype html>
 <html class="reftest-wait"><head>
 <style>
 html {
-  background-image: -moz-linear-gradient(black, white 20%)
+  background-image: -moz-linear-gradient(black, white 20%);
+  background-repeat: repeat-x;
 }
 body {
   font-size: 1em;
   padding: 2em;
   margin: 50px auto;
   width: 28em;
   border: 1px solid black;
   background-color: white;
 }
 </style>
 <script>
-window.onload = function() {
-  setTimeout(function() {
-    document.body.style.width = "14em";
-    setTimeout(function() {
-      document.documentElement.removeAttribute("class");
-    }, 100);
-  }, 100);
-}
+window.addEventListener("MozReftestInvalidate", function() {
+  document.body.style.width = "14em";
+  document.documentElement.removeAttribute("class");
+}, false);
 </script>
 </head><body>
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
--- a/layout/reftests/css-gradients/height-dependence-2-ref.html
+++ b/layout/reftests/css-gradients/height-dependence-2-ref.html
@@ -1,14 +1,15 @@
 <!doctype html>
 <html><head>
 <style>
 html {
   background-image: -moz-linear-gradient(black, white 20%);
-  -moz-background-size: 400px 400px;
+  background-repeat: repeat-x;
+  -moz-background-size: 1px 400px;
 }
 body {
   font-size: 1em;
   padding: 2em;
   margin: 50px auto;
   width: 14em;
   border: 1px solid black;
   background-color: white;
--- a/layout/reftests/css-gradients/height-dependence-2.html
+++ b/layout/reftests/css-gradients/height-dependence-2.html
@@ -1,33 +1,30 @@
 <!doctype html>
 <html class="reftest-wait"><head>
 <style>
 html {
   background-image: -moz-linear-gradient(black, white 20%);
-  -moz-background-size: 400px 400px;
+  background-repeat: repeat-x;
+  -moz-background-size: 1px 400px;
 }
 body {
   font-size: 1em;
   padding: 2em;
   margin: 50px auto;
   width: 28em;
   border: 1px solid black;
   background-color: white;
 }
 </style>
 <script>
-window.onload = function() {
-  setTimeout(function() {
-    document.body.style.width = "14em";
-    setTimeout(function() {
-      document.documentElement.removeAttribute("class");
-    }, 100);
-  }, 100);
-}
+window.addEventListener("MozReftestInvalidate", function() {
+  document.body.style.width = "14em";
+  document.documentElement.removeAttribute("class");
+}, false);
 </script>
 </head><body>
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
--- a/layout/reftests/css-gradients/height-dependence-3.html
+++ b/layout/reftests/css-gradients/height-dependence-3.html
@@ -11,24 +11,20 @@ body {
   padding: 2em;
   margin: 50px auto;
   width: 28em;
   border: 1px solid black;
   background-color: white;
 }
 </style>
 <script>
-window.onload = function() {
-  setTimeout(function() {
-    document.body.style.width = "14em";
-    setTimeout(function() {
-      document.documentElement.removeAttribute("class");
-    }, 100);
-  }, 100);
-}
+window.addEventListener("MozReftestInvalidate", function() {
+  document.body.style.width = "14em";
+  document.documentElement.removeAttribute("class");
+}, false);
 </script>
 </head><body>
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
 pad pad pad pad pad pad pad pad
--- a/layout/reftests/css-gradients/reftest.list
+++ b/layout/reftests/css-gradients/reftest.list
@@ -81,10 +81,10 @@ fails == aja-linear-2d.html aja-linear-2
 == aja-linear-3a.html aja-linear-3-ref.html
 == aja-linear-3b.html aja-linear-3-ref.html
 == aja-linear-4a.html aja-linear-4-ref.html
 == aja-linear-4b.html aja-linear-4-ref.html
 == aja-linear-5a.html aja-linear-5-ref.html
 fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == aja-linear-6a.html aja-linear-6-ref.html # bug 526708
 fails == aja-linear-6b.html aja-linear-6-ref.html # bug 522607
 == height-dependence-1.html height-dependence-1-ref.html
-== height-dependence-2.html height-dependence-2-ref.html
+fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == height-dependence-2.html height-dependence-2-ref.html # bug 535007
 == height-dependence-3.html height-dependence-3-ref.html
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -416,20 +416,20 @@ struct nsStyleBackground {
     // True if the effective image size described by this depends on
     // the size of the corresponding frame.  Gradients depend on the
     // frame size when their dimensions are 'auto', images don't; both
     // types depend on the frame size when their dimensions are
     // 'contain', 'cover', or a percentage.
     PRBool DependsOnFrameSize(nsStyleImageType aType) const {
       if (aType == eStyleImageType_Image) {
         return mWidthType <= ePercentage || mHeightType <= ePercentage;
-      } else if (aType == eStyleImageType_Gradient) {
+      } else {
+        NS_ABORT_IF_FALSE(aType == eStyleImageType_Gradient,
+                          "unrecognized image type");
         return mWidthType <= eAuto || mHeightType <= eAuto;
-      } else {
-        NS_NOTREACHED("unrecognized image type");
       }
     }
 
     // Initialize nothing
     Size() {}
 
     // Initialize to initial values
     void SetInitialValues();
@@ -455,19 +455,17 @@ struct nsStyleBackground {
     Layer();
     ~Layer();
 
     void SetInitialValues();
 
     // True if the rendering of this layer might change when the size
     // of the corresponding frame changes.  This is true for any
     // non-solid-color background whose position or size depends on
-    // the frame size (that is, was specified with percentages) and is
-    // also true for nearly all gradients.  We don't currently bother
-    // trying to identify gradients that don't depend on the frame size.
+    // the frame size.
     PRBool RenderingMightDependOnFrameSize() const {
       return (!mImage.IsEmpty() &&
               (mPosition.DependsOnFrameSize() ||
                mSize.DependsOnFrameSize(mImage.GetType())));
     }
 
     // An equality operator that compares the images using URL-equality
     // rather than pointer-equality.