Make nsMediaFeature::mKeywordTable an mData union. (Bug 522149) r=bzbarsky

This commit is contained in:
L. David Baron 2009-10-15 17:23:18 -07:00
Родитель 7a7055b825
Коммит db5753f9cd
4 изменённых файлов: 25 добавлений и 18 удалений

Просмотреть файл

@ -1823,7 +1823,7 @@ CSSParserImpl::ParseMediaQueryExpression(nsMediaQuery* aQuery)
break;
case nsMediaFeature::eEnumerated:
rv = ParseVariant(expr->mValue, VARIANT_KEYWORD,
feature->mKeywordTable);
feature->mData.mKeywordTable);
break;
}
if (!rv || !ExpectSymbol(')', PR_TRUE)) {

Просмотреть файл

@ -462,7 +462,7 @@ nsMediaQuery::AppendToString(nsAString& aString) const
"bad unit");
AppendASCIItoUTF16(
nsCSSProps::ValueToKeyword(expr.mValue.GetIntValue(),
feature->mKeywordTable),
feature->mData.mKeywordTable),
aString);
break;
}

Просмотреть файл

@ -262,91 +262,91 @@ nsMediaFeatures::features[] = {
&nsGkAtoms::width,
nsMediaFeature::eMinMaxAllowed,
nsMediaFeature::eLength,
nsnull,
{ nsnull },
GetWidth
},
{
&nsGkAtoms::height,
nsMediaFeature::eMinMaxAllowed,
nsMediaFeature::eLength,
nsnull,
{ nsnull },
GetHeight
},
{
&nsGkAtoms::deviceWidth,
nsMediaFeature::eMinMaxAllowed,
nsMediaFeature::eLength,
nsnull,
{ nsnull },
GetDeviceWidth
},
{
&nsGkAtoms::deviceHeight,
nsMediaFeature::eMinMaxAllowed,
nsMediaFeature::eLength,
nsnull,
{ nsnull },
GetDeviceHeight
},
{
&nsGkAtoms::orientation,
nsMediaFeature::eMinMaxNotAllowed,
nsMediaFeature::eEnumerated,
kOrientationKeywords,
{ kOrientationKeywords },
GetOrientation
},
{
&nsGkAtoms::aspectRatio,
nsMediaFeature::eMinMaxAllowed,
nsMediaFeature::eIntRatio,
nsnull,
{ nsnull },
GetAspectRatio
},
{
&nsGkAtoms::deviceAspectRatio,
nsMediaFeature::eMinMaxAllowed,
nsMediaFeature::eIntRatio,
nsnull,
{ nsnull },
GetDeviceAspectRatio
},
{
&nsGkAtoms::color,
nsMediaFeature::eMinMaxAllowed,
nsMediaFeature::eInteger,
nsnull,
{ nsnull },
GetColor
},
{
&nsGkAtoms::colorIndex,
nsMediaFeature::eMinMaxAllowed,
nsMediaFeature::eInteger,
nsnull,
{ nsnull },
GetColorIndex
},
{
&nsGkAtoms::monochrome,
nsMediaFeature::eMinMaxAllowed,
nsMediaFeature::eInteger,
nsnull,
{ nsnull },
GetMonochrome
},
{
&nsGkAtoms::resolution,
nsMediaFeature::eMinMaxAllowed,
nsMediaFeature::eResolution,
nsnull,
{ nsnull },
GetResolution
},
{
&nsGkAtoms::scan,
nsMediaFeature::eMinMaxNotAllowed,
nsMediaFeature::eEnumerated,
kScanKeywords,
{ kScanKeywords },
GetScan
},
{
&nsGkAtoms::grid,
nsMediaFeature::eMinMaxNotAllowed,
nsMediaFeature::eBoolInteger,
nsnull,
{ nsnull },
GetGrid
},
// Null-mName terminator:
@ -354,7 +354,7 @@ nsMediaFeatures::features[] = {
nsnull,
nsMediaFeature::eMinMaxAllowed,
nsMediaFeature::eInteger,
nsnull,
{ nsnull },
nsnull
},
};

Просмотреть файл

@ -73,8 +73,15 @@ struct nsMediaFeature {
};
ValueType mValueType;
// The same format as the keyword tables in nsCSSProps.
const PRInt32* mKeywordTable;
union {
// In static arrays, it's the first member that's initialized. We
// need that to be void* so we can initialize both other types.
// This member should never be accessed by name.
const void* mInitializer_;
// If mValueType == eEnumerated: const PRInt32*: keyword table in
// the same format as the keyword tables in nsCSSProps.
const PRInt32* mKeywordTable;
} mData;
// A function that returns the current value for this feature for a
// given presentation. If it returns eCSSUnit_Null, the feature is