public void ChangeFontColor(Color newcolor) { //change prop //then need to evaluate if (elem == null) { return; } BoxSpec boxSpec = elem.Spec; if (boxSpec.ActualColor == newcolor) { return; } HtmlElement.InvokeNotifyChangeOnIdleState( elem, ElementChangeKind.Spec); //------------------------------------- var existingRuleSet = elem.ElementRuleSet; if (existingRuleSet == null) { //create new one elem.ElementRuleSet = existingRuleSet = new CssRuleSet(); elem.IsStyleEvaluated = true; } existingRuleSet.AddCssCodeProperty( new CssPropertyDeclaration( WellknownCssPropertyName.Color, new CssCodeColor( CssColorConv.ConvertToCssColor(newcolor)))); HtmlElement.InvokeNotifyChangeOnIdleState(elem, ElementChangeKind.Spec); }
internal void LoadRuleSet(CssRuleSet ruleSet) { foreach (CssPropertyDeclaration otherAssignment in ruleSet.GetAssignmentIter()) { if (otherAssignment.WellknownPropertyName == WebDom.WellknownCssPropertyName.Unknown) { continue; } _myAssignments[otherAssignment.WellknownPropertyName] = otherAssignment; } }
public void ChangeBackgroundColor(Color backgroundColor) { if (elem == null) { return; } BoxSpec boxSpec = elem.Spec; if (boxSpec.BackgroundColor == backgroundColor) { return; } var existingRuleSet = elem.ElementRuleSet; if (existingRuleSet == null) { //create new one elem.ElementRuleSet = existingRuleSet = new CssRuleSet(); elem.IsStyleEvaluated = false; } //------------------------------------- existingRuleSet.RemoveCssProperty(WellknownCssPropertyName.BackgroundColor); existingRuleSet.AddCssCodeProperty( new CssPropertyDeclaration( WellknownCssPropertyName.BackgroundColor, new CssCodeColor(CssColorConv.ConvertToCssColor(backgroundColor)))); elem.SkipPrincipalBoxEvalulation = false; CssBox cssbox = HtmlElement.InternalGetPrincipalBox(elem); if (cssbox != null) { #if DEBUG cssbox.dbugMark1++; #endif CssBox.InvalidateComputeValue(cssbox); } HtmlElement.InvokeNotifyChangeOnIdleState( elem, ElementChangeKind.Spec); InvalidateCssBox(cssbox); }
public void AddRuleSet(CssRuleSet ruleSet) { _ruleSets.Add(ruleSet); }
public void AddRuleSet(CssRuleSet ruleSet) { this._ruleSets.Add(ruleSet); }