Bug 1188721 - Part 2: Replace void* with nsStyleStruct*. r?dbaron draft
authorCameron McCormack <cam@mcc.id.au>
Wed, 23 Mar 2016 17:35:58 +1100
changeset 343752 c479cf7d499edbe188760444b9dc898be3920953
parent 343751 96d6c4613ef8194dc35333bc34b1e736652af617
child 343753 ed5d5d8e740ba35535711a4be6444ef7ecb3e5af
push id13680
push usercmccormack@mozilla.com
push dateWed, 23 Mar 2016 06:36:18 +0000
reviewersdbaron
bugs1188721
milestone48.0a1
Bug 1188721 - Part 2: Replace void* with nsStyleStruct*. r?dbaron MozReview-Commit-ID: FseYprY5GEI
layout/style/nsRuleNode.cpp
layout/style/nsRuleNode.h
layout/style/nsStyleContext.cpp
layout/style/nsStyleContext.h
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -67,26 +67,26 @@
 #include <alloca.h>
 #endif
 
 using std::max;
 using std::min;
 using namespace mozilla;
 using namespace mozilla::dom;
 
-void*
+nsStyleStruct*
 nsConditionalResetStyleData::GetConditionalStyleData(nsStyleStructID aSID,
                                nsStyleContext* aStyleContext) const
 {
   Entry* e = static_cast<Entry*>(mEntries[aSID]);
   MOZ_ASSERT(e, "if mConditionalBits bit is set, we must have at least one "
                 "conditional style struct");
   do {
     if (e->mConditions.Matches(aStyleContext)) {
-      void* data = e->mStyleStruct;
+      nsStyleStruct* data = e->mStyleStruct;
 
       // For reset structs with conditions, we cache the data on the
       // style context.
       // Tell the style context that it doesn't own the data
       aStyleContext->AddStyleBit(GetBitForSID(aSID));
       aStyleContext->SetStyle(aSID, data);
 
       return data;
@@ -1625,17 +1625,17 @@ void nsRuleNode::SetUsedDirectly()
     for (nsStyleStructID sid = nsStyleStructID(0); sid < nsStyleStructID_Length;
          sid = nsStyleStructID(sid + 1)) {
       uint32_t bit = nsCachedStyleData::GetBitForSID(sid);
       if (mDependentBits & bit) {
         nsRuleNode *source = mParent;
         while ((source->mDependentBits & bit) && !source->IsUsedDirectly()) {
           source = source->mParent;
         }
-        void *data = source->mStyleData.GetStyleData(sid);
+        nsStyleStruct* data = source->mStyleData.GetStyleData(sid);
         NS_ASSERTION(data, "unexpected null struct");
         mStyleData.SetStyleData(sid, mPresContext, data);
       }
     }
   }
 }
 
 void
@@ -1666,17 +1666,17 @@ nsRuleNode::PropagateNoneBit(uint32_t aB
     if (curr == aHighestNode)
       break;
     curr = curr->mParent;
   }
 }
 
 inline void
 nsRuleNode::PropagateDependentBit(nsStyleStructID aSID, nsRuleNode* aHighestNode,
-                                  void* aStruct)
+                                  nsStyleStruct* aStruct)
 {
   NS_ASSERTION(aStruct, "expected struct");
 
   uint32_t bit = nsCachedStyleData::GetBitForSID(aSID);
   for (nsRuleNode* curr = this; curr != aHighestNode; curr = curr->mParent) {
     if (curr->mDependentBits & bit) {
 #ifdef DEBUG
       while (curr != aHighestNode) {
@@ -2231,33 +2231,33 @@ nsRuleNode::ResolveVariableReferences(co
         tokenStream->mLineNumber, tokenStream->mLineOffset);
     aRuleData->mConditions.SetUncacheable();
     anyTokenStreams = true;
   }
 
   return anyTokenStreams;
 }
 
-const void*
+const nsStyleStruct*
 nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
                          nsStyleContext* aContext)
 {
   // use placement new[] on the result of alloca() to allocate a
   // variable-sized stack array, including execution of constructors,
   // and use an RAII class to run the destructors too.
   size_t nprops = nsCSSProps::PropertyCountInStruct(aSID);
   void* dataStorage = alloca(nprops * sizeof(nsCSSValue));
   AutoCSSValueArray dataArray(dataStorage, nprops);
 
   nsRuleData ruleData(nsCachedStyleData::GetBitForSID(aSID),
                       dataArray.get(), mPresContext, aContext);
   ruleData.mValueOffsets[aSID] = 0;
 
   // We start at the most specific rule in the tree.
-  void* startStruct = nullptr;
+  nsStyleStruct* startStruct = nullptr;
 
   nsRuleNode* ruleNode = this;
   nsRuleNode* highestNode = nullptr; // The highest node in the rule tree
                                     // that has the same properties
                                     // specified for struct |aSID| as
                                     // |this| does.
   nsRuleNode* rootNode = this; // After the loop below, this will be the
                                // highest node that we've walked without
@@ -2410,44 +2410,44 @@ nsRuleNode::WalkRuleTree(const nsStyleSt
         PropagateGrandancestorBit(aContext, parentContext);
       }
     }
     if (parentContext) {
       // We have a parent, and so we should just inherit from the parent.
       // Set the inherit bits on our context.  These bits tell the style context that
       // it never has to go back to the rule tree for data.  Instead the style context tree
       // should be walked to find the data.
-      const void* parentStruct = parentContext->StyleData(aSID);
+      const nsStyleStruct* parentStruct = parentContext->StyleData(aSID);
       aContext->AddStyleBit(bit); // makes const_cast OK.
-      aContext->SetStyle(aSID, const_cast<void*>(parentStruct));
+      aContext->SetStyle(aSID, const_cast<nsStyleStruct*>(parentStruct));
       return parentStruct;
     }
     else
       // We are the root.  In the case of fonts, the default values just
       // come from the pres context.
       return SetDefaultOnRoot(aSID, aContext);
   }
 
-  typedef const void* (nsRuleNode::*ComputeFunc)(void*, const nsRuleData*,
-                                                 nsStyleContext*, nsRuleNode*,
-                                                 RuleDetail,
-                                                 const RuleNodeCacheConditions);
+  typedef const nsStyleStruct*
+    (nsRuleNode::*ComputeFunc)(nsStyleStruct*, const nsRuleData*,
+                               nsStyleContext*, nsRuleNode*, RuleDetail,
+                               const RuleNodeCacheConditions);
   static const ComputeFunc sComputeFuncs[] = {
 #define STYLE_STRUCT(name, checkdata_cb) &nsRuleNode::Compute##name##Data,
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
   };
 
   // We need to compute the data from the information that the rules specified.
   return (this->*sComputeFuncs[aSID])(startStruct, &ruleData, aContext,
                                       highestNode, detail,
                                       ruleData.mConditions);
 }
 
