本文整理汇总了C#中CssValue.GetPercentValue方法的典型用法代码示例。如果您正苦于以下问题:C# CssValue.GetPercentValue方法的具体用法?C# CssValue.GetPercentValue怎么用?C# CssValue.GetPercentValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CssValue
的用法示例。
在下文中一共展示了CssValue.GetPercentValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseNonNegativeVariant
// Note that this does include VARIANT_CALC, which is numeric. This is
// because calc() parsing, as proposed, drops range restrictions inside
// the calc() expression and clamps the result of the calculation to the
// range.
// Note that callers passing VARIANT_CALC in aVariantMask will get
// full-range parsing inside the calc() expression, and the code that
// computes the calc will be required to clamp the resulting value to an
// appropriate range.
internal bool ParseNonNegativeVariant(ref nsCSSValue aValue,
int32_t aVariantMask,
int32_t[] aKeywordTable)
{
// The variant mask must only contain non-numeric variants or the ones
// that we specifically handle.
Debug.Assert((aVariantMask & ~(VARIANT_ALL_NONNUMERIC |
VARIANT_NUMBER |
VARIANT_LENGTH |
VARIANT_PERCENT |
VARIANT_INTEGER)) == 0,
"need to update code below to handle additional variants");
if (ParseVariant(ref aValue, aVariantMask, aKeywordTable)) {
if (nsCSSUnit.Number == aValue.GetUnit() ||
aValue.IsLengthUnit()){
if (aValue.GetFloatValue() < 0) {
UngetToken();
return false;
}
}
else if (aValue.GetUnit() == nsCSSUnit.Percent) {
if (aValue.GetPercentValue() < 0) {
UngetToken();
return false;
}
} else if (aValue.GetUnit() == nsCSSUnit.Integer) {
if (aValue.GetIntValue() < 0) {
UngetToken();
return false;
}
}
return true;
}
return false;
}