Merge.
authorAndreas Gal <gal@mozilla.com>
Wed, 04 Feb 2009 15:01:19 -0800
changeset 24838 bd6990ab2cd72b2cada19a2137e5a805c93b9d7a
parent 24837 8a2b9464d6c5a4e7c165687ccf6f81896e167d51 (current diff)
parent 24640 f0439ca91c929895dfb4883734c86a36ededf381 (diff)
child 24839 33d63e807d6becd1759412e7ef05e4a086e4c44b
child 24842 ae5d5b241949e76e0b0f33fca0e0646a892b4f74
push idunknown
push userunknown
push dateunknown
milestone1.9.2a1pre
Merge.
modules/libpr0n/test/mochitest/big.png
modules/libpr0n/test/mochitest/test_bug466586.html
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4914,19 +4914,20 @@ var contentAreaDNDObserver = {
       var dragType = aXferData.flavour.contentType;
       var dragData = aXferData.data;
       if (dragType == "application/x-moz-tabbrowser-tab") {
         // If the tab was dragged from some other tab bar, its own dragend
         // handler will take care of detaching the tab
         if (dragData instanceof XULElement && dragData.localName == "tab" &&
             dragData.ownerDocument.defaultView == window) {
           // Detach only if the mouse pointer was released a little
-          // bit down in the content area (to be precise, by tab-height)
+          // bit down in the content area (to be precise, by half the height
+          // of a tab)
           if (aEvent.screenY > gBrowser.mPanelContainer.boxObject.screenY +
-                               dragData.boxObject.height) {
+                               dragData.boxObject.height / 2) {
             gBrowser.replaceTabWithWindow(dragData);
             aEvent.dataTransfer.dropEffect = "move";
             return;
           }
         }
         aEvent.dataTransfer.dropEffect = "none";
         return;
       }
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1916,16 +1916,18 @@
             var spec = uri ? uri.spec : "about:blank";
             dt.mozSetDataAt("text/x-moz-url", spec + "\n" + aEvent.target.label, 0);
             dt.mozSetDataAt("text/plain", spec, 0);
 
             var canvas = tabPreviews.capture(target, false);
             dt.setDragImage(canvas, 0, 0);
             aEvent.stopPropagation();
           }
+
+          this._dragLeftWindow = false;
         ]]>
         </body>
       </method>
 
       <field name="mDragTime">0</field>
       <field name="mDragOverDelay">350</field>
 
       <field name="_supportedLinkDropTypes"><![CDATA[
--- a/dom/locales/en-US/chrome/layout/css.properties
+++ b/dom/locales/en-US/chrome/layout/css.properties
@@ -32,18 +32,16 @@
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 MimeNotCss=The stylesheet %1$S was not loaded because its MIME type, "%2$S", is not "text/css".
 MimeNotCssWarn=The stylesheet %1$S was loaded as CSS even though its MIME type, "%2$S", is not "text/css".
 
-UseOfGetPropertyCSSValueWarning=Use of getPropertyCSSValue() is deprecated.  To upgrade your code, use getPropertyValue() instead.
-
 PEUnexpEOF2=Unexpected end of file while searching for %1$S.
 PEParseRuleWSOnly=Whitespace-only string given to be parsed as rule.
 PEDeclDropped=Declaration dropped.
 PEDeclSkipped=Skipped to next declaration.
 PEUnknownProperty=Unknown property '%1$S'.
 PEValueParsingError=Error in parsing value for '%1$S'.
 PEExpectEndValue=Expected end of value but found '%1$S'.
 PESkipAtRuleEOF=end of unknown at-rule
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -3116,16 +3116,19 @@ PresShell::VerifyHasDirtyRootAncestor(ns
 
 NS_IMETHODIMP
 PresShell::FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty,
                             nsFrameState aBitToAdd)
 {
   NS_PRECONDITION(aBitToAdd == NS_FRAME_IS_DIRTY ||
                   aBitToAdd == NS_FRAME_HAS_DIRTY_CHILDREN,
                   "Unexpected bits being added");
+  NS_PRECONDITION(aIntrinsicDirty != eStyleChange ||
+                  aBitToAdd == NS_FRAME_IS_DIRTY,
+                  "bits don't correspond to style change reason");
 
   NS_ASSERTION(!mIsReflowing, "can't mark frame dirty during reflow");
 
   // If we've not yet done the initial reflow, then don't bother
   // enqueuing a reflow command yet.
   if (! mDidInitialReflow)
     return NS_OK;
 
@@ -3146,98 +3149,116 @@ PresShell::FrameNeedsReflow(nsIFrame *aF
       nsIContent *rootContent = mDocument->GetRootContent();
       if (rootContent) {
         rootContent->List(stdout, 0);
       }
     }
   }  
 #endif
 
-  // Grab |wasDirty| now so we can go ahead and update the bits on aFrame.
-  PRBool wasDirty = NS_SUBTREE_DIRTY(aFrame);
-  aFrame->AddStateBits(aBitToAdd);
-
-  // Now if aFrame is a reflow root we can cut off this reflow at it if the bit
-  // being added is NS_FRAME_HAS_DIRTY_CHILDREN.
-  PRBool targetFrameDirty = (aBitToAdd == NS_FRAME_IS_DIRTY);
+  nsAutoTArray<nsIFrame*, 4> subtrees;
+  subtrees.AppendElement(aFrame);
+
+  do {
+    nsIFrame *subtreeRoot = subtrees.ElementAt(subtrees.Length() - 1);
+    subtrees.RemoveElementAt(subtrees.Length() - 1);
+
+    // Grab |wasDirty| now so we can go ahead and update the bits on
+    // subtreeRoot.
+    PRBool wasDirty = NS_SUBTREE_DIRTY(subtreeRoot);
+    subtreeRoot->AddStateBits(aBitToAdd);
+
+    // Now if subtreeRoot is a reflow root we can cut off this reflow at it if
+    // the bit being added is NS_FRAME_HAS_DIRTY_CHILDREN.
+    PRBool targetFrameDirty = (aBitToAdd == NS_FRAME_IS_DIRTY);
 
 #define FRAME_IS_REFLOW_ROOT(_f)                   \
   ((_f->GetStateBits() & NS_FRAME_REFLOW_ROOT) &&  \
-   (_f != aFrame || !targetFrameDirty))
-
-
-  // Mark the intrinsic widths as dirty on the frame, all of its ancestors,
-  // and all of its descendants, if needed:
-
-  if (aIntrinsicDirty != eResize) {
-    // Mark argument and all ancestors dirty. (Unless we hit a reflow root that
-    // should contain the reflow.  That root could be aFrame itself if it's not
-    // dirty, or it could be some ancestor of aFrame.)
-    for (nsIFrame *a = aFrame;
-         a && !FRAME_IS_REFLOW_ROOT(a);
-         a = a->GetParent())
-      a->MarkIntrinsicWidthsDirty();
-  }
-
-  if (aIntrinsicDirty == eStyleChange) {
-    // Mark all descendants dirty (using an nsTArray stack rather than
-    // recursion).
-    nsTArray<nsIFrame*> stack;
-    stack.AppendElement(aFrame);
-
-    while (stack.Length() != 0) {
-      nsIFrame *f =
-        stack.ElementAt(stack.Length() - 1);
-      stack.RemoveElementAt(stack.Length() - 1);
-
-      PRInt32 childListIndex = 0;
-      nsIAtom *childListName;
+   (_f != subtreeRoot || !targetFrameDirty))
+
+
+    // Mark the intrinsic widths as dirty on the frame, all of its ancestors,
+    // and all of its descendants, if needed:
+
+    if (aIntrinsicDirty != eResize) {
+      // Mark argument and all ancestors dirty. (Unless we hit a reflow
+      // root that should contain the reflow.  That root could be
+      // subtreeRoot itself if it's not dirty, or it could be some
+      // ancestor of subtreeRoot.)
+      for (nsIFrame *a = subtreeRoot;
+           a && !FRAME_IS_REFLOW_ROOT(a);
+           a = a->GetParent())
+        a->MarkIntrinsicWidthsDirty();
+    }
+
+    if (aIntrinsicDirty == eStyleChange) {
+      // Mark all descendants dirty (using an nsTArray stack rather than
+      // recursion).
+      nsAutoTArray<nsIFrame*, 32> stack;
+      stack.AppendElement(subtreeRoot);
+
       do {
-        childListName = f->GetAdditionalChildListName(childListIndex++);
-        for (nsIFrame *kid = f->GetFirstChild(childListName); kid;
-             kid = kid->GetNextSibling()) {
-          kid->MarkIntrinsicWidthsDirty();
-          stack.AppendElement(kid);
+        nsIFrame *f = stack.ElementAt(stack.Length() - 1);
+        stack.RemoveElementAt(stack.Length() - 1);
+
+        if (f->GetType() == nsGkAtoms::placeholderFrame) {
+          nsIFrame *oof = nsPlaceholderFrame::GetRealFrameForPlaceholder(f);
+          if (!nsLayoutUtils::IsProperAncestorFrame(subtreeRoot, oof)) {
+            // We have another distinct subtree we need to mark.
+            subtrees.AppendElement(oof);
+          }
         }
-      } while (childListName);
-    }
-  }
-
-  // Set NS_FRAME_HAS_DIRTY_CHILDREN bits (via nsIFrame::ChildIsDirty) up the
-  // tree until we reach either a frame that's already dirty or a reflow root.
-  nsIFrame *f = aFrame;
-  for (;;) {
-    if (FRAME_IS_REFLOW_ROOT(f) || !f->GetParent()) {
-      // we've hit a reflow root or the root frame
-      if (!wasDirty) {
-        mDirtyRoots.AppendElement(f);
-      }
+
+        PRInt32 childListIndex = 0;
+        nsIAtom *childListName;
+        do {
+          childListName = f->GetAdditionalChildListName(childListIndex++);
+          for (nsIFrame *kid = f->GetFirstChild(childListName); kid;
+               kid = kid->GetNextSibling()) {
+            kid->MarkIntrinsicWidthsDirty();
+            stack.AppendElement(kid);
+          }
+        } while (childListName);
+      } while (stack.Length() != 0);
+    }
+
+    // Set NS_FRAME_HAS_DIRTY_CHILDREN bits (via nsIFrame::ChildIsDirty)
+    // up the tree until we reach either a frame that's already dirty or
+    // a reflow root.
+    nsIFrame *f = subtreeRoot;
+    for (;;) {
+      if (FRAME_IS_REFLOW_ROOT(f) || !f->GetParent()) {
+        // we've hit a reflow root or the root frame
+        if (!wasDirty) {
+          mDirtyRoots.AppendElement(f);
+        }
 #ifdef DEBUG
-      else {
-        VerifyHasDirtyRootAncestor(f);
-      }
+        else {
+          VerifyHasDirtyRootAncestor(f);
+        }
 #endif
-      
-      break;
-    }
-
-    nsIFrame *child = f;
-    f = f->GetParent();
-    wasDirty = NS_SUBTREE_DIRTY(f);
-    f->ChildIsDirty(child);
-    NS_ASSERTION(f->GetStateBits() & NS_FRAME_HAS_DIRTY_CHILDREN,
-                 "ChildIsDirty didn't do its job");
-    if (wasDirty) {
-      // This frame was already marked dirty.
+        
+        break;
+      }
+
+      nsIFrame *child = f;
+      f = f->GetParent();
+      wasDirty = NS_SUBTREE_DIRTY(f);
+      f->ChildIsDirty(child);
+      NS_ASSERTION(f->GetStateBits() & NS_FRAME_HAS_DIRTY_CHILDREN,
+                   "ChildIsDirty didn't do its job");
+      if (wasDirty) {
+        // This frame was already marked dirty.
 #ifdef DEBUG
-      VerifyHasDirtyRootAncestor(f);
+        VerifyHasDirtyRootAncestor(f);
 #endif
-      break;
-    }
-  }
+        break;
+      }
+    }
+  } while (subtrees.Length() != 0);
 
   PostReflowEvent();
 
   return NS_OK;
 }
 
 nsIScrollableView*
 PresShell::GetViewToScroll(nsLayoutUtils::Direction aDirection)
--- a/layout/generic/nsBlockReflowState.cpp
+++ b/layout/generic/nsBlockReflowState.cpp
@@ -348,16 +348,19 @@ nsBlockReflowState::GetAvailableSpace(ns
   PRBool hasFloats;
   mAvailSpaceRect = 
     mFloatManager->GetBand(aY - BorderPadding().top, 
                            aRelaxHeightConstraint ? nscoord_MAX
                                                   : mContentArea.height,
                            mContentArea.width,
                            &hasFloats);
   mBandHasFloats = hasFloats;
+  // Keep the width >= 0 for compatibility with nsSpaceManager.
+  if (mAvailSpaceRect.width < 0)
+    mAvailSpaceRect.width = 0;
 
 #ifdef DEBUG
   if (nsBlockFrame::gNoisyReflow) {
     nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
     printf("GetAvailableSpace: band=%d,%d,%d,%d hasfloats=%d\n",
            mAvailSpaceRect.x, mAvailSpaceRect.y,
            mAvailSpaceRect.width, mAvailSpaceRect.height,
            mBandHasFloats);
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/363247-1-ref.html
@@ -0,0 +1,15 @@
+<html>
+  <head>
+    <title>bug 363247</title>
+    <link rel="stylesheet" href="data:text/css,body {font-size: 20pt}" id="main-css">
+  </head>
+  <body>
+    <table id="table" style="position: absolute; font-size: inherit;">
+      <tbody>
+        <tr>
+          <td>foo</td><td>bar</td>
+        </tr>
+      </tbody>
+    </table>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/363247-1.html
@@ -0,0 +1,20 @@
+<html>
+  <head>
+    <title>bug 363247</title>
+    <link rel="stylesheet" href="data:text/css,body {font-size: 10pt}" id="main-css">
+  </head>
+  <body>
+    <table id="table" style="position: absolute; font-size: inherit;">
+      <tbody>
+        <tr>
+          <td>foo</td><td>bar</td>
+        </tr>
+      </tbody>
+    </table>
+    <script>
+      document.body.offsetHeight;
+      var node = document.getElementById("main-css");
+      node.setAttribute("href", 'data:text/css,body {font-size: 20pt}');
+    </script>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/476063-4-ref.xhtml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<title>Test that legend is display:block by default when outside of fieldset (Bug 476063)</title>
+</head>
+<body>
+
+<div>
+  <div>The legend</div>
+  The rest of the figure.
+</div>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/476063-4.xhtml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<title>Test that legend is display:block by default when outside of fieldset (Bug 476063)</title>
+</head>
+<body>
+
+<figure>
+  <legend>The legend</legend>
+  The rest of the figure.
+</figure>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/476598-1-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<title>Test for incorrect inherited/aInherited use in -moz-transform-origin handling</title>
+<style type="text/css">
+
+p {
+  height: 20px;
+  width: 20px;
+  background: green;
+  margin: 0;
+}
+
+</style>
+<!-- scaled from bottom right -->
+<p style="margin-top: 40px; margin-left: 40px;"></p>
+<!-- scaled from 2x times bottom right -->
+<p style="margin-top: 30px; margin-left: 30px;"></p>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/476598-1-ref2.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML>
+<title>Test for incorrect inherited/aInherited use in -moz-transform-origin handling</title>
+<style type="text/css">
+
+p {
+  -moz-transform: scale(2);
+  height: 10px;
+  width: 10px;
+  background: green;
+  margin: 50px;
+}
+
+</style>
+<p style="-moz-transform-origin: 10px 10px"></p>
+<p style="-moz-transform-origin: 20px 20px"></p>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/476598-1a.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<title>Test for incorrect inherited/aInherited use in -moz-transform-origin handling</title>
+<style type="text/css">
+
+p {
+  -moz-transform-origin: 1em 1em;
+  -moz-transform: scale(2);
+  height: 10px;
+  width: 10px;
+  background: green;
+  margin: 50px;
+}
+
+</style>
+<p style="font-size: 10px"></p>
+<p style="font-size: 20px"></p>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/476598-1b.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<title>Test for incorrect inherited/aInherited use in -moz-transform-origin handling</title>
+<style type="text/css">
+
+p {
+  -moz-transform-origin: inherit;
+  -moz-transform: scale(2);
+  height: 10px;
+  width: 10px;
+  background: green;
+  margin: 50px;
+}
+
+</style>
+<div style="-moz-transform-origin: 10px 10px">
+<p style="font-size: 10px"></p>
+</div>
+<div style="-moz-transform-origin: 20px 20px">
+<p style="font-size: 20px"></p>
+</div>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -443,16 +443,17 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") ==
 == 362594-1b.html 362594-1-quirks-ref.html
 == 362594-1c.html 362594-1-standards-ref.html
 != 362594-2a.html 362594-1-quirks-ref.html
 == 362594-2a.html 362594-2-quirks-ref.html
 != 362594-2b.html 362594-1-standards-ref.html
 == 362594-2b.html 362594-2-standards-ref.html
 == 362594-2c.html 362594-2-standards-ref.html
 == 362901-1.html 362901-1-ref.html
+== 363247-1.html 363247-1-ref.html
 == 363329-1.html 363329-1-ref.html
 == 363329-2.html 363329-2-ref.html
 == 363370-1.html 363370-1-ref.html
 == 363402-1.html 363402-1-ref.html
 == 363637-1.html 363637-1-ref.html
 == 363706-1.html 363706-1-ref.html
 != 363706-1.html about:blank
 == 363858-1.html 363858-1-ref.html
@@ -1033,8 +1034,14 @@ fails == 461512-1.html 461512-1-ref.html
 == 472500-1.xul 472500-1-ref.xul
 == 473847-1.xul 473847-1-ref.xul
 == 474336-1.xul 474336-1-ref.xul
 == 474417-1.html 474417-1-ref.html
 == 474472-1.html 474472-1-ref.html
 == 476063-1.html 476063-1-ref.html
 == 476063-2.html 476063-2-ref.html
 != 476063-3.html 476063-3-ref.html
+== 476063-4.xhtml 476063-4-ref.xhtml
+== 476598-1a.html 476598-1-ref.html
+== 476598-1a.html 476598-1-ref2.html
+== 476598-1b.html 476598-1-ref.html
+== 476598-1b.html 476598-1-ref2.html
+!= 476598-1-ref.html about:blank
--- a/layout/style/nsCSSRules.cpp
+++ b/layout/style/nsCSSRules.cpp
@@ -1665,24 +1665,16 @@ nsCSSFontFaceStyleDecl::GetPropertyValue
   return GetPropertyValue(nsCSSProps::LookupFontDesc(propertyName), aResult);
 }
 
 // nsIDOMCSSValue getPropertyCSSValue (in DOMString propertyName);
 NS_IMETHODIMP
 nsCSSFontFaceStyleDecl::GetPropertyCSSValue(const nsAString & propertyName,
                                             nsIDOMCSSValue **aResult NS_OUTPARAM)
 {
-  nsCOMPtr<nsIURI> sheetURI;
-  nsIStyleSheet *sheet = ContainingRule()->mSheet;
-  if (sheet) {
-    sheet->GetSheetURI(getter_AddRefs(sheetURI));
-  }
-  nsStyleUtil::ReportUseOfDeprecatedMethod(sheetURI,
-                                           "UseOfGetPropertyCSSValueWarning");
-
   // ??? nsDOMCSSDeclaration returns null/NS_OK, but that seems wrong.
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 // DOMString removeProperty (in DOMString propertyName) raises (DOMException);
 NS_IMETHODIMP
 nsCSSFontFaceStyleDecl::RemoveProperty(const nsAString & propertyName,
                                        nsAString & aResult NS_OUTPARAM)
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -322,114 +322,17 @@ public:
   NS_HIDDEN_(void)  SetRectIsAutoValue();
   NS_HIDDEN_(void)  StartImageLoad(nsIDocument* aDocument)
                                    const;  // Not really const, but pretending
 
   // Returns an already addrefed buffer.  Can return null on allocation
   // failure.
   static nsStringBuffer* BufferFromString(const nsString& aValue);
   
-  struct Array {
-
-    // return |Array| with reference count of zero
-    static Array* Create(PRUint16 aItemCount) {
-      return new (aItemCount) Array(aItemCount);
-    }
-
-    nsCSSValue& operator[](PRUint16 aIndex) {
-      NS_ASSERTION(aIndex < mCount, "out of range");
-      return *(First() + aIndex);
-    }
-
-    const nsCSSValue& operator[](PRUint16 aIndex) const {
-      NS_ASSERTION(aIndex < mCount, "out of range");
-      return *(First() + aIndex);
-    }
-
-    nsCSSValue& Item(PRUint16 aIndex) { return (*this)[aIndex]; }
-    const nsCSSValue& Item(PRUint16 aIndex) const { return (*this)[aIndex]; }
-
-    PRUint16 Count() const { return mCount; }
-
-    PRBool operator==(const Array& aOther) const
-    {
-      if (mCount != aOther.mCount)
-        return PR_FALSE;
-      for (PRUint16 i = 0; i < mCount; ++i)
-        if ((*this)[i] != aOther[i])
-          return PR_FALSE;
-      return PR_TRUE;
-    }
-
-    void AddRef() {
-      if (mRefCnt == PR_UINT16_MAX) {
-        NS_WARNING("refcount overflow, leaking nsCSSValue::Array");
-        return;
-      }
-      ++mRefCnt;
-      NS_LOG_ADDREF(this, mRefCnt, "nsCSSValue::Array", sizeof(*this));
-    }
-    void Release() {
-      if (mRefCnt == PR_UINT16_MAX) {
-        NS_WARNING("refcount overflow, leaking nsCSSValue::Array");
-        return;
-      }
-      --mRefCnt;
-      NS_LOG_RELEASE(this, mRefCnt, "nsCSSValue::Array");
-      if (mRefCnt == 0)
-        delete this;
-    }
-
-  private:
-
-    PRUint16 mRefCnt;
-    PRUint16 mCount;
-
-    void* operator new(size_t aSelfSize, PRUint16 aItemCount) CPP_THROW_NEW {
-      return ::operator new(aSelfSize + sizeof(nsCSSValue)*aItemCount);
-    }
-
-    void operator delete(void* aPtr) { ::operator delete(aPtr); }
-
-    nsCSSValue* First() {
-      return (nsCSSValue*) (((char*)this) + sizeof(*this));
-    }
-
-    const nsCSSValue* First() const {
-      return (const nsCSSValue*) (((const char*)this) + sizeof(*this));
-    }
-
-#define CSSVALUE_LIST_FOR_VALUES(var)                                         \
-  for (nsCSSValue *var = First(), *var##_end = var + mCount;                  \
-       var != var##_end; ++var)
-
-    Array(PRUint16 aItemCount)
-      : mRefCnt(0)
-      , mCount(aItemCount)
-    {
-      MOZ_COUNT_CTOR(nsCSSValue::Array);
-      CSSVALUE_LIST_FOR_VALUES(val) {
-        new (val) nsCSSValue();
-      }
-    }
-
-    ~Array()
-    {
-      MOZ_COUNT_DTOR(nsCSSValue::Array);
-      CSSVALUE_LIST_FOR_VALUES(val) {
-        val->~nsCSSValue();
-      }
-    }
-
-#undef CSSVALUE_LIST_FOR_VALUES
-
-  private:
-    Array(const Array& aOther); // not to be implemented
-  };
-
+  struct Array;
   struct URL {
     // Methods are not inline because using an nsIPrincipal means requiring
     // caps, which leads to REQUIRES hell, since this header is included all
     // over.    
 
     // aString must not be null.
     // aOriginPrincipal must not be null.
     URL(nsIURI* aURI, nsStringBuffer* aString, nsIURI* aReferrer,
@@ -509,10 +412,109 @@ protected:
     nsStringBuffer* mString;
     nscolor    mColor;
     Array*     mArray;
     URL*       mURL;
     Image*     mImage;
   }         mValue;
 };
 
+struct nsCSSValue::Array {
+
+  // return |Array| with reference count of zero
+  static Array* Create(PRUint16 aItemCount) {
+    return new (aItemCount) Array(aItemCount);
+  }
+
+  nsCSSValue& operator[](PRUint16 aIndex) {
+    NS_ASSERTION(aIndex < mCount, "out of range");
+    return mArray[aIndex];
+  }
+
+  const nsCSSValue& operator[](PRUint16 aIndex) const {
+    NS_ASSERTION(aIndex < mCount, "out of range");
+    return mArray[aIndex];
+  }
+
+  nsCSSValue& Item(PRUint16 aIndex) { return (*this)[aIndex]; }
+  const nsCSSValue& Item(PRUint16 aIndex) const { return (*this)[aIndex]; }
+
+  PRUint16 Count() const { return mCount; }
+
+  PRBool operator==(const Array& aOther) const
+  {
+    if (mCount != aOther.mCount)
+      return PR_FALSE;
+    for (PRUint16 i = 0; i < mCount; ++i)
+      if ((*this)[i] != aOther[i])
+        return PR_FALSE;
+    return PR_TRUE;
+  }
+
+  void AddRef() {
+    if (mRefCnt == PR_UINT16_MAX) {
+      NS_WARNING("refcount overflow, leaking nsCSSValue::Array");
+      return;
+    }
+    ++mRefCnt;
+    NS_LOG_ADDREF(this, mRefCnt, "nsCSSValue::Array", sizeof(*this));
+  }
+  void Release() {
+    if (mRefCnt == PR_UINT16_MAX) {
+      NS_WARNING("refcount overflow, leaking nsCSSValue::Array");
+      return;
+    }
+    --mRefCnt;
+    NS_LOG_RELEASE(this, mRefCnt, "nsCSSValue::Array");
+    if (mRefCnt == 0)
+      delete this;
+  }
+
+private:
+
+  PRUint16 mRefCnt;
+  const PRUint16 mCount;
+  // This must be the last sub-object, since we extend this array to
+  // be of size mCount; it needs to be a sub-object so it gets proper
+  // alignment.
+  nsCSSValue mArray[1];
+
+  void* operator new(size_t aSelfSize, PRUint16 aItemCount) CPP_THROW_NEW {
+    NS_ABORT_IF_FALSE(aItemCount > 0, "cannot have a 0 item count");
+    return ::operator new(aSelfSize + sizeof(nsCSSValue) * (aItemCount - 1));
+  }
+
+  void operator delete(void* aPtr) { ::operator delete(aPtr); }
+
+  nsCSSValue* First() { return mArray; }
+
+  const nsCSSValue* First() const { return mArray; }
+
+#define CSSVALUE_LIST_FOR_EXTRA_VALUES(var)                                   \
+  for (nsCSSValue *var = First() + 1, *var##_end = First() + mCount;          \
+       var != var##_end; ++var)
+
+  Array(PRUint16 aItemCount)
+    : mRefCnt(0)
+    , mCount(aItemCount)
+  {
+    MOZ_COUNT_CTOR(nsCSSValue::Array);
+    CSSVALUE_LIST_FOR_EXTRA_VALUES(val) {
+      new (val) nsCSSValue();
+    }
+  }
+
+  ~Array()
+  {
+    MOZ_COUNT_DTOR(nsCSSValue::Array);
+    CSSVALUE_LIST_FOR_EXTRA_VALUES(val) {
+      val->~nsCSSValue();
+    }
+  }
+
+#undef CSSVALUE_LIST_FOR_EXTRA_VALUES
+
+private:
+  Array(const Array& aOther); // not to be implemented
+};
+
 #endif /* nsCSSValue_h___ */
 
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -292,43 +292,31 @@ nsComputedDOMStyle::GetParentRule(nsIDOM
 NS_IMETHODIMP
 nsComputedDOMStyle::GetPropertyValue(const nsAString& aPropertyName,
                                      nsAString& aReturn)
 {
   nsCOMPtr<nsIDOMCSSValue> val;
 
   aReturn.Truncate();
 
-  nsresult rv = GetPropertyCSSValueInternal(aPropertyName, getter_AddRefs(val));
+  nsresult rv = GetPropertyCSSValue(aPropertyName, getter_AddRefs(val));
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (val) {
     rv = val->GetCssText(aReturn);
   }
 
   return rv;
 }
 
 
 NS_IMETHODIMP
 nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName,
                                         nsIDOMCSSValue** aReturn)
 {
-  nsCOMPtr<nsIDocument> document = do_QueryReferent(mDocumentWeak);
-  nsStyleUtil::
-    ReportUseOfDeprecatedMethod(document ? document->GetDocumentURI() : nsnull,
-                                "UseOfGetPropertyCSSValueWarning");
-
-  return GetPropertyCSSValueInternal(aPropertyName, aReturn);
-}
-
-nsresult
-nsComputedDOMStyle::GetPropertyCSSValueInternal(const nsAString& aPropertyName,
-                                                nsIDOMCSSValue** aReturn)
-{
   NS_ENSURE_ARG_POINTER(aReturn);
   *aReturn = nsnull;
 
   nsCOMPtr<nsIDocument> document = do_QueryReferent(mDocumentWeak);
   NS_ENSURE_TRUE(document, NS_ERROR_NOT_AVAILABLE);
 
   // Flush _before_ getting the presshell, since that could create a new
   // presshell.  Also note that we want to flush the style on the document
--- a/layout/style/nsComputedDOMStyle.h
+++ b/layout/style/nsComputedDOMStyle.h
@@ -71,18 +71,16 @@ public:
   NS_DECL_NSIDOMCSSSTYLEDECLARATION
 
   nsComputedDOMStyle();
   virtual ~nsComputedDOMStyle();
 
   static void Shutdown();
 
 private:
-  nsresult GetPropertyCSSValueInternal(const nsAString& aPropertyName,
-                                       nsIDOMCSSValue** aReturn);
   void FlushPendingReflows();
   
 #define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_)                  \
   const nsStyle##name_ * GetStyle##name_() {                            \
     return mStyleContextHolder->GetStyle##name_();                      \
   }
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
--- a/layout/style/nsDOMCSSDeclaration.cpp
+++ b/layout/style/nsDOMCSSDeclaration.cpp
@@ -46,17 +46,16 @@
 #include "nsCSSDeclaration.h"
 #include "nsCSSProps.h"
 #include "nsCOMPtr.h"
 #include "nsIURL.h"
 #include "nsReadableUtils.h"
 #include "nsIPrincipal.h"
 
 #include "nsContentUtils.h"
-#include "nsStyleUtil.h"
 
 
 nsDOMCSSDeclaration::nsDOMCSSDeclaration()
   : mInner(this)
 {
 }
 
 nsDOMCSSDeclaration::~nsDOMCSSDeclaration()
@@ -142,31 +141,16 @@ nsDOMCSSDeclaration::GetLength(PRUint32*
 }
 
 NS_IMETHODIMP
 nsDOMCSSDeclaration::GetPropertyCSSValue(const nsAString& aPropertyName,
                                          nsIDOMCSSValue** aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
 
-  nsCOMPtr<nsICSSLoader> cssLoader;
-  nsCOMPtr<nsICSSParser> cssParser;
-  nsCOMPtr<nsIURI> baseURI, sheetURI;
-  nsCOMPtr<nsIPrincipal> sheetPrincipal;
-  
-  nsresult result = GetCSSParsingEnvironment(getter_AddRefs(sheetURI),
-                                             getter_AddRefs(baseURI),
-                                             getter_AddRefs(sheetPrincipal),
-                                             getter_AddRefs(cssLoader),
-                                             getter_AddRefs(cssParser));
-  if (NS_SUCCEEDED(result)) {
-    nsStyleUtil::ReportUseOfDeprecatedMethod(sheetURI,
-                                             "UseOfGetPropertyCSSValueWarning");
-  }
-
   // We don't support CSSValue yet so we'll just return null...
   *aReturn = nsnull;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMCSSDeclaration::Item(PRUint32 aIndex, nsAString& aReturn)
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -178,31 +178,31 @@ static nscoord CalcLengthWith(const nsCS
                               const nsStyleFont* aStyleFont,
                               nsStyleContext* aStyleContext,
                               nsPresContext* aPresContext,
                               PRBool aUseProvidedRootEmSize,
                               // aUseUserFontSet should always be PR_TRUE
                               // except when called from
                               // CalcLengthWithInitialFont.
                               PRBool aUseUserFontSet,
-                              PRBool& aInherited)
+                              PRBool& aCanStoreInRuleTree)
 {
   NS_ASSERTION(aValue.IsLengthUnit(), "not a length unit");
   NS_ASSERTION(aStyleFont || aStyleContext, "Must have style data");
   NS_ASSERTION(aPresContext, "Must have prescontext");
 
   if (aValue.IsFixedLengthUnit()) {
     return aPresContext->TwipsToAppUnits(aValue.GetLengthTwips());
   }
   nsCSSUnit unit = aValue.GetUnit();
   if (unit == eCSSUnit_Pixel) {
     return nsPresContext::CSSPixelsToAppUnits(aValue.GetFloatValue());
   }
   // Common code for all units other than pixels:
-  aInherited = PR_TRUE;
+  aCanStoreInRuleTree = PR_FALSE;
   if (!aStyleFont) {
     aStyleFont = aStyleContext->GetStyleFont();
   }
   if (aFontSize == -1) {
     // XXX Should this be aStyleFont->mSize instead to avoid taking minfontsize
     // prefs into account?
     aFontSize = aStyleFont->mFont.size;
   }
@@ -263,42 +263,42 @@ static nscoord CalcLengthWith(const nsCS
   }
   return 0;
 }
 
 /* static */ nscoord
 nsRuleNode::CalcLength(const nsCSSValue& aValue,
                        nsStyleContext* aStyleContext,
                        nsPresContext* aPresContext,
-                       PRBool& aInherited)
+                       PRBool& aCanStoreInRuleTree)
 {
   NS_ASSERTION(aStyleContext, "Must have style data");
 
   return CalcLengthWith(aValue, -1, nsnull, aStyleContext, aPresContext,
-                        PR_FALSE, PR_TRUE, aInherited);
+                        PR_FALSE, PR_TRUE, aCanStoreInRuleTree);
 }
 
 /* Inline helper function to redirect requests to CalcLength. */
 static inline nscoord CalcLength(const nsCSSValue& aValue,
                                  nsStyleContext* aStyleContext,
                                  nsPresContext* aPresContext,
-                                 PRBool& aInherited)
+                                 PRBool& aCanStoreInRuleTree)
 {
   return nsRuleNode::CalcLength(aValue, aStyleContext,
-                                aPresContext, aInherited);
+                                aPresContext, aCanStoreInRuleTree);
 }
 
 /* static */ nscoord
 nsRuleNode::CalcLengthWithInitialFont(nsPresContext* aPresContext,
                                       const nsCSSValue& aValue)
 {
   nsStyleFont defaultFont(aPresContext);
-  PRBool inherited;
+  PRBool canStoreInRuleTree;
   return CalcLengthWith(aValue, -1, &defaultFont, nsnull, aPresContext,
-                        PR_TRUE, PR_FALSE, inherited);
+                        PR_TRUE, PR_FALSE, canStoreInRuleTree);
 }
 
 #define SETCOORD_NORMAL                 0x01   // N
 #define SETCOORD_AUTO                   0x02   // A
 #define SETCOORD_INHERIT                0x04   // H
 #define SETCOORD_PERCENT                0x08   // P
 #define SETCOORD_FACTOR                 0x10   // F
 #define SETCOORD_LENGTH                 0x20   // L