-const void*
+const nsStyleStruct*
 nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContext)
 {
   switch (aSID) {
     case eStyleStruct_Font:
     {
       nsStyleFont* fontData = new (mPresContext) nsStyleFont(mPresContext);
       nscoord minimumFontSize = mPresContext->MinFontSize(fontData->mLanguage);
 
@@ -4035,18 +4035,18 @@ nsRuleNode::SetGenericFont(nsPresContext
   if (higherContext && contextPath.Length() > 1) {
     // contextPath is a list of all ancestor style contexts, so it must have
     // at least two elements for it to result in a dependency on grandancestor
     // styles.
     PropagateGrandancestorBit(aContext, higherContext);
   }
 }
 
-const void*
-nsRuleNode::ComputeFontData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeFontData(nsStyleStruct* aStartStruct,
                             const nsRuleData* aRuleData,
                             nsStyleContext* aContext,
                             nsRuleNode* aHighestNode,
                             const RuleDetail aRuleDetail,
                             const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_INHERITED(Font, (mPresContext), font, parentFont)
 
@@ -4357,18 +4357,18 @@ struct SetLineHeightCalcOps : public css
       result.mIsNumber = true;
       result.mLineHeight = 1.0f;
     }
 
     return result;
   }
 };
 
-const void*
-nsRuleNode::ComputeTextData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeTextData(nsStyleStruct* aStartStruct,
                             const nsRuleData* aRuleData,
                             nsStyleContext* aContext,
                             nsRuleNode* aHighestNode,
                             const RuleDetail aRuleDetail,
                             const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_INHERITED(Text, (mPresContext), text, parentText)
 
@@ -4708,18 +4708,18 @@ nsRuleNode::ComputeTextData(void* aStart
               conditions,
               SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
               parentText->mControlCharacterVisibility,
               nsCSSParser::ControlCharVisibilityDefault(), 0, 0, 0, 0);
 
   COMPUTE_END_INHERITED(Text, text)
 }
 
-const void*
-nsRuleNode::ComputeTextResetData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeTextResetData(nsStyleStruct* aStartStruct,
                                  const nsRuleData* aRuleData,
                                  nsStyleContext* aContext,
                                  nsRuleNode* aHighestNode,
                                  const RuleDetail aRuleDetail,
                                  const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(TextReset, (), text, parentText)
 
@@ -4870,18 +4870,18 @@ nsRuleNode::ComputeTextResetData(void* a
   SetDiscrete(*aRuleData->ValueForUnicodeBidi(), text->mUnicodeBidi, conditions,
               SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
               parentText->mUnicodeBidi,
               NS_STYLE_UNICODE_BIDI_NORMAL, 0, 0, 0, 0);
 
   COMPUTE_END_RESET(TextReset, text)
 }
 
-const void*
-nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeUserInterfaceData(nsStyleStruct* aStartStruct,
                                      const nsRuleData* aRuleData,
                                      nsStyleContext* aContext,
                                      nsRuleNode* aHighestNode,
                                      const RuleDetail aRuleDetail,
                                      const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_INHERITED(UserInterface, (), ui, parentUI)
 
@@ -4965,18 +4965,18 @@ nsRuleNode::ComputeUserInterfaceData(voi
               ui->mUserFocus, conditions,
               SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
               parentUI->mUserFocus,
               NS_STYLE_USER_FOCUS_NONE, 0, 0, 0, 0);
 
   COMPUTE_END_INHERITED(UserInterface, ui)
 }
 
-const void*
-nsRuleNode::ComputeUIResetData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeUIResetData(nsStyleStruct* aStartStruct,
                                const nsRuleData* aRuleData,
                                nsStyleContext* aContext,
                                nsRuleNode* aHighestNode,
                                const RuleDetail aRuleDetail,
                                const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(UIReset, (), ui, parentUI)
 
@@ -5211,18 +5211,18 @@ GetWillChangeBitFieldFromPropFlags(const
 
   if (nsCSSProps::PropHasFlags(aProp, CSS_PROPERTY_ABSPOS_CB)) {
     willChangeBitField |= NS_STYLE_WILL_CHANGE_ABSPOS_CB;
   }
 
   return willChangeBitField;
 }
 
-const void*
-nsRuleNode::ComputeDisplayData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeDisplayData(nsStyleStruct* aStartStruct,
                                const nsRuleData* aRuleData,
                                nsStyleContext* aContext,
                                nsRuleNode* aHighestNode,
                                const RuleDetail aRuleDetail,
                                const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(Display, (), display, parentDisplay)
 
@@ -6355,18 +6355,18 @@ nsRuleNode::ComputeDisplayData(void* aSt
               display->mOrient, conditions,
               SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
               parentDisplay->mOrient,
               NS_STYLE_ORIENT_INLINE, 0, 0, 0, 0);
 
   COMPUTE_END_RESET(Display, display)
 }
 
-const void*
-nsRuleNode::ComputeVisibilityData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeVisibilityData(nsStyleStruct* aStartStruct,
                                   const nsRuleData* aRuleData,
                                   nsStyleContext* aContext,
                                   nsRuleNode* aHighestNode,
                                   const RuleDetail aRuleDetail,
                                   const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_INHERITED(Visibility, (mPresContext),
                           visibility, parentVisibility)
@@ -6449,18 +6449,18 @@ nsRuleNode::ComputeVisibilityData(void* 
     }
   } else {
     MOZ_ASSERT(orientation->GetUnit() == eCSSUnit_Null, "Should be null unit");
   }
 
   COMPUTE_END_INHERITED(Visibility, visibility)
 }
 
-const void*
-nsRuleNode::ComputeColorData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeColorData(nsStyleStruct* aStartStruct,
                              const nsRuleData* aRuleData,
                              nsStyleContext* aContext,
                              nsRuleNode* aHighestNode,
                              const RuleDetail aRuleDetail,
                              const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_INHERITED(Color, (mPresContext), color, parentColor)
 
@@ -6930,18 +6930,18 @@ FillBackgroundList(AutoTArray< nsStyleIm
   for (uint32_t sourceLayer = 0, destLayer = aItemCount;
        destLayer < aFillCount;
        ++sourceLayer, ++destLayer) {
     aLayers[destLayer].*aResultLocation =
       aLayers[sourceLayer].*aResultLocation;
   }
 }
 
-const void*
-nsRuleNode::ComputeBackgroundData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeBackgroundData(nsStyleStruct* aStartStruct,
                                   const nsRuleData* aRuleData,
                                   nsStyleContext* aContext,
                                   nsRuleNode* aHighestNode,
                                   const RuleDetail aRuleDetail,
                                   const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(Background, (), bg, parentBG)
 
@@ -7074,18 +7074,18 @@ nsRuleNode::ComputeBackgroundData(void* 
   }
 
   // Now that the dust has settled, register the images with the document
   bg->mImage.TrackImages(aContext->PresContext());
 
   COMPUTE_END_RESET(Background, bg)
 }
 
-const void*
-nsRuleNode::ComputeMarginData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct,
                               const nsRuleData* aRuleData,
                               nsStyleContext* aContext,
                               nsRuleNode* aHighestNode,
                               const RuleDetail aRuleDetail,
                               const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(Margin, (), margin, parentMargin)
 
@@ -7180,18 +7180,18 @@ SetBorderImageSlice(const nsCSSValue& aV
     aSlice = aValue;
     aFill = aValue;
     break;
   default:
     NS_ASSERTION(false, "Unexpected border image value for pair.");
   }
 }
 
-const void*
-nsRuleNode::ComputeBorderData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
                               const nsRuleData* aRuleData,
                               nsStyleContext* aContext,
                               nsRuleNode* aHighestNode,
                               const RuleDetail aRuleDetail,
                               const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(Border, (mPresContext), border, parentBorder)
 
@@ -7523,18 +7523,18 @@ nsRuleNode::ComputeBorderData(void* aSta
               parentBorder->mBorderImageRepeatV,
               NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH, 0, 0, 0, 0);
 
   border->TrackImage(aContext->PresContext());
 
   COMPUTE_END_RESET(Border, border)
 }
 
-const void*
-nsRuleNode::ComputePaddingData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputePaddingData(nsStyleStruct* aStartStruct,
                                const nsRuleData* aRuleData,
                                nsStyleContext* aContext,
                                nsRuleNode* aHighestNode,
                                const RuleDetail aRuleDetail,
                                const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(Padding, (), padding, parentPadding)
 
@@ -7552,18 +7552,18 @@ nsRuleNode::ComputePaddingData(void* aSt
       padding->mPadding.Set(side, coord);
     }
   }
 
   padding->RecalcData();
   COMPUTE_END_RESET(Padding, padding)
 }
 
