static Boolean Check(CSSValue value, ref Position position) { var calc = value.AsCalc(); if (calc != null) { position.X = calc; } else if (value.Is("left")) { position.X = CSSCalcValue.Zero; } else if (value.Is("right")) { position.X = CSSCalcValue.Full; } else if (value.Is("top")) { position.Y = CSSCalcValue.Zero; } else if (value.Is("bottom")) { position.Y = CSSCalcValue.Full; } else if (!value.Is("center")) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { if (value.Is("normal")) { _mode = _normal; } else if (value.Is("none")) { _mode = null; } else if (value is CSSValueList) { return(Evaluate((CSSValueList)value)); } else if (value == CSSValue.Inherit) { return(true); } else { var mode = Evaluate(value); if (mode == null) { return(false); } _mode = mode; } return(true); }
/// <summary> /// Determines if the given value represents a valid state of this property. /// </summary> /// <param name="value">The state that should be used.</param> /// <returns>True if the state is valid, otherwise false.</returns> protected override Boolean IsValid(CSSValue value) { if (value.Is("visible")) _visible = true; else if (value.Is("hidden")) _visible = false; else if (value != CSSValue.Inherit) return false; return true; }
/// <summary> /// Determines if the given value represents a valid state of this property. /// </summary> /// <param name="value">The state that should be used.</param> /// <returns>True if the state is valid, otherwise false.</returns> protected override Boolean IsValid(CSSValue value) { if (value.Is("auto")) _mode = BreakMode.Auto; else if (value.Is("avoid")) _mode = BreakMode.Avoid; else if (value != CSSValue.Inherit) return false; return true; }
/// <summary> /// Determines if the given value represents a valid state of this property. /// </summary> /// <param name="value">The state that should be used.</param> /// <returns>True if the state is valid, otherwise false.</returns> protected override Boolean IsValid(CSSValue value) { if (value.Is("flat")) _flat = true; else if (value.Is("preserve-3d")) _flat = false; else if (value != CSSValue.Inherit) return false; return true; }
public static FontVariant?ToFontVariant(this CSSValue value) { if (value.Is(Keywords.Normal)) { return(FontVariant.Normal); } else if (value.Is(Keywords.SmallCaps)) { return(FontVariant.SmallCaps); } return(null); }
static SizeMode Check(CSSValue value) { var calc = value.AsCalc(); if (calc != null) return new CalcSizeMode(calc); else if (value.Is("auto")) return _default; else if (value.Is("cover")) return _cover; else if (value.Is("contain")) return _contain; return null; }
/// <summary> /// Determines if the given value represents a valid state of this property. /// </summary> /// <param name="value">The state that should be used.</param> /// <returns>True if the state is valid, otherwise false.</returns> protected override Boolean IsValid(CSSValue value) { TextDecorationLine mode; if (value.Is("none")) _line.Clear(); else if (value is CSSIdentifierValue && modes.TryGetValue(((CSSIdentifierValue)value).Value, out mode)) { _line.Clear(); _line.Add(mode); } else if (value is CSSValueList) { var values = (CSSValueList)value; var list = new List<TextDecorationLine>(); foreach (var item in values) { if (item is CSSIdentifierValue && modes.TryGetValue(((CSSIdentifierValue)value).Value, out mode)) list.Add(mode); else return false; } _line = list; } else if (value != CSSValue.Inherit) return false; return true; }
/// <summary> /// Determines if the given value represents a valid state of this property. /// </summary> /// <param name="value">The state that should be used.</param> /// <returns>True if the state is valid, otherwise false.</returns> protected override Boolean IsValid(CSSValue value) { if (value.Is("none")) _names.Clear(); else if (value is CSSIdentifierValue) { _names.Clear(); _names.Add(((CSSIdentifierValue)value).Value); } else if (value is CSSValueList) { var values = value.AsList<CSSIdentifierValue>(); if (values == null) return false; _names.Clear(); foreach (var ident in values) _names.Add(ident.Value); } else if (value != CSSValue.Inherit) return false; return true; }
protected override Boolean IsValid(CSSValue value) { if (value.Is("none")) { _properties.Clear(); } else if (value is CSSIdentifierValue) { _properties.Clear(); _properties.Add(((CSSIdentifierValue)value).Value); } else if (value is CSSValueList) { var values = value.AsList <CSSIdentifierValue>(); if (values == null) { return(false); } _properties.Clear(); foreach (var ident in values) { _properties.Add(ident.Value); } } else if (value != CSSValue.Inherit) { return(false); } return(true); }
/// <summary> /// Determines if the given value represents a valid state of this property. /// </summary> /// <param name="value">The state that should be used.</param> /// <returns>True if the state is valid, otherwise false.</returns> protected override Boolean IsValid(CSSValue value) { if (value.Is("none")) _quotes.Clear(); else if (value is CSSValueList) { var values = (CSSValueList)value; if (values.Length % 2 != 0) return false; var quotes = new List<Tuple<String, String>>(); for (int i = 0; i < values.Length; i += 2) { var open = values[i] as CSSStringValue; var close = values[i + 1] as CSSStringValue; if (open == null || close == null) return false; quotes.Add(Tuple.Create(open.Value, close.Value)); } _quotes = quotes; } else if (value != CSSValue.Inherit) return false; return true; }
protected override Boolean IsValid(CSSValue value) { if (value.Is("inside")) { _position = ListPosition.Inside; } else if (value.Is("outside")) { _position = ListPosition.Outside; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { if (value.Is("separate")) { _separate = true; } else if (value.Is("collapse")) { _separate = false; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { if (value.Is("normal")) { _style = FontVariant.Normal; } else if (value.Is("small-caps")) { _style = FontVariant.SmallCaps; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { if (value.Is("show")) { _visible = true; } else if (value.Is("hide")) { _visible = false; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { if (value.Is("flat")) { _flat = true; } else if (value.Is("preserve-3d")) { _flat = false; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { if (value.Is("auto")) { _mode = BreakMode.Auto; } else if (value.Is("avoid")) { _mode = BreakMode.Avoid; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { if (value.Is("top")) { _top = true; } else if (value.Is("bottom")) { _top = false; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { if (value.Is("fixed")) { _fixed = true; } else if (value.Is("auto")) { _fixed = false; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { if (value.Is("slice")) { _clone = false; } else if (value.Is("clone")) { _clone = true; } else if (value == CSSValue.Inherit) { return(true); } return(false); }
protected override Boolean IsValid(CSSValue value) { if (value.Is("ltr")) { _mode = DirectionMode.Ltr; } else if (value.Is("rtl")) { _mode = DirectionMode.Rtl; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
public static ICssObject ToImage(this CSSValue value) { if (value.Is(Keywords.None)) { return(Color.Transparent); } return(value.ToUri() ?? value.ToLinearGradient() ?? value.ToRadialGradient() as ICssObject); }
protected override Boolean IsValid(CSSValue value) { //The element does not span multiple columns. if (value.Is("none")) { _span = false; } //The element spans across all columns. else if (value.Is("all")) { _span = true; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { //Is a keyword indicating that columns are filled sequentially. if (value.Is("auto")) { _balanced = false; } //Is a keyword indicating that content is equally divided between columns. else if (value.Is("balance")) { _balanced = true; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { if (value.Is("none")) _shadows.Clear(); else if (value is CSSValueList) return Evaluate((CSSValueList)value); else if (value != CSSValue.Inherit) return false; return true; }
static SizeMode Check(CSSValue horizontal, CSSValue vertical) { var width = horizontal.AsCalc(); var height = vertical.AsCalc(); if (width == null && !horizontal.Is("auto")) return null; else if (height == null && !vertical.Is("auto")) return null; return new CalcSizeMode(width, height); }
/// <summary> /// Determines if the given value represents a valid state of this property. /// </summary> /// <param name="value">The state that should be used.</param> /// <returns>True if the state is valid, otherwise false.</returns> protected override Boolean IsValid(CSSValue value) { var shape = value as CSSShapeValue; if (shape != null) _shape = shape; else if (value.Is("auto")) _shape = null; else if (value != CSSValue.Inherit) return false; return true; }
/// <summary> /// Determines if the given value represents a valid state of this property. /// </summary> /// <param name="value">The state that should be used.</param> /// <returns>True if the state is valid, otherwise false.</returns> protected override Boolean IsValid(CSSValue value) { var width = value.ToLength(); if (width.HasValue) _width = width.Value; else if (value.Is("auto")) _width = null; else if (value != CSSValue.Inherit) return false; return true; }
/// <summary> /// Determines if the given value represents a valid state of this property. /// </summary> /// <param name="value">The state that should be used.</param> /// <returns>True if the state is valid, otherwise false.</returns> protected override Boolean IsValid(CSSValue value) { var calc = value.AsCalc(); if (calc != null) _mode = calc; else if (value.Is("none")) _mode = null; else if (value != CSSValue.Inherit) return false; return true; }
/// <summary> /// Determines if the given value represents a valid state of this property. /// </summary> /// <param name="value">The state that should be used.</param> /// <returns>True if the state is valid, otherwise false.</returns> protected override Boolean IsValid(CSSValue value) { if (value.Is("normal")) _mode = _normal; else if (value.Is("none")) _mode = null; else if (value is CSSValueList) return Evaluate((CSSValueList)value); else if (value == CSSValue.Inherit) return true; else { var mode = Evaluate(value); if (mode == null) return false; _mode = mode; } return true; }
static SizeMode Check(CSSValue value) { var calc = value.AsCalc(); if (calc != null) { return(new CalcSizeMode(calc)); } else if (value.Is("auto")) { return(_default); } else if (value.Is("cover")) { return(_cover); } else if (value.Is("contain")) { return(_contain); } return(null); }
static CSSPrimitiveValue<Number> ToNumber(CSSValue value) { if (value is CSSPrimitiveValue<Number>) { var n = (CSSPrimitiveValue<Number>)value; if (n.Value >= Number.Zero) return n; } else if (value.Is("infinite")) return new CSSPrimitiveValue<Number>(Number.Infinite); return null; }
public static Length?ToBorderWidth(this CSSValue value) { var length = value.ToLength(); if (length != null) { return(length); } else if (value.Is(Keywords.Thin)) { return(Length.Thin); } else if (value.Is(Keywords.Medium)) { return(Length.Medium); } else if (value.Is(Keywords.Thick)) { return(Length.Thick); } return(null); }
/// <summary> /// Determines if the given value represents a valid state of this property. /// </summary> /// <param name="value">The state that should be used.</param> /// <returns>True if the state is valid, otherwise false.</returns> protected override Boolean IsValid(CSSValue value) { //TODO //UNITLESS in QUIRKSMODE var calc = value.AsCalc(); if (calc != null) _value = calc; else if (value.Is("auto")) _value = null; else if (value != CSSValue.Inherit) return false; return true; }
static SizeMode Check(CSSValue horizontal, CSSValue vertical) { var width = horizontal.AsCalc(); var height = vertical.AsCalc(); if (width == null && !horizontal.Is("auto")) { return(null); } else if (height == null && !vertical.Is("auto")) { return(null); } return(new CalcSizeMode(width, height)); }
public static IDistance ToImageBorderWidth(this CSSValue value) { if (value.Is(Keywords.Auto)) { return(Percent.Hundred); } var multiple = value.ToSingle(); if (multiple.HasValue) { return(new Percent(multiple.Value * 100f)); } return(value.ToDistance()); }
static ImageWidthMode ToMode(CSSValue value) { if (value.Is("auto")) return _auto; var multiple = value.ToNumber(); if (multiple.HasValue) return new MultipleImageWidthMode(multiple.Value); var calc = value.AsCalc(); if (calc != null) return new CalcImageWidthMode(calc); return null; }
protected override Boolean IsValid(CSSValue value) { if (value is CSSPrimitiveValue <Number> ) { _value = (Int32)((CSSPrimitiveValue <Number>)value).Value.Value; } else if (value.Is("auto")) { _value = null; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { if (value.Is("normal")) { _spacing = null; } else if (value.ToLength().HasValue) { _spacing = value.ToLength(); } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { if (value.Is("none")) { _shadows.Clear(); } else if (value is CSSValueList) { return(Evaluate((CSSValueList)value)); } else if (value != CSSValue.Inherit) { return(false); } return(true); }
static CSSPrimitiveValue <Number> ToNumber(CSSValue value) { if (value is CSSPrimitiveValue <Number> ) { var n = (CSSPrimitiveValue <Number>)value; if (n.Value >= Number.Zero) { return(n); } } else if (value.Is("infinite")) { return(new CSSPrimitiveValue <Number>(Number.Infinite)); } return(null); }
protected override Boolean IsValid(CSSValue value) { var calc = value.AsCalc(); if (calc != null) { _mode = new CalcCoordinateMode(calc); } else if (value.Is("auto")) { _mode = _auto; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { var calc = value.AsCalc(); if (calc != null) { _mode = calc; } else if (value.Is("none")) { _mode = null; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { var shape = value as CSSShapeValue; if (shape != null) { _shape = shape; } else if (value.Is("auto")) { _shape = null; } else if (value != CSSValue.Inherit) { return(false); } return(true); }
protected override Boolean IsValid(CSSValue value) { var gap = value.ToLength(); if (gap.HasValue) { _gap = gap.Value; } else if (value.Is("normal")) { _gap = _normal; } else if (value != CSSValue.Inherit) { return(false); } return(true); }