public static bool IsAProtectedClass(IStylingRule rule) { var selectorName = rule.DisplaySelectorName; var cleansedName = RuleRegistry.StandardizeSelector(selectorName); return(cleansedName.IndexOf(":visited", StringComparison.Ordinal) > -1 || cleansedName.IndexOf(":hover", StringComparison.Ordinal) > -1 || cleansedName.IndexOf(":active", StringComparison.Ordinal) > -1); }
public static SnapshotSpan SnapshotSpanFromRule(ITextBuffer buffer, IStylingRule rule) { var snapshot = buffer.CurrentSnapshot; var span = new Span(rule.Offset, rule.SelectorLength); return(new SnapshotSpan(snapshot, span)); }
public Rectangle CalculateSafeArea(Rectangle parentBoundaries,IStylingRule style, AlignmentContext context) { var width = style.Width ?? parentBoundaries.Width; var height = style.Height ?? parentBoundaries.Height; var safeArea = new Rectangle( parentBoundaries.X + (parentBoundaries.Width - context.XAxis.SpaceAvailable) , parentBoundaries.Y + (parentBoundaries.Height - context.YAxis.SpaceAvailable) , width , height); return safeArea; }
public static UnusedCssTag FromRuleSet(ITextBuffer buffer, IStylingRule rule) { var ss = SnapshotSpanFromRule(buffer, rule); return(new UnusedCssTag { ToolTipContent = string.Format(CultureInfo.CurrentCulture, "No usages of the CSS selector '{0}' have been found.", rule.DisplaySelectorName), ErrorType = "compiler warning", Span = ss, }); }
public static Task ProduceErrorListTask(this IStylingRule rule, TaskErrorCategory category, Project project, string format) { var item = ResolveVsHierarchyItem(project.UniqueName); var task = new ErrorTask { Document = rule.File, Line = rule.Line - 1, Column = rule.Column, ErrorCategory = category, Category = TaskCategory.Html, Text = string.Format(CultureInfo.CurrentCulture, format, project.Name, rule.DisplaySelectorName, rule.File, rule.Line, rule.Column), HierarchyItem = item }; task.Navigate += NavigateToItem; return(task); }
public bool Equals(IStylingRule other) { return(!ReferenceEquals(other, null) && other.File == File && other.IsMatch(CleansedSelectorName) && other.Line == Line && other.Column == Column && other.Offset == Offset && other.Length == Length); }
private void AddElement(IGuiElement element, IStylingRule rule, IPriority priority) { if (styledElements.ContainsKey(element)) { if (priority.Amount > styledElements[element].Priority.Amount) { styledElements[element].Style.Override(rule); } else { styledElements[element].Style.Merge(rule); } return; } styledElements.Add(element, new StyleEntry(priority, rule)); }
public void Attach(ElementSelector selector, IStylingRule ruleSet) { ResolveSelector(selector, ruleSet); }
public void Attach(IGuiElement element, IStylingRule ruleSet) { AddElement(element, ruleSet, SelectorPriority.Default); }
public StyleEntry(IPriority priority, IStylingRule style) { Priority = priority; Style = style; }
private void ResolveSelector(ElementSelector selector, IStylingRule rule) { var selectedElements = selector.GetSelection(guiTree); foreach (var element in selectedElements) { AddElement(element, rule, selector.Priority); } }
public bool Equals(IStylingRule other) { return !ReferenceEquals(other, null) && other.File == File && other.IsMatch(CleansedSelectorName) && other.Line == Line && other.Column == Column && other.Offset == Offset && other.Length == Length; }
public static bool IsAProtectedClass(IStylingRule rule) { var selectorName = rule.DisplaySelectorName; var cleansedName = RuleRegistry.StandardizeSelector(selectorName); return cleansedName.IndexOf(":visited", StringComparison.Ordinal) > -1 || cleansedName.IndexOf(":hover", StringComparison.Ordinal) > -1 || cleansedName.IndexOf(":active", StringComparison.Ordinal) > -1; }
public void Override(IStylingRule other) { JoinHelper(other as StylingRule, this); }
public void Merge(IStylingRule other) { JoinHelper(this, other as StylingRule); }