-const void*
-nsRuleNode::ComputeOutlineData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeOutlineData(nsStyleStruct* aStartStruct,
                                const nsRuleData* aRuleData,
                                nsStyleContext* aContext,
                                nsRuleNode* aHighestNode,
                                const RuleDetail aRuleDetail,
                                const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(Outline, (mPresContext), outline, parentOutline)
 
@@ -7663,18 +7663,18 @@ nsRuleNode::ComputeOutlineData(void* aSt
     conditions.SetUncacheable();
     outline->SetOutlineStyle(parentOutline->GetOutlineStyle());
   }
 
   outline->RecalcData(mPresContext);
   COMPUTE_END_RESET(Outline, outline)
 }
 
-const void*
-nsRuleNode::ComputeListData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeListData(nsStyleStruct* aStartStruct,
                             const nsRuleData* aRuleData,
                             nsStyleContext* aContext,
                             nsRuleNode* aHighestNode,
                             const RuleDetail aRuleDetail,
                             const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_INHERITED(List, (mPresContext), list, parentList)
 
@@ -8120,18 +8120,18 @@ SetGridLine(const nsCSSValue& aValue,
       }
       item = item->mNext;
     } while (item);
     MOZ_ASSERT(!aResult.IsAuto(),
                "should have set something away from default value");
   }
 }
 
-const void*
-nsRuleNode::ComputePositionData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputePositionData(nsStyleStruct* aStartStruct,
                                 const nsRuleData* aRuleData,
                                 nsStyleContext* aContext,
                                 nsRuleNode* aHighestNode,
                                 const RuleDetail aRuleDetail,
                                 const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(Position, (), pos, parentPos)
 
@@ -8500,18 +8500,18 @@ nsRuleNode::ComputePositionData(void* aS
       conditions.SetUncacheable();
       pos->mZIndex = parentPos->mZIndex;
     }
   }
 
   COMPUTE_END_RESET(Position, pos)
 }
 
-const void*
-nsRuleNode::ComputeTableData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeTableData(nsStyleStruct* aStartStruct,
                              const nsRuleData* aRuleData,
                              nsStyleContext* aContext,
                              nsRuleNode* aHighestNode,
                              const RuleDetail aRuleDetail,
                              const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(Table, (), table, parentTable)
 
@@ -8526,18 +8526,18 @@ nsRuleNode::ComputeTableData(void* aStar
   const nsCSSValue* spanValue = aRuleData->ValueForSpan();
   if (eCSSUnit_Enumerated == spanValue->GetUnit() ||
       eCSSUnit_Integer == spanValue->GetUnit())
     table->mSpan = spanValue->GetIntValue();
 
   COMPUTE_END_RESET(Table, table)
 }
 
-const void*
-nsRuleNode::ComputeTableBorderData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeTableBorderData(nsStyleStruct* aStartStruct,
                                    const nsRuleData* aRuleData,
                                    nsStyleContext* aContext,
                                    nsRuleNode* aHighestNode,
                                    const RuleDetail aRuleDetail,
                                    const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_INHERITED(TableBorder, (), table, parentTable)
 
@@ -8584,18 +8584,18 @@ nsRuleNode::ComputeTableBorderData(void*
               SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT,
               parentTable->mEmptyCells,
               NS_STYLE_TABLE_EMPTY_CELLS_SHOW,
               0, 0, 0, 0);
 
   COMPUTE_END_INHERITED(TableBorder, table)
 }
 
-const void*
-nsRuleNode::ComputeContentData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeContentData(nsStyleStruct* aStartStruct,
                                const nsRuleData* aRuleData,
                                nsStyleContext* aContext,
                                nsRuleNode* aHighestNode,
                                const RuleDetail aRuleDetail,
                                const RuleNodeCacheConditions aConditions)
 {
   uint32_t count;
   nsAutoString buffer;
@@ -8824,18 +8824,18 @@ nsRuleNode::ComputeContentData(void* aSt
         content->ContentAt(i).mContent.mImage) {
       content->ContentAt(i).TrackImage(aContext->PresContext());
     }
   }
 
   COMPUTE_END_RESET(Content, content)
 }
 
-const void*
-nsRuleNode::ComputeQuotesData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeQuotesData(nsStyleStruct* aStartStruct,
                               const nsRuleData* aRuleData,
                               nsStyleContext* aContext,
                               nsRuleNode* aHighestNode,
                               const RuleDetail aRuleDetail,
                               const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_INHERITED(Quotes, (), quotes, parentQuotes)
 
@@ -8879,18 +8879,18 @@ nsRuleNode::ComputeQuotesData(void* aSta
   }
   default:
     MOZ_ASSERT(false, "unexpected value unit");
   }
 
   COMPUTE_END_INHERITED(Quotes, quotes)
 }
 