@@ -325,25 +325,27 @@ nsRuleNode::CalcLengthWithInitialFont(ns
 #define SETCOORD_LEH    (SETCOORD_LE | SETCOORD_INHERIT)
 #define SETCOORD_IA     (SETCOORD_INTEGER | SETCOORD_AUTO)
 #define SETCOORD_LAE    (SETCOORD_LENGTH | SETCOORD_AUTO | SETCOORD_ENUMERATED)
 
 // changes aCoord iff it returns PR_TRUE
 static PRBool SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord, 
                        const nsStyleCoord& aParentCoord,
                        PRInt32 aMask, nsStyleContext* aStyleContext,
-                       nsPresContext* aPresContext, PRBool& aInherited)
+                       nsPresContext* aPresContext,
+                       PRBool& aCanStoreInRuleTree)
 {
   PRBool  result = PR_TRUE;
   if (aValue.GetUnit() == eCSSUnit_Null) {
     result = PR_FALSE;
   }
   else if (((aMask & SETCOORD_LENGTH) != 0) && 
            aValue.IsLengthUnit()) {
-    aCoord.SetCoordValue(CalcLength(aValue, aStyleContext, aPresContext, aInherited));
+    aCoord.SetCoordValue(CalcLength(aValue, aStyleContext, aPresContext,
+                                    aCanStoreInRuleTree));
   }
   else if (((aMask & SETCOORD_PERCENT) != 0) && 
            (aValue.GetUnit() == eCSSUnit_Percent)) {
     aCoord.SetPercentValue(aValue.GetPercentValue());
   } 
   else if (((aMask & SETCOORD_INTEGER) != 0) && 
            (aValue.GetUnit() == eCSSUnit_Integer)) {
     aCoord.SetIntValue(aValue.GetIntValue(), eStyleUnit_Integer);
@@ -354,17 +356,17 @@ static PRBool SetCoord(const nsCSSValue&
   } 
   else if (((aMask & SETCOORD_AUTO) != 0) && 
            (aValue.GetUnit() == eCSSUnit_Auto)) {
     aCoord.SetAutoValue();
   } 
   else if (((aMask & SETCOORD_INHERIT) != 0) && 
            (aValue.GetUnit() == eCSSUnit_Inherit)) {
     aCoord = aParentCoord;  // just inherit value from parent
-    aInherited = PR_TRUE;
+    aCanStoreInRuleTree = PR_FALSE;
   }
   else if (((aMask & SETCOORD_NORMAL) != 0) && 
            (aValue.GetUnit() == eCSSUnit_Normal)) {
     aCoord.SetNormalValue();
   }
   else if (((aMask & SETCOORD_NONE) != 0) && 
            (aValue.GetUnit() == eCSSUnit_None)) {
     aCoord.SetNoneValue();
@@ -420,17 +422,17 @@ static float GetFloatFromBoxPosition(PRI
     // fall through
   case NS_STYLE_BG_POSITION_CENTER:
     return 0.5f;
   }
 }
 
 static PRBool SetColor(const nsCSSValue& aValue, const nscolor aParentColor, 
                        nsPresContext* aPresContext, nsStyleContext *aContext,
-                       nscolor& aResult, PRBool& aInherited)
+                       nscolor& aResult, PRBool& aCanStoreInRuleTree)
 {
   PRBool  result = PR_FALSE;
   nsCSSUnit unit = aValue.GetUnit();
 
   if (eCSSUnit_Color == unit) {
     aResult = aValue.GetColorValue();
     result = PR_TRUE;
   }
@@ -461,30 +463,30 @@ static PRBool SetColor(const nsCSSValue&
           aResult = aPresContext->DefaultVisitedLinkColor();
           break;
         case NS_COLOR_MOZ_ACTIVEHYPERLINKTEXT:
           aResult = aPresContext->DefaultActiveLinkColor();
           break;
         case NS_COLOR_CURRENTCOLOR:
           // The data computed from this can't be shared in the rule tree 
           // because they could be used on a node with a different color
-          aInherited = PR_TRUE;
+          aCanStoreInRuleTree = PR_FALSE;
           aResult = aContext->GetStyleColor()->mColor;
           break;
         default:
           NS_NOTREACHED("Should never have an unknown negative colorID.");
           break;
       }
       result = PR_TRUE;
     }
   }
   else if (eCSSUnit_Inherit == unit) {
     aResult = aParentColor;
     result = PR_TRUE;
-    aInherited = PR_TRUE;
+    aCanStoreInRuleTree = PR_FALSE;
   }
   return result;
 }
 
 // flags for SetDiscrete - align values with SETCOORD_* constants
 // where possible
 
 #define SETDSC_NORMAL                 0x01   // N
