Bug 1419709 - Move a few nsStyleStructID-related static methods out of nsRuleNode.h r=emilio

MozReview-Commit-ID: GyEMmvlH4mh
This commit is contained in:
Cameron McCormack
2017-11-22 18:08:33 +08:00
parent 7a3fb0690f
commit fea3ddf90b
3 changed files with 12 additions and 5 deletions

View File

@@ -492,7 +492,7 @@ inDOMUtils::IsInheritedProperty(const nsAString &aPropertyName, bool *_retval)
} }
nsStyleStructID sid = nsCSSProps::kSIDTable[prop]; nsStyleStructID sid = nsCSSProps::kSIDTable[prop];
*_retval = !nsCachedStyleData::IsReset(sid); *_retval = !nsStyleContext::IsReset(sid);
return NS_OK; return NS_OK;
} }

View File

@@ -499,7 +499,7 @@ nsCSSProps::IsInherited(nsCSSPropertyID aProperty)
MOZ_ASSERT(!IsShorthand(aProperty)); MOZ_ASSERT(!IsShorthand(aProperty));
nsStyleStructID sid = kSIDTable[aProperty]; nsStyleStructID sid = kSIDTable[aProperty];
return nsCachedStyleData::IsInherited(sid); return nsStyleContext::IsInherited(sid);
} }
/* static */ bool /* static */ bool

View File

@@ -197,7 +197,7 @@ public:
* because it was stored conditionally on the rule node. * because it was stored conditionally on the rule node.
*/ */
bool HasCachedDependentStyleData(nsStyleStructID aSID) { bool HasCachedDependentStyleData(nsStyleStructID aSID) {
return mBits & nsCachedStyleData::GetBitForSID(aSID); return mBits & GetBitForSID(aSID);
} }
inline nsRuleNode* RuleNode(); inline nsRuleNode* RuleNode();
@@ -292,6 +292,14 @@ public:
*/ */
inline void StartBackgroundImageLoads(); inline void StartBackgroundImageLoads();
static bool IsReset(const nsStyleStructID aSID) {
MOZ_ASSERT(0 <= aSID && aSID < nsStyleStructID_Length,
"must be an inherited or reset SID");
return nsStyleStructID_Reset_Start <= aSID;
}
static bool IsInherited(const nsStyleStructID aSID) { return !IsReset(aSID); }
static uint32_t GetBitForSID(const nsStyleStructID aSID) { return 1 << aSID; }
#ifdef DEBUG #ifdef DEBUG
void List(FILE* out, int32_t aIndent, bool aListDescendants = true); void List(FILE* out, int32_t aIndent, bool aListDescendants = true);
static const char* StructName(nsStyleStructID aSID); static const char* StructName(nsStyleStructID aSID);
@@ -334,8 +342,7 @@ protected:
static bool DependencyAllowed(nsStyleStructID aOuterSID, static bool DependencyAllowed(nsStyleStructID aOuterSID,
nsStyleStructID aInnerSID) nsStyleStructID aInnerSID)
{ {
return !!(sDependencyTable[aOuterSID] & return !!(sDependencyTable[aOuterSID] & GetBitForSID(aInnerSID));
nsCachedStyleData::GetBitForSID(aInnerSID));
} }
static const uint32_t sDependencyTable[]; static const uint32_t sDependencyTable[];