Bug 1216431 patch 6 - Back out bug 1209603 patch 8. r=heycam

This requires a little bit of gymnastics since it has to add the inverse
of tests, since the is-a-reset-struct tests originally added in patch 8
were made unconditional in patch 9, and with this backout we now want to
execute the code only for inherited structs.

This also doesn't back out the cleanup to use NS_STYLE_INHERIT_BIT() for
constants rather than nsCachedStyleData::GetBitForSID.

This backs out the part of bug 1209603 whose speed I was concerned about.

--HG--
extra : commitid : 6BWdXCpywlU
extra : rebase_source : 15597857a721a3a399432c8454ecfc7b789e5e2d
This commit is contained in:
L. David Baron 2015-10-23 08:57:36 +09:00
parent 43e7bc5c52
commit 8acc13bdfa
3 changed files with 8 additions and 21 deletions

View File

@ -2372,12 +2372,11 @@ nsRuleNode::WalkRuleTree(const nsStyleStructID aSID,
// branch that they never need to examine their rules for this particular struct type
// ever again.
PropagateDependentBit(aSID, ruleNode, startStruct);
// With this same bit set, we do two different things:
// For reset structs, record that we have asked for this struct on
// this context, but it is not cached on the context.
// For inherited structs, mark the struct (which will be set on
// the context by our caller) as not being owned by the context.
aContext->AddStyleBit(nsCachedStyleData::GetBitForSID(aSID));
if (!isReset) {
aContext->AddStyleBit(nsCachedStyleData::GetBitForSID(aSID));
}
return startStruct;
}
if ((!startStruct && !isReset &&
@ -2782,9 +2781,6 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex
SetStyleData(eStyleStruct_##type_, data_); \
/* Propagate the bit down. */ \
PropagateDependentBit(eStyleStruct_##type_, aHighestNode, data_); \
/* Tell the context that we've gotten the data (separate meaning */ \
/* of mBits when the cached data pointer is null) */ \
aContext->AddStyleBit(NS_STYLE_INHERIT_BIT(type_)); \
} else if (conditions.Cacheable()) { \
if (!mStyleData.mResetData) { \
mStyleData.mResetData = new (mPresContext) nsConditionalResetStyleData; \
@ -9436,12 +9432,11 @@ nsRuleNode::GetStyleData(nsStyleStructID aSID,
if (!(HasAnimationData() && ParentHasPseudoElementData(aContext))) {
data = mStyleData.GetStyleData(aSID, aContext, aComputeData);
if (MOZ_LIKELY(data != nullptr)) {
// With this same bit set, we do two different things:
// For reset structs, mark the struct as having been retrieved for
// this context.
// For inherited structs, mark the struct (which will be set on
// the context by our caller) as not being owned by the context.
aContext->AddStyleBit(nsCachedStyleData::GetBitForSID(aSID));
if (!nsCachedStyleData::IsReset(aSID)) {
aContext->AddStyleBit(nsCachedStyleData::GetBitForSID(aSID));
}
return data; // We have a fully specified struct. Just return it.
}
}

View File

@ -932,7 +932,7 @@ public:
#define STYLE_STRUCT_RESET(name_, checkdata_cb_) \
template<bool aComputeData> \
const nsStyle##name_* \
GetStyle##name_(nsStyleContext* aContext, uint64_t& aContextStyleBits) \
GetStyle##name_(nsStyleContext* aContext) \
{ \
NS_ASSERTION(IsUsedDirectly(), \
"if we ever call this on rule nodes that aren't used " \
@ -948,10 +948,6 @@ public:
if (!(HasAnimationData() && ParentHasPseudoElementData(aContext))) { \
data = mStyleData.GetStyle##name_(aContext, aComputeData); \
if (MOZ_LIKELY(data != nullptr)) { \
/* Mark the struct as having been retrieved for this context. */ \
/* Normally this would be aContext->AddStyleBit(), but aContext is */ \
/* an incomplete type here, so we work around that with a param. */ \
aContextStyleBits |= NS_STYLE_INHERIT_BIT(name_); \
return data; \
} \
} \

View File

@ -560,7 +560,7 @@ private:
} \
/* Have the rulenode deal */ \
AUTO_CHECK_DEPENDENCY(eStyleStruct_##name_); \
return mRuleNode->GetStyle##name_<aComputeData>(this, mBits); \
return mRuleNode->GetStyle##name_<aComputeData>(this); \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT_RESET
@ -630,10 +630,6 @@ private:
// - For all structs, when they are non-null in the style context's
// storage, it records (using the style struct bits) which structs
// are inherited from the parent context or owned by mRuleNode.
// - For reset (non-inherited) style structs, when they are null in
// the style context's storage, it records that we have been asked
// for that struct. (We don't need this for inherited structs
// since we always cache them in mCachedInheritedData.)
// - It also stores the additional bits listed at the top of
// nsStyleStruct.h.
uint64_t mBits;