@@ -494,32 +496,32 @@ static PRBool SetColor(const nsCSSValue&
 #define SETDSC_NONE                   0x100  // O
 #define SETDSC_SYSTEM_FONT            0x2000
 
 // no caller cares whether aField was changed or not
 template <typename FieldT,
           typename T1, typename T2, typename T3, typename T4, typename T5>
 static void
 SetDiscrete(const nsCSSValue& aValue, FieldT & aField,
-            PRBool& aInherited, PRUint32 aMask,
+            PRBool& aCanStoreInRuleTree, PRUint32 aMask,
             FieldT aParentValue,
             T1 aInitialValue,
             T2 aAutoValue,
             T3 aNoneValue,
             T4 aNormalValue,
             T5 aSystemFontValue)
 {
   switch (aValue.GetUnit()) {
   case eCSSUnit_Null:
     return;
 
     // every caller of SetDiscrete provides inherit and initial
     // alternatives, so we don't require them to say so in the mask
   case eCSSUnit_Inherit:
-    aInherited = PR_TRUE;
+    aCanStoreInRuleTree = PR_FALSE;
     aField = aParentValue;
     return;
 
   case eCSSUnit_Initial:
     aField = aInitialValue;
     return;
 
     // every caller provides one or other of these alternatives,
@@ -575,17 +577,17 @@ SetDiscrete(const nsCSSValue& aValue, Fi
 }
 
 // flags for SetFactor
 #define SETFCT_POSITIVE 0x01        // assert value is >= 0.0f
 #define SETFCT_OPACITY  0x02        // clamp value to [0.0f .. 1.0f]
 #define SETFCT_NONE     0x04        // allow _None (uses aInitialValue).
 
 static void
-SetFactor(const nsCSSValue& aValue, float& aField, PRBool& aInherited,
+SetFactor(const nsCSSValue& aValue, float& aField, PRBool& aCanStoreInRuleTree,
           float aParentValue, float aInitialValue, PRUint32 aFlags = 0)
 {
   switch (aValue.GetUnit()) {
   case eCSSUnit_Null:
     return;
 
   case eCSSUnit_Number:
     aField = aValue.GetFloatValue();
@@ -598,17 +600,17 @@ SetFactor(const nsCSSValue& aValue, floa
       if (aField < 0.0f)
         aField = 0.0f;
       if (aField > 1.0f)
         aField = 1.0f;
     }
     return;
 
   case eCSSUnit_Inherit:
-    aInherited = PR_TRUE;
+    aCanStoreInRuleTree = PR_FALSE;
     aField = aParentValue;
     return;
 
   case eCSSUnit_Initial:
     aField = aInitialValue;
     return;
 
   case eCSSUnit_None:
@@ -1808,17 +1810,17 @@ nsRuleNode::WalkRuleTree(const nsStyleSt
       return SetDefaultOnRoot(aSID, aContext);
   }
 
   // We need to compute the data from the information that the rules specified.
   const void* res;
 #define STYLE_STRUCT_TEST aSID
 #define STYLE_STRUCT(name, checkdata_cb, ctor_args)                           \
   res = Compute##name##Data(startStruct, *aSpecificData, aContext,            \
-                      highestNode, detail, !aRuleData->mCanStoreInRuleTree);
+                      highestNode, detail, aRuleData->mCanStoreInRuleTree);
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 #undef STYLE_STRUCT_TEST
 
   // If we have a post-resolve callback, handle that now.
   if (aRuleData->mPostResolveCallback && (NS_LIKELY(res != nsnull)))
     (*aRuleData->mPostResolveCallback)(const_cast<void*>(res), aRuleData);
 
@@ -2064,27 +2066,27 @@ nsRuleNode::SetDefaultOnRoot(const nsSty
 void
 nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
                                  const nsCSSValue& aLTRSource,
                                  const nsCSSValue& aRTLSource,
                                  const nsCSSValue& aLTRLogicalValue,
                                  const nsCSSValue& aRTLLogicalValue,
                                  PRUint8 aSide,
                                  nsCSSRect& aValueRect,
-                                 PRBool& aInherited)
+                                 PRBool& aCanStoreInRuleTree)
 {
   PRBool LTRlogical = aLTRSource.GetUnit() == eCSSUnit_Enumerated &&
                       aLTRSource.GetIntValue() == NS_BOXPROP_SOURCE_LOGICAL;
   PRBool RTLlogical = aRTLSource.GetUnit() == eCSSUnit_Enumerated &&
                       aRTLSource.GetIntValue() == NS_BOXPROP_SOURCE_LOGICAL;
   if (LTRlogical || RTLlogical) {
     // We can't cache anything on the rule tree if we use any data from
     // the style context, since data cached in the rule tree could be
     // used with a style context with a different value.
-    aInherited = PR_TRUE;
+    aCanStoreInRuleTree = PR_FALSE;
     PRUint8 dir = aContext->GetStyleVisibility()->mDirection;
 
     if (dir == NS_STYLE_DIRECTION_LTR) {
       if (LTRlogical)
         aValueRect.*(nsCSSRect::sides[aSide]) = aLTRLogicalValue;
     } else {
       if (RTLlogical)
         aValueRect.*(nsCSSRect::sides[aSide]) = aRTLLogicalValue;
@@ -2109,35 +2111,35 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyle
                "should not have bothered calling Compute*Data");              \
                                                                               \
   nsStyleContext* parentContext = aContext->GetParent();                      \
                                                                               \
   const nsRuleData##rdtype_& rdata_ =                                         \
     static_cast<const nsRuleData##rdtype_&>(aData);                           \
   nsStyle##type_* data_ = nsnull;                                             \
   const nsStyle##type_* parentdata_ = nsnull;                                 \
-  PRBool inherited = aInherited;                                              \
+  PRBool canStoreInRuleTree = aCanStoreInRuleTree;                            \
                                                                               \
-  /* If |inherited| might be false by the time we're done, we can't call */   \
-  /* parentContext->GetStyle##type_() since it could recur into setting */    \
-  /* the same struct on the same rule node, causing a leak. */                \
+  /* If |canStoreInRuleTree| might be false by the time we're done, we */     \
+  /* can't call parentContext->GetStyle##type_() since it could recur into */ \
+  /* setting the same struct on the same rule node, causing a leak. */        \
   if (parentContext && aRuleDetail != eRuleFullReset &&                       \
       (!aStartStruct || (aRuleDetail != eRulePartialReset &&                  \
                          aRuleDetail != eRuleNone)))                          \
     parentdata_ = parentContext->GetStyle##type_();                           \
   if (aStartStruct)                                                           \
     /* We only need to compute the delta between this computed data and */    \
     /* our computed data. */                                                  \
     data_ = new (mPresContext)                                                \
             nsStyle##type_(*static_cast<nsStyle##type_*>(aStartStruct));      \
   else {                                                                      \
     if (aRuleDetail != eRuleFullMixed && aRuleDetail != eRuleFullReset) {     \
       /* No question. We will have to inherit. Go ahead and init */           \
       /* with inherited vals from parent. */                                  \
-      inherited = PR_TRUE;                                                    \
+      canStoreInRuleTree = PR_FALSE;                                          \
       if (parentdata_)                                                        \
         data_ = new (mPresContext) nsStyle##type_(*parentdata_);              \
       else                                                                    \
         data_ = new (mPresContext) nsStyle##type_ ctorargs_;                  \
     }                                                                         \
     else                                                                      \
       data_ = new (mPresContext) nsStyle##type_ ctorargs_;                    \
   }                                                                           \
@@ -2180,37 +2182,37 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyle
     data_ = new (mPresContext)                                                \
             nsStyle##type_(*static_cast<nsStyle##type_*>(aStartStruct));      \
   else                                                                        \
     data_ = new (mPresContext) nsStyle##type_ ctorargs_;                      \
                                                                               \
   if (NS_UNLIKELY(!data_))                                                    \
     return nsnull;  /* Out Of Memory */                                       \
                                                                               \
-  /* If |inherited| might be false by the time we're done, we can't call */   \
-  /* parentContext->GetStyle##type_() since it could recur into setting */    \
-  /* the same struct on the same rule node, causing a leak. */                \
+  /* If |canStoreInRuleTree| might be false by the time we're done, we */     \
+  /* can't call parentContext->GetStyle##type_() since it could recur into */ \
+  /* setting the same struct on the same rule node, causing a leak. */        \
   const nsStyle##type_* parentdata_ = data_;                                  \
   if (parentContext &&                                                        \
       aRuleDetail != eRuleFullReset &&                                        \
       aRuleDetail != eRulePartialReset &&                                     \
       aRuleDetail != eRuleNone)                                               \
     parentdata_ = parentContext->GetStyle##type_();                           \
-  PRBool inherited = aInherited;
+  PRBool canStoreInRuleTree = aCanStoreInRuleTree;
 
 /**
  * Begin an nsRuleNode::Compute*Data function for an inherited struct.
  *
  * @param type_ The nsStyle* type this function computes.
  * @param data_ Variable holding the result of this function.
  */
 #define COMPUTE_END_INHERITED(type_, data_)                                   \
-  if (inherited)                                                              \
-    /* We inherited, and therefore can't be cached in the rule node.  We */   \
-    /* have to be put right on the style context. */                          \
+  if (!canStoreInRuleTree)                                                    \
+    /* We can't be cached in the rule node.  We have to be put right */       \
+    /* on the style context. */                                               \
     aContext->SetStyle(eStyleStruct_##type_, data_);                          \
   else {                                                                      \
     /* We were fully specified and can therefore be cached right on the */    \
     /* rule node. */                                                          \
     if (!aHighestNode->mStyleData.mInheritedData) {                           \
       aHighestNode->mStyleData.mInheritedData =                               \
         new (mPresContext) nsInheritedStyleData;                              \
       if (NS_UNLIKELY(!aHighestNode->mStyleData.mInheritedData)) {            \
@@ -2227,19 +2229,19 @@ nsRuleNode::AdjustLogicalBoxProp(nsStyle
 
 /**
  * Begin an nsRuleNode::Compute*Data function for a reset struct.
  *
  * @param type_ The nsStyle* type this function computes.
  * @param data_ Variable holding the result of this function.
  */
 #define COMPUTE_END_RESET(type_, data_)                                       \
-  if (inherited)                                                              \
-    /* We inherited, and therefore can't be cached in the rule node.  We */   \
-    /* have to be put right on the style context. */                          \
+  if (!canStoreInRuleTree)                                                    \
+    /* We can't be cached in the rule node.  We have to be put right */       \
+    /* on the style context. */                                               \
     aContext->SetStyle(eStyleStruct_##type_, data_);                          \
   else {                                                                      \
     /* We were fully specified and can therefore be cached right on the */    \
     /* rule node. */                                                          \
     if (!aHighestNode->mStyleData.mResetData) {                               \
       aHighestNode->mStyleData.mResetData =                                   \
         new (mPresContext) nsResetStyleData;                                  \
       if (NS_UNLIKELY(!aHighestNode->mStyleData.mResetData)) {                \
@@ -2321,17 +2323,17 @@ nsRuleNode::SetFontSize(nsPresContext* a
                         const nsStyleFont* aFont,
                         const nsStyleFont* aParentFont,
                         nscoord* aSize,
                         const nsFont& aSystemFont,
                         nscoord aParentSize,
                         nscoord aScriptLevelAdjustedParentSize,
                         PRBool aUsedStartStruct,
                         PRBool aAtRoot,
-                        PRBool& aInherited)
+                        PRBool& aCanStoreInRuleTree)
 {
   PRBool zoom = PR_FALSE;
   PRInt32 baseSize = (PRInt32) aPresContext->
     GetDefaultFont(aFont->mGenericID)->size;
   if (eCSSUnit_Enumerated == aFontData.mSize.GetUnit()) {
     PRInt32 value = aFontData.mSize.GetIntValue();
     PRInt32 scaler = aPresContext->FontScaler();
     float scaleFactor = nsStyleUtil::GetScalingFactor(scaler);
@@ -2344,17 +2346,17 @@ nsRuleNode::SetFontSize(nsPresContext* a
     }
     else if (NS_STYLE_FONT_SIZE_XXXLARGE == value) {
       // <font size="7"> is not specified in CSS, so we don't use eFontSize_CSS.
       *aSize = nsStyleUtil::CalcFontPointSize(value, baseSize,
                        scaleFactor, aPresContext);
     }
     else if (NS_STYLE_FONT_SIZE_LARGER  == value ||
              NS_STYLE_FONT_SIZE_SMALLER == value) {
-      aInherited = PR_TRUE;
+      aCanStoreInRuleTree = PR_FALSE;
 
       // Un-zoom so we use the tables correctly.  We'll then rezoom due
       // to the |zoom = PR_TRUE| above.
       // Note that relative units here use the parent's size unadjusted
       // for scriptlevel changes. A scriptlevel change between us and the parent
       // is simply ignored.
       nscoord parentSize =
         nsStyleFont::UnZoomText(aPresContext, aParentSize);
@@ -2376,36 +2378,37 @@ nsRuleNode::SetFontSize(nsPresContext* a
       NS_NOTREACHED("unexpected value");
     }
   }
   else if (aFontData.mSize.IsLengthUnit()) {
     // Note that font-based length units use the parent's size unadjusted
     // for scriptlevel changes. A scriptlevel change between us and the parent
     // is simply ignored.
     *aSize = CalcLengthWith(aFontData.mSize, aParentSize, aParentFont, nsnull,
-                            aPresContext, aAtRoot, PR_TRUE, aInherited);
+                            aPresContext, aAtRoot, PR_TRUE,
+                            aCanStoreInRuleTree);
     zoom = aFontData.mSize.IsFixedLengthUnit() ||
            aFontData.mSize.GetUnit() == eCSSUnit_Pixel;
   }
   else if (eCSSUnit_Percent == aFontData.mSize.GetUnit()) {
-    aInherited = PR_TRUE;
+    aCanStoreInRuleTree = PR_FALSE;
     // Note that % units use the parent's size unadjusted for scriptlevel
     // changes. A scriptlevel change between us and the parent is simply
     // ignored.
     *aSize = NSToCoordRound(aParentSize *
                             aFontData.mSize.GetPercentValue());
     zoom = PR_FALSE;
   }
   else if (eCSSUnit_System_Font == aFontData.mSize.GetUnit()) {
     // this becomes our cascading size
     *aSize = aSystemFont.size;
     zoom = PR_TRUE;
   }
   else if (eCSSUnit_Inherit == aFontData.mSize.GetUnit()) {
-    aInherited = PR_TRUE;
+    aCanStoreInRuleTree = PR_FALSE;
     // We apply scriptlevel change for this case, because the default is
     // to inherit and we don't want explicit "inherit" to differ from the
     // default.
     *aSize = aScriptLevelAdjustedParentSize;
     zoom = PR_FALSE;
   }
   else if (eCSSUnit_Initial == aFontData.mSize.GetUnit()) {
     // The initial value is 'medium', which has magical sizing based on
@@ -2417,19 +2420,19 @@ nsRuleNode::SetFontSize(nsPresContext* a
                  "What kind of font-size value is this?");
 #ifdef MOZ_MATHML
     // if aUsedStartStruct is true, then every single property in the
     // font struct is being set all at once. This means scriptlevel is not
     // going to have any influence on the font size; there is no need to
     // do anything here.
     if (!aUsedStartStruct && aParentSize != aScriptLevelAdjustedParentSize) {
       // There was no rule affecting the size but the size has been
-      // affected by the parent's size via scriptlevel change. So treat
-      // this as inherited.
-      aInherited = PR_TRUE;
+      // affected by the parent's size via scriptlevel change. So we cannot
+      // store the data in the rule tree.
+      aCanStoreInRuleTree = PR_FALSE;
       *aSize = aScriptLevelAdjustedParentSize;
     }
 #endif
   }
 
   // We want to zoom the cascaded size so that em-based measurements,
   // line-heights, etc., work.
   if (zoom) {
@@ -2446,17 +2449,17 @@ static PRInt8 ClampTo8Bit(PRInt32 aValue
 }
 
 /* static */ void
 nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
                     nscoord aMinFontSize,
                     PRUint8 aGenericFontID, const nsRuleDataFont& aFontData,
                     const nsStyleFont* aParentFont,
                     nsStyleFont* aFont, PRBool aUsedStartStruct,
-                    PRBool& aInherited)
+                    PRBool& aCanStoreInRuleTree)
 {
   const nsFont* defaultVariableFont =
     aPresContext->GetDefaultFont(kPresContext_DefaultVariableFont_ID);
   PRBool atRoot = !aContext->GetParent();
 
   // -moz-system-font: enum (never inherit!)
   nsFont systemFont;
   if (eCSSUnit_Enumerated == aFontData.mSystemFont.GetUnit()) {
@@ -2546,17 +2549,17 @@ nsRuleNode::SetFont(nsPresContext* aPres
   }
   else if (eCSSUnit_System_Font == aFontData.mFamily.GetUnit()) {
     aFont->mFont.name = systemFont.name;
     aFont->mFont.familyNameQuirks = PR_FALSE;
     aFont->mFont.systemFont = PR_TRUE;
     aFont->mGenericID = kGenericFont_NONE;
   }
   else if (eCSSUnit_Inherit == aFontData.mFamily.GetUnit()) {
-    aInherited = PR_TRUE;
+    aCanStoreInRuleTree = PR_FALSE;
     aFont->mFont.name = aParentFont->mFont.name;
     aFont->mFont.familyNameQuirks = aParentFont->mFont.familyNameQuirks;
     aFont->mFont.systemFont = aParentFont->mFont.systemFont;
     aFont->mGenericID = aParentFont->mGenericID;
   }
   else if (eCSSUnit_Initial == aFontData.mFamily.GetUnit()) {
     aFont->mFont.name = defaultVariableFont->name;
     aFont->mFont.familyNameQuirks = PR_FALSE;
@@ -2568,26 +2571,26 @@ nsRuleNode::SetFont(nsPresContext* aPres
   // always keep aFont->mFlags set to the correct generic.  But we have
   // to be careful not to touch it when we're called directly from
   // ComputeFontData, because we could have a start struct.
   if (aGenericFontID != kGenericFont_NONE) {
     aFont->mGenericID = aGenericFontID;
   }
 
   // font-style: enum, normal, inherit, initial, -moz-system-font
-  SetDiscrete(aFontData.mStyle, aFont->mFont.style, aInherited,
+  SetDiscrete(aFontData.mStyle, aFont->mFont.style, aCanStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NORMAL | SETDSC_SYSTEM_FONT,
               aParentFont->mFont.style,
               defaultVariableFont->style,
               0, 0,
               NS_STYLE_FONT_STYLE_NORMAL,
               systemFont.style);
 
   // font-variant: enum, normal, inherit, initial, -moz-system-font
-  SetDiscrete(aFontData.mVariant, aFont->mFont.variant, aInherited,
+  SetDiscrete(aFontData.mVariant, aFont->mFont.variant, aCanStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NORMAL | SETDSC_SYSTEM_FONT,
               aParentFont->mFont.variant,
               defaultVariableFont->variant,
               0, 0,
               NS_STYLE_FONT_VARIANT_NORMAL,
               systemFont.variant);
 
   // font-weight: int, enum, normal, inherit, initial, -moz-system-font
@@ -2596,80 +2599,81 @@ nsRuleNode::SetFont(nsPresContext* aPres
     PRInt32 value = aFontData.mWeight.GetIntValue();
     switch (value) {
       case NS_STYLE_FONT_WEIGHT_NORMAL:
       case NS_STYLE_FONT_WEIGHT_BOLD:
         aFont->mFont.weight = value;
         break;
       case NS_STYLE_FONT_WEIGHT_BOLDER:
       case NS_STYLE_FONT_WEIGHT_LIGHTER:
-        aInherited = PR_TRUE;
+        aCanStoreInRuleTree = PR_FALSE;
         aFont->mFont.weight = nsStyleUtil::ConstrainFontWeight(aParentFont->mFont.weight + value);
         break;
     }
   } else 
-    SetDiscrete(aFontData.mWeight, aFont->mFont.weight, aInherited,
+    SetDiscrete(aFontData.mWeight, aFont->mFont.weight, aCanStoreInRuleTree,
                 SETDSC_INTEGER | SETDSC_NORMAL | SETDSC_SYSTEM_FONT,
                 aParentFont->mFont.weight,
                 defaultVariableFont->weight,
                 0, 0,
                 NS_STYLE_FONT_WEIGHT_NORMAL,
                 systemFont.weight);
 
   // font-stretch: enum, normal, inherit
   if (eCSSUnit_Enumerated == aFontData.mStretch.GetUnit()) {
     PRInt32 value = aFontData.mStretch.GetIntValue();
     switch (value) {
       case NS_FONT_STRETCH_WIDER:
       case NS_FONT_STRETCH_NARROWER:
-        aInherited = PR_TRUE;
+        aCanStoreInRuleTree = PR_FALSE;
         aFont->mFont.stretch = aParentFont->mFont.stretch + value;
         break;
       default:
         aFont->mFont.stretch = value;
         break;
     }
   } else
-    SetDiscrete(aFontData.mStretch, aFont->mFont.stretch, aInherited,
+    SetDiscrete(aFontData.mStretch, aFont->mFont.stretch, aCanStoreInRuleTree,
                 SETDSC_NORMAL | SETDSC_SYSTEM_FONT,
                 aParentFont->mFont.stretch,
                 defaultVariableFont->stretch,
                 0, 0, NS_FONT_STRETCH_NORMAL, systemFont.stretch);
 
 #ifdef MOZ_MATHML
   // Compute scriptlevel, scriptminsize and scriptsizemultiplier now so
   // they're available for font-size computation.
 
   // -moz-script-min-size: length
   if (aFontData.mScriptMinSize.IsLengthUnit()) {
     // scriptminsize in font units (em, ex) has to be interpreted relative
     // to the parent font, or the size definitions are circular and we
     // 
     aFont->mScriptMinSize =
       CalcLengthWith(aFontData.mScriptMinSize, aParentFont->mSize, aParentFont,
-                     nsnull, aPresContext, atRoot, PR_TRUE, aInherited);
+                     nsnull, aPresContext, atRoot, PR_TRUE,
+                     aCanStoreInRuleTree);
   }
 
   // -moz-script-size-multiplier: factor, inherit, initial
   SetFactor(aFontData.mScriptSizeMultiplier, aFont->mScriptSizeMultiplier,
-            aInherited, aParentFont->mScriptSizeMultiplier,
+            aCanStoreInRuleTree, aParentFont->mScriptSizeMultiplier,
             NS_MATHML_DEFAULT_SCRIPT_SIZE_MULTIPLIER,
             SETFCT_POSITIVE);
   
   // -moz-script-level: integer, number, inherit
   if (eCSSUnit_Integer == aFontData.mScriptLevel.GetUnit()) {
     // "relative"
     aFont->mScriptLevel = ClampTo8Bit(aParentFont->mScriptLevel + aFontData.mScriptLevel.GetIntValue());
   }
   else if (eCSSUnit_Number == aFontData.mScriptLevel.GetUnit()) {
     // "absolute"
     aFont->mScriptLevel = ClampTo8Bit(PRInt32(aFontData.mScriptLevel.GetFloatValue()));
   }
   else if (eCSSUnit_Inherit == aFontData.mScriptSizeMultiplier.GetUnit()) {
-    aInherited = PR_TRUE;
+    aCanStoreInRuleTree = PR_FALSE;
     aFont->mScriptLevel = aParentFont->mScriptLevel;
   }
   else if (eCSSUnit_Initial == aFontData.mScriptSizeMultiplier.GetUnit()) {
     aFont->mScriptLevel = 0;
   }
 #endif
 
   // font-size: enum, length, percent, inherit
@@ -2679,50 +2683,51 @@ nsRuleNode::SetFont(nsPresContext* aPres
   scriptLevelAdjustedParentSize =
     ComputeScriptLevelSize(aFont, aParentFont, aPresContext,
                            &scriptLevelAdjustedUnconstrainedParentSize);
   NS_ASSERTION(!aUsedStartStruct || aFont->mScriptUnconstrainedSize == aFont->mSize,
                "If we have a start struct, we should have reset everything coming in here");
 #endif
   SetFontSize(aPresContext, aFontData, aFont, aParentFont, &aFont->mSize,
               systemFont, aParentFont->mSize, scriptLevelAdjustedParentSize,
-              aUsedStartStruct, atRoot, aInherited);
+              aUsedStartStruct, atRoot, aCanStoreInRuleTree);
 #ifdef MOZ_MATHML
   if (aParentFont->mSize == aParentFont->mScriptUnconstrainedSize &&
       scriptLevelAdjustedParentSize == scriptLevelAdjustedUnconstrainedParentSize) {
     // Fast path: we have not been affected by scriptminsize so we don't
     // need to call SetFontSize again to compute the
     // scriptminsize-unconstrained size. This is OK even if we have a
     // start struct, because if we have a start struct then 'font-size'
     // was specified and so scriptminsize has no effect.
     aFont->mScriptUnconstrainedSize = aFont->mSize;
   } else {
     SetFontSize(aPresContext, aFontData, aFont, aParentFont,
                 &aFont->mScriptUnconstrainedSize, systemFont,
                 aParentFont->mScriptUnconstrainedSize,
                 scriptLevelAdjustedUnconstrainedParentSize,
-                aUsedStartStruct, atRoot, aInherited);
+                aUsedStartStruct, atRoot, aCanStoreInRuleTree);
   }
   NS_ASSERTION(aFont->mScriptUnconstrainedSize <= aFont->mSize,
                "scriptminsize should never be making things bigger");
 #endif
 
   // enforce the user' specified minimum font-size on the value that we expose
   // (but don't change font-size:0)
   if (0 < aFont->mSize && aFont->mSize < aMinFontSize)
     aFont->mFont.size = aMinFontSize;
   else
     aFont->mFont.size = aFont->mSize;
 
   // font-size-adjust: number, none, inherit, initial, -moz-system-font
   if (eCSSUnit_System_Font == aFontData.mSizeAdjust.GetUnit()) {
     aFont->mFont.sizeAdjust = systemFont.sizeAdjust;
   } else
-    SetFactor(aFontData.mSizeAdjust, aFont->mFont.sizeAdjust, aInherited,
-              aParentFont->mFont.sizeAdjust, 0.0f, SETFCT_NONE);
+    SetFactor(aFontData.mSizeAdjust, aFont->mFont.sizeAdjust,
+              aCanStoreInRuleTree, aParentFont->mFont.sizeAdjust, 0.0f,
+              SETFCT_NONE);
 }
 
 // SetGenericFont:
 //  - backtrack to an ancestor with the same generic font name (possibly
 //    up to the root where default values come from the presentation context)
 //  - re-apply cascading rules from there without caching intermediate values
 /* static */ void
 nsRuleNode::SetGenericFont(nsPresContext* aPresContext,
@@ -2815,17 +2820,18 @@ static PRBool ExtractGeneric(const nsStr
   return PR_TRUE;
 }
 
 const void* 
 nsRuleNode::ComputeFontData(void* aStartStruct,
                             const nsRuleDataStruct& aData, 
                             nsStyleContext* aContext, 
                             nsRuleNode* aHighestNode,
-                            const RuleDetail aRuleDetail, PRBool aInherited)
+                            const RuleDetail aRuleDetail,
+                            const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_INHERITED(Font, (mPresContext), font, parentFont,
                           Font, fontData)
 
   // NOTE:  The |aRuleDetail| passed in is a little bit conservative due
   // to the -moz-system-font property.  We really don't need to consider
   // it here in determining whether to cache in the rule tree.  However,
   // we do need to consider it in WalkRuleTree when deciding whether to
@@ -2891,33 +2897,33 @@ nsRuleNode::ComputeFontData(void* aStart
     }
   }
 
   // Now compute our font struct
   if (generic == kGenericFont_NONE) {
     // continue the normal processing
     nsRuleNode::SetFont(mPresContext, aContext, minimumFontSize, generic,
                         fontData, parentFont, font,
-                        aStartStruct != nsnull, inherited);
+                        aStartStruct != nsnull, canStoreInRuleTree);
   }
   else {
     // re-calculate the font as a generic font
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     nsRuleNode::SetGenericFont(mPresContext, aContext, generic,
                                minimumFontSize, font);
   }
 
   COMPUTE_END_INHERITED(Font, font)
 }
 
 already_AddRefed<nsCSSShadowArray>
 nsRuleNode::GetShadowData(nsCSSValueList* aList,
                           nsStyleContext* aContext,
                           PRBool aUsesSpread,
-                          PRBool& inherited)
+                          PRBool& canStoreInRuleTree)
 {
   PRUint32 arrayLength = 0;
   for (nsCSSValueList *list2 = aList; list2; list2 = list2->mNext)
     ++arrayLength;
 
   NS_ASSERTION(arrayLength > 0, "Non-null text-shadow list, yet we counted 0 items.");
   nsCSSShadowArray* shadowList = new(arrayLength) nsCSSShadowArray(arrayLength);
 
@@ -2927,194 +2933,201 @@ nsRuleNode::GetShadowData(nsCSSValueList
   nsStyleCoord tempCoord;
   PRBool unitOK;
   for (nsCSSShadowItem* item = shadowList->ShadowAt(0);
        aList;
        aList = aList->mNext, ++item) {
     nsCSSValue::Array *arr = aList->mValue.GetArrayValue();
     // OK to pass bad aParentCoord since we're not passing SETCOORD_INHERIT
     unitOK = SetCoord(arr->Item(0), tempCoord, nsStyleCoord(),
-                      SETCOORD_LENGTH, aContext, mPresContext, inherited);
+                      SETCOORD_LENGTH, aContext, mPresContext,
+                      canStoreInRuleTree);
     NS_ASSERTION(unitOK, "unexpected unit");
     item->mXOffset = tempCoord.GetCoordValue();
 
     unitOK = SetCoord(arr->Item(1), tempCoord, nsStyleCoord(),
-                      SETCOORD_LENGTH, aContext, mPresContext, inherited);
+                      SETCOORD_LENGTH, aContext, mPresContext,
+                      canStoreInRuleTree);
     NS_ASSERTION(unitOK, "unexpected unit");
     item->mYOffset = tempCoord.GetCoordValue();
 
     // Blur radius is optional in the current box-shadow spec
     if (arr->Item(2).GetUnit() != eCSSUnit_Null) {
       unitOK = SetCoord(arr->Item(2), tempCoord, nsStyleCoord(),
-                        SETCOORD_LENGTH, aContext, mPresContext, inherited);
+                        SETCOORD_LENGTH, aContext, mPresContext,
+                        canStoreInRuleTree);
       NS_ASSERTION(unitOK, "unexpected unit");
       item->mRadius = tempCoord.GetCoordValue();
     } else {
       item->mRadius = 0;
     }
 
     // Find the spread radius
     if (aUsesSpread && arr->Item(3).GetUnit() != eCSSUnit_Null) {
       unitOK = SetCoord(arr->Item(3), tempCoord, nsStyleCoord(),
-                        SETCOORD_LENGTH, aContext, mPresContext, inherited);
+                        SETCOORD_LENGTH, aContext, mPresContext,
+                        canStoreInRuleTree);
       NS_ASSERTION(unitOK, "unexpected unit");
       item->mSpread = tempCoord.GetCoordValue();
     } else {
       item->mSpread = 0;
     }
 
     if (arr->Item(4).GetUnit() != eCSSUnit_Null) {
       item->mHasColor = PR_TRUE;
       // 2nd argument can be bogus since inherit is not a valid color
       unitOK = SetColor(arr->Item(4), 0, mPresContext, aContext, item->mColor,
-                        inherited);
+                        canStoreInRuleTree);
       NS_ASSERTION(unitOK, "unexpected unit");
     }
   }
 
   NS_ADDREF(shadowList);
   return shadowList;
 }
 
 const void*
 nsRuleNode::ComputeTextData(void* aStartStruct,
                             const nsRuleDataStruct& aData, 
                             nsStyleContext* aContext, 
                             nsRuleNode* aHighestNode,
-                            const RuleDetail aRuleDetail, PRBool aInherited)
+                            const RuleDetail aRuleDetail,
+                            const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_INHERITED(Text, (), text, parentText, Text, textData)
 
     // letter-spacing: normal, length, inherit
   SetCoord(textData.mLetterSpacing, text->mLetterSpacing, parentText->mLetterSpacing,
            SETCOORD_LH | SETCOORD_NORMAL | SETCOORD_INITIAL_NORMAL,
-           aContext, mPresContext, inherited);
+           aContext, mPresContext, canStoreInRuleTree);
 
   // text-shadow: none, list, inherit, initial
   nsCSSValueList* list = textData.mTextShadow;
   if (list) {
     text->mTextShadow = nsnull;
 
     // Don't need to handle none/initial explicitly: The above assignment
     // takes care of that
     if (eCSSUnit_Inherit == list->mValue.GetUnit()) {
-      inherited = PR_TRUE;
+      canStoreInRuleTree = PR_FALSE;
       text->mTextShadow = parentText->mTextShadow;
     } else if (eCSSUnit_Array == list->mValue.GetUnit()) {
       // List of arrays
-      text->mTextShadow = GetShadowData(list, aContext, PR_FALSE, inherited);
+      text->mTextShadow = GetShadowData(list, aContext, PR_FALSE,
+                                        canStoreInRuleTree);
     }
   }
 
   // line-height: normal, number, length, percent, inherit
   if (eCSSUnit_Percent == textData.mLineHeight.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     // Use |mFont.size| to pick up minimum font size.
     text->mLineHeight.SetCoordValue(
         nscoord(float(aContext->GetStyleFont()->mFont.size) *
                 textData.mLineHeight.GetPercentValue()));
   }
   else if (eCSSUnit_Initial == textData.mLineHeight.GetUnit() ||
            eCSSUnit_System_Font == textData.mLineHeight.GetUnit()) {
     text->mLineHeight.SetNormalValue();
   }
   else {
     SetCoord(textData.mLineHeight, text->mLineHeight, parentText->mLineHeight,
              SETCOORD_LH | SETCOORD_FACTOR | SETCOORD_NORMAL,
-             aContext, mPresContext, inherited);
+             aContext, mPresContext, canStoreInRuleTree);
     if (textData.mLineHeight.IsFixedLengthUnit() ||
         textData.mLineHeight.GetUnit() == eCSSUnit_Pixel) {
       nscoord lh = nsStyleFont::ZoomText(mPresContext,
                                          text->mLineHeight.GetCoordValue());
       nscoord minimumFontSize =
         mPresContext->GetCachedIntPref(kPresContext_MinimumFontSize);
 
       if (minimumFontSize > 0 && !mPresContext->IsChrome()) {
         // If we applied a minimum font size, scale the line height by
         // the same ratio.  (If we *might* have applied a minimum font
         // size, we can't cache in the rule tree.)
-        inherited = PR_TRUE;
+        canStoreInRuleTree = PR_FALSE;
         const nsStyleFont *font = aContext->GetStyleFont();
         if (font->mSize != 0) {
           lh = nscoord(float(lh) * float(font->mFont.size) / float(font->mSize));
         } else {
           lh = minimumFontSize;
         }
       }
       text->mLineHeight.SetCoordValue(lh);
     }
   }
 
 
   // text-align: enum, string, inherit, initial
   if (eCSSUnit_String == textData.mTextAlign.GetUnit()) {
     NS_NOTYETIMPLEMENTED("align string");
   } else
-    SetDiscrete(textData.mTextAlign, text->mTextAlign, inherited,
+    SetDiscrete(textData.mTextAlign, text->mTextAlign, canStoreInRuleTree,
                 SETDSC_ENUMERATED, parentText->mTextAlign,
                 NS_STYLE_TEXT_ALIGN_DEFAULT,
                 0, 0, 0, 0);
 
   // text-indent: length, percent, inherit, initial
   SetCoord(textData.mTextIndent, text->mTextIndent, parentText->mTextIndent,
            SETCOORD_LPH | SETCOORD_INITIAL_ZERO, aContext,
-           mPresContext, inherited);
+           mPresContext, canStoreInRuleTree);
 
   // text-transform: enum, none, inherit, initial
-  SetDiscrete(textData.mTextTransform, text->mTextTransform, inherited,
+  SetDiscrete(textData.mTextTransform, text->mTextTransform, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NONE, parentText->mTextTransform,
               NS_STYLE_TEXT_TRANSFORM_NONE, 0,
               NS_STYLE_TEXT_TRANSFORM_NONE, 0, 0);
 
   // white-space: enum, normal, inherit, initial
-  SetDiscrete(textData.mWhiteSpace, text->mWhiteSpace, inherited,
+  SetDiscrete(textData.mWhiteSpace, text->mWhiteSpace, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NORMAL, parentText->mWhiteSpace,
               NS_STYLE_WHITESPACE_NORMAL, 0, 0,
               NS_STYLE_WHITESPACE_NORMAL, 0);
  
   // word-spacing: normal, length, inherit
   nsStyleCoord tempCoord;
   if (SetCoord(textData.mWordSpacing, tempCoord,
                nsStyleCoord(parentText->mWordSpacing),
                SETCOORD_LH | SETCOORD_NORMAL | SETCOORD_INITIAL_NORMAL,
-               aContext, mPresContext, inherited)) {
+               aContext, mPresContext, canStoreInRuleTree)) {
     if (tempCoord.GetUnit() == eStyleUnit_Coord) {
       text->mWordSpacing = tempCoord.GetCoordValue();
     } else if (tempCoord.GetUnit() == eStyleUnit_Normal) {
       text->mWordSpacing = 0;
     } else {
       NS_NOTREACHED("unexpected unit");
     }
   } else {
     NS_ASSERTION(textData.mWordSpacing.GetUnit() == eCSSUnit_Null,
                  "unexpected unit");
   }
 
   // word-wrap: enum, normal, inherit, initial
-  SetDiscrete(textData.mWordWrap, text->mWordWrap, inherited,
+  SetDiscrete(textData.mWordWrap, text->mWordWrap, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NORMAL, parentText->mWordWrap,
               NS_STYLE_WORDWRAP_NORMAL, 0, 0,
               NS_STYLE_WORDWRAP_NORMAL, 0);
 
   COMPUTE_END_INHERITED(Text, text)
 }
 
 const void*
 nsRuleNode::ComputeTextResetData(void* aStartStruct,
                                  const nsRuleDataStruct& aData, 
                                  nsStyleContext* aContext, 
                                  nsRuleNode* aHighestNode,
-                                 const RuleDetail aRuleDetail, PRBool aInherited)
+                                 const RuleDetail aRuleDetail,
+                                 const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_RESET(TextReset, (), text, parentText, Text, textData)
   
   // vertical-align: enum, length, percent, inherit
   if (!SetCoord(textData.mVerticalAlign, text->mVerticalAlign,
                 parentText->mVerticalAlign, SETCOORD_LPH | SETCOORD_ENUMERATED,
-                aContext, mPresContext, inherited)) {
+                aContext, mPresContext, canStoreInRuleTree)) {
     if (eCSSUnit_Initial == textData.mVerticalAlign.GetUnit()) {
       text->mVerticalAlign.SetIntValue(NS_STYLE_VERTICAL_ALIGN_BASELINE,
                                        eStyleUnit_Enumerated);
     }
   }
 
   // text-decoration: none, enum (bit field), inherit, initial
   if (eCSSUnit_Enumerated == textData.mDecoration.GetUnit()) {
@@ -3127,52 +3140,52 @@ nsRuleNode::ComputeTextResetData(void* a
         text->mTextDecoration |= NS_STYLE_TEXT_DECORATION_UNDERLINE;
       }
       else {
         text->mTextDecoration &= ~NS_STYLE_TEXT_DECORATION_UNDERLINE;
       }
     }
   }
   else
-    SetDiscrete(textData.mDecoration, text->mTextDecoration, inherited,
-                SETDSC_NONE,
+    SetDiscrete(textData.mDecoration, text->mTextDecoration,
+                canStoreInRuleTree, SETDSC_NONE,
                 parentText->mTextDecoration,
                 NS_STYLE_TEXT_DECORATION_NONE, 0,
                 NS_STYLE_TEXT_DECORATION_NONE, 0, 0);
 
   // unicode-bidi: enum, normal, inherit, initial
-  SetDiscrete(textData.mUnicodeBidi, text->mUnicodeBidi, inherited,
+  SetDiscrete(textData.mUnicodeBidi, text->mUnicodeBidi, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NORMAL,
               parentText->mUnicodeBidi,
               NS_STYLE_UNICODE_BIDI_NORMAL, 0, 0,
               NS_STYLE_UNICODE_BIDI_NORMAL, 0);
 
   COMPUTE_END_RESET(TextReset, text)
 }
 
 const void*
 nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
                                      const nsRuleDataStruct& aData, 
                                      nsStyleContext* aContext, 
                                      nsRuleNode* aHighestNode,
                                      const RuleDetail aRuleDetail,
-                                     PRBool aInherited)
+                                     const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_INHERITED(UserInterface, (), ui, parentUI,
                           UserInterface, uiData)
 
   // cursor: enum, auto, url, inherit
   nsCSSValueList*  list = uiData.mCursor;
   if (nsnull != list) {
     delete [] ui->mCursorArray;
     ui->mCursorArray = nsnull;
     ui->mCursorArrayLength = 0;
 
     if (eCSSUnit_Inherit == list->mValue.GetUnit()) {
-      inherited = PR_TRUE;
+      canStoreInRuleTree = PR_FALSE;
       ui->mCursor = parentUI->mCursor;
       ui->CopyCursorArrayFrom(*parentUI);
     }
     else if (eCSSUnit_Initial == list->mValue.GetUnit()) {
       ui->mCursor = NS_STYLE_CURSOR_AUTO;
     }
     else {
       // The parser will never create a list that is *all* URL values --
@@ -3216,142 +3229,144 @@ nsRuleNode::ComputeUserInterfaceData(voi
       }
       else if (eCSSUnit_Auto == list->mValue.GetUnit()) {
         ui->mCursor = NS_STYLE_CURSOR_AUTO;
       }
     }
   }
 
   // user-input: auto, none, enum, inherit, initial
-  SetDiscrete(uiData.mUserInput, ui->mUserInput, inherited,
+  SetDiscrete(uiData.mUserInput, ui->mUserInput, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NONE | SETDSC_AUTO,
               parentUI->mUserInput,
               NS_STYLE_USER_INPUT_AUTO,
               NS_STYLE_USER_INPUT_AUTO,
               NS_STYLE_USER_INPUT_NONE,
               0, 0);
 
   // user-modify: enum, inherit, initial
-  SetDiscrete(uiData.mUserModify, ui->mUserModify, inherited,
+  SetDiscrete(uiData.mUserModify, ui->mUserModify, canStoreInRuleTree,
               SETDSC_ENUMERATED,
               parentUI->mUserModify,
               NS_STYLE_USER_MODIFY_READ_ONLY, 
               0, 0, 0, 0);
 
   // user-focus: none, normal, enum, inherit, initial
-  SetDiscrete(uiData.mUserFocus, ui->mUserFocus, inherited,
+  SetDiscrete(uiData.mUserFocus, ui->mUserFocus, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NONE | SETDSC_NORMAL,
               parentUI->mUserFocus,
               NS_STYLE_USER_FOCUS_NONE,
               0,
               NS_STYLE_USER_FOCUS_NONE,
               NS_STYLE_USER_FOCUS_NORMAL,
               0);
 
   COMPUTE_END_INHERITED(UserInterface, ui)
 }
 
 const void*
 nsRuleNode::ComputeUIResetData(void* aStartStruct,
                                const nsRuleDataStruct& aData, 
                                nsStyleContext* aContext, 
                                nsRuleNode* aHighestNode,
-                               const RuleDetail aRuleDetail, PRBool aInherited)
+                               const RuleDetail aRuleDetail,
+                               const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_RESET(UIReset, (), ui, parentUI, UserInterface, uiData)
   
   // user-select: auto, none, enum, inherit, initial
-  SetDiscrete(uiData.mUserSelect, ui->mUserSelect, inherited,
+  SetDiscrete(uiData.mUserSelect, ui->mUserSelect, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NONE | SETDSC_AUTO,
               parentUI->mUserSelect,
               NS_STYLE_USER_SELECT_AUTO,
               NS_STYLE_USER_SELECT_AUTO,
               NS_STYLE_USER_SELECT_NONE,
               0, 0);
 
   // ime-mode: auto, normal, enum, inherit, initial
-  SetDiscrete(uiData.mIMEMode, ui->mIMEMode, inherited,
+  SetDiscrete(uiData.mIMEMode, ui->mIMEMode, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NORMAL | SETDSC_AUTO,
               parentUI->mIMEMode,
               NS_STYLE_IME_MODE_AUTO,
               NS_STYLE_IME_MODE_AUTO,
               0,
               NS_STYLE_IME_MODE_NORMAL,
               0);
 
   // force-broken-image-icons: integer, inherit, initial
   SetDiscrete(uiData.mForceBrokenImageIcon, ui->mForceBrokenImageIcon,
-              inherited,
+              canStoreInRuleTree,
               SETDSC_INTEGER,
               parentUI->mForceBrokenImageIcon,
               0, 0, 0, 0, 0);
 
   // -moz-window-shadow: enum, none, inherit, initial
-  SetDiscrete(uiData.mWindowShadow, ui->mWindowShadow, inherited,
+  SetDiscrete(uiData.mWindowShadow, ui->mWindowShadow, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NONE, parentUI->mWindowShadow,
               NS_STYLE_WINDOW_SHADOW_DEFAULT, 0,
               NS_STYLE_WINDOW_SHADOW_NONE, 0, 0);
 
   COMPUTE_END_RESET(UIReset, ui)
 }
 
 /* Given a -moz-transform token stream, accumulates them into an
  * nsStyleTransformMatrix
  *
  * @param aList The nsCSSValueList of arrays to read into transform functions.
  * @param aContext The style context to use for unit conversion.
  * @param aPresContext The presentation context to use for unit conversion
- * @param aInherited If the value is inherited, this is set to PR_TRUE.
+ * @param aCanStoreInRuleTree This is set to PR_FALSE if the value cannot be stored in the rule tree.
  * @return An nsStyleTransformMatrix corresponding to the net transform.
  */
 static nsStyleTransformMatrix ReadTransforms(const nsCSSValueList* aList,
                                              nsStyleContext* aContext,
                                              nsPresContext* aPresContext,
-                                             PRBool &aInherited)
+                                             PRBool &aCanStoreInRuleTree)
 {
   nsStyleTransformMatrix result;
 
   for (const nsCSSValueList* curr = aList; curr != nsnull; curr = curr->mNext) {
     const nsCSSValue &currElem = curr->mValue;
     NS_ASSERTION(currElem.GetUnit() == eCSSUnit_Function,
                  "Stream should consist solely of functions!");
     NS_ASSERTION(currElem.GetArrayValue()->Count() >= 1,
                  "Incoming function is too short!");
 
     /* Read in a single transform matrix, then accumulate it with the total. */
     nsStyleTransformMatrix currMatrix;
     currMatrix.SetToTransformFunction(currElem.GetArrayValue(), aContext,
-                                      aPresContext, aInherited);
+                                      aPresContext, aCanStoreInRuleTree);
     result *= currMatrix;
   }
   return result;
 }
 
 const void*
 nsRuleNode::ComputeDisplayData(void* aStartStruct,
                                const nsRuleDataStruct& aData, 
                                nsStyleContext* aContext, 
                                nsRuleNode* aHighestNode,
-                               const RuleDetail aRuleDetail, PRBool aInherited)
+                               const RuleDetail aRuleDetail,
+                               const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_RESET(Display, (), display, parentDisplay,
                       Display, displayData)
 
   // opacity: factor, inherit, initial
-  SetFactor(displayData.mOpacity, display->mOpacity, inherited,
+  SetFactor(displayData.mOpacity, display->mOpacity, canStoreInRuleTree,
             parentDisplay->mOpacity, 1.0f, SETFCT_OPACITY);
 
   // display: enum, none, inherit, initial
-  SetDiscrete(displayData.mDisplay, display->mDisplay, inherited,
+  SetDiscrete(displayData.mDisplay, display->mDisplay, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NONE, parentDisplay->mDisplay,
               NS_STYLE_DISPLAY_INLINE, 0,
               NS_STYLE_DISPLAY_NONE, 0, 0);
 
   // appearance: enum, none, inherit, initial
-  SetDiscrete(displayData.mAppearance, display->mAppearance, inherited,
+  SetDiscrete(displayData.mAppearance, display->mAppearance, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NONE, parentDisplay->mAppearance,
               NS_THEME_NONE, 0,
               NS_THEME_NONE, 0, 0);
 
   // binding: url, none, inherit
   if (eCSSUnit_URL == displayData.mBinding.GetUnit()) {
     nsCSSValue::URL* url = displayData.mBinding.GetURLStructValue();
     NS_ASSERTION(url, "What's going on here?");
@@ -3362,27 +3377,27 @@ nsRuleNode::ComputeDisplayData(void* aSt
       display->mBinding = nsnull;
     }
   }
   else if (eCSSUnit_None == displayData.mBinding.GetUnit() ||
            eCSSUnit_Initial == displayData.mBinding.GetUnit()) {
     display->mBinding = nsnull;
   }
   else if (eCSSUnit_Inherit == displayData.mBinding.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     display->mBinding = parentDisplay->mBinding;
   }
 
   // position: enum, inherit, initial
-  SetDiscrete(displayData.mPosition, display->mPosition, inherited,
+  SetDiscrete(displayData.mPosition, display->mPosition, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentDisplay->mPosition,
               NS_STYLE_POSITION_STATIC, 0, 0, 0, 0);
 
   // clear: enum, none, inherit, initial
-  SetDiscrete(displayData.mClear, display->mBreakType, inherited,
+  SetDiscrete(displayData.mClear, display->mBreakType, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NONE, parentDisplay->mBreakType,
               NS_STYLE_CLEAR_NONE, 0,
               NS_STYLE_CLEAR_NONE, 0, 0);
 
   // temp fix for bug 24000
   // Map 'auto' and 'avoid' to PR_FALSE, and 'always', 'left', and
   // 'right' to PR_TRUE.
   // "A conforming user agent may interpret the values 'left' and
@@ -3390,66 +3405,66 @@ nsRuleNode::ComputeDisplayData(void* aSt
   if (eCSSUnit_Enumerated == displayData.mBreakBefore.GetUnit()) {
     display->mBreakBefore = (NS_STYLE_PAGE_BREAK_AVOID != displayData.mBreakBefore.GetIntValue());
   }
   else if (eCSSUnit_Auto == displayData.mBreakBefore.GetUnit() ||
            eCSSUnit_Initial == displayData.mBreakBefore.GetUnit()) {
     display->mBreakBefore = PR_FALSE;
   }
   else if (eCSSUnit_Inherit == displayData.mBreakBefore.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     display->mBreakBefore = parentDisplay->mBreakBefore;
   }
 
   if (eCSSUnit_Enumerated == displayData.mBreakAfter.GetUnit()) {
     display->mBreakAfter = (NS_STYLE_PAGE_BREAK_AVOID != displayData.mBreakAfter.GetIntValue());
   }
   else if (eCSSUnit_Auto == displayData.mBreakAfter.GetUnit() ||
            eCSSUnit_Initial == displayData.mBreakAfter.GetUnit()) {
     display->mBreakAfter = PR_FALSE;
   }
   else if (eCSSUnit_Inherit == displayData.mBreakAfter.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     display->mBreakAfter = parentDisplay->mBreakAfter;
   }
   // end temp fix
 
   // float: enum, none, inherit, initial
-  SetDiscrete(displayData.mFloat, display->mFloats, inherited,
+  SetDiscrete(displayData.mFloat, display->mFloats, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NONE, parentDisplay->mFloats,
               NS_STYLE_FLOAT_NONE, 0,
               NS_STYLE_FLOAT_NONE, 0, 0);
 
   // overflow-x: enum, auto, inherit, initial
-  SetDiscrete(displayData.mOverflowX, display->mOverflowX, inherited,
+  SetDiscrete(displayData.mOverflowX, display->mOverflowX, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_AUTO,
               parentDisplay->mOverflowX,
               NS_STYLE_OVERFLOW_VISIBLE,
               NS_STYLE_OVERFLOW_AUTO,
               0, 0, 0);
 
   // overflow-y: enum, auto, inherit, initial
-  SetDiscrete(displayData.mOverflowY, display->mOverflowY, inherited,
+  SetDiscrete(displayData.mOverflowY, display->mOverflowY, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_AUTO,
               parentDisplay->mOverflowY,
               NS_STYLE_OVERFLOW_VISIBLE,
               NS_STYLE_OVERFLOW_AUTO,
               0, 0, 0);
 
   // CSS3 overflow-x and overflow-y require some fixup as well in some
   // cases.  NS_STYLE_OVERFLOW_VISIBLE and NS_STYLE_OVERFLOW_CLIP are
   // meaningful only when used in both dimensions.
   if (display->mOverflowX != display->mOverflowY &&
       (display->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE ||
        display->mOverflowX == NS_STYLE_OVERFLOW_CLIP ||
        display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE ||
        display->mOverflowY == NS_STYLE_OVERFLOW_CLIP)) {
     // We can't store in the rule tree since a more specific rule might
     // change these conditions.
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
 
     // NS_STYLE_OVERFLOW_CLIP is a deprecated value, so if it's specified
     // in only one dimension, convert it to NS_STYLE_OVERFLOW_HIDDEN.
     if (display->mOverflowX == NS_STYLE_OVERFLOW_CLIP)
       display->mOverflowX = NS_STYLE_OVERFLOW_HIDDEN;
     if (display->mOverflowY == NS_STYLE_OVERFLOW_CLIP)
       display->mOverflowY = NS_STYLE_OVERFLOW_HIDDEN;
 
@@ -3458,17 +3473,17 @@ nsRuleNode::ComputeDisplayData(void* aSt
     if (display->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE)
       display->mOverflowX = NS_STYLE_OVERFLOW_AUTO;
     if (display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE)
       display->mOverflowY = NS_STYLE_OVERFLOW_AUTO;
   }
 
   // clip property: length, auto, inherit
   if (eCSSUnit_Inherit == displayData.mClip.mTop.GetUnit()) { // if one is inherit, they all are
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     display->mClipFlags = parentDisplay->mClipFlags;
     display->mClip = parentDisplay->mClip;
   }
   // if one is initial or auto (rect), they all are
   else if (eCSSUnit_Initial == displayData.mClip.mTop.GetUnit() ||
            eCSSUnit_RectIsAuto == displayData.mClip.mTop.GetUnit()) {
     display->mClipFlags = NS_STYLE_CLIP_AUTO;
     display->mClip.SetRect(0,0,0,0);
@@ -3476,45 +3491,49 @@ nsRuleNode::ComputeDisplayData(void* aSt
   else if (eCSSUnit_Null != displayData.mClip.mTop.GetUnit()) {
     display->mClipFlags = 0; // clear it
 
     if (eCSSUnit_Auto == displayData.mClip.mTop.GetUnit()) {
       display->mClip.y = 0;
       display->mClipFlags |= NS_STYLE_CLIP_TOP_AUTO;
     } 
     else if (displayData.mClip.mTop.IsLengthUnit()) {
-      display->mClip.y = CalcLength(displayData.mClip.mTop, aContext, mPresContext, inherited);
+      display->mClip.y = CalcLength(displayData.mClip.mTop, aContext,
+                                    mPresContext, canStoreInRuleTree);
     }
     if (eCSSUnit_Auto == displayData.mClip.mBottom.GetUnit()) {
       // Setting to NS_MAXSIZE for the 'auto' case ensures that
       // the clip rect is nonempty. It is important that mClip be
       // nonempty if the actual clip rect could be nonempty.
       display->mClip.height = NS_MAXSIZE;
       display->mClipFlags |= NS_STYLE_CLIP_BOTTOM_AUTO;
     } 
     else if (displayData.mClip.mBottom.IsLengthUnit()) {
-      display->mClip.height = CalcLength(displayData.mClip.mBottom, aContext, mPresContext, inherited) -
+      display->mClip.height = CalcLength(displayData.mClip.mBottom, aContext,
+                                         mPresContext, canStoreInRuleTree) -
                               display->mClip.y;
     }
     if (eCSSUnit_Auto == displayData.mClip.mLeft.GetUnit()) {
       display->mClip.x = 0;
       display->mClipFlags |= NS_STYLE_CLIP_LEFT_AUTO;
     } 
     else if (displayData.mClip.mLeft.IsLengthUnit()) {
-      display->mClip.x = CalcLength(displayData.mClip.mLeft, aContext, mPresContext, inherited);
+      display->mClip.x = CalcLength(displayData.mClip.mLeft, aContext,
+                                    mPresContext, canStoreInRuleTree);
     }
     if (eCSSUnit_Auto == displayData.mClip.mRight.GetUnit()) {
       // Setting to NS_MAXSIZE for the 'auto' case ensures that
       // the clip rect is nonempty. It is important that mClip be
       // nonempty if the actual clip rect could be nonempty.
       display->mClip.width = NS_MAXSIZE;
       display->mClipFlags |= NS_STYLE_CLIP_RIGHT_AUTO;
     } 
     else if (displayData.mClip.mRight.IsLengthUnit()) {
-      display->mClip.width = CalcLength(displayData.mClip.mRight, aContext, mPresContext, inherited) -
+      display->mClip.width = CalcLength(displayData.mClip.mRight, aContext,
+                                        mPresContext, canStoreInRuleTree) -
                              display->mClip.x;
     }
     display->mClipFlags &= ~NS_STYLE_CLIP_TYPE_MASK;
     display->mClipFlags |= NS_STYLE_CLIP_RECT;
   }
 
   if (display->mDisplay != NS_STYLE_DISPLAY_NONE) {
     // CSS2 9.7 specifies display type corrections dealing with 'float'
@@ -3524,44 +3543,44 @@ nsRuleNode::ComputeDisplayData(void* aSt
     if (nsCSSPseudoElements::firstLetter == aContext->GetPseudoType()) {
       // a non-floating first-letter must be inline
       // XXX this fix can go away once bug 103189 is fixed correctly
       display->mDisplay = NS_STYLE_DISPLAY_INLINE;
 
       // We can't cache the data in the rule tree since if a more specific
       // rule has 'float: left' we'll end up with the wrong 'display'
       // property.
-      inherited = PR_TRUE;
+      canStoreInRuleTree = PR_FALSE;
     }
 
     if (display->IsAbsolutelyPositioned()) {
       // 1) if position is 'absolute' or 'fixed' then display must be
       // block-level and float must be 'none'
 
       // Backup original display value for calculation of a hypothetical
       // box (CSS2 10.6.4/10.6.5).
       // See nsHTMLReflowState::CalculateHypotheticalBox
       display->mOriginalDisplay = display->mDisplay;
       EnsureBlockDisplay(display->mDisplay);
       display->mFloats = NS_STYLE_FLOAT_NONE;
 
       // We can't cache the data in the rule tree since if a more specific
       // rule has 'position: static' we'll end up with problems with the
       // 'display' and 'float' properties.
-      inherited = PR_TRUE;
+      canStoreInRuleTree = PR_FALSE;
     } else if (display->mFloats != NS_STYLE_FLOAT_NONE) {
       // 2) if float is not none, and display is not none, then we must
       // set a block-level 'display' type per CSS2.1 section 9.7.
 
       EnsureBlockDisplay(display->mDisplay);
 
       // We can't cache the data in the rule tree since if a more specific
       // rule has 'float: none' we'll end up with the wrong 'display'
       // property.
-      inherited = PR_TRUE;
+      canStoreInRuleTree = PR_FALSE;
     }
 
   }
   
   /* Convert the nsCSSValueList into an nsTArray<nsTransformFunction *>. */
   const nsCSSValueList *head = displayData.mTransform;
   
   if (head != nsnull) {
@@ -3574,30 +3593,30 @@ nsRuleNode::ComputeDisplayData(void* aSt
     if (head->mValue.GetUnit() == eCSSUnit_None)
       display->mTransformPresent = PR_FALSE;
     
     /* If we need to inherit, do so by making a full deep-copy. */
     else if (head->mValue.GetUnit() == eCSSUnit_Inherit)  {
       display->mTransformPresent = parentDisplay->mTransformPresent;
       if (parentDisplay->mTransformPresent)
         display->mTransform = parentDisplay->mTransform;
-      inherited = PR_TRUE;
+      canStoreInRuleTree = PR_FALSE;
     }
     /* If it's 'initial', then we reset to empty. */
     else if (head->mValue.GetUnit() == eCSSUnit_Initial)
       display->mTransformPresent = PR_FALSE;
     
     /* Otherwise, we are looking at a list of CSS tokens.  We'll read each of
      * them in as an array of nsTransformFunction objects, then will accumulate
      * them all together to form the final transform matrix.
      */
     else {
  
       display->mTransform = 
-        ReadTransforms(head, aContext, mPresContext, inherited);
+        ReadTransforms(head, aContext, mPresContext, canStoreInRuleTree);
 
       /* Make sure to say that this data is valid! */
       display->mTransformPresent = PR_TRUE;
     }
   }
   
   /* Convert -moz-transform-origin. */
   if (displayData.mTransformOrigin.mXValue.GetUnit() != eCSSUnit_Null ||
@@ -3612,17 +3631,17 @@ nsRuleNode::ComputeDisplayData(void* aSt
       /* Convert lengths, percents, and inherit.  Default value is 50%. */
 #ifdef DEBUG
       PRBool result =
 #endif
         SetCoord(displayData.mTransformOrigin.mXValue,
                  display->mTransformOrigin[0],
                  parentDisplay->mTransformOrigin[0],
                  SETCOORD_LPH | SETCOORD_INITIAL_HALF,
-                 aContext, mPresContext, aInherited);
+                 aContext, mPresContext, canStoreInRuleTree);
       NS_ASSERTION(result, "Malformed -moz-transform-origin parse!");
     }
 
     /* If Y coordinate is an enumerated type, handle it explicitly. */
     if (eCSSUnit_Enumerated == displayData.mTransformOrigin.mYValue.GetUnit())
       display->mTransformOrigin[1].SetPercentValue
         (GetFloatFromBoxPosition
          (displayData.mTransformOrigin.mYValue.GetIntValue()));
@@ -3630,45 +3649,48 @@ nsRuleNode::ComputeDisplayData(void* aSt
       /* Convert lengths, percents, initial, inherit. */
 #ifdef DEBUG
       PRBool result =
 #endif
         SetCoord(displayData.mTransformOrigin.mYValue,
                  display->mTransformOrigin[1],
                  parentDisplay->mTransformOrigin[1],
                  SETCOORD_LPH | SETCOORD_INITIAL_HALF,
-                 aContext, mPresContext, aInherited);
+                 aContext, mPresContext, canStoreInRuleTree);
       NS_ASSERTION(result, "Malformed -moz-transform-origin parse!");
     }
   }
 
   COMPUTE_END_RESET(Display, display)
 }
 
 const void*
 nsRuleNode::ComputeVisibilityData(void* aStartStruct,
                                   const nsRuleDataStruct& aData, 
                                   nsStyleContext* aContext, 
                                   nsRuleNode* aHighestNode,
-                                  const RuleDetail aRuleDetail, PRBool aInherited)
+                                  const RuleDetail aRuleDetail,
+                                  const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_INHERITED(Visibility, (mPresContext),
                           visibility, parentVisibility,
                           Display, displayData)
 
   // direction: enum, inherit, initial
-  SetDiscrete(displayData.mDirection, visibility->mDirection, inherited,
+  SetDiscrete(displayData.mDirection, visibility->mDirection,
+              canStoreInRuleTree,
               SETDSC_ENUMERATED, parentVisibility->mDirection,
               (GET_BIDI_OPTION_DIRECTION(mPresContext->GetBidi())
                == IBMBIDI_TEXTDIRECTION_RTL)
               ? NS_STYLE_DIRECTION_RTL : NS_STYLE_DIRECTION_LTR,
               0, 0, 0, 0);
 
   // visibility: enum, inherit, initial
-  SetDiscrete(displayData.mVisibility, visibility->mVisible, inherited,
+  SetDiscrete(displayData.mVisibility, visibility->mVisible,
+              canStoreInRuleTree,
               SETDSC_ENUMERATED, parentVisibility->mVisible,
               NS_STYLE_VISIBILITY_VISIBLE, 0, 0, 0, 0);
 
   // lang: string, inherit
   // this is not a real CSS property, it is a html attribute mapped to CSS struture
   if (eCSSUnit_String == displayData.mLang.GetUnit()) {
     if (!gLangService) {
       CallGetService(NS_LANGUAGEATOMSERVICE_CONTRACTID, &gLangService);
@@ -3684,245 +3706,249 @@ nsRuleNode::ComputeVisibilityData(void* 
   COMPUTE_END_INHERITED(Visibility, visibility)
 }
 
 const void*
 nsRuleNode::ComputeColorData(void* aStartStruct,
                              const nsRuleDataStruct& aData, 
                              nsStyleContext* aContext, 
                              nsRuleNode* aHighestNode,
-                             const RuleDetail aRuleDetail, PRBool aInherited)
+                             const RuleDetail aRuleDetail,
+                             const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_INHERITED(Color, (mPresContext), color, parentColor,
                           Color, colorData)
 
   // color: color, string, inherit
   // Special case for currentColor.  According to CSS3, setting color to 'currentColor'
   // should behave as if it is inherited
   if (colorData.mColor.GetUnit() == eCSSUnit_EnumColor && 
       colorData.mColor.GetIntValue() == NS_COLOR_CURRENTCOLOR) {
     color->mColor = parentColor->mColor;
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
   }
   else if (colorData.mColor.GetUnit() == eCSSUnit_Initial) {
     color->mColor = mPresContext->DefaultColor();
   }
   else {
-    SetColor(colorData.mColor, parentColor->mColor, mPresContext, aContext, color->mColor, 
-             inherited);
+    SetColor(colorData.mColor, parentColor->mColor, mPresContext, aContext,
+             color->mColor, canStoreInRuleTree);
   }
 
   COMPUTE_END_INHERITED(Color, color)
 }
 
 const void*
 nsRuleNode::ComputeBackgroundData(void* aStartStruct,
                                   const nsRuleDataStruct& aData, 
                                   nsStyleContext* aContext, 
                                   nsRuleNode* aHighestNode,
                                   const RuleDetail aRuleDetail,
-                                  PRBool aInherited)
+                                  const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_RESET(Background, (), bg, parentBG, Color, colorData)
 
   // save parentFlags in case bg == parentBG and we clobber them later
   PRUint8 parentFlags = parentBG->mBackgroundFlags;
 
   // background-color: color, string, inherit
   if (eCSSUnit_Initial == colorData.mBackColor.GetUnit()) {
     bg->mBackgroundColor = NS_RGBA(0, 0, 0, 0);
   } else if (!SetColor(colorData.mBackColor, parentBG->mBackgroundColor,
                        mPresContext, aContext, bg->mBackgroundColor,
-                       inherited)) {
+                       canStoreInRuleTree)) {
     NS_ASSERTION(eCSSUnit_Null == colorData.mBackColor.GetUnit(),
                  "unexpected color unit");
   }
 
   // background-image: url (stored as image), none, inherit
   if (eCSSUnit_Image == colorData.mBackImage.GetUnit()) {
     bg->mBackgroundImage = colorData.mBackImage.GetImageValue();
   }
   else if (eCSSUnit_None == colorData.mBackImage.GetUnit() ||
            eCSSUnit_Initial == colorData.mBackImage.GetUnit()) {
     bg->mBackgroundImage = nsnull;
   }
   else if (eCSSUnit_Inherit == colorData.mBackImage.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     bg->mBackgroundImage = parentBG->mBackgroundImage;
   }
 
   if (bg->mBackgroundImage) {
     bg->mBackgroundFlags &= ~NS_STYLE_BG_IMAGE_NONE;
   } else {
     bg->mBackgroundFlags |= NS_STYLE_BG_IMAGE_NONE;
   }
 
   // background-repeat: enum, inherit, initial
-  SetDiscrete(colorData.mBackRepeat, bg->mBackgroundRepeat, inherited,
+  SetDiscrete(colorData.mBackRepeat, bg->mBackgroundRepeat, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentBG->mBackgroundRepeat,
               NS_STYLE_BG_REPEAT_XY, 0, 0, 0, 0);
 
   // background-attachment: enum, inherit, initial
-  SetDiscrete(colorData.mBackAttachment, bg->mBackgroundAttachment, inherited,
+  SetDiscrete(colorData.mBackAttachment, bg->mBackgroundAttachment, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentBG->mBackgroundAttachment,
               NS_STYLE_BG_ATTACHMENT_SCROLL, 0, 0, 0, 0);
 
   // background-clip: enum, inherit, initial
-  SetDiscrete(colorData.mBackClip, bg->mBackgroundClip, inherited,
+  SetDiscrete(colorData.mBackClip, bg->mBackgroundClip, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentBG->mBackgroundClip,
               NS_STYLE_BG_CLIP_BORDER, 0, 0, 0, 0);
 
   // background-inline-policy: enum, inherit, initial
   SetDiscrete(colorData.mBackInlinePolicy, bg->mBackgroundInlinePolicy,
-              inherited, SETDSC_ENUMERATED,
+              canStoreInRuleTree, SETDSC_ENUMERATED,
               parentBG->mBackgroundInlinePolicy,
               NS_STYLE_BG_INLINE_POLICY_CONTINUOUS, 0, 0, 0, 0);
 
   // background-origin: enum, inherit, initial
-  SetDiscrete(colorData.mBackOrigin, bg->mBackgroundOrigin, inherited,
+  SetDiscrete(colorData.mBackOrigin, bg->mBackgroundOrigin, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentBG->mBackgroundOrigin,
               NS_STYLE_BG_ORIGIN_PADDING, 0, 0, 0, 0);
 
   // background-position: enum, length, percent (flags), inherit
   if (eCSSUnit_Percent == colorData.mBackPosition.mXValue.GetUnit()) {
     bg->mBackgroundXPosition.mFloat = colorData.mBackPosition.mXValue.GetPercentValue();
     bg->mBackgroundFlags |= NS_STYLE_BG_X_POSITION_PERCENT;
     bg->mBackgroundFlags &= ~NS_STYLE_BG_X_POSITION_LENGTH;
   }
   else if (colorData.mBackPosition.mXValue.IsLengthUnit()) {
     bg->mBackgroundXPosition.mCoord = CalcLength(colorData.mBackPosition.mXValue, 
-                                                 aContext, mPresContext, inherited);
+                                                 aContext, mPresContext, canStoreInRuleTree);
     bg->mBackgroundFlags |= NS_STYLE_BG_X_POSITION_LENGTH;
     bg->mBackgroundFlags &= ~NS_STYLE_BG_X_POSITION_PERCENT;
   }
   else if (eCSSUnit_Enumerated == colorData.mBackPosition.mXValue.GetUnit()) {
     bg->mBackgroundXPosition.mFloat =
       GetFloatFromBoxPosition(colorData.mBackPosition.mXValue.GetIntValue());
 
     bg->mBackgroundFlags |= NS_STYLE_BG_X_POSITION_PERCENT;
     bg->mBackgroundFlags &= ~NS_STYLE_BG_X_POSITION_LENGTH;
   }
   else if (eCSSUnit_Inherit == colorData.mBackPosition.mXValue.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     bg->mBackgroundXPosition = parentBG->mBackgroundXPosition;
     bg->mBackgroundFlags &= ~(NS_STYLE_BG_X_POSITION_LENGTH | NS_STYLE_BG_X_POSITION_PERCENT);
     bg->mBackgroundFlags |= (parentFlags & (NS_STYLE_BG_X_POSITION_LENGTH | NS_STYLE_BG_X_POSITION_PERCENT));
   }
   else if (eCSSUnit_Initial == colorData.mBackPosition.mXValue.GetUnit()) {
     bg->mBackgroundFlags &= ~(NS_STYLE_BG_X_POSITION_LENGTH | NS_STYLE_BG_X_POSITION_PERCENT);
   }
 
   if (eCSSUnit_Percent == colorData.mBackPosition.mYValue.GetUnit()) {
     bg->mBackgroundYPosition.mFloat = colorData.mBackPosition.mYValue.GetPercentValue();
     bg->mBackgroundFlags |= NS_STYLE_BG_Y_POSITION_PERCENT;
     bg->mBackgroundFlags &= ~NS_STYLE_BG_Y_POSITION_LENGTH;
   }
   else if (colorData.mBackPosition.mYValue.IsLengthUnit()) {
     bg->mBackgroundYPosition.mCoord = CalcLength(colorData.mBackPosition.mYValue,
-                                                 aContext, mPresContext, inherited);
+                                                 aContext, mPresContext, canStoreInRuleTree);
     bg->mBackgroundFlags |= NS_STYLE_BG_Y_POSITION_LENGTH;
     bg->mBackgroundFlags &= ~NS_STYLE_BG_Y_POSITION_PERCENT;
   }
   else if (eCSSUnit_Enumerated == colorData.mBackPosition.mYValue.GetUnit()) {
     bg->mBackgroundYPosition.mFloat =
       GetFloatFromBoxPosition(colorData.mBackPosition.mYValue.GetIntValue());
 
     bg->mBackgroundFlags |= NS_STYLE_BG_Y_POSITION_PERCENT;
     bg->mBackgroundFlags &= ~NS_STYLE_BG_Y_POSITION_LENGTH;
   }
   else if (eCSSUnit_Inherit == colorData.mBackPosition.mYValue.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     bg->mBackgroundYPosition = parentBG->mBackgroundYPosition;
     bg->mBackgroundFlags &= ~(NS_STYLE_BG_Y_POSITION_LENGTH | NS_STYLE_BG_Y_POSITION_PERCENT);
     bg->mBackgroundFlags |= (parentFlags & (NS_STYLE_BG_Y_POSITION_LENGTH | NS_STYLE_BG_Y_POSITION_PERCENT));
   }
   else if (eCSSUnit_Initial == colorData.mBackPosition.mYValue.GetUnit()) {
     bg->mBackgroundFlags &= ~(NS_STYLE_BG_Y_POSITION_LENGTH | NS_STYLE_BG_Y_POSITION_PERCENT);
   }
 
   COMPUTE_END_RESET(Background, bg)
 }
 
 const void*
 nsRuleNode::ComputeMarginData(void* aStartStruct,
                               const nsRuleDataStruct& aData, 
                               nsStyleContext* aContext, 
                               nsRuleNode* aHighestNode,
-                              const RuleDetail aRuleDetail, PRBool aInherited)
+                              const RuleDetail aRuleDetail,
+                              const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_RESET(Margin, (), margin, parentMargin, Margin, marginData)
 
   // margin: length, percent, auto, inherit
   nsStyleCoord  coord;
   nsCSSRect ourMargin(marginData.mMargin);
   AdjustLogicalBoxProp(aContext,
                        marginData.mMarginLeftLTRSource,
                        marginData.mMarginLeftRTLSource,
                        marginData.mMarginStart, marginData.mMarginEnd,
-                       NS_SIDE_LEFT, ourMargin, inherited);
+                       NS_SIDE_LEFT, ourMargin, canStoreInRuleTree);
   AdjustLogicalBoxProp(aContext,
                        marginData.mMarginRightLTRSource,
                        marginData.mMarginRightRTLSource,
                        marginData.mMarginEnd, marginData.mMarginStart,
-                       NS_SIDE_RIGHT, ourMargin, inherited);
+                       NS_SIDE_RIGHT, ourMargin, canStoreInRuleTree);
   NS_FOR_CSS_SIDES(side) {
     nsStyleCoord parentCoord = parentMargin->mMargin.Get(side);
     if (SetCoord(ourMargin.*(nsCSSRect::sides[side]),
                  coord, parentCoord, SETCOORD_LPAH | SETCOORD_INITIAL_ZERO,
-                 aContext, mPresContext, inherited)) {
+                 aContext, mPresContext, canStoreInRuleTree)) {
       margin->mMargin.Set(side, coord);
     }
   }
 
   margin->RecalcData();
   COMPUTE_END_RESET(Margin, margin)
 }
 
 const void* 
 nsRuleNode::ComputeBorderData(void* aStartStruct,
                               const nsRuleDataStruct& aData, 
                               nsStyleContext* aContext, 
                               nsRuleNode* aHighestNode,
-                              const RuleDetail aRuleDetail, PRBool aInherited)
+                              const RuleDetail aRuleDetail,
+                              const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_RESET(Border, (mPresContext), border, parentBorder,
                       Margin, marginData)
 
   // -moz-box-shadow: none, list, inherit, initial
   {
     nsCSSValueList* list = marginData.mBoxShadow;
     if (list) {
       // This handles 'none' and 'initial'
       border->mBoxShadow = nsnull;
 
       if (eCSSUnit_Inherit == list->mValue.GetUnit()) {
-        inherited = PR_TRUE;
+        canStoreInRuleTree = PR_FALSE;
         border->mBoxShadow = parentBorder->mBoxShadow;
       } else if (eCSSUnit_Array == list->mValue.GetUnit()) {
         // List of arrays
-        border->mBoxShadow = GetShadowData(list, aContext, PR_TRUE, inherited);
+        border->mBoxShadow = GetShadowData(list, aContext, PR_TRUE,
+                                           canStoreInRuleTree);
       }
     }
   }
 
   // border-width, border-*-width: length, enum, inherit
   nsStyleCoord  coord;
   nsCSSRect ourBorderWidth(marginData.mBorderWidth);
   AdjustLogicalBoxProp(aContext,
                        marginData.mBorderLeftWidthLTRSource,
                        marginData.mBorderLeftWidthRTLSource,
                        marginData.mBorderStartWidth,
                        marginData.mBorderEndWidth,
-                       NS_SIDE_LEFT, ourBorderWidth, inherited);
+                       NS_SIDE_LEFT, ourBorderWidth, canStoreInRuleTree);
   AdjustLogicalBoxProp(aContext,
                        marginData.mBorderRightWidthLTRSource,
                        marginData.mBorderRightWidthRTLSource,
                        marginData.mBorderEndWidth,
                        marginData.mBorderStartWidth,
-                       NS_SIDE_RIGHT, ourBorderWidth, inherited);
+                       NS_SIDE_RIGHT, ourBorderWidth, canStoreInRuleTree);
   { // scope for compilers with broken |for| loop scoping
     NS_FOR_CSS_SIDES(side) {
       const nsCSSValue &value = ourBorderWidth.*(nsCSSRect::sides[side]);
       NS_ASSERTION(eCSSUnit_Percent != value.GetUnit(),
                    "Percentage borders not implemented yet "
                    "If implementing, make sure to fix all consumers of "
                    "nsStyleBorder, the IsPercentageAwareChild method, "
                    "the nsAbsoluteContainingBlock::FrameDependsOnContainer "
@@ -3934,22 +3960,22 @@ nsRuleNode::ComputeBorderData(void* aSta
                      value.GetIntValue() == NS_STYLE_BORDER_WIDTH_MEDIUM ||
                      value.GetIntValue() == NS_STYLE_BORDER_WIDTH_THICK,
                      "Unexpected enum value");
         border->SetBorderWidth(side,
                                (mPresContext->GetBorderWidthTable())[value.GetIntValue()]);
       }
       // OK to pass bad aParentCoord since we're not passing SETCOORD_INHERIT
       else if (SetCoord(value, coord, nsStyleCoord(), SETCOORD_LENGTH,
-                        aContext, mPresContext, inherited)) {
+                        aContext, mPresContext, canStoreInRuleTree)) {
         NS_ASSERTION(coord.GetUnit() == eStyleUnit_Coord, "unexpected unit");
         border->SetBorderWidth(side, coord.GetCoordValue());
       }
       else if (eCSSUnit_Inherit == value.GetUnit()) {
-        inherited = PR_TRUE;
+        canStoreInRuleTree = PR_FALSE;
         border->SetBorderWidth(side,
                                parentBorder->GetComputedBorder().side(side));
       }
       else if (eCSSUnit_Initial == value.GetUnit()) {
         border->SetBorderWidth(side,
           (mPresContext->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM]);
       }
       else {
@@ -3960,34 +3986,34 @@ nsRuleNode::ComputeBorderData(void* aSta
   }
 
   // border-style, border-*-style: enum, none, inherit
   nsCSSRect ourStyle(marginData.mBorderStyle);
   AdjustLogicalBoxProp(aContext,
                        marginData.mBorderLeftStyleLTRSource,
                        marginData.mBorderLeftStyleRTLSource,
                        marginData.mBorderStartStyle, marginData.mBorderEndStyle,
-                       NS_SIDE_LEFT, ourStyle, inherited);
+                       NS_SIDE_LEFT, ourStyle, canStoreInRuleTree);
   AdjustLogicalBoxProp(aContext,
                        marginData.mBorderRightStyleLTRSource,
                        marginData.mBorderRightStyleRTLSource,
                        marginData.mBorderEndStyle, marginData.mBorderStartStyle,
-                       NS_SIDE_RIGHT, ourStyle, inherited);
+                       NS_SIDE_RIGHT, ourStyle, canStoreInRuleTree);
   { // scope for compilers with broken |for| loop scoping
     NS_FOR_CSS_SIDES(side) {
       const nsCSSValue &value = ourStyle.*(nsCSSRect::sides[side]);
       nsCSSUnit unit = value.GetUnit();
       if (eCSSUnit_Enumerated == unit) {
         border->SetBorderStyle(side, value.GetIntValue());
       }
       else if (eCSSUnit_None == unit || eCSSUnit_Initial == unit) {
         border->SetBorderStyle(side, NS_STYLE_BORDER_STYLE_NONE);
       }
       else if (eCSSUnit_Inherit == unit) {
-        inherited = PR_TRUE;
+        canStoreInRuleTree = PR_FALSE;
         border->SetBorderStyle(side, parentBorder->GetBorderStyle(side));
       }
     }
   }
 
   // -moz-border-*-colors: color, string, enum, none, inherit/initial
   nscolor borderColor;
   nscolor unused = NS_RGB(0,0,0);
@@ -4016,17 +4042,17 @@ nsRuleNode::ComputeBorderData(void* aSta
         }
         else {
           // Some composite border color information has been specified for this
           // border side.
           border->EnsureBorderColors();
           border->ClearBorderColors(side);
           while (list) {
             if (SetColor(list->mValue, unused, mPresContext,
-                         aContext, borderColor, inherited))
+                         aContext, borderColor, canStoreInRuleTree))
               border->AppendBorderColor(side, borderColor);
             else {
               NS_NOTREACHED("unexpected item in -moz-border-*-colors list");
             }
             list = list->mNext;
           }
         }
       }
@@ -4035,44 +4061,45 @@ nsRuleNode::ComputeBorderData(void* aSta
 
   // border-color, border-*-color: color, string, enum, inherit
   nsCSSRect ourBorderColor(marginData.mBorderColor);
   PRBool foreground;
   AdjustLogicalBoxProp(aContext,
                        marginData.mBorderLeftColorLTRSource,
                        marginData.mBorderLeftColorRTLSource,
                        marginData.mBorderStartColor, marginData.mBorderEndColor,
-                       NS_SIDE_LEFT, ourBorderColor, inherited);
+                       NS_SIDE_LEFT, ourBorderColor, canStoreInRuleTree);
   AdjustLogicalBoxProp(aContext,
                        marginData.mBorderRightColorLTRSource,
                        marginData.mBorderRightColorRTLSource,
                        marginData.mBorderEndColor, marginData.mBorderStartColor,
-                       NS_SIDE_RIGHT, ourBorderColor, inherited);
+                       NS_SIDE_RIGHT, ourBorderColor, canStoreInRuleTree);
   { // scope for compilers with broken |for| loop scoping
     NS_FOR_CSS_SIDES(side) {
       const nsCSSValue &value = ourBorderColor.*(nsCSSRect::sides[side]);
       if (eCSSUnit_Inherit == value.GetUnit()) {
         if (parentContext) {
-          inherited = PR_TRUE;
+          canStoreInRuleTree = PR_FALSE;
           parentBorder->GetBorderColor(side, borderColor, foreground);
           if (foreground) {
             // We want to inherit the color from the parent, not use the
             // color on the element where this chunk of style data will be
             // used.  We can ensure that the data for the parent are fully
             // computed (unlike for the element where this will be used, for
             // which the color could be specified on a more specific rule).
             border->SetBorderColor(side, parentContext->GetStyleColor()->mColor);
           } else
             border->SetBorderColor(side, borderColor);
         } else {
           // We're the root
           border->SetBorderToForeground(side);
         }
       }
-      else if (SetColor(value, unused, mPresContext, aContext, borderColor, inherited)) {
+      else if (SetColor(value, unused, mPresContext, aContext, borderColor,
+                        canStoreInRuleTree)) {
         border->SetBorderColor(side, borderColor);
       }
       else if (eCSSUnit_Enumerated == value.GetUnit()) {
         switch (value.GetIntValue()) {
           case NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR:
             border->SetBorderToForeground(side);
             break;
         }
@@ -4085,23 +4112,23 @@ nsRuleNode::ComputeBorderData(void* aSta
 
   // -moz-border-radius: length, percent, inherit
   {
     const nsCSSCornerSizes& borderRadius = marginData.mBorderRadius;
     NS_FOR_CSS_HALF_CORNERS(corner) {
       nsStyleCoord parentCoord = parentBorder->mBorderRadius.Get(corner);
       if (SetCoord(borderRadius.GetHalfCorner(corner),
                    coord, parentCoord, SETCOORD_LPH | SETCOORD_INITIAL_ZERO,
-                   aContext, mPresContext, inherited))
+                   aContext, mPresContext, canStoreInRuleTree))
         border->mBorderRadius.Set(corner, coord);
     }
   }
 
   // float-edge: enum, inherit, initial
-  SetDiscrete(marginData.mFloatEdge, border->mFloatEdge, inherited,
+  SetDiscrete(marginData.mFloatEdge, border->mFloatEdge, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentBorder->mFloatEdge,
               NS_STYLE_FLOAT_EDGE_CONTENT, 0, 0, 0, 0);
   
   // border-image
   if (eCSSUnit_Array == marginData.mBorderImage.GetUnit()) {
     nsCSSValue::Array *arr = marginData.mBorderImage.GetArrayValue();
     
     // the image
@@ -4109,28 +4136,29 @@ nsRuleNode::ComputeBorderData(void* aSta
       border->SetBorderImage(arr->Item(0).GetImageValue());
     }
     
     // the numbers saying where to split the image
     NS_FOR_CSS_SIDES(side) {
       // an uninitialized parentCoord is ok because I'm not passing SETCOORD_INHERIT
       if (SetCoord(arr->Item(1 + side), coord, nsStyleCoord(),
                    SETCOORD_FACTOR | SETCOORD_PERCENT, aContext,
-                   mPresContext, inherited)) {
+                   mPresContext, canStoreInRuleTree)) {
         border->mBorderImageSplit.Set(side, coord);
       }
     }
     
     // possible replacement for border-width
     // if have one - have all four (see CSSParserImpl::ParseBorderImage())
     if (eCSSUnit_Null != arr->Item(5).GetUnit()) {
       NS_FOR_CSS_SIDES(side) {
         // an uninitialized parentCoord is ok because I'm not passing SETCOORD_INHERIT
         if (!SetCoord(arr->Item(5 + side), coord, nsStyleCoord(),
-                      SETCOORD_LENGTH, aContext, mPresContext, inherited)) {
+                      SETCOORD_LENGTH, aContext, mPresContext,
+                      canStoreInRuleTree)) {
           NS_NOTREACHED("SetCoord for border-width replacement from border-image failed");
         }
         if (coord.GetUnit() == eStyleUnit_Coord) {
           border->SetBorderImageWidthOverride(side, coord.GetCoordValue());
         } else {
           NS_WARNING("a border-width replacement from border-image "
                      "has a unit that's not eStyleUnit_Coord");
           border->SetBorderImageWidthOverride(side, 0);
@@ -4175,85 +4203,87 @@ nsRuleNode::ComputeBorderData(void* aSta
   COMPUTE_END_RESET(Border, border)
 }
   
 const void*
 nsRuleNode::ComputePaddingData(void* aStartStruct,
                                const nsRuleDataStruct& aData, 
                                nsStyleContext* aContext, 
                                nsRuleNode* aHighestNode,
-                               const RuleDetail aRuleDetail, PRBool aInherited)
+                               const RuleDetail aRuleDetail,
+                               const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_RESET(Padding, (), padding, parentPadding, Margin, marginData)
 
   // padding: length, percent, inherit
   nsStyleCoord  coord;
   nsCSSRect ourPadding(marginData.mPadding);
   AdjustLogicalBoxProp(aContext,
                        marginData.mPaddingLeftLTRSource,
                        marginData.mPaddingLeftRTLSource,
                        marginData.mPaddingStart, marginData.mPaddingEnd,
-                       NS_SIDE_LEFT, ourPadding, inherited);
+                       NS_SIDE_LEFT, ourPadding, canStoreInRuleTree);
   AdjustLogicalBoxProp(aContext,
                        marginData.mPaddingRightLTRSource,
                        marginData.mPaddingRightRTLSource,
                        marginData.mPaddingEnd, marginData.mPaddingStart,
-                       NS_SIDE_RIGHT, ourPadding, inherited);
+                       NS_SIDE_RIGHT, ourPadding, canStoreInRuleTree);
   NS_FOR_CSS_SIDES(side) {
     nsStyleCoord parentCoord = parentPadding->mPadding.Get(side);
     if (SetCoord(ourPadding.*(nsCSSRect::sides[side]),
                  coord, parentCoord, SETCOORD_LPH | SETCOORD_INITIAL_ZERO,
-                 aContext, mPresContext, inherited)) {
+                 aContext, mPresContext, canStoreInRuleTree)) {
       padding->mPadding.Set(side, coord);
     }
   }
 
   padding->RecalcData();
   COMPUTE_END_RESET(Padding, padding)
 }
 
 const void*
 nsRuleNode::ComputeOutlineData(void* aStartStruct,
                                const nsRuleDataStruct& aData, 
                                nsStyleContext* aContext, 
                                nsRuleNode* aHighestNode,
-                               const RuleDetail aRuleDetail, PRBool aInherited)
+                               const RuleDetail aRuleDetail,
+                               const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_RESET(Outline, (mPresContext), outline, parentOutline,
                       Margin, marginData)
 
   // outline-width: length, enum, inherit
   if (eCSSUnit_Initial == marginData.mOutlineWidth.GetUnit()) {
     outline->mOutlineWidth =
       nsStyleCoord(NS_STYLE_BORDER_WIDTH_MEDIUM, eStyleUnit_Enumerated);
   }
   else {
     SetCoord(marginData.mOutlineWidth, outline->mOutlineWidth,
              parentOutline->mOutlineWidth, SETCOORD_LEH, aContext,
-             mPresContext, inherited);
+             mPresContext, canStoreInRuleTree);
   }
 
   // outline-offset: length, inherit
   nsStyleCoord tempCoord;
   if (SetCoord(marginData.mOutlineOffset, tempCoord,
                parentOutline->mOutlineOffset,
                SETCOORD_LH | SETCOORD_INITIAL_ZERO, aContext, mPresContext,
-               inherited)) {
+               canStoreInRuleTree)) {
     outline->mOutlineOffset = tempCoord.GetCoordValue();
   } else {
     NS_ASSERTION(marginData.mOutlineOffset.GetUnit() == eCSSUnit_Null,
                  "unexpected unit");
   }
 
   // outline-color: color, string, enum, inherit
   nscolor outlineColor;
   nscolor unused = NS_RGB(0,0,0);
   if (eCSSUnit_Inherit == marginData.mOutlineColor.GetUnit()) {
     if (parentContext) {
-      inherited = PR_TRUE;
+      canStoreInRuleTree = PR_FALSE;
       if (parentOutline->GetOutlineColor(outlineColor))
         outline->SetOutlineColor(outlineColor);
       else {
 #ifdef GFX_HAS_INVERT
         outline->SetOutlineInitialColor();
 #else
         // We want to inherit the color from the parent, not use the
         // color on the element where this chunk of style data will be
@@ -4262,194 +4292,206 @@ nsRuleNode::ComputeOutlineData(void* aSt
         // which the color could be specified on a more specific rule).
         outline->SetOutlineColor(parentContext->GetStyleColor()->mColor);
 #endif
       }
     } else {
       outline->SetOutlineInitialColor();
     }
   }
-  else if (SetColor(marginData.mOutlineColor, unused, mPresContext, aContext, outlineColor, inherited))
+  else if (SetColor(marginData.mOutlineColor, unused, mPresContext,
+                    aContext, outlineColor, canStoreInRuleTree))
     outline->SetOutlineColor(outlineColor);
   else if (eCSSUnit_Enumerated == marginData.mOutlineColor.GetUnit() ||
            eCSSUnit_Initial == marginData.mOutlineColor.GetUnit()) {
     outline->SetOutlineInitialColor();
   }
 
   // -moz-outline-radius: length, percent, inherit
   { 
     nsStyleCoord coord;
     const nsCSSCornerSizes& outlineRadius = marginData.mOutlineRadius;
     NS_FOR_CSS_HALF_CORNERS(corner) {
       nsStyleCoord parentCoord = parentOutline->mOutlineRadius.Get(corner);
       if (SetCoord(outlineRadius.GetHalfCorner(corner),
                    coord, parentCoord, SETCOORD_LPH | SETCOORD_INITIAL_ZERO,
-                   aContext, mPresContext, inherited))
+                   aContext, mPresContext, canStoreInRuleTree))
         outline->mOutlineRadius.Set(corner, coord);
     }
   }
 
   // outline-style: auto, enum, none, inherit, initial
   // cannot use SetDiscrete because of SetOutlineStyle
   if (eCSSUnit_Enumerated == marginData.mOutlineStyle.GetUnit())
     outline->SetOutlineStyle(marginData.mOutlineStyle.GetIntValue());
   else if (eCSSUnit_None == marginData.mOutlineStyle.GetUnit() ||
            eCSSUnit_Initial == marginData.mOutlineStyle.GetUnit())
     outline->SetOutlineStyle(NS_STYLE_BORDER_STYLE_NONE);
   else if (eCSSUnit_Auto == marginData.mOutlineStyle.GetUnit()) {
     outline->SetOutlineStyle(NS_STYLE_BORDER_STYLE_AUTO);
   } else if (eCSSUnit_Inherit == marginData.mOutlineStyle.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     outline->SetOutlineStyle(parentOutline->GetOutlineStyle());
   }
 
   outline->RecalcData(mPresContext);
   COMPUTE_END_RESET(Outline, outline)
 }
 
 const void* 
 nsRuleNode::ComputeListData(void* aStartStruct,
                             const nsRuleDataStruct& aData, 
                             nsStyleContext* aContext, 
                             nsRuleNode* aHighestNode,
-                            const RuleDetail aRuleDetail, PRBool aInherited)
+                            const RuleDetail aRuleDetail,
+                            const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_INHERITED(List, (), list, parentList, List, listData)
 
   // list-style-type: enum, none, inherit, initial
-  SetDiscrete(listData.mType, list->mListStyleType, inherited,
+  SetDiscrete(listData.mType, list->mListStyleType, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NONE, parentList->mListStyleType,
               NS_STYLE_LIST_STYLE_DISC, 0,
               NS_STYLE_LIST_STYLE_NONE, 0, 0);
 
   // list-style-image: url, none, inherit
   if (eCSSUnit_Image == listData.mImage.GetUnit()) {
     list->mListStyleImage = listData.mImage.GetImageValue();
   }
   else if (eCSSUnit_None == listData.mImage.GetUnit() ||
            eCSSUnit_Initial == listData.mImage.GetUnit()) {
     list->mListStyleImage = nsnull;
   }
   else if (eCSSUnit_Inherit == listData.mImage.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     list->mListStyleImage = parentList->mListStyleImage;
   }
 
   // list-style-position: enum, inherit, initial
-  SetDiscrete(listData.mPosition, list->mListStylePosition, inherited,
+  SetDiscrete(listData.mPosition, list->mListStylePosition, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentList->mListStylePosition,
               NS_STYLE_LIST_STYLE_POSITION_OUTSIDE, 0, 0, 0, 0);
 
   // image region property: length, auto, inherit
   if (eCSSUnit_Inherit == listData.mImageRegion.mTop.GetUnit()) { // if one is inherit, they all are
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     list->mImageRegion = parentList->mImageRegion;
   }
   // if one is -moz-initial or auto (rect), they all are
   else if (eCSSUnit_Initial == listData.mImageRegion.mTop.GetUnit() ||
            eCSSUnit_RectIsAuto == listData.mImageRegion.mTop.GetUnit()) {
     list->mImageRegion.Empty();
   }
   else if (eCSSUnit_Null != listData.mImageRegion.mTop.GetUnit()) {
     if (eCSSUnit_Auto == listData.mImageRegion.mTop.GetUnit())
       list->mImageRegion.y = 0;
     else if (listData.mImageRegion.mTop.IsLengthUnit())
-      list->mImageRegion.y = CalcLength(listData.mImageRegion.mTop, aContext, mPresContext, inherited);
+      list->mImageRegion.y =
+        CalcLength(listData.mImageRegion.mTop, aContext, mPresContext,
+                   canStoreInRuleTree);
       
     if (eCSSUnit_Auto == listData.mImageRegion.mBottom.GetUnit())
       list->mImageRegion.height = 0;
     else if (listData.mImageRegion.mBottom.IsLengthUnit())
-      list->mImageRegion.height = CalcLength(listData.mImageRegion.mBottom, aContext, 
-                                            mPresContext, inherited) - list->mImageRegion.y;
+      list->mImageRegion.height =
+        CalcLength(listData.mImageRegion.mBottom, aContext, mPresContext,
+                   canStoreInRuleTree) -
+        list->mImageRegion.y;
   
     if (eCSSUnit_Auto == listData.mImageRegion.mLeft.GetUnit())
       list->mImageRegion.x = 0;
     else if (listData.mImageRegion.mLeft.IsLengthUnit())
-      list->mImageRegion.x = CalcLength(listData.mImageRegion.mLeft, aContext, mPresContext, inherited);
+      list->mImageRegion.x =
+        CalcLength(listData.mImageRegion.mLeft, aContext, mPresContext,
+                   canStoreInRuleTree);
       
     if (eCSSUnit_Auto == listData.mImageRegion.mRight.GetUnit())
       list->mImageRegion.width = 0;
     else if (listData.mImageRegion.mRight.IsLengthUnit())
-      list->mImageRegion.width = CalcLength(listData.mImageRegion.mRight, aContext, mPresContext, inherited) -
-                                list->mImageRegion.x;
+      list->mImageRegion.width =
+        CalcLength(listData.mImageRegion.mRight, aContext, mPresContext,
+                   canStoreInRuleTree) -
+        list->mImageRegion.x;
   }
 
   COMPUTE_END_INHERITED(List, list)
 }
 
 const void* 
 nsRuleNode::ComputePositionData(void* aStartStruct,
                                 const nsRuleDataStruct& aData, 
                                 nsStyleContext* aContext, 
                                 nsRuleNode* aHighestNode,
-                                const RuleDetail aRuleDetail, PRBool aInherited)
+                                const RuleDetail aRuleDetail,
+                                const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_RESET(Position, (), pos, parentPos, Position, posData)
 
   // box offsets: length, percent, auto, inherit
   nsStyleCoord  coord;
   NS_FOR_CSS_SIDES(side) {
     nsStyleCoord parentCoord = parentPos->mOffset.Get(side);
     if (SetCoord(posData.mOffset.*(nsCSSRect::sides[side]),
                  coord, parentCoord, SETCOORD_LPAH | SETCOORD_INITIAL_AUTO,
-                 aContext, mPresContext, inherited)) {
+                 aContext, mPresContext, canStoreInRuleTree)) {
       pos->mOffset.Set(side, coord);
     }
   }
 
   SetCoord(posData.mWidth, pos->mWidth, parentPos->mWidth,
            SETCOORD_LPAEH | SETCOORD_INITIAL_AUTO, aContext,
-           mPresContext, inherited);
+           mPresContext, canStoreInRuleTree);
   SetCoord(posData.mMinWidth, pos->mMinWidth, parentPos->mMinWidth,
            SETCOORD_LPEH | SETCOORD_INITIAL_ZERO, aContext,
-           mPresContext, inherited);
+           mPresContext, canStoreInRuleTree);
   SetCoord(posData.mMaxWidth, pos->mMaxWidth, parentPos->mMaxWidth,
            SETCOORD_LPOEH | SETCOORD_INITIAL_NONE, aContext,
-           mPresContext, inherited);
+           mPresContext, canStoreInRuleTree);
 
   SetCoord(posData.mHeight, pos->mHeight, parentPos->mHeight,
            SETCOORD_LPAH | SETCOORD_INITIAL_AUTO, aContext,
-           mPresContext, inherited);
+           mPresContext, canStoreInRuleTree);
   SetCoord(posData.mMinHeight, pos->mMinHeight, parentPos->mMinHeight,
            SETCOORD_LPH | SETCOORD_INITIAL_ZERO, aContext,
-           mPresContext, inherited);
+           mPresContext, canStoreInRuleTree);
   SetCoord(posData.mMaxHeight, pos->mMaxHeight, parentPos->mMaxHeight,
            SETCOORD_LPOH | SETCOORD_INITIAL_NONE, aContext,
-           mPresContext, inherited);
+           mPresContext, canStoreInRuleTree);
 
   // box-sizing: enum, inherit, initial
-  SetDiscrete(posData.mBoxSizing, pos->mBoxSizing, inherited,
+  SetDiscrete(posData.mBoxSizing, pos->mBoxSizing, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentPos->mBoxSizing,
               NS_STYLE_BOX_SIZING_CONTENT, 0, 0, 0, 0);
 
   // z-index
   if (! SetCoord(posData.mZIndex, pos->mZIndex, parentPos->mZIndex,
                  SETCOORD_IA | SETCOORD_INITIAL_AUTO, aContext,
-                 nsnull, inherited)) {
+                 nsnull, canStoreInRuleTree)) {
     if (eCSSUnit_Inherit == posData.mZIndex.GetUnit()) {
       // handle inherit, because it's ok to inherit 'auto' here
-      inherited = PR_TRUE;
+      canStoreInRuleTree = PR_FALSE;
       pos->mZIndex = parentPos->mZIndex;
     }
   }
 
   COMPUTE_END_RESET(Position, pos)
 }
 
 const void* 
 nsRuleNode::ComputeTableData(void* aStartStruct,
                              const nsRuleDataStruct& aData, 
                              nsStyleContext* aContext, 
                              nsRuleNode* aHighestNode,
-                             const RuleDetail aRuleDetail, PRBool aInherited)
+                             const RuleDetail aRuleDetail,
+                             const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_RESET(Table, (), table, parentTable, Table, tableData)
 
   // table-layout: auto, enum, inherit, initial
-  SetDiscrete(tableData.mLayout, table->mLayoutStrategy, inherited,
+  SetDiscrete(tableData.mLayout, table->mLayoutStrategy, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_AUTO,
               parentTable->mLayoutStrategy,
               NS_STYLE_TABLE_LAYOUT_AUTO,
               NS_STYLE_TABLE_LAYOUT_AUTO, 0, 0, 0);
 
   // rules: enum (not a real CSS prop)
   if (eCSSUnit_Enumerated == tableData.mRules.GetUnit())
     table->mRules = tableData.mRules.GetIntValue();
@@ -4471,88 +4513,91 @@ nsRuleNode::ComputeTableData(void* aStar
   COMPUTE_END_RESET(Table, table)
 }
 
 const void* 
 nsRuleNode::ComputeTableBorderData(void* aStartStruct,
                                    const nsRuleDataStruct& aData, 
                                    nsStyleContext* aContext, 
                                    nsRuleNode* aHighestNode,
-                                   const RuleDetail aRuleDetail, PRBool aInherited)
+                                   const RuleDetail aRuleDetail,
+                                   const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_INHERITED(TableBorder, (mPresContext), table, parentTable,
                           Table, tableData)
 
   // border-collapse: enum, inherit, initial
-  SetDiscrete(tableData.mBorderCollapse, table->mBorderCollapse, inherited,
+  SetDiscrete(tableData.mBorderCollapse, table->mBorderCollapse,
+              canStoreInRuleTree,
               SETDSC_ENUMERATED, parentTable->mBorderCollapse,
               NS_STYLE_BORDER_SEPARATE, 0, 0, 0, 0);
 
   // border-spacing-x: length, inherit
   nsStyleCoord tempCoord;
   if (SetCoord(tableData.mBorderSpacing.mXValue, tempCoord,
                parentTable->mBorderSpacingX,
                SETCOORD_LH | SETCOORD_INITIAL_ZERO,
-               aContext, mPresContext, inherited)) {
+               aContext, mPresContext, canStoreInRuleTree)) {
     table->mBorderSpacingX = tempCoord.GetCoordValue();
   } else {
     NS_ASSERTION(tableData.mBorderSpacing.mXValue.GetUnit() == eCSSUnit_Null,
                  "unexpected unit");
   }
 
   // border-spacing-y: length, inherit
   if (SetCoord(tableData.mBorderSpacing.mYValue, tempCoord,
                parentTable->mBorderSpacingY,
                SETCOORD_LH | SETCOORD_INITIAL_ZERO,
-               aContext, mPresContext, inherited)) {
+               aContext, mPresContext, canStoreInRuleTree)) {
     table->mBorderSpacingY = tempCoord.GetCoordValue();
   } else {
     NS_ASSERTION(tableData.mBorderSpacing.mYValue.GetUnit() == eCSSUnit_Null,
                  "unexpected unit");
   }
 
   // caption-side: enum, inherit, initial
-  SetDiscrete(tableData.mCaptionSide, table->mCaptionSide, inherited,
+  SetDiscrete(tableData.mCaptionSide, table->mCaptionSide, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentTable->mCaptionSide,
               NS_STYLE_CAPTION_SIDE_TOP, 0, 0, 0, 0);
 
   // empty-cells: enum, inherit, initial
-  SetDiscrete(tableData.mEmptyCells, table->mEmptyCells, inherited,
+  SetDiscrete(tableData.mEmptyCells, table->mEmptyCells, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentTable->mEmptyCells,
               (mPresContext->CompatibilityMode() == eCompatibility_NavQuirks)
               ? NS_STYLE_TABLE_EMPTY_CELLS_SHOW_BACKGROUND     
               : NS_STYLE_TABLE_EMPTY_CELLS_SHOW,
               0, 0, 0, 0);
 
   COMPUTE_END_INHERITED(TableBorder, table)
 }
 
 const void* 
 nsRuleNode::ComputeContentData(void* aStartStruct,
                                const nsRuleDataStruct& aData, 
                                nsStyleContext* aContext, 
                                nsRuleNode* aHighestNode,
-                               const RuleDetail aRuleDetail, PRBool aInherited)
+                               const RuleDetail aRuleDetail,
+                               const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_RESET(Content, (), content, parentContent,
                       Content, contentData)
 
   // content: [string, url, counter, attr, enum]+, normal, none, inherit
   PRUint32 count;
   nsAutoString  buffer;
   nsCSSValueList* contentValue = contentData.mContent;
   if (contentValue) {
     if (eCSSUnit_Normal == contentValue->mValue.GetUnit() ||
         eCSSUnit_None == contentValue->mValue.GetUnit() ||
         eCSSUnit_Initial == contentValue->mValue.GetUnit()) {
       // "normal", "none", and "initial" all mean no content
       content->AllocateContents(0);
     }
     else if (eCSSUnit_Inherit == contentValue->mValue.GetUnit()) {
-      inherited = PR_TRUE;
+      canStoreInRuleTree = PR_FALSE;
       count = parentContent->ContentCount();
       if (NS_SUCCEEDED(content->AllocateContents(count))) {
         while (0 < count--) {
           content->ContentAt(count) = parentContent->ContentAt(count);
         }
       }
     }
     else {
@@ -4621,17 +4666,17 @@ nsRuleNode::ComputeContentData(void* aSt
   // counter-increment: [string [int]]+, none, inherit
   nsCSSValuePairList* ourIncrement = contentData.mCounterIncrement;
   if (ourIncrement) {
     if (eCSSUnit_None == ourIncrement->mXValue.GetUnit() ||
         eCSSUnit_Initial == ourIncrement->mXValue.GetUnit()) {
       content->AllocateCounterIncrements(0);
     }
     else if (eCSSUnit_Inherit == ourIncrement->mXValue.GetUnit()) {
-      inherited = PR_TRUE;
+      canStoreInRuleTree = PR_FALSE;
       count = parentContent->CounterIncrementCount();
       if (NS_SUCCEEDED(content->AllocateCounterIncrements(count))) {
         while (0 < count--) {
           const nsStyleCounterData *data =
             parentContent->GetCounterIncrementAt(count);
           content->SetCounterIncrementAt(count, data->mCounter, data->mValue);
         }
       }
@@ -4664,17 +4709,17 @@ nsRuleNode::ComputeContentData(void* aSt
   // counter-reset: [string [int]]+, none, inherit
   nsCSSValuePairList* ourReset = contentData.mCounterReset;
   if (ourReset) {
     if (eCSSUnit_None == ourReset->mXValue.GetUnit() ||
         eCSSUnit_Initial == ourReset->mXValue.GetUnit()) {
       content->AllocateCounterResets(0);
     }
     else if (eCSSUnit_Inherit == ourReset->mXValue.GetUnit()) {
-      inherited = PR_TRUE;
+      canStoreInRuleTree = PR_FALSE;
       count = parentContent->CounterResetCount();
       if (NS_SUCCEEDED(content->AllocateCounterResets(count))) {
         while (0 < count--) {
           const nsStyleCounterData *data =
             parentContent->GetCounterResetAt(count);
           content->SetCounterResetAt(count, data->mCounter, data->mValue);
         }
       }
@@ -4702,36 +4747,37 @@ nsRuleNode::ComputeContentData(void* aSt
         }
       }
     }
   }
 
   // marker-offset: length, auto, inherit
   SetCoord(contentData.mMarkerOffset, content->mMarkerOffset, parentContent->mMarkerOffset,
            SETCOORD_LH | SETCOORD_AUTO | SETCOORD_INITIAL_AUTO, aContext,
-           mPresContext, inherited);
+           mPresContext, canStoreInRuleTree);
     
   COMPUTE_END_RESET(Content, content)
 }
 
 const void* 
 nsRuleNode::ComputeQuotesData(void* aStartStruct,
                               const nsRuleDataStruct& aData, 
                               nsStyleContext* aContext, 
                               nsRuleNode* aHighestNode,
-                              const RuleDetail aRuleDetail, PRBool aInherited)
+                              const RuleDetail aRuleDetail,
+                              const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_INHERITED(Quotes, (), quotes, parentQuotes,
                           Content, contentData)
 
   // quotes: inherit, initial, none, [string string]+
   nsCSSValuePairList* ourQuotes = contentData.mQuotes;
   if (ourQuotes) {
     if (eCSSUnit_Inherit == ourQuotes->mXValue.GetUnit()) {
-      inherited = PR_TRUE;
+      canStoreInRuleTree = PR_FALSE;
       quotes->CopyFrom(*parentQuotes);
     }
     else if (eCSSUnit_Initial == ourQuotes->mXValue.GetUnit()) {
       quotes->SetInitial();
     }
     else if (eCSSUnit_None == ourQuotes->mXValue.GetUnit()) {
       quotes->AllocateQuotes(0);
     }
@@ -4762,93 +4808,95 @@ nsRuleNode::ComputeQuotesData(void* aSta
   COMPUTE_END_INHERITED(Quotes, quotes)
 }
 
 const void* 
 nsRuleNode::ComputeXULData(void* aStartStruct,
                            const nsRuleDataStruct& aData, 
                            nsStyleContext* aContext, 
                            nsRuleNode* aHighestNode,
-                           const RuleDetail aRuleDetail, PRBool aInherited)
+                           const RuleDetail aRuleDetail,
+                           const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_RESET(XUL, (), xul, parentXUL, XUL, xulData)
 
   // box-align: enum, inherit, initial
-  SetDiscrete(xulData.mBoxAlign, xul->mBoxAlign, inherited,
+  SetDiscrete(xulData.mBoxAlign, xul->mBoxAlign, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentXUL->mBoxAlign,
               NS_STYLE_BOX_ALIGN_STRETCH, 0, 0, 0, 0);
 
   // box-direction: enum, inherit, initial
-  SetDiscrete(xulData.mBoxDirection, xul->mBoxDirection, inherited,
+  SetDiscrete(xulData.mBoxDirection, xul->mBoxDirection, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentXUL->mBoxDirection,
               NS_STYLE_BOX_DIRECTION_NORMAL, 0, 0, 0, 0);
 
   // box-flex: factor, inherit
-  SetFactor(xulData.mBoxFlex, xul->mBoxFlex, inherited,
+  SetFactor(xulData.mBoxFlex, xul->mBoxFlex, canStoreInRuleTree,
             parentXUL->mBoxFlex, 0.0f);
 
   // box-orient: enum, inherit, initial
-  SetDiscrete(xulData.mBoxOrient, xul->mBoxOrient, inherited,
+  SetDiscrete(xulData.mBoxOrient, xul->mBoxOrient, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentXUL->mBoxOrient,
               NS_STYLE_BOX_ORIENT_HORIZONTAL, 0, 0, 0, 0);
 
   // box-pack: enum, inherit, initial
-  SetDiscrete(xulData.mBoxPack, xul->mBoxPack, inherited,
+  SetDiscrete(xulData.mBoxPack, xul->mBoxPack, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentXUL->mBoxPack,
               NS_STYLE_BOX_PACK_START, 0, 0, 0, 0);
 
   // box-ordinal-group: integer, inherit, initial
-  SetDiscrete(xulData.mBoxOrdinal, xul->mBoxOrdinal, inherited,
+  SetDiscrete(xulData.mBoxOrdinal, xul->mBoxOrdinal, canStoreInRuleTree,
               SETDSC_INTEGER, parentXUL->mBoxOrdinal, 1,
               0, 0, 0, 0);
 
   if (eCSSUnit_Inherit == xulData.mStackSizing.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     xul->mStretchStack = parentXUL->mStretchStack;
   } else if (eCSSUnit_Initial == xulData.mStackSizing.GetUnit()) {
     xul->mStretchStack = PR_TRUE;
   } else if (eCSSUnit_Enumerated == xulData.mStackSizing.GetUnit()) {
     xul->mStretchStack = xulData.mStackSizing.GetIntValue() ==
       NS_STYLE_STACK_SIZING_STRETCH_TO_FIT;
   }
 
   COMPUTE_END_RESET(XUL, xul)
 }
 
 const void* 
 nsRuleNode::ComputeColumnData(void* aStartStruct,
                               const nsRuleDataStruct& aData, 
                               nsStyleContext* aContext, 
                               nsRuleNode* aHighestNode,
-                              const RuleDetail aRuleDetail, PRBool aInherited)
+                              const RuleDetail aRuleDetail,
+                              const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_RESET(Column, (mPresContext), column, parent, Column, columnData)
 
   // column-width: length, auto, inherit
   SetCoord(columnData.mColumnWidth,
            column->mColumnWidth, parent->mColumnWidth,
            SETCOORD_LAH | SETCOORD_INITIAL_AUTO,
-           aContext, mPresContext, inherited);
+           aContext, mPresContext, canStoreInRuleTree);
 
   // column-gap: length, percentage, inherit, normal
   SetCoord(columnData.mColumnGap,
            column->mColumnGap, parent->mColumnGap,
            SETCOORD_LPH | SETCOORD_NORMAL | SETCOORD_INITIAL_NORMAL,
-           aContext, mPresContext, inherited);
+           aContext, mPresContext, canStoreInRuleTree);
 
   // column-count: auto, integer, inherit
   if (eCSSUnit_Auto == columnData.mColumnCount.GetUnit() ||
       eCSSUnit_Initial == columnData.mColumnCount.GetUnit()) {
     column->mColumnCount = NS_STYLE_COLUMN_COUNT_AUTO;
   } else if (eCSSUnit_Integer == columnData.mColumnCount.GetUnit()) {
     column->mColumnCount = columnData.mColumnCount.GetIntValue();
     // Max 1000 columns - wallpaper for bug 345583.
     column->mColumnCount = PR_MIN(column->mColumnCount, 1000);
   } else if (eCSSUnit_Inherit == columnData.mColumnCount.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     column->mColumnCount = parent->mColumnCount;
   }
 
   // column-rule-width: length, enum, inherit
   const nsCSSValue& widthValue = columnData.mColumnRuleWidth;
   if (eCSSUnit_Initial == widthValue.GetUnit()) {
     column->SetColumnRuleWidth(
         (mPresContext->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM]);
@@ -4858,192 +4906,197 @@ nsRuleNode::ComputeColumnData(void* aSta
                  widthValue.GetIntValue() == NS_STYLE_BORDER_WIDTH_MEDIUM ||
                  widthValue.GetIntValue() == NS_STYLE_BORDER_WIDTH_THICK,
                  "Unexpected enum value");
     column->SetColumnRuleWidth(
         (mPresContext->GetBorderWidthTable())[widthValue.GetIntValue()]);
   }
   else if (eCSSUnit_Inherit == widthValue.GetUnit()) {
     column->SetColumnRuleWidth(parent->GetComputedColumnRuleWidth());
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
   }
   else if (widthValue.IsLengthUnit()) {
     column->SetColumnRuleWidth(CalcLength(widthValue, aContext,
-                                          mPresContext, inherited));
+                                          mPresContext, canStoreInRuleTree));
   }
 
   // column-rule-style: enum, none, inherit
   const nsCSSValue& styleValue = columnData.mColumnRuleStyle;
   if (eCSSUnit_Enumerated == styleValue.GetUnit()) {
     column->mColumnRuleStyle = styleValue.GetIntValue();
   }
   else if (eCSSUnit_None == styleValue.GetUnit() ||
            eCSSUnit_Initial == styleValue.GetUnit()) {
     column->mColumnRuleStyle = NS_STYLE_BORDER_STYLE_NONE;
   }
   else if (eCSSUnit_Inherit == styleValue.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     column->mColumnRuleStyle = parent->mColumnRuleStyle;
   }
 
   // column-rule-color: color, inherit
   const nsCSSValue& colorValue = columnData.mColumnRuleColor;
   if (eCSSUnit_Inherit == colorValue.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     column->mColumnRuleColorIsForeground = PR_FALSE;
     if (parent->mColumnRuleColorIsForeground) {
       column->mColumnRuleColor = parentContext->GetStyleColor()->mColor;
     } else {
       column->mColumnRuleColor = parent->mColumnRuleColor;
     }
   }
   else if (eCSSUnit_Initial == colorValue.GetUnit()) {
     column->mColumnRuleColorIsForeground = PR_TRUE;
   }
-  else if (SetColor(colorValue, 0, mPresContext, aContext, column->mColumnRuleColor, inherited)) {
+  else if (SetColor(colorValue, 0, mPresContext, aContext,
+                    column->mColumnRuleColor, canStoreInRuleTree)) {
     column->mColumnRuleColorIsForeground = PR_FALSE;
   }
 
   COMPUTE_END_RESET(Column, column)
 }
 
 #ifdef MOZ_SVG
 static void
 SetSVGPaint(const nsCSSValuePair& aValue, const nsStyleSVGPaint& parentPaint,
             nsPresContext* aPresContext, nsStyleContext *aContext, 
             nsStyleSVGPaint& aResult, nsStyleSVGPaintType aInitialPaintType,
-            PRBool& aInherited)
+            PRBool& aCanStoreInRuleTree)
 {
   nscolor color;
 
   if (aValue.mXValue.GetUnit() == eCSSUnit_Inherit) {
     aResult = parentPaint;
-    aInherited = PR_TRUE;
+    aCanStoreInRuleTree = PR_FALSE;
   } else if (aValue.mXValue.GetUnit() == eCSSUnit_None) {
     aResult.SetType(eStyleSVGPaintType_None);
   } else if (aValue.mXValue.GetUnit() == eCSSUnit_Initial) {
     aResult.SetType(aInitialPaintType);
     aResult.mPaint.mColor = NS_RGB(0, 0, 0);
     aResult.mFallbackColor = NS_RGB(0, 0, 0);
   } else if (aValue.mXValue.GetUnit() == eCSSUnit_URL) {
     aResult.SetType(eStyleSVGPaintType_Server);
     aResult.mPaint.mPaintServer = aValue.mXValue.GetURLValue();
     NS_IF_ADDREF(aResult.mPaint.mPaintServer);
     if (aValue.mYValue.GetUnit() == eCSSUnit_None) {
       aResult.mFallbackColor = NS_RGBA(0, 0, 0, 0);
     } else {
       NS_ASSERTION(aValue.mYValue.GetUnit() != eCSSUnit_Inherit, "cannot inherit fallback colour");
-      SetColor(aValue.mYValue, NS_RGB(0, 0, 0), aPresContext, aContext, aResult.mFallbackColor, aInherited);
+      SetColor(aValue.mYValue, NS_RGB(0, 0, 0), aPresContext, aContext,
+               aResult.mFallbackColor, aCanStoreInRuleTree);
     }
-  } else if (SetColor(aValue.mXValue, parentPaint.mPaint.mColor, aPresContext, aContext, color, aInherited)) {
+  } else if (SetColor(aValue.mXValue, parentPaint.mPaint.mColor, aPresContext,
+                      aContext, color, aCanStoreInRuleTree)) {
     aResult.SetType(eStyleSVGPaintType_Color);
     aResult.mPaint.mColor = color;
   }
 }
 
 const void* 
 nsRuleNode::ComputeSVGData(void* aStartStruct,
                            const nsRuleDataStruct& aData, 
                            nsStyleContext* aContext, 
                            nsRuleNode* aHighestNode,
-                           const RuleDetail aRuleDetail, PRBool aInherited)
+                           const RuleDetail aRuleDetail,
+                           const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_INHERITED(SVG, (), svg, parentSVG, SVG, SVGData)
 
   // clip-rule: enum, inherit, initial
-  SetDiscrete(SVGData.mClipRule, svg->mClipRule, inherited,
+  SetDiscrete(SVGData.mClipRule, svg->mClipRule, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentSVG->mClipRule,
               NS_STYLE_FILL_RULE_NONZERO, 0, 0, 0, 0);
 
   // color-interpolation: enum, auto, inherit, initial
-  SetDiscrete(SVGData.mColorInterpolation, svg->mColorInterpolation, inherited,
+  SetDiscrete(SVGData.mColorInterpolation, svg->mColorInterpolation,
+              canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_AUTO,
               parentSVG->mColorInterpolation,
               NS_STYLE_COLOR_INTERPOLATION_SRGB,
               NS_STYLE_COLOR_INTERPOLATION_AUTO, 0, 0, 0);
 
   // color-interpolation-filters: enum, auto, inherit, initial
   SetDiscrete(SVGData.mColorInterpolationFilters,
-              svg->mColorInterpolationFilters, inherited,
+              svg->mColorInterpolationFilters, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_AUTO,
               parentSVG->mColorInterpolationFilters,
               NS_STYLE_COLOR_INTERPOLATION_LINEARRGB,
               NS_STYLE_COLOR_INTERPOLATION_AUTO, 0, 0, 0);
 
   // fill: 
   SetSVGPaint(SVGData.mFill, parentSVG->mFill, mPresContext, aContext,
-              svg->mFill, eStyleSVGPaintType_Color, inherited);
+              svg->mFill, eStyleSVGPaintType_Color, canStoreInRuleTree);
 
   // fill-opacity: factor, inherit, initial
-  SetFactor(SVGData.mFillOpacity, svg->mFillOpacity, inherited,
+  SetFactor(SVGData.mFillOpacity, svg->mFillOpacity, canStoreInRuleTree,
             parentSVG->mFillOpacity, 1.0f, SETFCT_OPACITY);
 
   // fill-rule: enum, inherit, initial
-  SetDiscrete(SVGData.mFillRule, svg->mFillRule, inherited,
+  SetDiscrete(SVGData.mFillRule, svg->mFillRule, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentSVG->mFillRule,
               NS_STYLE_FILL_RULE_NONZERO, 0, 0, 0, 0);
 
   // marker-end: url, none, inherit
   if (eCSSUnit_URL == SVGData.mMarkerEnd.GetUnit()) {
     svg->mMarkerEnd = SVGData.mMarkerEnd.GetURLValue();
   } else if (eCSSUnit_None == SVGData.mMarkerEnd.GetUnit() ||
              eCSSUnit_Initial == SVGData.mMarkerEnd.GetUnit()) {
     svg->mMarkerEnd = nsnull;
   } else if (eCSSUnit_Inherit == SVGData.mMarkerEnd.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     svg->mMarkerEnd = parentSVG->mMarkerEnd;
   }
 
   // marker-mid: url, none, inherit
   if (eCSSUnit_URL == SVGData.mMarkerMid.GetUnit()) {
     svg->mMarkerMid = SVGData.mMarkerMid.GetURLValue();
   } else if (eCSSUnit_None == SVGData.mMarkerMid.GetUnit() ||
              eCSSUnit_Initial == SVGData.mMarkerMid.GetUnit()) {
     svg->mMarkerMid = nsnull;
   } else if (eCSSUnit_Inherit == SVGData.mMarkerMid.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     svg->mMarkerMid = parentSVG->mMarkerMid;
   }
 
   // marker-start: url, none, inherit
   if (eCSSUnit_URL == SVGData.mMarkerStart.GetUnit()) {
     svg->mMarkerStart = SVGData.mMarkerStart.GetURLValue();
   } else if (eCSSUnit_None == SVGData.mMarkerStart.GetUnit() ||
              eCSSUnit_Initial == SVGData.mMarkerStart.GetUnit()) {
     svg->mMarkerStart = nsnull;
   } else if (eCSSUnit_Inherit == SVGData.mMarkerStart.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     svg->mMarkerStart = parentSVG->mMarkerStart;
   }
 
   // pointer-events: enum, none, inherit, initial
-  SetDiscrete(SVGData.mPointerEvents, svg->mPointerEvents, inherited,
+  SetDiscrete(SVGData.mPointerEvents, svg->mPointerEvents, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_NONE, parentSVG->mPointerEvents,
               NS_STYLE_POINTER_EVENTS_VISIBLEPAINTED, 0,
               NS_STYLE_POINTER_EVENTS_NONE, 0, 0);
 
   // shape-rendering: enum, auto, inherit
-  SetDiscrete(SVGData.mShapeRendering, svg->mShapeRendering, inherited,
+  SetDiscrete(SVGData.mShapeRendering, svg->mShapeRendering, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_AUTO,
               parentSVG->mShapeRendering,
               NS_STYLE_SHAPE_RENDERING_AUTO, 
               NS_STYLE_SHAPE_RENDERING_AUTO, 0, 0, 0);
 
   // stroke: 
   SetSVGPaint(SVGData.mStroke, parentSVG->mStroke, mPresContext, aContext,
-              svg->mStroke, eStyleSVGPaintType_None, inherited);
+              svg->mStroke, eStyleSVGPaintType_None, canStoreInRuleTree);
 
   // stroke-dasharray: <dasharray>, none, inherit
   nsCSSValueList *list = SVGData.mStrokeDasharray;
   if (list) {
     if (eCSSUnit_Inherit == list->mValue.GetUnit()) {
       // only do the copy if weren't already set up by the copy constructor
       // FIXME Bug 389408: This is broken when aStartStruct is non-null!
       if (!svg->mStrokeDasharray) {
-        inherited = PR_TRUE;
+        canStoreInRuleTree = PR_FALSE;
         svg->mStrokeDasharrayLength = parentSVG->mStrokeDasharrayLength;
         if (svg->mStrokeDasharrayLength) {
           svg->mStrokeDasharray = new nsStyleCoord[svg->mStrokeDasharrayLength];
           if (svg->mStrokeDasharray)
             memcpy(svg->mStrokeDasharray,
                    parentSVG->mStrokeDasharray,
                    svg->mStrokeDasharrayLength * sizeof(nsStyleCoord));
           else
@@ -5070,153 +5123,156 @@ nsRuleNode::ComputeSVGData(void* aStartS
 
         if (svg->mStrokeDasharray) {
           value = SVGData.mStrokeDasharray;
           PRUint32 i = 0;
           while (nsnull != value) {
             SetCoord(value->mValue,
                      svg->mStrokeDasharray[i++], nsnull,
                      SETCOORD_LP | SETCOORD_FACTOR,
-                     aContext, mPresContext, inherited);
+                     aContext, mPresContext, canStoreInRuleTree);
             value = value->mNext;
           }
         } else
           svg->mStrokeDasharrayLength = 0;
       }
     }
   }
 
   // stroke-dashoffset: <dashoffset>, inherit
   SetCoord(SVGData.mStrokeDashoffset,
            svg->mStrokeDashoffset, parentSVG->mStrokeDashoffset,
            SETCOORD_LPH | SETCOORD_FACTOR | SETCOORD_INITIAL_ZERO,
-           aContext, mPresContext, inherited);
+           aContext, mPresContext, canStoreInRuleTree);
 
   // stroke-linecap: enum, inherit, initial
-  SetDiscrete(SVGData.mStrokeLinecap, svg->mStrokeLinecap, inherited,
+  SetDiscrete(SVGData.mStrokeLinecap, svg->mStrokeLinecap, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentSVG->mStrokeLinecap,
               NS_STYLE_STROKE_LINECAP_BUTT, 0, 0, 0, 0);
 
   // stroke-linejoin: enum, inherit, initial
-  SetDiscrete(SVGData.mStrokeLinejoin, svg->mStrokeLinejoin, inherited,
+  SetDiscrete(SVGData.mStrokeLinejoin, svg->mStrokeLinejoin, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentSVG->mStrokeLinejoin,
               NS_STYLE_STROKE_LINEJOIN_MITER, 0, 0, 0, 0);
 
   // stroke-miterlimit: <miterlimit>, inherit
-  SetFactor(SVGData.mStrokeMiterlimit, svg->mStrokeMiterlimit, inherited,
+  SetFactor(SVGData.mStrokeMiterlimit, svg->mStrokeMiterlimit,
+            canStoreInRuleTree,
             parentSVG->mStrokeMiterlimit, 4.0f);
 
   // stroke-opacity:
-  SetFactor(SVGData.mStrokeOpacity, svg->mStrokeOpacity, inherited,
+  SetFactor(SVGData.mStrokeOpacity, svg->mStrokeOpacity, canStoreInRuleTree,
             parentSVG->mStrokeOpacity, 1.0f, SETFCT_OPACITY);
 
   // stroke-width:
   if (eCSSUnit_Initial == SVGData.mStrokeWidth.GetUnit()) {
     svg->mStrokeWidth.SetCoordValue(nsPresContext::CSSPixelsToAppUnits(1));
   } else {
     SetCoord(SVGData.mStrokeWidth,
              svg->mStrokeWidth, parentSVG->mStrokeWidth,
              SETCOORD_LPH | SETCOORD_FACTOR,
-             aContext, mPresContext, inherited);
+             aContext, mPresContext, canStoreInRuleTree);
   }
 
   // text-anchor: enum, inherit, initial
-  SetDiscrete(SVGData.mTextAnchor, svg->mTextAnchor, inherited,
+  SetDiscrete(SVGData.mTextAnchor, svg->mTextAnchor, canStoreInRuleTree,
               SETDSC_ENUMERATED, parentSVG->mTextAnchor,
               NS_STYLE_TEXT_ANCHOR_START, 0, 0, 0, 0);
   
   // text-rendering: enum, auto, inherit, initial
-  SetDiscrete(SVGData.mTextRendering, svg->mTextRendering, inherited,
+  SetDiscrete(SVGData.mTextRendering, svg->mTextRendering, canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_AUTO,
               parentSVG->mTextRendering,
               NS_STYLE_TEXT_RENDERING_AUTO,
               NS_STYLE_TEXT_RENDERING_AUTO, 0, 0, 0);
 
   COMPUTE_END_INHERITED(SVG, svg)
 }
 
 const void* 
 nsRuleNode::ComputeSVGResetData(void* aStartStruct,
                                 const nsRuleDataStruct& aData,
                                 nsStyleContext* aContext, 
                                 nsRuleNode* aHighestNode,
-                                const RuleDetail aRuleDetail, PRBool aInherited)
+                                const RuleDetail aRuleDetail,
+                                const PRBool aCanStoreInRuleTree)
 {
   COMPUTE_START_RESET(SVGReset, (), svgReset, parentSVGReset, SVG, SVGData)
 
   // stop-color:
   if (eCSSUnit_Initial == SVGData.mStopColor.GetUnit()) {
     svgReset->mStopColor = NS_RGB(0, 0, 0);
   } else {
     SetColor(SVGData.mStopColor, parentSVGReset->mStopColor,
-             mPresContext, aContext, svgReset->mStopColor, inherited);
+             mPresContext, aContext, svgReset->mStopColor, canStoreInRuleTree);
   }
 
   // flood-color:
   if (eCSSUnit_Initial == SVGData.mFloodColor.GetUnit()) {
     svgReset->mFloodColor = NS_RGB(0, 0, 0);
   } else {
     SetColor(SVGData.mFloodColor, parentSVGReset->mFloodColor,
-             mPresContext, aContext, svgReset->mFloodColor, inherited);
+             mPresContext, aContext, svgReset->mFloodColor, canStoreInRuleTree);
   }
 
   // lighting-color:
   if (eCSSUnit_Initial == SVGData.mLightingColor.GetUnit()) {
     svgReset->mLightingColor = NS_RGB(255, 255, 255);
   } else {
     SetColor(SVGData.mLightingColor, parentSVGReset->mLightingColor,
-             mPresContext, aContext, svgReset->mLightingColor, inherited);
+             mPresContext, aContext, svgReset->mLightingColor,
+             canStoreInRuleTree);
   }
 
   // clip-path: url, none, inherit
   if (eCSSUnit_URL == SVGData.mClipPath.GetUnit()) {
     svgReset->mClipPath = SVGData.mClipPath.GetURLValue();
   } else if (eCSSUnit_None == SVGData.mClipPath.GetUnit() ||
              eCSSUnit_Initial == SVGData.mClipPath.GetUnit()) {
     svgReset->mClipPath = nsnull;
   } else if (eCSSUnit_Inherit == SVGData.mClipPath.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     svgReset->mClipPath = parentSVGReset->mClipPath;
   }
 
   // stop-opacity:
-  SetFactor(SVGData.mStopOpacity, svgReset->mStopOpacity, inherited,
+  SetFactor(SVGData.mStopOpacity, svgReset->mStopOpacity, canStoreInRuleTree,
             parentSVGReset->mStopOpacity, 1.0f, SETFCT_OPACITY);
 
   // flood-opacity:
-  SetFactor(SVGData.mFloodOpacity, svgReset->mFloodOpacity, inherited,
+  SetFactor(SVGData.mFloodOpacity, svgReset->mFloodOpacity, canStoreInRuleTree,
             parentSVGReset->mFloodOpacity, 1.0f, SETFCT_OPACITY);
 
   // dominant-baseline: enum, auto, inherit, initial
   SetDiscrete(SVGData.mDominantBaseline, svgReset->mDominantBaseline,
-              inherited,
+              canStoreInRuleTree,
               SETDSC_ENUMERATED | SETDSC_AUTO,
               parentSVGReset->mDominantBaseline,
               NS_STYLE_DOMINANT_BASELINE_AUTO,
               NS_STYLE_DOMINANT_BASELINE_AUTO, 0, 0, 0);
 
   // filter: url, none, inherit
   if (eCSSUnit_URL == SVGData.mFilter.GetUnit()) {
     svgReset->mFilter = SVGData.mFilter.GetURLValue();
   } else if (eCSSUnit_None == SVGData.mFilter.GetUnit() ||
              eCSSUnit_Initial == SVGData.mFilter.GetUnit()) {
     svgReset->mFilter = nsnull;
   } else if (eCSSUnit_Inherit == SVGData.mFilter.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     svgReset->mFilter = parentSVGReset->mFilter;
   }
 
   // mask: url, none, inherit
   if (eCSSUnit_URL == SVGData.mMask.GetUnit()) {
     svgReset->mMask = SVGData.mMask.GetURLValue();
   } else if (eCSSUnit_None == SVGData.mMask.GetUnit() ||
              eCSSUnit_Initial == SVGData.mMask.GetUnit()) {
     svgReset->mMask = nsnull;
   } else if (eCSSUnit_Inherit == SVGData.mMask.GetUnit()) {
-    inherited = PR_TRUE;
+    canStoreInRuleTree = PR_FALSE;
     svgReset->mMask = parentSVGReset->mMask;
   }
   
   COMPUTE_END_RESET(SVGReset, svgReset)
 }
 #endif
 
 inline const void* 
--- a/layout/style/nsRuleNode.h
+++ b/layout/style/nsRuleNode.h
@@ -470,189 +470,213 @@ protected:
   NS_HIDDEN_(const void*)
     WalkRuleTree(const nsStyleStructID aSID, nsStyleContext* aContext, 
                  nsRuleData* aRuleData, nsRuleDataStruct* aSpecificData);
 
   NS_HIDDEN_(const void*)
     ComputeDisplayData(void* aStartStruct,
                        const nsRuleDataStruct& aData,
                        nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                       RuleDetail aRuleDetail, PRBool aInherited);
+                       RuleDetail aRuleDetail,
+                       const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeVisibilityData(void* aStartStruct,
                           const nsRuleDataStruct& aData,
                           nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                          RuleDetail aRuleDetail, PRBool aInherited);
+                          RuleDetail aRuleDetail,
+                          const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeFontData(void* aStartStruct,
                     const nsRuleDataStruct& aData,
                     nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                    RuleDetail aRuleDetail, PRBool aInherited);
+                    RuleDetail aRuleDetail,
+                    const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeColorData(void* aStartStruct,
                      const nsRuleDataStruct& aData,
                      nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                     RuleDetail aRuleDetail, PRBool aInherited);
+                     RuleDetail aRuleDetail,
+                     const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeBackgroundData(void* aStartStruct,
                           const nsRuleDataStruct& aData, 
                           nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                          RuleDetail aRuleDetail, PRBool aInherited);
+                          RuleDetail aRuleDetail,
+                          const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeMarginData(void* aStartStruct,
                       const nsRuleDataStruct& aData, 
                       nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                      RuleDetail aRuleDetail, PRBool aInherited);
+                      RuleDetail aRuleDetail,
+                      const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeBorderData(void* aStartStruct,
                       const nsRuleDataStruct& aData, 
                       nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                      RuleDetail aRuleDetail, PRBool aInherited);
+                      RuleDetail aRuleDetail,
+                      const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputePaddingData(void* aStartStruct,
                        const nsRuleDataStruct& aData, 
                        nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                       RuleDetail aRuleDetail, PRBool aInherited);
+                       RuleDetail aRuleDetail,
+                       const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeOutlineData(void* aStartStruct,
                        const nsRuleDataStruct& aData, 
                        nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                       RuleDetail aRuleDetail, PRBool aInherited);
+                       RuleDetail aRuleDetail,
+                       const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeListData(void* aStartStruct,
                     const nsRuleDataStruct& aData,
                     nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                    RuleDetail aRuleDetail, PRBool aInherited);
+                    RuleDetail aRuleDetail,
+                    const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputePositionData(void* aStartStruct,
                         const nsRuleDataStruct& aData, 
                         nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                        RuleDetail aRuleDetail, PRBool aInherited);
+                        RuleDetail aRuleDetail,
+                        const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeTableData(void* aStartStruct,
                      const nsRuleDataStruct& aData, 
                      nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                     RuleDetail aRuleDetail, PRBool aInherited);
+                     RuleDetail aRuleDetail,
+                     const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeTableBorderData(void* aStartStruct,
                            const nsRuleDataStruct& aData, 
                            nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                           RuleDetail aRuleDetail, PRBool aInherited);
+                           RuleDetail aRuleDetail,
+                           const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeContentData(void* aStartStruct,
                        const nsRuleDataStruct& aData,
                        nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                       RuleDetail aRuleDetail, PRBool aInherited);
+                       RuleDetail aRuleDetail,
+                       const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeQuotesData(void* aStartStruct,
                       const nsRuleDataStruct& aData, 
                       nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                      RuleDetail aRuleDetail, PRBool aInherited);
+                      RuleDetail aRuleDetail,
+                      const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeTextData(void* aStartStruct,
                     const nsRuleDataStruct& aData, 
                     nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                    RuleDetail aRuleDetail, PRBool aInherited);
+                    RuleDetail aRuleDetail,
+                    const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeTextResetData(void* aStartStruct,
                          const nsRuleDataStruct& aData,
                          nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                         RuleDetail aRuleDetail, PRBool aInherited);
+                         RuleDetail aRuleDetail,
+                         const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeUserInterfaceData(void* aStartStruct,
                              const nsRuleDataStruct& aData, 
                              nsStyleContext* aContext,
                              nsRuleNode* aHighestNode,
-                             RuleDetail aRuleDetail, PRBool aInherited);
+                             RuleDetail aRuleDetail,
+                             const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeUIResetData(void* aStartStruct,
                        const nsRuleDataStruct& aData,
                        nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                       RuleDetail aRuleDetail, PRBool aInherited);
+                       RuleDetail aRuleDetail,
+                       const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeXULData(void* aStartStruct,
                    const nsRuleDataStruct& aData, 
                    nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                   RuleDetail aRuleDetail, PRBool aInherited);
+                   RuleDetail aRuleDetail,
+                   const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeColumnData(void* aStartStruct,
                       const nsRuleDataStruct& aData,
                       nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                      RuleDetail aRuleDetail, PRBool aInherited);
+                      RuleDetail aRuleDetail,
+                      const PRBool aCanStoreInRuleTree);
 
 #ifdef MOZ_SVG
   NS_HIDDEN_(const void*)
     ComputeSVGData(void* aStartStruct,
                    const nsRuleDataStruct& aData, 
                    nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                   RuleDetail aRuleDetail, PRBool aInherited);
+                   RuleDetail aRuleDetail,
+                   const PRBool aCanStoreInRuleTree);
 
   NS_HIDDEN_(const void*)
     ComputeSVGResetData(void* aStartStruct,
                         const nsRuleDataStruct& aData, 
                         nsStyleContext* aContext, nsRuleNode* aHighestNode,
-                        RuleDetail aRuleDetail, PRBool aInherited);
+                        RuleDetail aRuleDetail,
+                        const PRBool aCanStoreInRuleTree);
 #endif
 
   // helpers for |ComputeFontData| that need access to |mNoneBits|:
   static NS_HIDDEN_(void) SetFontSize(nsPresContext* aPresContext,
                                       const nsRuleDataFont& aFontData,
                                       const nsStyleFont* aFont,
                                       const nsStyleFont* aParentFont,
                                       nscoord* aSize,
                                       const nsFont& aSystemFont,
                                       nscoord aParentSize,
                                       nscoord aScriptLevelAdjustedParentSize,
                                       PRBool aUsedStartStruct,
                                       PRBool aAtRoot,
-                                      PRBool& aInherited);
+                                      PRBool& aCanStoreInRuleTree);
 
   static NS_HIDDEN_(void) SetFont(nsPresContext* aPresContext,
                                   nsStyleContext* aContext,
                                   nscoord aMinFontSize,
                                   PRUint8 aGenericFontID,
                                   const nsRuleDataFont& aFontData,
                                   const nsStyleFont* aParentFont,
                                   nsStyleFont* aFont,
-                                  PRBool aStartStruct, PRBool& aInherited);
+                                  PRBool aStartStruct,
+                                  PRBool& aCanStoreInRuleTree);
 
   static NS_HIDDEN_(void) SetGenericFont(nsPresContext* aPresContext,
                                          nsStyleContext* aContext,
                                          PRUint8 aGenericFontID,
                                          nscoord aMinFontSize,
                                          nsStyleFont* aFont);
 
   NS_HIDDEN_(void) AdjustLogicalBoxProp(nsStyleContext* aContext,
                                         const nsCSSValue& aLTRSource,
                                         const nsCSSValue& aRTLSource,
                                         const nsCSSValue& aLTRLogicalValue,
                                         const nsCSSValue& aRTLLogicalValue,
                                         PRUint8 aSide,
                                         nsCSSRect& aValueRect,
-                                        PRBool& aInherited);
+                                        PRBool& aCanStoreInRuleTree);
 
   inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, const nsRuleDataStruct& aRuleDataStruct);
 
   NS_HIDDEN_(const void*) GetParentData(const nsStyleStructID aSID);
   #define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_)  \
     NS_HIDDEN_(const nsStyle##name_*) GetParent##name_();
   #include "nsStyleStructList.h"
   #undef STYLE_STRUCT  
@@ -746,17 +770,17 @@ public:
 
   // Expose this so media queries can use it
   static nscoord CalcLengthWithInitialFont(nsPresContext* aPresContext,
                                            const nsCSSValue& aValue);
   // Expose this so nsTransformFunctions can use it.
   static nscoord CalcLength(const nsCSSValue& aValue,
                             nsStyleContext* aStyleContext,
                             nsPresContext* aPresContext,
-                            PRBool& aInherited);
+                            PRBool& aCanStoreInRuleTree);
 
   // Return whether the rule tree for which this node is the root has
   // cached data such that we need to do dynamic change handling for
   // changes that change the results of media queries or require
   // rebuilding all style data.
   PRBool TreeHasCachedData() const {
     NS_ASSERTION(IsRoot(), "should only be called on root of rule tree");
     return HaveChildren() || mStyleData.mInheritedData || mStyleData.mResetData;
--- a/layout/style/nsStyleTransformMatrix.cpp
+++ b/layout/style/nsStyleTransformMatrix.cpp
@@ -231,140 +231,142 @@ nsStyleTransformMatrix::operator *(const
 {
   return nsStyleTransformMatrix(*this) *= aOther;
 }
 
 /* Helper function to fill in an nscoord with the specified nsCSSValue. */
 static void SetCoordToValue(const nsCSSValue &aValue,
                             nsStyleContext* aContext,
                             nsPresContext* aPresContext,
-                            PRBool &aInherited, nscoord &aOut)
+                            PRBool &aCanStoreInRuleTree, nscoord &aOut)
 {
-  aOut = nsRuleNode::CalcLength(aValue, aContext, aPresContext, aInherited);
+  aOut = nsRuleNode::CalcLength(aValue, aContext, aPresContext,
+                                aCanStoreInRuleTree);
 }
 
 /* Helper function to process a matrix entry. */
 static void ProcessMatrix(float aMain[4], nscoord aDelta[2],
                           float aX[2], float aY[2],
                           const nsCSSValue::Array* aData,
                           nsStyleContext* aContext,
                           nsPresContext* aPresContext,
-                          PRBool& aInherited)
+                          PRBool& aCanStoreInRuleTree)
 {
   NS_PRECONDITION(aData->Count() == 7, "Invalid array!");
 
   /* Take the first four elements out of the array as floats and store
    * them in aMain.
    */
   for (PRUint16 index = 1; index <= 4; ++index)
     aMain[index - 1] = aData->Item(index).GetFloatValue();
 
   /* For the fifth element, if it's a percentage, store it in aX[0].
    * Otherwise, it's a length that needs to go in aDelta[0]
    */
   if (aData->Item(5).GetUnit() == eCSSUnit_Percent)
     aX[0] = aData->Item(5).GetPercentValue();
   else
-    SetCoordToValue(aData->Item(5), aContext, aPresContext, aInherited,
+    SetCoordToValue(aData->Item(5), aContext, aPresContext, aCanStoreInRuleTree,
                     aDelta[0]);
 
   /* For the final element, if it's a percentage, store it in aY[1].
    * Otherwise, it's a length that needs to go in aDelta[1].
    */
   if (aData->Item(6).GetUnit() == eCSSUnit_Percent)
     aY[1] = aData->Item(6).GetPercentValue();
   else
-    SetCoordToValue(aData->Item(6), aContext, aPresContext, aInherited,
+    SetCoordToValue(aData->Item(6), aContext, aPresContext, aCanStoreInRuleTree,
                     aDelta[1]);
 }
 
 /* Helper function to process a translatex function. */
 static void ProcessTranslateX(nscoord aDelta[2], float aX[2],
                               const nsCSSValue::Array* aData,
                               nsStyleContext* aContext,
                               nsPresContext* aPresContext,
-                              PRBool& aInherited)
+                              PRBool& aCanStoreInRuleTree)
 {
   NS_PRECONDITION(aData->Count() == 2, "Invalid array!");
 
   /* There are two cases.  If we have a number, we want our matrix to look
    * like this:
    *
    * |  1  0 dx|
    * |  0  1  0|
    * |  0  0  1|
    * So E = value
    * 
    * Otherwise, we might have a percentage, so we want to set the dX component
    * to the percent.
    */
   if (aData->Item(1).GetUnit() != eCSSUnit_Percent)
-    SetCoordToValue(aData->Item(1), aContext, aPresContext, aInherited,
+    SetCoordToValue(aData->Item(1), aContext, aPresContext, aCanStoreInRuleTree,
                     aDelta[0]);
   else
     aX[0] = aData->Item(1).GetPercentValue();
 }
 
 /* Helper function to process a translatey function. */
 static void ProcessTranslateY(nscoord aDelta[2], float aY[2],
                               const nsCSSValue::Array* aData,
                               nsStyleContext* aContext,
                               nsPresContext* aPresContext,
-                              PRBool& aInherited)
+                              PRBool& aCanStoreInRuleTree)
 {
   NS_PRECONDITION(aData->Count() == 2, "Invalid array!");
 
   /* There are two cases.  If we have a number, we want our matrix to look
    * like this:
    *
    * |  1  0  0|
    * |  0  1 dy|
    * |  0  0  1|
    * So E = value
    * 
    * Otherwise, we might have a percentage, so we want to set the dY component
    * to the percent.
    */
   if (aData->Item(1).GetUnit() != eCSSUnit_Percent)
-    SetCoordToValue(aData->Item(1), aContext, aPresContext, aInherited,
+    SetCoordToValue(aData->Item(1), aContext, aPresContext, aCanStoreInRuleTree,
                     aDelta[1]);
   else
     aY[1] = aData->Item(1).GetPercentValue();
 }
 
 /* Helper function to process a translate function. */
 static void ProcessTranslate(nscoord aDelta[2], float aX[2], float aY[2],
                              const nsCSSValue::Array* aData,
                              nsStyleContext* aContext,
                              nsPresContext* aPresContext,
-                             PRBool& aInherited)
+                             PRBool& aCanStoreInRuleTree)
 {
   NS_PRECONDITION(aData->Count() == 2 || aData->Count() == 3, "Invalid array!");
 
   /* There are several cases to consider.
    * First, we might have one value, or we might have two.  If we have
    * two, we need to consider both dX and dY components.
    * Next, the values might be lengths, or they might be percents.  If they're
    * percents, store them in the dX and dY components.  Otherwise, store them in
    * the main matrix.
    */
 
   const nsCSSValue &dx = aData->Item(1);
   if (dx.GetUnit() == eCSSUnit_Percent)
     aX[0] = dx.GetPercentValue();
   else
-    SetCoordToValue(dx, aContext, aPresContext, aInherited, aDelta[0]);
+    SetCoordToValue(dx, aContext, aPresContext, aCanStoreInRuleTree, aDelta[0]);
 
   /* If we read in a Y component, set it appropriately */
   if (aData->Count() == 3) {
     const nsCSSValue &dy = aData->Item(2);
     if (dy.GetUnit() == eCSSUnit_Percent)
       aY[1] = dy.GetPercentValue();
     else
-      SetCoordToValue(dy, aContext, aPresContext, aInherited, aDelta[1]); 
+      SetCoordToValue(dy, aContext, aPresContext, aCanStoreInRuleTree,
+                      aDelta[1]); 
   }
 }
 
 /* Helper function to set up a scale matrix. */
 static void ProcessScaleHelper(float aXScale, float aYScale, float aMain[4])
 {
   /* We want our matrix to look like this:
    * | dx  0  0|
@@ -470,40 +472,42 @@ static void ProcessRotate(float aMain[4]
 /**
  * SetToTransformFunction is essentially a giant switch statement that fans
  * out to many smaller helper functions.
  */
 void
 nsStyleTransformMatrix::SetToTransformFunction(const nsCSSValue::Array * aData,
                                                nsStyleContext* aContext,
                                                nsPresContext* aPresContext,
-                                               PRBool& aInherited)
+                                               PRBool& aCanStoreInRuleTree)
 {
   NS_PRECONDITION(aData, "Why did you want to get data from a null array?");
   NS_PRECONDITION(aContext, "Need a context for unit conversion!");
   NS_PRECONDITION(aPresContext, "Need a context for unit conversion!");
   
   /* Reset the matrix to the identity so that each subfunction can just
    * worry about its own components.
    */
   SetToIdentity();
 
   /* Get the keyword for the transform. */
   nsAutoString keyword;
   aData->Item(0).GetStringValue(keyword);
   switch (nsCSSKeywords::LookupKeyword(keyword)) {
   case eCSSKeyword_translatex:
-    ProcessTranslateX(mDelta, mX, aData, aContext, aPresContext, aInherited);
+    ProcessTranslateX(mDelta, mX, aData, aContext, aPresContext,
+                      aCanStoreInRuleTree);
     break;
   case eCSSKeyword_translatey:
-    ProcessTranslateY(mDelta, mY, aData, aContext, aPresContext, aInherited);
+    ProcessTranslateY(mDelta, mY, aData, aContext, aPresContext,
+                      aCanStoreInRuleTree);
     break;
   case eCSSKeyword_translate:
     ProcessTranslate(mDelta, mX, mY, aData, aContext, aPresContext,
-                     aInherited);
+                     aCanStoreInRuleTree);
     break;
   case eCSSKeyword_scalex:
     ProcessScaleX(mMain, aData);
     break;
   case eCSSKeyword_scaley:
     ProcessScaleY(mMain, aData);
     break;
   case eCSSKeyword_scale:
@@ -518,17 +522,17 @@ nsStyleTransformMatrix::SetToTransformFu
   case eCSSKeyword_skew:
     ProcessSkew(mMain, aData);
     break;
   case eCSSKeyword_rotate:
     ProcessRotate(mMain, aData);
     break;
   case eCSSKeyword_matrix:
     ProcessMatrix(mMain, mDelta, mX, mY, aData, aContext, aPresContext,
-                  aInherited);
+                  aCanStoreInRuleTree);
     break;
   default:
     NS_NOTREACHED("Unknown transform function!");
   }
 }
 
 /* Does an element-by-element comparison and returns whether or not the
  * matrices are equal.
--- a/layout/style/nsStyleTransformMatrix.h
+++ b/layout/style/nsStyleTransformMatrix.h
@@ -107,23 +107,23 @@ class nsStyleTransformMatrix
 
   /**
    * Given an nsCSSValue::Array* containing a -moz-transform function,
    * updates this matrix to hold the value of that function.
    *
    * @param aData The nsCSSValue::Array* containing the transform function.
    * @param aContext The style context, used for unit conversion.
    * @param aPresContext The presentation context, used for unit conversion.
-   * @param aInherited Set to true if the result cannot be cached in the rule
-   *                   tree, otherwise untouched.
+   * @param aCanStoreInRuleTree Set to false if the result cannot be cached
+   *                            in the rule tree, otherwise untouched.
    */
   void SetToTransformFunction(const nsCSSValue::Array* aData,
                               nsStyleContext* aContext,
                               nsPresContext* aPresContext,
-                              PRBool& aInherited);
+                              PRBool& aCanStoreInRuleTree);
 
   /**
    * Sets this matrix to be the identity matrix.
    */
   void SetToIdentity();
 
   /**
    * Returns the value of the entry at the 2x2 submatrix of the
--- a/layout/style/nsStyleUtil.cpp
+++ b/layout/style/nsStyleUtil.cpp
@@ -46,17 +46,16 @@
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsINameSpaceManager.h"
 #include "nsIURI.h"
 #include "nsNetUtil.h"
 #include "nsReadableUtils.h"
 #include "nsContentUtils.h"
 #include "nsTextFormatter.h"
-#include "nsIScriptError.h"
 
 // XXX This is here because nsCachedStyleData is accessed outside of
 // the content module; e.g., by nsCSSFrameConstructor.
 #include "nsRuleNode.h"
 
 nsCachedStyleData::StyleStructInfo
 nsCachedStyleData::gInfo[] = {
 
@@ -602,17 +601,8 @@ nsStyleUtil::IsSignificantChild(nsIConte
     return PR_TRUE;
   }
 
   return aTextIsSignificant && isText && aChild->TextLength() != 0 &&
          (aWhitespaceIsSignificant ||
           !aChild->TextIsOnlyWhitespace());
 }
 
-/* static */ void
-nsStyleUtil::ReportUseOfDeprecatedMethod(nsIURI* aURI, const char* aWarning)
-{
-  nsContentUtils::ReportToConsole(nsContentUtils::eCSS_PROPERTIES,
-                                  aWarning, nsnull, 0, aURI,
-                                  EmptyString(), 0, 0,
-                                  nsIScriptError::warningFlag,
-                                  "CSS Object Model");
-}
--- a/layout/style/nsStyleUtil.h
+++ b/layout/style/nsStyleUtil.h
@@ -104,14 +104,12 @@ public:
   static float ColorComponentToFloat(PRUint8 aAlpha);
 
   /*
    * Does this child count as significant for selector matching?
    */
   static PRBool IsSignificantChild(nsIContent* aChild,
                                    PRBool aTextIsSignificant,
                                    PRBool aWhitespaceIsSignificant);
-
-  static void ReportUseOfDeprecatedMethod(nsIURI* aURI, const char* aWarning);
 };
 
 
 #endif /* nsStyleUtil_h___ */
--- a/modules/libpr0n/src/imgLoader.cpp
+++ b/modules/libpr0n/src/imgLoader.cpp
@@ -123,18 +123,16 @@ static PRBool NewRequestAndEntry(nsIURI 
   if (!*entry) {
     delete *request;
     return PR_FALSE;
   }
 
   NS_ADDREF(*request);
   NS_ADDREF(*entry);
 
-  imgLoader::SetHasNoProxies(uri, *entry);
-
   return PR_TRUE;
 }
 
 static PRBool ShouldRevalidateEntry(imgCacheEntry *aEntry,
                               nsLoadFlags aFlags,
                               PRBool aHasExpired)
 {
   PRBool bValidateEntry = PR_FALSE;
@@ -244,77 +242,46 @@ static PRUint32 SecondsFromPRTime(PRTime
 }
 
 imgCacheEntry::imgCacheEntry(imgRequest *request, PRBool mustValidateIfExpired /* = PR_FALSE */)
  : mRequest(request),
    mDataSize(0),
    mTouchedTime(SecondsFromPRTime(PR_Now())),
    mExpiryTime(0),
    mMustValidateIfExpired(mustValidateIfExpired),
-   mEvicted(PR_FALSE),
-   mHasNoProxies(PR_TRUE)
+   mEvicted(PR_FALSE)
 {}
 
-imgCacheEntry::~imgCacheEntry()
-{
-  LOG_FUNC(gImgLog, "imgCacheEntry::~imgCacheEntry()");
-}
-
 void imgCacheEntry::TouchWithSize(PRInt32 diff)
 {
   LOG_SCOPE(gImgLog, "imgCacheEntry::TouchWithSize");
 
   mTouchedTime = SecondsFromPRTime(PR_Now());
 
-  // Don't update the cache if we've been removed from it or it doesn't care
-  // about our size or usage.
-  if (!Evicted() && HasNoProxies()) {
-    // We can't use mKeyURI here, because we're not guaranteed to be updated if
-    // the request has no observers and has thus dropped its reference to us.
+  if (!Evicted()) {
     nsCOMPtr<nsIURI> uri;
     mRequest->GetKeyURI(getter_AddRefs(uri));
     imgLoader::CacheEntriesChanged(uri, diff);
   }
 }
 
 void imgCacheEntry::Touch(PRBool updateTime /* = PR_TRUE */)
 {
   LOG_SCOPE(gImgLog, "imgCacheEntry::Touch");
 
   if (updateTime)
     mTouchedTime = SecondsFromPRTime(PR_Now());
 
-  // Don't update the cache if we've been removed from it or it doesn't care
-  // about our size or usage.
-  if (!Evicted() && HasNoProxies()) {
-    // We can't use mKeyURI here, because we're not guaranteed to be updated if
-    // the request has no observers and has thus dropped its reference to us.
+  if (!Evicted()) {
     nsCOMPtr<nsIURI> uri;
     mRequest->GetKeyURI(getter_AddRefs(uri));
     imgLoader::CacheEntriesChanged(uri);
   }
 }
 
-void imgCacheEntry::SetHasNoProxies(PRBool hasNoProxies)
-{
-#if defined(PR_LOGGING)
-  nsCOMPtr<nsIURI> uri;
-  mRequest->GetKeyURI(getter_AddRefs(uri));
-  nsCAutoString spec;
-  if (uri)
-    uri->GetSpec(spec);
-  if (hasNoProxies)
-    LOG_FUNC_WITH_PARAM(gImgLog, "imgCacheEntry::SetHasNoProxies true", "uri", spec.get());
-  else
-    LOG_FUNC_WITH_PARAM(gImgLog, "imgCacheEntry::SetHasNoProxies false", "uri", spec.get());
-#endif
-
-  mHasNoProxies = hasNoProxies;
-}
-
 imgCacheQueue::imgCacheQueue()
  : mDirty(PR_FALSE),
    mSize(0)
 {}
 
 void imgCacheQueue::UpdateSize(PRInt32 diff)
 {
   mSize += diff;
@@ -477,27 +444,16 @@ protected:
 };
 
 imgCacheExpirationTracker::imgCacheExpirationTracker()
  : nsExpirationTracker<imgCacheEntry, 3>(TIMEOUT_SECONDS * 1000)
 {}
 
 void imgCacheExpirationTracker::NotifyExpired(imgCacheEntry *entry)
 {
-#if defined(PR_LOGGING)
-  nsRefPtr<imgRequest> req(entry->GetRequest());
-  if (req) {
-    nsCOMPtr<nsIURI> uri;
-    req->GetKeyURI(getter_AddRefs(uri));
-    nsCAutoString spec;
-    uri->GetSpec(spec);
-    LOG_FUNC_WITH_PARAM(gImgLog, "imgCacheExpirationTracker::NotifyExpired", "entry", spec.get());
-  }
-#endif
-
   // We can be called multiple times on the same entry. Don't do work multiple
   // times.
   if (!entry->Evicted())
     imgLoader::RemoveFromCache(entry);
 
   imgLoader::VerifyCacheSizes();
 }
 
@@ -528,23 +484,23 @@ imgLoader::~imgLoader()
   /* destructor code */
 }
 
 void imgLoader::VerifyCacheSizes()
 {
   if (!gCacheTracker)
     return;
 
+  PRUint32 queuesize = sCacheQueue.GetNumElements() + sChromeCacheQueue.GetNumElements();
   PRUint32 cachesize = sCache.Count() + sChromeCache.Count();
-  PRUint32 queuesize = sCacheQueue.GetNumElements() + sChromeCacheQueue.GetNumElements();
   PRUint32 trackersize = 0;
   for (nsExpirationTracker<imgCacheEntry, 3>::Iterator it(gCacheTracker); it.Next(); )
     trackersize++;
-  NS_ABORT_IF_FALSE(queuesize == trackersize, "Queue and tracker sizes out of sync!");
-  NS_ABORT_IF_FALSE(queuesize <= cachesize, "Queue has more elements than cache!");
+  NS_ASSERTION(queuesize == cachesize, "Queue and cache sizes out of sync!");
+  NS_ASSERTION(queuesize == trackersize, "Queue and tracker sizes out of sync!");
 }
 
 imgLoader::imgCacheTable & imgLoader::GetCache(nsIURI *aURI)
 {
   PRBool chrome = PR_FALSE;
   aURI->SchemeIs("chrome", &chrome);
   if (chrome)
     return sChromeCache;
@@ -632,19 +588,18 @@ NS_IMETHODIMP imgLoader::FindEntryProper
   nsRefPtr<imgCacheEntry> entry;
   nsCAutoString spec;
   imgCacheTable &cache = GetCache(uri);
 
   uri->GetSpec(spec);
   *_retval = nsnull;
 
   if (cache.Get(spec, getter_AddRefs(entry)) && entry) {
-    if (gCacheTracker && entry->HasNoProxies())
+    if (gCacheTracker)
       gCacheTracker->MarkUsed(entry);
-
     nsRefPtr<imgRequest> request = getter_AddRefs(entry->GetRequest());
     if (request) {
       *_retval = request->Properties();
       NS_ADDREF(*_retval);
     }
   }
 
   return NS_OK;
@@ -666,23 +621,23 @@ nsresult imgLoader::ClearChromeImageCach
 
 nsresult imgLoader::ClearImageCache()
 {
   return EvictEntries(sCache, sCacheQueue);
 }
 
 PRBool imgLoader::PutIntoCache(nsIURI *key, imgCacheEntry *entry)
 {
+  LOG_STATIC_FUNC(gImgLog, "imgLoader::PutIntoCache");
+
   imgCacheTable &cache = GetCache(key);
 
   nsCAutoString spec;
   key->GetSpec(spec);
 
-  LOG_STATIC_FUNC_WITH_PARAM(gImgLog, "imgLoader::PutIntoCache", "uri", spec.get());
-
   // Check to see if this request already exists in the cache and is being
   // loaded on a different thread. If so, don't allow this entry to be added to
   // the cache.
   nsRefPtr<imgCacheEntry> tmpCacheEntry;
   if (cache.Get(spec, getter_AddRefs(tmpCacheEntry)) && tmpCacheEntry) {
     PR_LOG(gImgLog, PR_LOG_DEBUG,
            ("[this=%p] imgLoader::PutIntoCache -- Element already in the cache", nsnull));
     nsRefPtr<imgRequest> tmpRequest = getter_AddRefs(tmpCacheEntry->GetRequest());
@@ -700,72 +655,27 @@ PRBool imgLoader::PutIntoCache(nsIURI *k
   } else {
     PR_LOG(gImgLog, PR_LOG_DEBUG,
            ("[this=%p] imgLoader::PutIntoCache -- Element NOT already in the cache", nsnull));
   }
 
   if (!cache.Put(spec, entry))
     return PR_FALSE;
 
-  return PR_TRUE;
-}
-
-PRBool imgLoader::SetHasNoProxies(nsIURI *key, imgCacheEntry *entry)
-{
-#if defined(PR_LOGGING)
-  nsCAutoString spec;
-  key->GetSpec(spec);
-
-  LOG_STATIC_FUNC_WITH_PARAM(gImgLog, "imgLoader::SetHasNoProxies", "uri", spec.get());
-#endif
-
-  if (entry->Evicted())
-    return PR_FALSE;
-
   imgCacheQueue &queue = GetCacheQueue(key);
   queue.Push(entry);
 
   if (gCacheTracker)
     gCacheTracker->AddObject(entry);
 
-  entry->SetHasNoProxies(PR_TRUE);
-
-  imgCacheTable &cache = GetCache(key);
   CheckCacheLimits(cache, queue);
 
   return PR_TRUE;
 }
 
-PRBool imgLoader::SetHasProxies(nsIURI *key)
-{
-  VerifyCacheSizes();
-
-  imgCacheTable &cache = GetCache(key);
-
-  nsCAutoString spec;
-  key->GetSpec(spec);
-
-  LOG_STATIC_FUNC_WITH_PARAM(gImgLog, "imgLoader::SetHasProxies", "uri", spec.get());
-
-  nsRefPtr<imgCacheEntry> entry;
-  if (cache.Get(spec, getter_AddRefs(entry)) && entry && entry->HasNoProxies()) {
-    imgCacheQueue &queue = GetCacheQueue(key);
-    queue.Remove(entry);
-
-    if (gCacheTracker)
-      gCacheTracker->RemoveObject(entry);
-
-    entry->SetHasNoProxies(PR_FALSE);
-
-    return PR_TRUE;
-  }
-
-  return PR_FALSE;
-}
-
 void imgLoader::CacheEntriesChanged(nsIURI *uri, PRInt32 sizediff /* = 0 */)
 {
   imgCacheQueue &queue = GetCacheQueue(uri);
   queue.MarkDirty();
   queue.UpdateSize(sizediff);
 }
 
 void imgLoader::CheckCacheLimits(imgCacheTable &cache, imgCacheQueue &queue)
@@ -776,27 +686,16 @@ void imgLoader::CheckCacheLimits(imgCach
 
   // Remove entries from the cache until we're back under our desired size.
   while (queue.GetSize() >= sCacheMaxSize) {
     // Remove the first entry in the queue.
     nsRefPtr<imgCacheEntry> entry(queue.Pop());
 
     NS_ASSERTION(entry, "imgLoader::CheckCacheLimits -- NULL entry pointer");
 
-#if defined(PR_LOGGING)
-    nsRefPtr<imgRequest> req(entry->GetRequest());
-    if (req) {
-      nsCOMPtr<nsIURI> uri;
-      req->GetKeyURI(getter_AddRefs(uri));
-      nsCAutoString spec;
-      uri->GetSpec(spec);
-      LOG_STATIC_FUNC_WITH_PARAM(gImgLog, "imgLoader::CheckCacheLimits", "entry", spec.get());
-    }
-#endif
-
     if (entry)
       RemoveFromCache(entry);
   }
 }
 
 PRBool imgLoader::ValidateRequestWithNewChannel(imgRequest *request,
                                                 nsIURI *aURI,
                                                 nsIURI *aInitialDocumentURI,
@@ -809,18 +708,16 @@ PRBool imgLoader::ValidateRequestWithNew
                                                 imgIRequest **aProxyRequest)
 {
   // now we need to insert a new channel request object inbetween the real
   // request and the proxy that basically delays loading the image until it
   // gets a 304 or figures out that this needs to be a new request
 
   nsresult rv;
 
-  // If we're currently in the middle of validating this request, just hand
-  // back a proxy to it; the required work will be done for us.
   if (request->mValidator) {
     rv = CreateNewProxyForRequest(request, aLoadGroup, aObserver,
                                   aLoadFlags, aExistingRequest, 
                                   reinterpret_cast<imgIRequest **>(aProxyRequest));
 
     if (*aProxyRequest)
       request->mValidator->AddProxy(static_cast<imgRequestProxy*>(*aProxyRequest));
 
@@ -999,99 +896,63 @@ PRBool imgLoader::ValidateEntry(imgCache
   } 
 
   return !validateRequest;
 }
 
 
 PRBool imgLoader::RemoveFromCache(nsIURI *aKey)
 {
+  LOG_STATIC_FUNC(gImgLog, "imgLoader::RemoveFromCache uri");
   if (!aKey) return PR_FALSE;
 
   imgCacheTable &cache = GetCache(aKey);
   imgCacheQueue &queue = GetCacheQueue(aKey);
 
   nsCAutoString spec;
   aKey->GetSpec(spec);
 
-  LOG_STATIC_FUNC_WITH_PARAM(gImgLog, "imgLoader::RemoveFromCache", "uri", spec.get());
-
   nsRefPtr<imgCacheEntry> entry;
   if (cache.Get(spec, getter_AddRefs(entry)) && entry) {
+    if (gCacheTracker)
+      gCacheTracker->RemoveObject(entry);
     cache.Remove(spec);
-
-    NS_ABORT_IF_FALSE(!entry->Evicted(), "Evicting an already-evicted cache entry!");
-
-    // Entries with no proxies are in the tracker.
-    if (entry->HasNoProxies()) {
-      if (gCacheTracker)
-        gCacheTracker->RemoveObject(entry);
-      queue.Remove(entry);
-    }
-
+    queue.Remove(entry);
     entry->SetEvicted(PR_TRUE);
-
     return PR_TRUE;
   }
   else
     return PR_FALSE;
 }
 
 PRBool imgLoader::RemoveFromCache(imgCacheEntry *entry)
 {
   LOG_STATIC_FUNC(gImgLog, "imgLoader::RemoveFromCache entry");
-
+  PRBool ret = PR_FALSE;
   nsRefPtr<imgRequest> request(getter_AddRefs(entry->GetRequest()));
   if (request) {
     nsCOMPtr<nsIURI> key;
-    if (NS_SUCCEEDED(request->GetKeyURI(getter_AddRefs(key))) && key) {
-      imgCacheTable &cache = GetCache(key);
-      imgCacheQueue &queue = GetCacheQueue(key);
-      nsCAutoString spec;
-      key->GetSpec(spec);
-      cache.Remove(spec);
-
-      if (entry->HasNoProxies()) {
-        LOG_STATIC_FUNC(gImgLog, "imgLoader::RemoveFromCache removing from tracker");
-        if (gCacheTracker)
-          gCacheTracker->RemoveObject(entry);
-        queue.Remove(entry);
-      }
-
-      entry->SetEvicted(PR_TRUE);
-
-      return PR_TRUE;
-    }
+    if (NS_SUCCEEDED(request->GetKeyURI(getter_AddRefs(key))) && key)
+      ret = RemoveFromCache(key);
   }
 
-  return PR_FALSE;
-}
-
-static PLDHashOperator EnumEvictEntries(const nsACString&, 
-                                        nsRefPtr<imgCacheEntry> &aData,
-                                        void *data)
-{
-  nsTArray<nsRefPtr<imgCacheEntry> > *entries = 
-    reinterpret_cast<nsTArray<nsRefPtr<imgCacheEntry> > *>(data);
-
-  entries->AppendElement(aData);
-
-  return PL_DHASH_NEXT;
+  return ret;
 }
 
 nsresult imgLoader::EvictEntries(imgCacheTable &aCacheToClear, imgCacheQueue &aQueueToClear)
 {
   LOG_STATIC_FUNC(gImgLog, "imgLoader::EvictEntries");
 
   // We have to make a temporary, since RemoveFromCache removes the element
   // from the queue, invalidating iterators.
   nsTArray<nsRefPtr<imgCacheEntry> > entries;
-  aCacheToClear.Enumerate(EnumEvictEntries, &entries);
-
-  for (PRUint32 i = 0; i < entries.Length(); ++i)
+  for (imgCacheQueue::iterator it = aQueueToClear.begin(); it != aQueueToClear.end(); ++it)
+    entries.AppendElement(*it);
+  
+  for (PRUint32  i = 0; i < entries.Length(); ++i)
     if (!RemoveFromCache(entries[i]))
       return NS_ERROR_FAILURE;
 
   return NS_OK;
 }
 
 #define LOAD_FLAGS_CACHE_MASK    (nsIRequest::LOAD_BYPASS_CACHE | \
                                   nsIRequest::LOAD_FROM_CACHE)
@@ -1172,32 +1033,24 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIUR
     // for correctly dealing with image load requests that are a result
     // of post data.
     imgCacheTable &cache = GetCache(aURI);
 
     nsCAutoString spec;
     aURI->GetSpec(spec);
 
     if (cache.Get(spec, getter_AddRefs(entry)) && entry) {
+      if (gCacheTracker)
+        gCacheTracker->MarkUsed(entry);
+
       if (ValidateEntry(entry, aURI, aInitialDocumentURI, aReferrerURI, aLoadGroup, aObserver, aCX,
                         requestFlags, PR_TRUE, aRequest, _retval)) {
         request = getter_AddRefs(entry->GetRequest());
 
-        // If this entry has no proxies, its request has no reference to the entry.
-        if (entry->HasNoProxies()) {
-          LOG_FUNC_WITH_PARAM(gImgLog, "imgLoader::LoadImage() adding proxyless entry", "uri", spec.get());
-          NS_ABORT_IF_FALSE(!request->HasCacheEntry(), "Proxyless entry's request has cache entry!");
-          request->SetCacheEntry(entry);
-
-          if (gCacheTracker)
-            gCacheTracker->MarkUsed(entry);
-        } 
-
         entry->Touch();
-
 #ifdef DEBUG_joe
         printf("CACHEGET: %d %s %d\n", time(NULL), spec.get(), entry->GetDataSize());
 #endif
       }
       else
         entry = nsnull;
     }
   }
@@ -1315,16 +1168,19 @@ NS_IMETHODIMP imgLoader::LoadImageWithCh
     // for correctly dealing with image load requests that are a result
     // of post data.
     imgCacheTable &cache = GetCache(uri);
     nsCAutoString spec;
 
     uri->GetSpec(spec);
 
     if (cache.Get(spec, getter_AddRefs(entry)) && entry) {
+      if (gCacheTracker)
+        gCacheTracker->MarkUsed(entry);
+
       // We don't want to kick off another network load. So we ask
       // ValidateEntry to only do validation without creating a new proxy. If
       // it says that the entry isn't valid any more, we'll only use the entry
       // we're getting if the channel is loading from the cache anyways.
       //
       // XXX -- should this be changed? it's pretty much verbatim from the old
       // code, but seems nonsensical.
       if (ValidateEntry(entry, uri, nsnull, nsnull, nsnull, aObserver, aCX,
@@ -1340,54 +1196,39 @@ NS_IMETHODIMP imgLoader::LoadImageWithCh
           bUseCacheCopy = PR_FALSE;
 
         if (!bUseCacheCopy)
           entry = nsnull;
         else {
           request = getter_AddRefs(entry->GetRequest());
         }
       }
-
-      if (request && entry) {
-        // If this entry has no proxies, its request has no reference to the entry.
-        if (entry->HasNoProxies()) {
-          LOG_FUNC_WITH_PARAM(gImgLog, "imgLoader::LoadImageWithChannel() adding proxyless entry", "uri", spec.get());
-          NS_ABORT_IF_FALSE(!request->HasCacheEntry(), "Proxyless entry's request has cache entry!");
-          request->SetCacheEntry(entry);
-
-          if (gCacheTracker)
-            gCacheTracker->MarkUsed(entry);
-        } 
-      }
     }
   }
 
   nsCOMPtr<nsILoadGroup> loadGroup;
   channel->GetLoadGroup(getter_AddRefs(loadGroup));
 
   if (request) {
     // we have this in our cache already.. cancel the current (document) load
 
     channel->Cancel(NS_IMAGELIB_ERROR_LOAD_ABORTED); // this should fire an OnStopRequest
 
     *listener = nsnull; // give them back a null nsIStreamListener
   } else {
-    if (!NewRequestAndEntry(uri, getter_AddRefs(request), getter_AddRefs(entry)))
-      return NS_ERROR_OUT_OF_MEMORY;
+    NewRequestAndEntry(uri, getter_AddRefs(request), getter_AddRefs(entry));
 
     // We use originalURI here to fulfil the imgIRequest contract on GetURI.
     nsCOMPtr<nsIURI> originalURI;
     channel->GetOriginalURI(getter_AddRefs(originalURI));
     request->Init(originalURI, uri, channel, channel, entry, NS_GetCurrentThread(), aCX);
 
     ProxyListener *pl = new ProxyListener(static_cast<nsIStreamListener *>(request.get()));
-    if (!pl) {
-      request->CancelAndAbort(NS_ERROR_OUT_OF_MEMORY);
+    if (!pl)
       return NS_ERROR_OUT_OF_MEMORY;
-    }
 
     NS_ADDREF(pl);
 
     *listener = static_cast<nsIStreamListener*>(pl);
     NS_ADDREF(*listener);
 
     NS_RELEASE(pl);
 
@@ -1400,16 +1241,17 @@ NS_IMETHODIMP imgLoader::LoadImageWithCh
 
   rv = CreateNewProxyForRequest(request, loadGroup, aObserver,
                                 requestFlags, nsnull, _retval);
   request->NotifyProxyListener(static_cast<imgRequestProxy*>(*_retval));
 
   return rv;
 }
 
+
 NS_IMETHODIMP imgLoader::SupportImageWithMimeType(const char* aMimeType, PRBool *_retval)
 {
   *_retval = PR_FALSE;
   nsCOMPtr<nsIComponentRegistrar> reg;
   nsresult rv = NS_GetComponentRegistrar(getter_AddRefs(reg));
   if (NS_FAILED(rv))
     return rv;
   nsCAutoString mimeType(aMimeType);
@@ -1624,67 +1466,57 @@ NS_IMETHODIMP imgCacheValidator::OnStart
       mRequest->mValidator = nsnull;
 
       mRequest = nsnull;
 
       return NS_OK;
     }
   }
 
-  // We can't load out of cache. We have to create a whole new request for the
-  // data that's coming in off the channel.
+  // fun stuff.
   nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
   nsRefPtr<imgCacheEntry> entry;
   nsCOMPtr<nsIURI> uri;
 
-  mRequest->GetURI(getter_AddRefs(uri));
-
-#if defined(PR_LOGGING)
-  nsCAutoString spec;
-  uri->GetSpec(spec);
-  LOG_MSG_WITH_PARAM(gImgLog, "imgCacheValidator::OnStartRequest creating new request", "uri", spec.get());
-#endif
-
   // Doom the old request's cache entry
   mRequest->RemoveFromCache();
 
+  mRequest->GetURI(getter_AddRefs(uri));
+
   mRequest->mValidator = nsnull;
   mRequest = nsnull;
 
   imgRequest *request;
 
   if (!NewRequestAndEntry(uri, &request, getter_AddRefs(entry)))
       return NS_ERROR_OUT_OF_MEMORY;
 
   // We use originalURI here to fulfil the imgIRequest contract on GetURI.
   nsCOMPtr<nsIURI> originalURI;
   channel->GetOriginalURI(getter_AddRefs(originalURI));
   request->Init(originalURI, uri, channel, channel, entry, NS_GetCurrentThread(), mContext);
 
   ProxyListener *pl = new ProxyListener(static_cast<nsIStreamListener *>(request));
   if (!pl) {
-    request->CancelAndAbort(NS_ERROR_OUT_OF_MEMORY);
     NS_RELEASE(request);
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   mDestListener = static_cast<nsIStreamListener*>(pl);
 
-  // Try to add the new request into the cache. Note that the entry must be in
-  // the cache before the proxies' ownership changes, because adding a proxy
-  // changes the caching behaviour for imgRequests.
-  sImgLoader.PutIntoCache(uri, entry);
-
   PRUint32 count = mProxies.Count();
   for (PRInt32 i = count-1; i>=0; i--) {
     imgRequestProxy *proxy = static_cast<imgRequestProxy *>(mProxies[i]);
     proxy->ChangeOwner(request);
     request->NotifyProxyListener(proxy);
   }
 
+  // Try to add the new request into the cache.
+  sImgLoader.PutIntoCache(uri, entry);
+
   NS_RELEASE(request);
 
   if (!mDestListener)
     return NS_OK;
 
   return mDestListener->OnStartRequest(aRequest, ctxt);
 }
 
--- a/modules/libpr0n/src/imgLoader.h
+++ b/modules/libpr0n/src/imgLoader.h
@@ -56,17 +56,16 @@ class imgRequestProxy;
 class imgIRequest;
 class imgIDecoderObserver;
 class nsILoadGroup;
 
 class imgCacheEntry
 {
 public:
   imgCacheEntry(imgRequest *request, PRBool mustValidateIfExpired = PR_FALSE);
-  ~imgCacheEntry();
 
   nsrefcnt AddRef()
   {
     NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt");
     NS_ASSERT_OWNINGTHREAD(imgCacheEntry);
     ++mRefCnt;
     NS_LOG_ADDREF(this, mRefCnt, "imgCacheEntry", sizeof(*this));
     return mRefCnt;
@@ -139,48 +138,37 @@ public:
     return mEvicted;
   }
 
   nsExpirationState *GetExpirationState()
   {
     return &mExpirationState;
   }
 
-  PRBool HasNoProxies() const
-  {
-    return mHasNoProxies;
-  }
-
 private: // methods
   friend class imgLoader;
   friend class imgCacheQueue;
   void Touch(PRBool updateTime = PR_TRUE);
   void TouchWithSize(PRInt32 diff);
   void SetEvicted(PRBool evict)
   {
     mEvicted = evict;
   }
-  void SetHasNoProxies(PRBool hasNoProxies);
-
-  // Private, unimplemented copy constructor.
-  imgCacheEntry(const imgCacheEntry &);
 
 private: // data
   nsAutoRefCnt mRefCnt;
   NS_DECL_OWNINGTHREAD
 
   nsRefPtr<imgRequest> mRequest;
-  nsCOMPtr<nsIURI> mKeyURI;
   PRUint32 mDataSize;
   PRInt32 mTouchedTime;
   PRInt32 mExpiryTime;
   nsExpirationState mExpirationState;
-  PRPackedBool mMustValidateIfExpired : 1;
-  PRPackedBool mEvicted : 1;
-  PRPackedBool mHasNoProxies : 1;
+  PRBool mMustValidateIfExpired;
+  PRBool mEvicted;
 };
 
 #include <vector>
 
 #define NS_IMGLOADER_CID \
 { /* 9f6a0d2e-1dd1-11b2-a5b8-951f13c846f7 */         \
      0x9f6a0d2e,                                     \
      0x1dd1,                                         \
@@ -257,30 +245,16 @@ public:
     const PRFloat64 sizeweight = 1.0 - sCacheTimeWeight;
     PRInt32 diffsize = PRInt32(two->GetDataSize()) - PRInt32(one->GetDataSize());
     PRInt32 difftime = one->GetTouchedTime() - two->GetTouchedTime();
     return difftime * sCacheTimeWeight + diffsize * sizeweight < 0;
   }
 
   static void VerifyCacheSizes();
 
-  // The image loader maintains a hash table of all imgCacheEntries. However,
-  // only some of them will be evicted from the cache: those who have no
-  // imgRequestProxies watching their imgRequests. 
-  //
-  // Once an imgRequest has no imgRequestProxies, it should notify us by
-  // calling HasNoObservers(), and null out its cache entry pointer.
-  // 
-  // Upon having a proxy start observing again, it should notify us by calling
-  // HasObservers(). The request's cache entry will be re-set before this
-  // happens, by calling imgRequest::SetCacheEntry() when an entry with no
-  // observers is re-requested.
-  static PRBool SetHasNoProxies(nsIURI *key, imgCacheEntry *entry);
-  static PRBool SetHasProxies(nsIURI *key);
-
 private: // methods
 
 
   PRBool ValidateEntry(imgCacheEntry *aEntry, nsIURI *aKey,
                        nsIURI *aInitialDocumentURI, nsIURI *aReferrerURI, 
                        nsILoadGroup *aLoadGroup,
                        imgIDecoderObserver *aObserver, nsISupports *aCX,
                        nsLoadFlags aLoadFlags, PRBool aCanMakeNewChannel,
--- a/modules/libpr0n/src/imgRequest.cpp
+++ b/modules/libpr0n/src/imgRequest.cpp
@@ -87,45 +87,38 @@ imgRequest::imgRequest() :
   mValidator(nsnull), mIsMultiPartChannel(PR_FALSE),
   mImageSniffers("image-sniffing-services") 
 {
   /* member initializers and constructor code */
 }
 
 imgRequest::~imgRequest()
 {
-  if (mKeyURI) {
-    nsCAutoString spec;
-    mKeyURI->GetSpec(spec);
-    LOG_FUNC_WITH_PARAM(gImgLog, "imgRequest::~imgRequest()", "keyuri", spec.get());
-  } else
-    LOG_FUNC(gImgLog, "imgRequest::~imgRequest()");
+  /* destructor code */
 }
 
 nsresult imgRequest::Init(nsIURI *aURI,
                           nsIURI *aKeyURI,
                           nsIRequest *aRequest,
                           nsIChannel *aChannel,
                           imgCacheEntry *aCacheEntry,
                           void *aCacheId,
                           void *aLoadId)
 {
   LOG_FUNC(gImgLog, "imgRequest::Init");
 
-  NS_ABORT_IF_FALSE(!mImage, "Multiple calls to init");
-  NS_ABORT_IF_FALSE(aURI, "No uri");
-  NS_ABORT_IF_FALSE(aKeyURI, "No key uri");
-  NS_ABORT_IF_FALSE(aRequest, "No request");
-  NS_ABORT_IF_FALSE(aChannel, "No channel");
+  NS_ASSERTION(!mImage, "Multiple calls to init");
+  NS_ASSERTION(aURI, "No uri");
+  NS_ASSERTION(aRequest, "No request");
+  NS_ASSERTION(aChannel, "No channel");
 
   mProperties = do_CreateInstance("@mozilla.org/properties;1");
   if (!mProperties)
     return NS_ERROR_OUT_OF_MEMORY;
 
-
   mURI = aURI;
   mKeyURI = aKeyURI;
   mRequest = aRequest;
   mChannel = aChannel;
   mChannel->GetNotificationCallbacks(getter_AddRefs(mPrevChannelSink));
 
   NS_ASSERTION(mPrevChannelSink != this,
                "Initializing with a channel that already calls back to us!");
@@ -143,38 +136,21 @@ nsresult imgRequest::Init(nsIURI *aURI,
 
   mCacheId = aCacheId;
 
   SetLoadId(aLoadId);
 
   return NS_OK;
 }
 
-void imgRequest::SetCacheEntry(imgCacheEntry *entry)
-{
-  mCacheEntry = entry;
-}
-
-PRBool imgRequest::HasCacheEntry() const
-{
-  return mCacheEntry != nsnull;
-}
-
 nsresult imgRequest::AddProxy(imgRequestProxy *proxy)
 {
   NS_PRECONDITION(proxy, "null imgRequestProxy passed in");
   LOG_SCOPE_WITH_PARAM(gImgLog, "imgRequest::AddProxy", "proxy", proxy);
 
-  // If we're empty before adding, we have to tell the loader we now have
-  // proxies.
-  if (mObservers.IsEmpty()) {
-    NS_ABORT_IF_FALSE(mKeyURI, "Trying to SetHasProxies without key uri.");
-    imgLoader::SetHasProxies(mKeyURI);
-  }
-
   return mObservers.AppendElementUnlessExists(proxy) ?
     NS_OK : NS_ERROR_OUT_OF_MEMORY;
 }
 
 nsresult imgRequest::RemoveProxy(imgRequestProxy *proxy, nsresult aStatus, PRBool aNotify)
 {
   LOG_SCOPE_WITH_PARAM(gImgLog, "imgRequest::RemoveProxy", "proxy", proxy);
 
@@ -201,32 +177,16 @@ nsresult imgRequest::RemoveProxy(imgRequ
 
   if (mImage && !HaveProxyWithObserver(nsnull)) {
     LOG_MSG(gImgLog, "imgRequest::RemoveProxy", "stopping animation");
 
     mImage->StopAnimation();
   }
 
   if (mObservers.IsEmpty()) {
-    // If we have no observers, there's nothing holding us alive. If we haven't
-    // been cancelled and thus removed from the cache, tell the image loader so
-    // we can be evicted from the cache.
-    if (mCacheEntry) {
-      NS_ABORT_IF_FALSE(mKeyURI, "Removing last observer without key uri.");
-
-      imgLoader::SetHasNoProxies(mKeyURI, mCacheEntry);
-    } 
-#if defined(PR_LOGGING)
-    else {
-      nsCAutoString spec;
-      mKeyURI->GetSpec(spec);
-      LOG_MSG_WITH_PARAM(gImgLog, "imgRequest::RemoveProxy no cache entry", "uri", spec.get());
-    }
-#endif
-
     /* If |aStatus| is a failure code, then cancel the load if it is still in progress.
        Otherwise, let the load continue, keeping 'this' in the cache with no observers.
        This way, if a proxy is destroyed without calling cancel on it, it won't leak
        and won't leave a bad pointer in mObservers.
      */
     if (mRequest && mLoading && NS_FAILED(aStatus)) {
       LOG_MSG(gImgLog, "imgRequest::RemoveProxy", "load in progress.  canceling");
 
@@ -349,18 +309,16 @@ void imgRequest::Cancel(nsresult aStatus
   }
 
   if (mRequest && mLoading)
     mRequest->Cancel(aStatus);
 }
 
 void imgRequest::CancelAndAbort(nsresult aStatus)
 {
-  LOG_SCOPE(gImgLog, "imgRequest::CancelAndAbort");
-
   Cancel(aStatus);
 
   // It's possible for the channel to fail to open after we've set our
   // notification callbacks. In that case, make sure to break the cycle between
   // the channel and us, because it won't.
   if (mChannel) {
     mChannel->SetNotificationCallbacks(mPrevChannelSink);
     mPrevChannelSink = nsnull;
@@ -414,22 +372,20 @@ nsresult imgRequest::GetSecurityInfo(nsI
   NS_IF_ADDREF(*aSecurityInfo = mSecurityInfo);
   return NS_OK;
 }
 
 void imgRequest::RemoveFromCache()
 {
   LOG_SCOPE(gImgLog, "imgRequest::RemoveFromCache");
 
-  if (mCacheEntry)
-    imgLoader::RemoveFromCache(mCacheEntry);
-  else
-    imgLoader::RemoveFromCache(mKeyURI);
-
-  mCacheEntry = nsnull;
+  if (mCacheEntry) {
+    imgLoader::RemoveFromCache(mURI);
+    mCacheEntry = nsnull;
+  }
 }
 
 PRBool imgRequest::HaveProxyWithObserver(imgRequestProxy* aProxyToIgnore) const
 {
   nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mObservers);
   imgRequestProxy* proxy;
   while (iter.HasMore()) {
     proxy = iter.GetNext();
@@ -1061,33 +1017,20 @@ imgRequest::OnChannelRedirect(nsIChannel
   nsresult rv = NS_OK;
   nsCOMPtr<nsIChannelEventSink> sink(do_GetInterface(mPrevChannelSink));
   if (sink) {
     rv = sink->OnChannelRedirect(oldChannel, newChannel, flags);
     if (NS_FAILED(rv))
       return rv;
   }
 
-#if defined(PR_LOGGING)
-  nsCAutoString spec;
-  mKeyURI->GetSpec(spec);
-
-  LOG_MSG_WITH_PARAM(gImgLog, "imgRequest::OnChannelRedirect", "old", spec.get());
-#endif
-
   RemoveFromCache();
 
   mChannel = newChannel;
 
   newChannel->GetOriginalURI(getter_AddRefs(mKeyURI));
 
-#if defined(PR_LOGGING)
-  mKeyURI->GetSpec(spec);
-
-  LOG_MSG_WITH_PARAM(gImgLog, "imgRequest::OnChannelRedirect", "new", spec.get());
-#endif
-
   // If we don't still have a cache entry, we don't want to refresh the cache.
   if (mKeyURI && mCacheEntry)
     imgLoader::PutIntoCache(mKeyURI, mCacheEntry);
 
   return rv;
 }
--- a/modules/libpr0n/src/imgRequest.h
+++ b/modules/libpr0n/src/imgRequest.h
@@ -115,17 +115,16 @@ public:
   // won't be sufficient.
   void CancelAndAbort(nsresult aStatus);
 
 private:
   friend class imgCacheEntry;
   friend class imgRequestProxy;
   friend class imgLoader;
   friend class imgCacheValidator;
-  friend class imgCacheExpirationTracker;
 
   inline void SetLoadId(void *aLoadId) {
     mLoadId = aLoadId;
     mLoadTime = PR_Now();
   }
   inline PRUint32 GetImageStatus() const { return mImageStatus; }
   inline nsresult GetResultFromImageStatus(PRUint32 aStatus) const;
   void Cancel(nsresult aStatus);
@@ -136,24 +135,16 @@ private:
   void RemoveFromCache();
   inline const char *GetMimeType() const {
     return mContentType.get();
   }
   inline nsIProperties *Properties() {
     return mProperties;
   }
 
-  // Reset the cache entry after we've dropped our reference to it. Used by the
-  // imgLoader when our cache entry is re-requested after we've dropped our
-  // reference to it.
-  void SetCacheEntry(imgCacheEntry *entry);
-
-  // Returns whether we've got a reference to the cache entry.
-  PRBool HasCacheEntry() const;
-
   // Return true if at least one of our proxies, excluding
   // aProxyToIgnore, has an observer.  aProxyToIgnore may be null.
   PRBool HaveProxyWithObserver(imgRequestProxy* aProxyToIgnore) const;
 
   // Return the priority of the underlying network request, or return
   // PRIORITY_NORMAL if it doesn't support nsISupportsPriority.
   PRInt32 Priority() const;
 
--- a/modules/libpr0n/test/mochitest/Makefile.in
+++ b/modules/libpr0n/test/mochitest/Makefile.in
@@ -44,14 +44,12 @@ relativesrcdir  = modules/libpr0n/test/m
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _TEST_FILES = 	test_bug399925.html \
 		bug399925.gif \
                 bug468160.sjs \
                 test_bug468160.html \
                 red.png \
-                test_bug466586.html \
-                big.png \
 		$(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
deleted file mode 100644
index 94e7eb6db226f884fd67467a1e7d63c22c9b83d4..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/modules/libpr0n/test/mochitest/test_bug466586.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=466586
--->
-<head>
-  <title>Test for Bug 466586</title>
-  <script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body onload="loadSmall()">
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=89419">Mozilla Bug 466586</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-<img src="big.png" width="100" height="100" id="big" />
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-SimpleTest.waitForExplicitFinish();
-
-// We have loaded the large png with id "big". We want to test if it'll be
-// kicked out of the cache and thus have to be reloaded, but to ensure that, we
-// need to get the cache to look at what's there. So we load another image,
-// this one small.
-function loadSmall()
-{
-  var small = new Image();
-
-  small.onload = smallLoaded;
-  small.src="red.png";
-}
-
-function smallLoaded()
-{
-  // Make sure that we don't need another load.
-  var big = document.getElementById('big');
-  var img = new Image();
-  img.src = big.src;
-  ok(img.width != 0);
-
-  SimpleTest.finish();
-}
-</script>
-</pre>
-</body>
-</html>