-const void*
-nsRuleNode::ComputeXULData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeXULData(nsStyleStruct* aStartStruct,
                            const nsRuleData* aRuleData,
                            nsStyleContext* aContext,
                            nsRuleNode* aHighestNode,
                            const RuleDetail aRuleDetail,
                            const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(XUL, (), xul, parentXUL)
 
@@ -8945,18 +8945,18 @@ nsRuleNode::ComputeXULData(void* aStartS
   } else if (eCSSUnit_Enumerated == stackSizingValue->GetUnit()) {
     xul->mStretchStack = stackSizingValue->GetIntValue() ==
       NS_STYLE_STACK_SIZING_STRETCH_TO_FIT;
   }
 
   COMPUTE_END_RESET(XUL, xul)
 }
 
-const void*
-nsRuleNode::ComputeColumnData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeColumnData(nsStyleStruct* aStartStruct,
                               const nsRuleData* aRuleData,
                               nsStyleContext* aContext,
                               nsRuleNode* aHighestNode,
                               const RuleDetail aRuleDetail,
                               const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(Column, (mPresContext), column, parent)
 
@@ -9168,18 +9168,18 @@ SetSVGOpacity(const nsCSSValue& aValue,
     aOpacityTypeField = aParentOpacityType;
   } else if (eCSSUnit_Null != aValue.GetUnit()) {
     SetFactor(aValue, aOpacityField, aConditions,
               aParentOpacity, 1.0f, SETFCT_OPACITY);
     aOpacityTypeField = eStyleSVGOpacitySource_Normal;
   }
 }
 
-const void*
-nsRuleNode::ComputeSVGData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeSVGData(nsStyleStruct* aStartStruct,
                            const nsRuleData* aRuleData,
                            nsStyleContext* aContext,
                            nsRuleNode* aHighestNode,
                            const RuleDetail aRuleDetail,
                            const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_INHERITED(SVG, (), svg, parentSVG)
 
@@ -9708,18 +9708,18 @@ nsRuleNode::SetStyleFilterToCSSValue(nsS
                                          nsStyleCoord(), mask,
                                          aStyleContext, aPresContext,
                                          aConditions);
   aStyleFilter->SetFilterParameter(filterParameter, type);
   MOZ_ASSERT(didSetCoord, "unexpected unit");
   return true;
 }
 
-const void*
-nsRuleNode::ComputeSVGResetData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeSVGResetData(nsStyleStruct* aStartStruct,
                                 const nsRuleData* aRuleData,
                                 nsStyleContext* aContext,
                                 nsRuleNode* aHighestNode,
                                 const RuleDetail aRuleDetail,
                                 const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_RESET(SVGReset, (), svgReset, parentSVGReset)
 
@@ -10002,18 +10002,18 @@ nsRuleNode::ComputeSVGResetData(void* aS
   }
 #endif
 
   svgReset->mMask.TrackImages(aContext->PresContext());
 
   COMPUTE_END_RESET(SVGReset, svgReset)
 }
 
