Boolean CheckList(CSSValueList values) { var sizes = new List <SizeMode>(); var list = values.ToList(); foreach (var entry in list) { while (entry.Length == 0 || entry.Length > 2) { return(false); } var size = entry.Length == 1 ? Check(entry[0]) : Check(entry[0], entry[1]); if (size == null) { return(false); } sizes.Add(size); } _sizes = sizes; return(true); }
Boolean Evaluate(CSSValueList values) { var modes = new List <CursorMode>(); var entries = values.ToList(); var acceptMore = true; foreach (var entry in entries) { if (!acceptMore || entry.Length == 0) { return(false); } if (entry.Length == 1) { var item = Evaluate(entry[0]); if (item == null) { return(false); } acceptMore = item is CustomCursorMode; modes.Add(item); } else if (entry.Length == 3) { var location = entry[0].ToUri(); var x = entry[1].ToNumber(); var y = entry[2].ToNumber(); if (location == null || !x.HasValue || !y.HasValue) { return(false); } modes.Add(new CustomCursorMode(location, x, y)); } else { return(false); } } if (modes.Count == 1) { _mode = modes[0]; } else if (modes.Count == 0) { return(false); } _mode = new MultiCursorMode(modes); return(true); }
Boolean Evaluate(CSSValueList values) { var shadows = new List<Shadow>(); var items = values.ToList(); foreach (var item in items) { var shadow = item.ToShadow(); if (shadow == null) return false; shadows.Add(shadow); } _shadows = shadows; return true; }
Boolean SetFamilies(CSSValueList values) { var families = new List <BaseFontFamily>(); var items = values.ToList(); foreach (var item in items) { var family = GetFamily(item.Length == 1 ? item[0] : item); if (family == null) { return(false); } families.Add(family); } _families = families; return(true); }
Boolean CheckList(CSSValueList values) { var sizes = new List<SizeMode>(); var list = values.ToList(); foreach (var entry in list) { while (entry.Length == 0 || entry.Length > 2) return false; var size = entry.Length == 1 ? Check(entry[0]) : Check(entry[0], entry[1]); if (size == null) return false; sizes.Add(size); } _sizes = sizes; return true; }
Boolean Evaluate(CSSValueList values) { var modes = new List<CursorMode>(); var entries = values.ToList(); var acceptMore = true; foreach (var entry in entries) { if (!acceptMore || entry.Length == 0) return false; if (entry.Length == 1) { var item = Evaluate(entry[0]); if (item == null) return false; acceptMore = item is CustomCursorMode; modes.Add(item); } else if(entry.Length == 3) { var location = entry[0].ToUri(); var x = entry[1].ToNumber(); var y = entry[2].ToNumber(); if (location == null || !x.HasValue || !y.HasValue) return false; modes.Add(new CustomCursorMode(location, x, y)); } else return false; } if (modes.Count == 1) _mode = modes[0]; else if (modes.Count == 0) return false; _mode = new MultiCursorMode(modes); return true; }