internal CSSColumnsProperty() : base(PropertyNames.Columns) { _inherited = false; _count = new CSSColumnCountProperty(); _width = new CSSColumnWidthProperty(); }
protected override Boolean IsValid(CSSValue value) { if (value == CSSValue.Inherit) { return(true); } var index = 0; var list = value as CSSValueList ?? new CSSValueList(value); var startGroup = new List <CSSProperty>(2); var width = new CSSColumnWidthProperty(); var count = new CSSColumnCountProperty(); startGroup.Add(width); startGroup.Add(count); while (true) { var length = startGroup.Count; for (int i = 0; i < length; i++) { if (CheckSingleProperty(startGroup[i], index, list)) { startGroup.RemoveAt(i); index++; break; } } if (length == startGroup.Count) { break; } } if (index == list.Length) { _width = width; _count = count; return(true); } return(false); }
/// <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 == CSSValue.Inherit) return true; var index = 0; var list = value as CSSValueList ?? new CSSValueList(value); var startGroup = new List<CSSProperty>(2); var width = new CSSColumnWidthProperty(); var count = new CSSColumnCountProperty(); startGroup.Add(width); startGroup.Add(count); while (true) { var length = startGroup.Count; for (int i = 0; i < length; i++) { if (CheckSingleProperty(startGroup[i], index, list)) { startGroup.RemoveAt(i); index++; break; } } if (length == startGroup.Count) break; } if (index == list.Length) { _width = width; _count = count; return true; } return false; }