-const void*
-nsRuleNode::ComputeVariablesData(void* aStartStruct,
+const nsStyleStruct*
+nsRuleNode::ComputeVariablesData(nsStyleStruct* aStartStruct,
                                  const nsRuleData* aRuleData,
                                  nsStyleContext* aContext,
                                  nsRuleNode* aHighestNode,
                                  const RuleDetail aRuleDetail,
                                  const RuleNodeCacheConditions aConditions)
 {
   COMPUTE_START_INHERITED(Variables, (), variables, parentVariables)
 
@@ -10024,29 +10024,29 @@ nsRuleNode::ComputeVariablesData(void* a
   CSSVariableResolver resolver(&variables->mVariables);
   resolver.Resolve(&parentVariables->mVariables,
                    aRuleData->mVariables);
   conditions.SetUncacheable();
 
   COMPUTE_END_INHERITED(Variables, variables)
 }
 
-const void*
+const nsStyleStruct*
 nsRuleNode::GetStyleData(nsStyleStructID aSID,
                          nsStyleContext* aContext,
                          bool aComputeData)
 {
   NS_ASSERTION(IsUsedDirectly(),
                "if we ever call this on rule nodes that aren't used "
                "directly, we should adjust handling of mDependentBits "
                "in some way.");
   MOZ_ASSERT(!aContext->GetCachedStyleData(aSID),
              "style context should not have cached data for struct");
 
-  const void *data;
+  const nsStyleStruct* data;
 
   // Never use cached data for animated style inside a pseudo-element;
   // see comment on cacheability in AnimValuesStyleRule::MapRuleInfoInto.
   if (!(HasAnimationData() && ParentHasPseudoElementData(aContext))) {
     data = mStyleData.GetStyleData(aSID, aContext, aComputeData);
     if (MOZ_LIKELY(data != nullptr)) {
       // For inherited structs, mark the struct (which will be set on
       // the context by our caller) as not being owned by the context.
--- a/layout/style/nsRuleNode.h
+++ b/layout/style/nsRuleNode.h
@@ -26,28 +26,28 @@ class nsStyleContext;
 class nsStyleCoord;
 struct nsCSSRect;
 struct nsCSSValueList;
 struct nsCSSValuePairList;
 struct nsRuleData;
 
 struct nsInheritedStyleData
 {
-  mozilla::RangedArray<void*,
+  mozilla::RangedArray<nsStyleStruct*,
                        nsStyleStructID_Inherited_Start,
                        nsStyleStructID_Inherited_Count> mStyleStructs;
 
   void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
     return aContext->PresShell()->
       AllocateByObjectID(mozilla::eArenaObjectID_nsInheritedStyleData, sz);
   }
 
   void DestroyStructs(uint64_t aBits, nsPresContext* aContext) {
 #define STYLE_STRUCT_INHERITED(name, checkdata_cb) \
-    void *name##Data = mStyleStructs[eStyleStruct_##name]; \
+    nsStyleStruct* name##Data = mStyleStructs[eStyleStruct_##name]; \
     if (name##Data && !(aBits & NS_STYLE_INHERIT_BIT(name))) \
       static_cast<nsStyle##name*>(name##Data)->Destroy(aContext);
 #define STYLE_STRUCT_RESET(name, checkdata_cb)
 
 #include "nsStyleStructList.h"
 
 #undef STYLE_STRUCT_INHERITED
 #undef STYLE_STRUCT_RESET
@@ -65,17 +65,17 @@ struct nsInheritedStyleData
          i = nsStyleStructID(i + 1)) {
       mStyleStructs[i] = nullptr;
     }
   }
 };
 
 struct nsResetStyleData
 {
-  mozilla::RangedArray<void*,
+  mozilla::RangedArray<nsStyleStruct*,
                        nsStyleStructID_Reset_Start,
                        nsStyleStructID_Reset_Count> mStyleStructs;
 
   nsResetStyleData()
   {
     for (nsStyleStructID i = nsStyleStructID_Reset_Start;
          i < nsStyleStructID_Reset_Start + nsStyleStructID_Reset_Count;
          i = nsStyleStructID(i + 1)) {
@@ -85,17 +85,17 @@ struct nsResetStyleData
 
   void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
     return aContext->PresShell()->
       AllocateByObjectID(mozilla::eArenaObjectID_nsResetStyleData, sz);
   }
 
   void Destroy(uint64_t aBits, nsPresContext* aContext) {
 #define STYLE_STRUCT_RESET(name, checkdata_cb) \
-    void *name##Data = mStyleStructs[eStyleStruct_##name]; \
+    nsStyleStruct* name##Data = mStyleStructs[eStyleStruct_##name]; \
     if (name##Data && !(aBits & NS_STYLE_INHERIT_BIT(name))) \
       static_cast<nsStyle##name*>(name##Data)->Destroy(aContext);
 #define STYLE_STRUCT_INHERITED(name, checkdata_cb)
 
 #include "nsStyleStructList.h"
 
 #undef STYLE_STRUCT_RESET
 #undef STYLE_STRUCT_INHERITED
@@ -109,27 +109,27 @@ struct nsConditionalResetStyleData
 {
   static uint32_t GetBitForSID(const nsStyleStructID aSID) {
     return 1 << aSID;
   }
 
   struct Entry
   {
     Entry(const mozilla::RuleNodeCacheConditions& aConditions,
-          void* aStyleStruct,
+          nsStyleStruct* aStyleStruct,
           Entry* aNext)
       : mConditions(aConditions), mStyleStruct(aStyleStruct), mNext(aNext) {}
 
     void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
       return aContext->PresShell()->AllocateByObjectID(
           mozilla::eArenaObjectID_nsConditionalResetStyleDataEntry, sz);
     }
 
     const mozilla::RuleNodeCacheConditions mConditions;
-    void* const mStyleStruct;
+    nsStyleStruct* const mStyleStruct;
     Entry* const mNext;
   };
 
   // Each entry is either a pointer to a style struct or a
   // pointer to an Entry object.  A bit in mConditionalBits
   // means that it is an Entry.
   mozilla::RangedArray<void*,
                        nsStyleStructID_Reset_Start,
@@ -147,57 +147,57 @@ struct nsConditionalResetStyleData
     mConditionalBits = 0;
   }
 
   void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
     return aContext->PresShell()->AllocateByObjectID(
         mozilla::eArenaObjectID_nsConditionalResetStyleData, sz);
   }
 
-  void* GetStyleData(nsStyleStructID aSID) const {
+  nsStyleStruct* GetStyleData(nsStyleStructID aSID) const {
     if (mConditionalBits & GetBitForSID(aSID)) {
       return nullptr;
     }
-    return mEntries[aSID];
+    return static_cast<nsStyleStruct*>(mEntries[aSID]);
   }
 
-  void* GetStyleData(nsStyleStructID aSID,
-                     nsStyleContext* aStyleContext,
-                     bool aCanComputeData) const {
+  nsStyleStruct* GetStyleData(nsStyleStructID aSID,
+                               nsStyleContext* aStyleContext,
+                               bool aCanComputeData) const {
     if (!(mConditionalBits & GetBitForSID(aSID))) {
-      return mEntries[aSID];
+      return static_cast<nsStyleStruct*>(mEntries[aSID]);
     }
     if (!aCanComputeData) {
       // If aCanComputeData is false, then any previously-computed data
       // would have been cached on the style context.  Therefore it's
       // unnecessary to check the conditional data.  It's also
       // incorrect, because calling e->mConditions.Matches() below could
       // cause additional structs to be computed, which is incorrect
       // during CalcStyleDifference.
       return nullptr;
     }
     return GetConditionalStyleData(aSID, aStyleContext);
   }
 
 private:
   // non-inline helper for GetStyleData
-  void* GetConditionalStyleData(nsStyleStructID aSID,
-                                nsStyleContext* aStyleContext) const;
+  nsStyleStruct* GetConditionalStyleData(nsStyleStructID aSID,
+                                         nsStyleContext* aStyleContext) const;
 
 public:
-  void SetStyleData(nsStyleStructID aSID, void* aStyleStruct) {
+  void SetStyleData(nsStyleStructID aSID, nsStyleStruct* aStyleStruct) {
     MOZ_ASSERT(!(mConditionalBits & GetBitForSID(aSID)),
                "rule node should not have unconditional and conditional style "
                "data for a given struct");
     mEntries[aSID] = aStyleStruct;
   }
 
   void SetStyleData(nsStyleStructID aSID,
                     nsPresContext* aPresContext,
-                    void* aStyleStruct,
+                    nsStyleStruct* aStyleStruct,
                     const mozilla::RuleNodeCacheConditions& aConditions) {
     MOZ_ASSERT((mConditionalBits & GetBitForSID(aSID)) ||
                !mEntries[aSID],
                "rule node should not have unconditional and conditional style "
                "data for a given struct");
     MOZ_ASSERT(aConditions.CacheableWithDependencies(),
                "don't call SetStyleData with a cache key that has no "
                "conditions or is uncacheable");
@@ -262,46 +262,47 @@ struct nsCachedStyleData
   static bool IsInherited(const nsStyleStructID aSID) {
     return !IsReset(aSID);
   }
 
   static uint32_t GetBitForSID(const nsStyleStructID aSID) {
     return nsConditionalResetStyleData::GetBitForSID(aSID);
   }
 
-  void* NS_FASTCALL GetStyleData(const nsStyleStructID aSID) {
+  nsStyleStruct* NS_FASTCALL GetStyleData(const nsStyleStructID aSID) {
     if (IsReset(aSID)) {
       if (mResetData) {
         return mResetData->GetStyleData(aSID);
       }
     } else {
       if (mInheritedData) {
         return mInheritedData->mStyleStructs[aSID];
       }
     }
     return nullptr;
   }
 
-  void* NS_FASTCALL GetStyleData(const nsStyleStructID aSID,
-                                 nsStyleContext* aStyleContext,
-                                 bool aCanComputeData) {
+  nsStyleStruct* NS_FASTCALL GetStyleData(const nsStyleStructID aSID,
+                                          nsStyleContext* aStyleContext,
+                                          bool aCanComputeData) {
     if (IsReset(aSID)) {
       if (mResetData) {
         return mResetData->GetStyleData(aSID, aStyleContext, aCanComputeData);
       }
     } else {
       if (mInheritedData) {
         return mInheritedData->mStyleStructs[aSID];
       }
     }
     return nullptr;
   }
 
   void NS_FASTCALL SetStyleData(const nsStyleStructID aSID,
-                                nsPresContext *aPresContext, void *aData) {
+                                nsPresContext *aPresContext,
+                                nsStyleStruct* aData) {
     if (IsReset(aSID)) {
       if (!mResetData) {
         mResetData = new (aPresContext) nsConditionalResetStyleData;
       }
       mResetData->SetStyleData(aSID, aData);
     } else {
       if (!mInheritedData) {
         mInheritedData = new (aPresContext) nsInheritedStyleData;
@@ -558,203 +559,203 @@ public:
   inline void AddRef();
 
   // Implemented in nsStyleSet.h, since it needs to know about nsStyleSet.
   inline void Release();
 
 protected:
   void DestroyInternal(nsRuleNode ***aDestroyQueueTail);
   void PropagateDependentBit(nsStyleStructID aSID, nsRuleNode* aHighestNode,
-                             void* aStruct);
+                             nsStyleStruct* aStruct);
   void PropagateNoneBit(uint32_t aBit, nsRuleNode* aHighestNode);
   static void PropagateGrandancestorBit(nsStyleContext* aContext,
                                         nsStyleContext* aContextInheritedFrom);
 
-  const void* SetDefaultOnRoot(const nsStyleStructID aSID,
-                               nsStyleContext* aContext);
+  const nsStyleStruct* SetDefaultOnRoot(const nsStyleStructID aSID,
+                                        nsStyleContext* aContext);
 
   /**
    * Resolves any property values in aRuleData for a given style struct that
    * have eCSSUnit_TokenStream values, by resolving them against the computed
    * variable values on the style context and re-parsing the property.
    *
    * @return Whether any properties with eCSSUnit_TokenStream values were
    *   encountered.
    */
   static bool ResolveVariableReferences(const nsStyleStructID aSID,
                                         nsRuleData* aRuleData,
                                         nsStyleContext* aContext);
 
-  const void*
+  const nsStyleStruct*
     WalkRuleTree(const nsStyleStructID aSID, nsStyleContext* aContext);
 
-  const void*
-    ComputeDisplayData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeDisplayData(nsStyleStruct* aStartStruct,
                        const nsRuleData* aRuleData,
                        nsStyleContext* aContext, nsRuleNode* aHighestNode,
                        RuleDetail aRuleDetail,
                        const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeVisibilityData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeVisibilityData(nsStyleStruct* aStartStruct,
                           const nsRuleData* aRuleData,
                           nsStyleContext* aContext, nsRuleNode* aHighestNode,
                           RuleDetail aRuleDetail,
                           const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeFontData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeFontData(nsStyleStruct* aStartStruct,
                     const nsRuleData* aRuleData,
                     nsStyleContext* aContext, nsRuleNode* aHighestNode,
                     RuleDetail aRuleDetail,
                     const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeColorData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeColorData(nsStyleStruct* aStartStruct,
                      const nsRuleData* aRuleData,
                      nsStyleContext* aContext, nsRuleNode* aHighestNode,
                      RuleDetail aRuleDetail,
                      const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeBackgroundData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeBackgroundData(nsStyleStruct* aStartStruct,
                           const nsRuleData* aRuleData,
                           nsStyleContext* aContext, nsRuleNode* aHighestNode,
                           RuleDetail aRuleDetail,
                           const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeMarginData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeMarginData(nsStyleStruct* aStartStruct,
                       const nsRuleData* aRuleData,
                       nsStyleContext* aContext, nsRuleNode* aHighestNode,
                       RuleDetail aRuleDetail,
                       const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeBorderData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeBorderData(nsStyleStruct* aStartStruct,
                       const nsRuleData* aRuleData,
                       nsStyleContext* aContext, nsRuleNode* aHighestNode,
                       RuleDetail aRuleDetail,
                       const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputePaddingData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputePaddingData(nsStyleStruct* aStartStruct,
                        const nsRuleData* aRuleData,
                        nsStyleContext* aContext, nsRuleNode* aHighestNode,
                        RuleDetail aRuleDetail,
                        const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeOutlineData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeOutlineData(nsStyleStruct* aStartStruct,
                        const nsRuleData* aRuleData,
                        nsStyleContext* aContext, nsRuleNode* aHighestNode,
                        RuleDetail aRuleDetail,
                        const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeListData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeListData(nsStyleStruct* aStartStruct,
                     const nsRuleData* aRuleData,
                     nsStyleContext* aContext, nsRuleNode* aHighestNode,
                     RuleDetail aRuleDetail,
                     const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputePositionData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputePositionData(nsStyleStruct* aStartStruct,
                         const nsRuleData* aRuleData,
                         nsStyleContext* aContext, nsRuleNode* aHighestNode,
                         RuleDetail aRuleDetail,
                         const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeTableData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeTableData(nsStyleStruct* aStartStruct,
                      const nsRuleData* aRuleData,
                      nsStyleContext* aContext, nsRuleNode* aHighestNode,
                      RuleDetail aRuleDetail,
                      const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeTableBorderData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeTableBorderData(nsStyleStruct* aStartStruct,
                            const nsRuleData* aRuleData,
                            nsStyleContext* aContext, nsRuleNode* aHighestNode,
                            RuleDetail aRuleDetail,
                            const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeContentData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeContentData(nsStyleStruct* aStartStruct,
                        const nsRuleData* aRuleData,
                        nsStyleContext* aContext, nsRuleNode* aHighestNode,
                        RuleDetail aRuleDetail,
                        const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeQuotesData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeQuotesData(nsStyleStruct* aStartStruct,
                       const nsRuleData* aRuleData,
                       nsStyleContext* aContext, nsRuleNode* aHighestNode,
                       RuleDetail aRuleDetail,
                       const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeTextData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeTextData(nsStyleStruct* aStartStruct,
                     const nsRuleData* aRuleData,
                     nsStyleContext* aContext, nsRuleNode* aHighestNode,
                     RuleDetail aRuleDetail,
                     const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeTextResetData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeTextResetData(nsStyleStruct* aStartStruct,
                          const nsRuleData* aRuleData,
                          nsStyleContext* aContext, nsRuleNode* aHighestNode,
                          RuleDetail aRuleDetail,
                          const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeUserInterfaceData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeUserInterfaceData(nsStyleStruct* aStartStruct,
                              const nsRuleData* aRuleData,
                              nsStyleContext* aContext,
                              nsRuleNode* aHighestNode,
                              RuleDetail aRuleDetail,
                              const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeUIResetData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeUIResetData(nsStyleStruct* aStartStruct,
                        const nsRuleData* aRuleData,
                        nsStyleContext* aContext, nsRuleNode* aHighestNode,
                        RuleDetail aRuleDetail,
                        const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeXULData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeXULData(nsStyleStruct* aStartStruct,
                    const nsRuleData* aRuleData,
                    nsStyleContext* aContext, nsRuleNode* aHighestNode,
                    RuleDetail aRuleDetail,
                    const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeColumnData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeColumnData(nsStyleStruct* aStartStruct,
                       const nsRuleData* aRuleData,
                       nsStyleContext* aContext, nsRuleNode* aHighestNode,
                       RuleDetail aRuleDetail,
                       const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeSVGData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeSVGData(nsStyleStruct* aStartStruct,
                    const nsRuleData* aRuleData,
                    nsStyleContext* aContext, nsRuleNode* aHighestNode,
                    RuleDetail aRuleDetail,
                    const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeSVGResetData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeSVGResetData(nsStyleStruct* aStartStruct,
                         const nsRuleData* aRuleData,
                         nsStyleContext* aContext, nsRuleNode* aHighestNode,
                         RuleDetail aRuleDetail,
                         const mozilla::RuleNodeCacheConditions aConditions);
 
-  const void*
-    ComputeVariablesData(void* aStartStruct,
+  const nsStyleStruct*
+    ComputeVariablesData(nsStyleStruct* aStartStruct,
                          const nsRuleData* aRuleData,
                          nsStyleContext* aContext, nsRuleNode* aHighestNode,
                          RuleDetail aRuleDetail,
                          const mozilla::RuleNodeCacheConditions aConditions);
 
   // helpers for |ComputeFontData| that need access to |mNoneBits|:
   static void SetFontSize(nsPresContext* aPresContext,
                           const nsRuleData* aRuleData,
@@ -870,19 +871,19 @@ public:
     return (mNoneBits & NS_RULE_NODE_HAS_ANIMATION_DATA) != 0;
   }
 
   // NOTE:  Does not |AddRef|.  Null only for the root.
   nsIStyleRule* GetRule() const { return mRule; }
   // NOTE: Does not |AddRef|.  Never null.
   nsPresContext* PresContext() const { return mPresContext; }
 
-  const void* GetStyleData(nsStyleStructID aSID,
-                           nsStyleContext* aContext,
-                           bool aComputeData);
+  const nsStyleStruct* GetStyleData(nsStyleStructID aSID,
+                                    nsStyleContext* aContext,
+                                    bool aComputeData);
 
 
   // See comments in GetStyleData for an explanation of what the
   // code below does.
   #define STYLE_STRUCT_INHERITED(name_, checkdata_cb_)                        \
   template<bool aComputeData>                                                 \
   const nsStyle##name_*                                                       \
   GetStyle##name_(nsStyleContext* aContext, uint64_t& aContextStyleBits)      \
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -195,17 +195,17 @@ void
 nsStyleContext::AssertStructsNotUsedElsewhere(
                                        nsStyleContext* aDestroyingContext,
                                        int32_t aLevels) const
 {
   if (aLevels == 0) {
     return;
   }
 
-  void* data;
+  nsStyleStruct* data;
 
   if (mBits & NS_STYLE_IS_GOING_AWAY) {
     return;
   }
 
   if (this != aDestroyingContext) {
     nsInheritedStyleData& destroyingInheritedData =
       aDestroyingContext->mCachedInheritedData;
@@ -409,49 +409,50 @@ nsStyleContext::FindChildWithRules(const
       AddChild(result);
     }
     result->mBits |= NS_STYLE_IS_SHARED;
   }
 
   return result.forget();
 }
 
-const void* nsStyleContext::StyleData(nsStyleStructID aSID)
+const nsStyleStruct*
+nsStyleContext::StyleData(nsStyleStructID aSID)
 {
-  const void* cachedData = GetCachedStyleData(aSID);
+  const nsStyleStruct* cachedData = GetCachedStyleData(aSID);
   if (cachedData)
     return cachedData; // We have computed data stored on this node in the context tree.
   // Our rule node will take care of it for us.
-  const void* newData = mRuleNode->GetStyleData(aSID, this, true);
+  const nsStyleStruct* newData = mRuleNode->GetStyleData(aSID, this, true);
   if (!nsCachedStyleData::IsReset(aSID)) {
     // always cache inherited data on the style context; the rule
     // node set the bit in mBits for us if needed.
-    mCachedInheritedData.mStyleStructs[aSID] = const_cast<void*>(newData);
+    mCachedInheritedData.mStyleStructs[aSID] = const_cast<nsStyleStruct*>(newData);
   }
   return newData;
 }
 
 // This is an evil evil function, since it forces you to alloc your own separate copy of
 // style data!  Do not use this function unless you absolutely have to!  You should avoid
 // this at all costs! -dwh
-void* 
+nsStyleStruct*
 nsStyleContext::GetUniqueStyleData(const nsStyleStructID& aSID)
 {
   // If we already own the struct and no kids could depend on it, then
   // just return it.  (We leak in this case if there are kids -- and this
   // function really shouldn't be called for style contexts that could
   // have kids depending on the data.  ClearStyleData would be OK, but
   // this test for no mChild or mEmptyChild doesn't catch that case.)
-  const void *current = StyleData(aSID);
+  const nsStyleStruct* current = StyleData(aSID);
   if (!mChild && !mEmptyChild &&
       !(mBits & nsCachedStyleData::GetBitForSID(aSID)) &&
       GetCachedStyleData(aSID))
-    return const_cast<void*>(current);
+    return const_cast<nsStyleStruct*>(current);
 
-  void* result;
+  nsStyleStruct* result;
   nsPresContext *presContext = PresContext();
   switch (aSID) {
 
 #define UNIQUE_CASE(c_)                                                       \
   case eStyleStruct_##c_:                                                     \
     result = new (presContext) nsStyle##c_(                                   \
       * static_cast<const nsStyle##c_ *>(current));                           \
     break;
@@ -471,25 +472,25 @@ nsStyleContext::GetUniqueStyleData(const
   SetStyle(aSID, result);
   mBits &= ~static_cast<uint64_t>(nsCachedStyleData::GetBitForSID(aSID));
 
   return result;
 }
 
 // This is an evil function, but less evil than GetUniqueStyleData. It
 // creates an empty style struct for this nsStyleContext.
-void*
+nsStyleStruct*
 nsStyleContext::CreateEmptyStyleData(const nsStyleStructID& aSID)
 {
   MOZ_ASSERT(!mChild && !mEmptyChild &&
              !(mBits & nsCachedStyleData::GetBitForSID(aSID)) &&
              !GetCachedStyleData(aSID),
              "This style should not have been computed");
 
-  void* result;
+  nsStyleStruct* result;
   nsPresContext* presContext = PresContext();
   switch (aSID) {
 #define UNIQUE_CASE(c_, ...) \
     case eStyleStruct_##c_: \
       result = new (presContext) nsStyle##c_(__VA_ARGS__); \
       break;
 
   UNIQUE_CASE(Border, presContext)
@@ -505,28 +506,28 @@ nsStyleContext::CreateEmptyStyleData(con
   // The new struct is owned by this style context, but that we don't
   // need to clear the bit in mBits because we've asserted that at the
   // top of this function.
   SetStyle(aSID, result);
   return result;
 }
 
 void
-nsStyleContext::SetStyle(nsStyleStructID aSID, void* aStruct)
+nsStyleContext::SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct)
 {
   // This method should only be called from nsRuleNode!  It is not a public
   // method!
   
   NS_ASSERTION(aSID >= 0 && aSID < nsStyleStructID_Length, "out of bounds");
 
   // NOTE:  nsCachedStyleData::GetStyleData works roughly the same way.
   // See the comments there (in nsRuleNode.h) for more details about
   // what this is doing and why.
 
-  void** dataSlot;
+  nsStyleStruct** dataSlot;
   if (nsCachedStyleData::IsReset(aSID)) {
     if (!mCachedResetData) {
       mCachedResetData = new (mRuleNode->PresContext()) nsResetStyleData;
     }
     dataSlot = &mCachedResetData->mStyleStructs[aSID];
   } else {
     dataSlot = &mCachedInheritedData.mStyleStructs[aSID];
   }
@@ -1391,18 +1392,18 @@ nsStyleContext::SwapStyleData(nsStyleCon
 
   for (nsStyleStructID i = nsStyleStructID_Inherited_Start;
        i < nsStyleStructID_Inherited_Start + nsStyleStructID_Inherited_Count;
        i = nsStyleStructID(i + 1)) {
     uint32_t bit = nsCachedStyleData::GetBitForSID(i);
     if (!(aStructs & bit)) {
       continue;
     }
-    void*& thisData = mCachedInheritedData.mStyleStructs[i];
-    void*& otherData = aNewContext->mCachedInheritedData.mStyleStructs[i];
+    nsStyleStruct*& thisData = mCachedInheritedData.mStyleStructs[i];
+    nsStyleStruct*& otherData = aNewContext->mCachedInheritedData.mStyleStructs[i];
     if (mBits & bit) {
       if (thisData == otherData) {
         thisData = nullptr;
       }
     } else if (!(aNewContext->mBits & bit) && thisData && otherData) {
       std::swap(thisData, otherData);
     }
   }
@@ -1416,18 +1417,18 @@ nsStyleContext::SwapStyleData(nsStyleCon
     }
     if (!mCachedResetData) {
       mCachedResetData = new (mRuleNode->PresContext()) nsResetStyleData;
     }
     if (!aNewContext->mCachedResetData) {
       aNewContext->mCachedResetData =
         new (mRuleNode->PresContext()) nsResetStyleData;
     }
-    void*& thisData = mCachedResetData->mStyleStructs[i];
-    void*& otherData = aNewContext->mCachedResetData->mStyleStructs[i];
+    nsStyleStruct*& thisData = mCachedResetData->mStyleStructs[i];
+    nsStyleStruct*& otherData = aNewContext->mCachedResetData->mStyleStructs[i];
     if (mBits & bit) {
       if (thisData == otherData) {
         thisData = nullptr;
       }
     } else if (!(aNewContext->mBits & bit) && thisData && otherData) {
       std::swap(thisData, otherData);
     }
   }
@@ -1518,17 +1519,17 @@ nsStyleContext::SetIneligibleForSharing(
 nsCString
 nsStyleContext::GetCachedStyleDataAsString(uint32_t aStructs)
 {
   nsCString structs;
   for (nsStyleStructID i = nsStyleStructID(0);
        i < nsStyleStructID_Length;
        i = nsStyleStructID(i + 1)) {
     if (aStructs & nsCachedStyleData::GetBitForSID(i)) {
-      const void* data = GetCachedStyleData(i);
+      const nsStyleStruct* data = GetCachedStyleData(i);
       if (!structs.IsEmpty()) {
         structs.Append(' ');
       }
       structs.AppendPrintf("%s=%p", StructName(i), data);
       if (HasCachedDependentStyleData(i)) {
         structs.AppendLiteral("(dependent)");
       } else {
         structs.AppendLiteral("(owned)");
--- a/layout/style/nsStyleContext.h
+++ b/layout/style/nsStyleContext.h
@@ -258,17 +258,17 @@ public:
     { return !!(mBits & NS_STYLE_CHILD_USES_GRANDANCESTOR_STYLE); }
 
   // Is this style context shared with a sibling or cousin?
   // (See nsStyleSet::GetContext.)
   bool IsShared() const
     { return !!(mBits & NS_STYLE_IS_SHARED); }
 
   // Tell this style context to cache aStruct as the struct for aSID
-  void SetStyle(nsStyleStructID aSID, void* aStruct);
+  void SetStyle(nsStyleStructID aSID, nsStyleStruct* aStruct);
 
   /**
    * Returns whether this style context has cached style data for a
    * given style struct and it does NOT own that struct.  This can
    * happen because it was inherited from the parent style context, or
    * because it was stored conditionally on the rule node.
    */
   bool HasCachedDependentStyleData(nsStyleStructID aSID) {
@@ -295,17 +295,17 @@ public:
    * This function will NOT return null (even when out of memory) when
    * given a valid style struct ID, so the result does not need to be
    * null-checked.
    *
    * The typesafe functions below are preferred to the use of this
    * function, both because they're easier to read and because they're
    * faster.
    */
-  const void* NS_FASTCALL StyleData(nsStyleStructID aSID);
+  const nsStyleStruct* NS_FASTCALL StyleData(nsStyleStructID aSID);
 
   /**
    * Define typesafe getter functions for each style struct by
    * preprocessing the list of style structs.  These functions are the
    * preferred way to get style data.  The macro creates functions like:
    *   const nsStyleBorder* StyleBorder();
    *   const nsStyleColor* StyleColor();
    */
@@ -442,19 +442,19 @@ public:
 
   /**
    * Return style data that is currently cached on the style context.
    * Only returns the structs we cache ourselves; never consults the
    * rule tree.
    *
    * For "internal" use only in nsStyleContext and nsRuleNode.
    */
-  const void* GetCachedStyleData(nsStyleStructID aSID)
+  const nsStyleStruct* GetCachedStyleData(nsStyleStructID aSID)
   {
-    const void* cachedData;
+    const nsStyleStruct* cachedData;
     if (nsCachedStyleData::IsReset(aSID)) {
       if (mCachedResetData) {
         cachedData = mCachedResetData->mStyleStructs[aSID];
       } else {
         cachedData = nullptr;
       }
     } else {
       cachedData = mCachedInheritedData.mStyleStructs[aSID];
@@ -464,18 +464,18 @@ public:
 
 private:
   // Private destructor, to discourage deletion outside of Release():
   ~nsStyleContext();
 
   void AddChild(nsStyleContext* aChild);
   void RemoveChild(nsStyleContext* aChild);
 
-  void* GetUniqueStyleData(const nsStyleStructID& aSID);
-  void* CreateEmptyStyleData(const nsStyleStructID& aSID);
+  nsStyleStruct* GetUniqueStyleData(const nsStyleStructID& aSID);
+  nsStyleStruct* CreateEmptyStyleData(const nsStyleStructID& aSID);
 
   void ApplyStyleFixups(bool aSkipParentDisplayBasedStyleFixup);
 
 #ifdef DEBUG
   struct AutoCheckDependency {
 
     nsStyleContext* mStyleContext;
     nsStyleStructID mOuterSID;