Bug 921731 - Part 6: Treat "unset" as "inherit" when determining rule detail for inherited style structs. r=bzbarsky

This commit is contained in:
Cameron McCormack 2013-10-04 04:49:18 +10:00
parent 2e9e72b5c4
commit 806271a533

View File

@ -1571,16 +1571,21 @@ typedef nsRuleNode::RuleDetail
/**
* @param aValue the value being examined
* @param aSpecifiedCount to be incremented by one if the value is specified
* @param aInherited to be incremented by one if the value is set to inherit
* @param aInheritedCount to be incremented by one if the value is set to inherit
* @param aUnsetCount to be incremented by one if the value is set to unset
*/
inline void
ExamineCSSValue(const nsCSSValue& aValue,
uint32_t& aSpecifiedCount, uint32_t& aInheritedCount)
uint32_t& aSpecifiedCount,
uint32_t& aInheritedCount,
uint32_t& aUnsetCount)
{
if (aValue.GetUnit() != eCSSUnit_Null) {
++aSpecifiedCount;
if (aValue.GetUnit() == eCSSUnit_Inherit) {
++aInheritedCount;
} else if (aValue.GetUnit() == eCSSUnit_Unset) {
++aUnsetCount;
}
}
}
@ -1839,8 +1844,9 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
// Build a count of the:
uint32_t total = 0, // total number of props in the struct
specified = 0, // number that were specified for this node
inherited = 0; // number that were 'inherit' (and not
inherited = 0, // number that were 'inherit' (and not
// eCSSUnit_Inherit) for this node
unset = 0; // number that were 'unset'
// See comment in nsRuleData.h above mValueOffsets.
NS_ABORT_IF_FALSE(aRuleData->mValueOffsets[aSID] == 0,
@ -1849,7 +1855,13 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID,
*values_end = values + nsCSSProps::PropertyCountInStruct(aSID);
values != values_end; ++values) {
++total;
ExamineCSSValue(*values, specified, inherited);
ExamineCSSValue(*values, specified, inherited, unset);
}
if (!nsCachedStyleData::IsReset(aSID)) {
// For inherited properties, 'unset' means the same as 'inherit'.
inherited += unset;
unset = 0;
}
#if 0