本文整理汇总了C#中CssValue.InitFunction方法的典型用法代码示例。如果您正苦于以下问题:C# CssValue.InitFunction方法的具体用法?C# CssValue.InitFunction怎么用?C# CssValue.InitFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CssValue
的用法示例。
在下文中一共展示了CssValue.InitFunction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseImageRect
/**
* Parse the arguments of -moz-image-rect() function.
* -moz-image-rect(<uri>, <top>, <right>, <bottom>, <left>)
*/
internal bool ParseImageRect(ref nsCSSValue aImage)
{
// A non-iterative for loop to break out when an error occurs.
for (;;) {
var newFunction = new nsCSSValue();
const uint32_t kNumArgs = 5;
nsCSSValue[] func =
newFunction.InitFunction(nsCSSKeyword._moz_image_rect, kNumArgs);
// func[0] is reserved for the function name.
nsCSSValue url = func[1];
nsCSSValue top = func[2];
nsCSSValue right = func[3];
nsCSSValue bottom = func[4];
nsCSSValue left = func[5];
string urlString = "";
if (!ParseURLOrString(ref urlString) ||
!SetValueToURL(ref url, urlString) ||
!ExpectSymbol(',', true)) {
break;
}
const int32_t VARIANT_SIDE = VARIANT_NUMBER | VARIANT_PERCENT;
if (!ParseNonNegativeVariant(ref top, VARIANT_SIDE, null) ||
!ExpectSymbol(',', true) ||
!ParseNonNegativeVariant(ref right, VARIANT_SIDE, null) ||
!ExpectSymbol(',', true) ||
!ParseNonNegativeVariant(ref bottom, VARIANT_SIDE, null) ||
!ExpectSymbol(',', true) ||
!ParseNonNegativeVariant(ref left, VARIANT_SIDE, null) ||
!ExpectSymbol(')', true))
break;
aImage = newFunction;
return true;
}
SkipUntil(')');
return false;
}