本文整理汇总了C#中CssValue类的典型用法代码示例。如果您正苦于以下问题:C# CssValue类的具体用法?C# CssValue怎么用?C# CssValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CssValue类属于命名空间,在下文中一共展示了CssValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MoveValue
protected static bool MoveValue(ref CssValue aSource, ref CssValue aDest)
{
bool changed = aSource != aDest;
aDest = aSource;
aSource.Reset();
return changed;
}
开发者ID:rexwhitten,项目名称:CsCss,代码行数:7,代码来源:nsCSSDataBlock.cs
示例2: PatchValue
// transform 0.04s linear, opacity 0.04s linear, visibility 0.04s linear;
// -webkit-transform 0.04s linear, opacity 0.04s linear, visibility 0.04s linear;
public static CssValue PatchValue(CssValue value, Browser browser)
{
if (value.Kind != NodeKind.ValueList) return value;
var a = (CssValueList)value;
var list = new CssValueList(a.Seperator);
foreach (var node in a)
{
if (node.Kind == NodeKind.ValueList) // For comma seperated componented lists
{
list.Add(PatchValue(node, browser));
}
else if (node.Kind == NodeKind.String && node.ToString() == "transform")
{
list.Add(new CssString(browser.Prefix.Text + "transform"));
}
else
{
list.Add(node);
}
}
return list;
}
开发者ID:carbon,项目名称:Css,代码行数:29,代码来源:CssCompatibility.cs
示例3: BinaryExpression
// ||, &&, ==, !=
// +, -, *, /, %
public BinaryExpression(CssValue left, BinaryOperator op, CssValue right)
: base(NodeKind.Expression)
{
Left = left;
Operator = op;
Right = right;
}
开发者ID:carbon,项目名称:Css,代码行数:10,代码来源:BinaryExpression.cs
示例4: PeriodicValue
public PeriodicValue(IPropertyValue[] options, IEnumerable<CssToken> tokens, String[] labels)
{
_top = options[0];
_right = options[1] ?? _top;
_bottom = options[2] ?? _top;
_left = options[3] ?? _right;
_original = new CssValue(tokens);
_labels = labels;
}
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:9,代码来源:PeriodicValueConverter.cs
示例5: ReadExpressionFrom
public CssValue ReadExpressionFrom(CssValue left)
{
var opToken = Read(); // Read operator
ReadTrivia();
var op = (BinaryOperator)((int)opToken.Kind);
// This may be another expression...
// TODO: Make recurssive
var right = ReadComponent();
return new BinaryExpression(left, op, right);
}
开发者ID:carbon,项目名称:Css,代码行数:14,代码来源:CssParser.Expressions.cs
示例6: SetSide
public void SetSide(Side side, CssValue aValue)
{
switch (side) {
case Side.Top:
mTop = aValue;
break;
case Side.Right:
mRight = aValue;
break;
case Side.Bottom:
mBottom = aValue;
break;
case Side.Left:
mLeft = aValue;
break;
default:
throw new ArgumentOutOfRangeException("side");
}
}
开发者ID:rexwhitten,项目名称:CsCss,代码行数:19,代码来源:CssRect.cs
示例7: TrySetValue
internal Boolean TrySetValue(CssValue value)
{
var result = false;
if (value == null)
{
result = !IsMinimum && !IsMaximum && Converter.HasDefault();
}
else
{
result = Converter.Convert(value) != null;
}
if (result)
{
_value = value;
}
return result;
}
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:20,代码来源:MediaFeature.cs
示例8: Patch
public Patch(string name, CssValue value)
{
Name = name;
Value = value;
}
开发者ID:carbon,项目名称:Css,代码行数:5,代码来源:CssCompatibility.cs
示例9: GradientValue
public GradientValue(Boolean repeating, IPropertyValue initial, IPropertyValue[] stops, IEnumerable<CssToken> tokens)
{
_repeating = repeating;
_initial = initial;
_stops = stops;
_original = new CssValue(tokens);
}
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:7,代码来源:GradientConverter.cs
示例10: GetUnit
//typedef nsCSSValue input_type;
//typedef nsCSSValue::Array input_array_type;
public static CssUnit GetUnit(CssValue aValue)
{
return aValue.GetUnit();
}
开发者ID:rexwhitten,项目名称:CsCss,代码行数:6,代码来源:CssValueInputCalcOps.cs
示例11: SetAllSidesTo
internal void SetAllSidesTo(CssValue aValue)
{
mTop = mRight = mBottom = mLeft = aValue;
}
开发者ID:rexwhitten,项目名称:CsCss,代码行数:4,代码来源:CssRect.cs
示例12: MultipleValue
public MultipleValue(IPropertyValue[] values, IEnumerable<CssToken> tokens)
{
_values = values;
_value = new CssValue(tokens);
}
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:5,代码来源:OneOrMoreValueConverter.cs
示例13: StringsValue
public StringsValue(String[] values, IEnumerable<CssToken> tokens)
{
_values = values;
_original = new CssValue(tokens);
}
开发者ID:fjwuyongzhi,项目名称:AngleSharp,代码行数:5,代码来源:StringsValueConverter.cs
示例14: StopValue
public StopValue(IPropertyValue color, IPropertyValue position, IEnumerable<CssToken> tokens)
{
_color = color;
_position = position;
_original = new CssValue(tokens);
}
开发者ID:Wojdav,项目名称:AngleSharp,代码行数:6,代码来源:GradientConverter.cs
示例15: ParseFlex
// flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]
internal bool ParseFlex()
{
// First check for inherit / initial
var tmpVal = new nsCSSValue();
if (ParseVariant(ref tmpVal, VARIANT_INHERIT, null)) {
AppendValue(nsCSSProperty.FlexGrow, tmpVal);
AppendValue(nsCSSProperty.FlexShrink, tmpVal);
AppendValue(nsCSSProperty.FlexBasis, tmpVal);
return true;
}
// Next, check for 'none' == '0 0 auto'
if (ParseVariant(ref tmpVal, VARIANT_NONE, null)) {
AppendValue(nsCSSProperty.FlexGrow, new nsCSSValue(0.0f, nsCSSUnit.Number));
AppendValue(nsCSSProperty.FlexShrink, new nsCSSValue(0.0f, nsCSSUnit.Number));
AppendValue(nsCSSProperty.FlexBasis, new nsCSSValue(nsCSSUnit.Auto));
return true;
}
// OK, try parsing our value as individual per-subproperty components:
// [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]
// Each subproperty has a default value that it takes when it's omitted in a
// "flex" shorthand value. These default values are *only* for the shorthand
// syntax -- they're distinct from the subproperties' own initial values. We
// start with each subproperty at its default, as if we had "flex: 1 1 0%".
var flexGrow = new nsCSSValue(1.0f, nsCSSUnit.Number);
var flexShrink = new nsCSSValue(1.0f, nsCSSUnit.Number);
var flexBasis = new nsCSSValue(0.0f, nsCSSUnit.Percent);
// OVERVIEW OF PARSING STRATEGY:
// =============================
// a) Parse the first component as either flex-basis or flex-grow.
// b) If it wasn't flex-grow, parse the _next_ component as flex-grow.
// c) Now we've just parsed flex-grow -- so try parsing the next thing as
// flex-shrink.
// d) Finally: If we didn't get flex-basis at the beginning, try to parse
// it now, at the end.
//
// More details in each section below.
uint32_t flexBasisVariantMask =
(nsCSSProps.ParserVariant(nsCSSProperty.FlexBasis) & ~(VARIANT_INHERIT));
// (a) Parse first component. It can be either be a 'flex-basis' value or a
// 'flex-grow' value, so we use the flex-basis-specific variant mask, along
// with VARIANT_NUMBER to accept 'flex-grow' values.
//
// NOTE: if we encounter unitless 0 here, we *must* interpret it as a
// 'flex-grow' value (a number), *not* as a 'flex-basis' value (a length).
// Conveniently, that's the behavior this combined variant-mask gives us --
// it'll treat unitless 0 as a number. The flexbox spec requires this:
// "a unitless zero that is not already preceded by two flex factors must be
// interpreted as a flex factor.
if (!ParseNonNegativeVariant(ref tmpVal, flexBasisVariantMask | VARIANT_NUMBER,
nsCSSProps.kWidthKTable)) {
// First component was not a valid flex-basis or flex-grow value. Fail.
return false;
}
// Record what we just parsed as either flex-basis or flex-grow:
bool wasFirstComponentFlexBasis = (tmpVal.GetUnit() != nsCSSUnit.Number);
if (wasFirstComponentFlexBasis) flexBasis = tmpVal; else flexGrow = tmpVal;
// (b) If we didn't get flex-grow yet, parse _next_ component as flex-grow.
bool doneParsing = false;
if (wasFirstComponentFlexBasis) {
if (ParseNonNegativeVariant(ref tmpVal, VARIANT_NUMBER, null)) {
flexGrow = tmpVal;
} else {
// Failed to parse anything after our flex-basis -- that's fine. We can
// skip the remaining parsing.
doneParsing = true;
}
}
if (!doneParsing) {
// (c) OK -- the last thing we parsed was flex-grow, so look for a
// flex-shrink in the next position.
if (ParseNonNegativeVariant(ref tmpVal, VARIANT_NUMBER, null)) {
flexShrink = tmpVal;
}
// d) Finally: If we didn't get flex-basis at the beginning, try to parse
// it now, at the end.
//
// NOTE: If we encounter unitless 0 in this final position, we'll parse it
// as a 'flex-basis' value. That's OK, because we know it must have
// been "preceded by 2 flex factors" (justification below), which gets us
// out of the spec's requirement of otherwise having to treat unitless 0
// as a flex factor.
//
// JUSTIFICATION: How do we know that a unitless 0 here must have been
// preceded by 2 flex factors? Well, suppose we had a unitless 0 that
// was preceded by only 1 flex factor. Then, we would have already
// accepted this unitless 0 as the 'flex-shrink' value, up above (since
// it's a valid flex-shrink value), and we'd have moved on to the next
// token (if any). And of course, if we instead had a unitless 0 preceded
// by *no* flex factors (if it were the first token), we would've already
//.........这里部分代码省略.........
开发者ID:jorik041,项目名称:CsCss,代码行数:101,代码来源:nsCSSParser.conv.cs
示例16: ParseTextOverflow
internal bool ParseTextOverflow(ref nsCSSValue aValue)
{
if (ParseVariant(ref aValue, VARIANT_INHERIT, null)) {
// 'inherit' and 'initial' must be alone
return true;
}
var left = new nsCSSValue();
if (!ParseVariant(ref left, VARIANT_KEYWORD | VARIANT_STRING,
nsCSSProps.kTextOverflowKTable))
return false;
var right = new nsCSSValue();
if (ParseVariant(ref right, VARIANT_KEYWORD | VARIANT_STRING,
nsCSSProps.kTextOverflowKTable))
aValue.SetPairValue(left, right);
else {
aValue = left;
}
return true;
}
开发者ID:jorik041,项目名称:CsCss,代码行数:21,代码来源:nsCSSParser.conv.cs
示例17: ParseTransform
/* Parses a transform property list by continuously reading in properties
* and constructing a matrix from it.
*/
bool ParseTransform(bool aIsPrefixed)
{
var value = new nsCSSValue();
if (ParseVariant(ref value, VARIANT_INHERIT | VARIANT_NONE, null)) {
// 'inherit', 'initial', and 'none' must be alone
if (!ExpectEndProperty()) {
return false;
}
} else {
nsCSSValueList cur = value.SetListValue();
for (;;) {
bool is3D = false;
if (!ParseSingleTransform(aIsPrefixed, ref cur.mValue, ref is3D)) {
return false;
}
if (is3D && !nsLayoutUtils.Are3DTransformsEnabled()) {
return false;
}
if (CheckEndProperty()) {
break;
}
cur.mNext = new nsCSSValueList();
cur = cur.mNext;
}
}
AppendValue(nsCSSProperty.Transform, value);
return true;
}
开发者ID:jorik041,项目名称:CsCss,代码行数:31,代码来源:nsCSSParser.conv.cs
示例18: ParseTransformOrigin
bool ParseTransformOrigin(bool aPerspective)
{
var position = new nsCSSValuePair();
if (!ParseBoxPositionValues(ref position, true))
return false;
nsCSSProperty prop = nsCSSProperty.TransformOrigin;
if (aPerspective) {
if (!ExpectEndProperty()) {
return false;
}
prop = nsCSSProperty.PerspectiveOrigin;
}
// Unlike many other uses of pairs, this position should always be stored
// as a pair, even if the values are the same, so it always serializes as
// a pair, and to keep the computation code simple.
if (position.mXValue.GetUnit() == nsCSSUnit.Inherit ||
position.mXValue.GetUnit() == nsCSSUnit.Initial) {
Debug.Assert(position.mXValue == position.mYValue,
"inherit/initial only half?");
AppendValue(prop, position.mXValue);
} else {
var value = new nsCSSValue();
if (aPerspective) {
value.SetPairValue(position.mXValue, position.mYValue);
} else {
var depth = new nsCSSValue();
if (!nsLayoutUtils.Are3DTransformsEnabled() ||
// only try parsing if 3-D transforms are enabled
!ParseVariant(ref depth, VARIANT_LENGTH | VARIANT_CALC, null)) {
depth.SetFloatValue(0.0f, nsCSSUnit.Pixel);
}
value.SetTripletValue(position.mXValue, position.mYValue, depth);
}
AppendValue(prop, value);
}
return true;
}
开发者ID:jorik041,项目名称:CsCss,代码行数:40,代码来源:nsCSSParser.conv.cs
示例19: ParseTransitionStepTimingFunctionValues
internal bool ParseTransitionStepTimingFunctionValues(ref nsCSSValue aValue)
{
Debug.Assert(!mHavePushBack &&
mToken.mType == nsCSSTokenType.Function &&
mToken.mIdentStr.LowerCaseEqualsLiteral("steps"),
"unexpected initial state");
nsCSSValue[] val = new nsCSSValue[2];
if (!ParseOneOrLargerVariant(ref val[0], VARIANT_INTEGER, null)) {
return false;
}
int32_t type = nsStyle.TRANSITION_TIMING_FUNCTION_STEP_END;
if (ExpectSymbol(',', true)) {
if (!GetToken(true)) {
return false;
}
type = -1;
if (mToken.mType == nsCSSTokenType.Ident) {
if (mToken.mIdentStr.LowerCaseEqualsLiteral("start")) {
type = nsStyle.TRANSITION_TIMING_FUNCTION_STEP_START;
} else if (mToken.mIdentStr.LowerCaseEqualsLiteral("end")) {
type = nsStyle.TRANSITION_TIMING_FUNCTION_STEP_END;
}
}
if (type == -1) {
UngetToken();
return false;
}
}
val[1].SetIntValue(type, nsCSSUnit.Enumerated);
if (!ExpectSymbol(')', true)) {
return false;
}
aValue.SetArrayValue(val, nsCSSUnit.Steps);
return true;
}
开发者ID:jorik041,项目名称:CsCss,代码行数:40,代码来源:nsCSSParser.conv.cs
示例20: SetBorderImageInitialValues
internal void SetBorderImageInitialValues()
{
// border-image-source: none
var source = new nsCSSValue();
source.SetNoneValue();
AppendValue(nsCSSProperty.BorderImageSource, source);
// border-image-slice: 100%
var sliceBoxValue = new nsCSSValue();
nsCSSRect sliceBox = sliceBoxValue.SetRectValue();
sliceBox.SetAllSidesTo(new nsCSSValue(1.0f, nsCSSUnit.Percent));
var slice = new nsCSSValue();
nsCSSValueList sliceList = slice.SetListValue();
sliceList.mValue = sliceBoxValue;
AppendValue(nsCSSProperty.BorderImageSlice, slice);
// border-image-width: 1
var width = new nsCSSValue();
nsCSSRect widthBox = width.SetRectValue();
widthBox.SetAllSidesTo(new nsCSSValue(1.0f, nsCSSUnit.Number));
AppendValue(nsCSSProperty.BorderImageWidth, width);
// border-image-outset: 0
var outset = new nsCSSValue();
nsCSSRect outsetBox = outset.SetRectValue();
outsetBox.SetAllSidesTo(new nsCSSValue(0.0f, nsCSSUnit.Number));
AppendValue(nsCSSProperty.BorderImageOutset, outset);
// border-image-repeat: repeat
var repeat = new nsCSSValue();
var repeatPair = new nsCSSValuePair();
repeatPair.SetBothValuesTo(new nsCSSValue(nsStyle.BORDER_IMAGE_REPEAT_STRETCH,
nsCSSUnit.Enumerated));
repeat.SetPairValue(repeatPair);
AppendValue(nsCSSProperty.BorderImageRepeat, repeat);
}
开发者ID:jorik041,项目名称:CsCss,代码行数:36,代码来源:nsCSSParser.conv.cs
注:本文中的CssValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论