Replace use of nsCSS* structs in nsCSSExpandedDataBlock with an array of nsCSSValue. (Bug 645620, patch 1) r=bzbarsky
authorL. David Baron <dbaron@dbaron.org>
Mon, 28 Mar 2011 16:07:26 -0700
changeset 64074 0864cd7f9e9b704a673a4bad42b5aac40cf578f3
parent 64073 5b20af343bd4ef9d944352af9d258d5915b9dd14
child 64075 967f25420b71b9105f3b48e33f7ae042a735f6d3
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs645620
milestone2.2a1pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Replace use of nsCSS* structs in nsCSSExpandedDataBlock with an array of nsCSSValue. (Bug 645620, patch 1) r=bzbarsky Note that this increases the size of nsCSSExpandedDataBlock by three nsCSSValues for the three non-CSS properties.
layout/style/nsCSSDataBlock.cpp
layout/style/nsCSSDataBlock.h
--- a/layout/style/nsCSSDataBlock.cpp
+++ b/layout/style/nsCSSDataBlock.cpp
@@ -606,17 +606,14 @@ nsCSSExpandedDataBlock::DoTransferFromBl
 #ifdef DEBUG
 void
 nsCSSExpandedDataBlock::DoAssertInitialState()
 {
     mPropertiesSet.AssertIsEmpty("not initial state");
     mPropertiesImportant.AssertIsEmpty("not initial state");
 
     for (PRUint32 i = 0; i < eCSSProperty_COUNT_no_shorthands; ++i) {
-        // Check all properties except the non-CSS ones, which have
-        // size_t(-1) in kOffsetTable.
         nsCSSProperty prop = nsCSSProperty(i);
-        NS_ABORT_IF_FALSE(kOffsetTable[prop] == size_t(-1) ||
-                          PropertyAt(prop)->GetUnit() == eCSSUnit_Null,
+        NS_ABORT_IF_FALSE(PropertyAt(prop)->GetUnit() == eCSSUnit_Null,
                           "not initial state");
     }
 }
 #endif
--- a/layout/style/nsCSSDataBlock.h
+++ b/layout/style/nsCSSDataBlock.h
@@ -146,33 +146,17 @@ class nsCSSExpandedDataBlock {
 public:
     nsCSSExpandedDataBlock();
     ~nsCSSExpandedDataBlock();
 
 private:
     /* Property storage may not be accessed directly; use AddLonghandProperty
      * and friends.
      */
-
-    nsCSSFont mFont;
-    nsCSSDisplay mDisplay;
-    nsCSSMargin mMargin;
-    nsCSSList mList;
-    nsCSSPosition mPosition;
-    nsCSSTable mTable;
-    nsCSSColor mColor;
-    nsCSSContent mContent;
-    nsCSSText mText;
-    nsCSSUserInterface mUserInterface;
-    nsCSSAural mAural;
-    nsCSSPage mPage;
-    nsCSSBreaks mBreaks;
-    nsCSSXUL mXUL;
-    nsCSSSVG mSVG;
-    nsCSSColumn mColumn;
+    nsCSSValue mValues[eCSSProperty_COUNT_no_shorthands];
 
 public:
     /**
      * Transfer all of the state from a pair of compressed data blocks
      * to this expanded block.  This expanded block must be clear
      * beforehand.
      *
      * This method DELETES both of the compressed data blocks it is
@@ -284,21 +268,17 @@ private:
     /*
      * Return the storage location within |this| of the value of the
      * property |aProperty|.
      */
     nsCSSValue* PropertyAt(nsCSSProperty aProperty) {
         NS_ABORT_IF_FALSE(0 <= aProperty &&
                           aProperty < eCSSProperty_COUNT_no_shorthands,
                           "property out of range");
-        size_t offset = nsCSSExpandedDataBlock::kOffsetTable[aProperty];
-        NS_ABORT_IF_FALSE(offset != size_t(-1), 
-                          "requesting offset of non-CSS property");
-        return reinterpret_cast<nsCSSValue*>(reinterpret_cast<char*>(this) +
-                                             offset);
+        return &mValues[aProperty];
     }
 
     void SetPropertyBit(nsCSSProperty aProperty) {
         mPropertiesSet.AddProperty(aProperty);
     }
 
     void ClearPropertyBit(nsCSSProperty aProperty) {
         mPropertiesSet.RemoveProperty(aProperty);