зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1282076 - Store all non-inherited structs which are stored on the rule node on the style context if we have animation data. r=heycam
This commit is contained in:
Родитель
cdd7fc4a11
Коммит
7b1125457a
|
@ -2427,7 +2427,13 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
|
|||
// the context by our caller) as not being owned by the context.
|
||||
if (!isReset) {
|
||||
aContext->AddStyleBit(nsCachedStyleData::GetBitForSID(aSID));
|
||||
} else if (HasAnimationData()) {
|
||||
// If we have animation data, the struct should be cached on the style
|
||||
// context so that we can peek the struct.
|
||||
// See comment in AnimValuesStyleRule::MapRuleInfoInto.
|
||||
StoreStyleOnContext(aContext, aSID, startStruct);
|
||||
}
|
||||
|
||||
return startStruct;
|
||||
}
|
||||
if ((!startStruct && !isReset &&
|
||||
|
@ -2830,6 +2836,12 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
|
|||
SetStyleData(eStyleStruct_##type_, data_); \
|
||||
/* Propagate the bit down. */ \
|
||||
PropagateDependentBit(eStyleStruct_##type_, aHighestNode, data_); \
|
||||
if (HasAnimationData()) { \
|
||||
/* If we have animation data, the struct should be cached on the */ \
|
||||
/* style context so that we can peek the struct. */ \
|
||||
/* See comment in AnimValuesStyleRule::MapRuleInfoInto. */ \
|
||||
StoreStyleOnContext(aContext, eStyleStruct_##type_, data_); \
|
||||
} \
|
||||
} else if (conditions.Cacheable()) { \
|
||||
if (!mStyleData.mResetData) { \
|
||||
mStyleData.mResetData = new (mPresContext) nsConditionalResetStyleData; \
|
||||
|
@ -10268,7 +10280,13 @@ nsRuleNode::GetStyleData(nsStyleStructID aSID,
|
|||
// the context by our caller) as not being owned by the context.
|
||||
if (!nsCachedStyleData::IsReset(aSID)) {
|
||||
aContext->AddStyleBit(nsCachedStyleData::GetBitForSID(aSID));
|
||||
} else if (HasAnimationData()) {
|
||||
// If we have animation data, the struct should be cached on the style
|
||||
// context so that we can peek the struct.
|
||||
// See comment in AnimValuesStyleRule::MapRuleInfoInto.
|
||||
StoreStyleOnContext(aContext, aSID, const_cast<void*>(data));
|
||||
}
|
||||
|
||||
return data; // We have a fully specified struct. Just return it.
|
||||
}
|
||||
}
|
||||
|
@ -10627,6 +10645,15 @@ nsRuleNode::ParentHasPseudoElementData(nsStyleContext* aContext)
|
|||
return parent && parent->HasPseudoElementData();
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsRuleNode::StoreStyleOnContext(nsStyleContext* aContext,
|
||||
nsStyleStructID aSID,
|
||||
void* aStruct)
|
||||
{
|
||||
aContext->AddStyleBit(nsCachedStyleData::GetBitForSID(aSID));
|
||||
aContext->SetStyle(aSID, aStruct);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool
|
||||
nsRuleNode::ContextHasCachedData(nsStyleContext* aContext,
|
||||
|
|
|
@ -943,6 +943,14 @@ public:
|
|||
if (!(HasAnimationData() && ParentHasPseudoElementData(aContext))) { \
|
||||
data = mStyleData.GetStyle##name_(aContext, aComputeData); \
|
||||
if (MOZ_LIKELY(data != nullptr)) { \
|
||||
if (HasAnimationData()) { \
|
||||
/* If we have animation data, the struct should be cached on the */ \
|
||||
/* style context so that we can peek the struct. */ \
|
||||
/* See comment in AnimValuesStyleRule::MapRuleInfoInto. */ \
|
||||
StoreStyleOnContext(aContext, \
|
||||
eStyleStruct_##name_, \
|
||||
const_cast<nsStyle##name_*>(data)); \
|
||||
} \
|
||||
return data; \
|
||||
} \
|
||||
} \
|
||||
|
@ -1071,6 +1079,11 @@ private:
|
|||
bool ContextHasCachedData(nsStyleContext* aContext, nsStyleStructID aSID);
|
||||
#endif
|
||||
|
||||
// Store style struct on the style context and tell the style context
|
||||
// that it doesn't own the data
|
||||
static void StoreStyleOnContext(nsStyleContext* aContext,
|
||||
nsStyleStructID aSID,
|
||||
void* aStruct);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче