--- 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) \