public CssPropertyDeclaration(WellknownCssPropertyName wellNamePropertyName, CssCodeValueExpression value) { //from another this.WellknownPropertyName = wellNamePropertyName; this.propertyValue = value; this.markedAsInherit = value.IsInherit; //auto gen from another prop this.isAutoGen = true; }
public CssPropertyDeclaration(WellknownCssPropertyName wellNamePropertyName, CssCodeValueExpression value) { //from another this.WellknownPropertyName = wellNamePropertyName; _firstValue = value; _markedAsInherit = value.IsInherit; //auto gen from another prop _isAutoGen = true; }
public CssPropertyDeclaration(WellknownCssPropertyName wellNamePropertyName, CssCodeValueExpression value) { //if (this.dbugId == 221) //{ //} //from another this.WellknownPropertyName = wellNamePropertyName; this.firstValue = value; this.markedAsInherit = value.IsInherit; //auto gen from another prop this.isAutoGen = true; }
public void RemoveCssProperty(WellknownCssPropertyName wellknownName) { if (wellknownName == WellknownCssPropertyName.Unknown) { //can't delete return; } for (int i = _decls.Count - 1; i >= 0; --i) { if (_decls[i].WellknownPropertyName == wellknownName) { _decls.RemoveAt(i); } } }
/// <summary> /// assign property value from parent /// </summary> /// <param name="spec"></param> /// <param name="propName"></param> static void SetPropertyValueFromParent(BoxSpec spec, BoxSpec parentSpec, WellknownCssPropertyName propName) { switch (propName) { case WellknownCssPropertyName.BorderBottomWidth: spec.BorderBottomWidth = parentSpec.BorderBottomWidth; break; case WellknownCssPropertyName.BorderLeftWidth: spec.BorderLeftWidth = parentSpec.BorderLeftWidth; break; case WellknownCssPropertyName.BorderRightWidth: spec.BorderRightWidth = parentSpec.BorderRightWidth; break; case WellknownCssPropertyName.BorderTopWidth: spec.BorderTopWidth = parentSpec.BorderTopWidth; break; //------------------------------------------------ case WellknownCssPropertyName.BorderBottomStyle: spec.BorderBottomStyle = parentSpec.BorderBottomStyle; break; case WellknownCssPropertyName.BorderLeftStyle: spec.BorderLeftStyle = parentSpec.BorderBottomStyle; break; case WellknownCssPropertyName.BorderRightStyle: spec.BorderRightStyle = parentSpec.BorderRightStyle; break; case WellknownCssPropertyName.BorderTopStyle: spec.BorderTopStyle = parentSpec.BorderTopStyle; break; //------------------------------------------------ case WellknownCssPropertyName.BorderBottomColor: spec.BorderBottomColor = parentSpec.BorderBottomColor; break; case WellknownCssPropertyName.BorderLeftColor: spec.BorderLeftColor = parentSpec.BorderLeftColor; break; case WellknownCssPropertyName.BorderRightColor: spec.BorderRightColor = parentSpec.BorderRightColor; break; case WellknownCssPropertyName.BorderTopColor: spec.BorderTopColor = parentSpec.BorderTopColor; break; //------------------------------------------------ case WellknownCssPropertyName.BorderSpacing: spec.BorderSpacingHorizontal = parentSpec.BorderSpacingHorizontal; spec.BorderSpacingVertical = parentSpec.BorderSpacingVertical; break; case WellknownCssPropertyName.BorderCollapse: spec.BorderCollapse = parentSpec.BorderCollapse; break; //------------------------------------------------ case WellknownCssPropertyName.CornerRadius: spec.CornerNERadius = parentSpec.CornerNERadius; spec.CornerNWRadius = parentSpec.CornerNWRadius; spec.CornerSERadius = parentSpec.CornerSERadius; spec.CornerSWRadius = parentSpec.CornerSWRadius; break; case WellknownCssPropertyName.CornerNWRadius: spec.CornerNWRadius = parentSpec.CornerNWRadius; break; case WellknownCssPropertyName.CornerNERadius: spec.CornerNERadius = parentSpec.CornerNERadius; break; case WellknownCssPropertyName.CornerSERadius: spec.CornerSERadius = parentSpec.CornerSERadius; break; case WellknownCssPropertyName.CornerSWRadius: spec.CornerSWRadius = parentSpec.CornerSWRadius; break; //------------------------------------------------ case WellknownCssPropertyName.MarginBottom: spec.MarginBottom = parentSpec.MarginBottom; break; case WellknownCssPropertyName.MarginLeft: spec.MarginLeft = parentSpec.MarginLeft; break; case WellknownCssPropertyName.MarginRight: spec.MarginRight = parentSpec.MarginRight; break; case WellknownCssPropertyName.MarginTop: spec.MarginTop = parentSpec.MarginTop; break; //------------------------------------------------ case WellknownCssPropertyName.PaddingBottom: spec.PaddingBottom = parentSpec.PaddingBottom; break; case WellknownCssPropertyName.PaddingLeft: spec.PaddingLeft = parentSpec.PaddingLeft; break; case WellknownCssPropertyName.PaddingRight: spec.PaddingRight = parentSpec.PaddingRight; break; case WellknownCssPropertyName.PaddingTop: spec.PaddingTop = parentSpec.PaddingTop; break; //------------------------------------------------ case WellknownCssPropertyName.Left: spec.Left = parentSpec.Left; break; case WellknownCssPropertyName.Top: spec.Top = parentSpec.Top; break; case WellknownCssPropertyName.Width: spec.Width = parentSpec.Width; break; case WellknownCssPropertyName.MaxWidth: spec.MaxWidth = parentSpec.MaxWidth; break; case WellknownCssPropertyName.Height: spec.Height = parentSpec.Height; break; case WellknownCssPropertyName.BackgroundColor: spec.BackgroundColor = parentSpec.BackgroundColor; break; case WellknownCssPropertyName.BackgroundImage: spec.BackgroundImageBinder = parentSpec.BackgroundImageBinder; break; case WellknownCssPropertyName.BackgroundPosition: spec.BackgroundPositionX = parentSpec.BackgroundPositionX; spec.BackgroundPositionY = parentSpec.BackgroundPositionY; break; case WellknownCssPropertyName.BackgroundRepeat: spec.BackgroundRepeat = parentSpec.BackgroundRepeat; break; case WellknownCssPropertyName.BackgroundGradient: spec.BackgroundGradient = parentSpec.BackgroundGradient; break; case WellknownCssPropertyName.BackgroundGradientAngle: { spec.BackgroundGradientAngle = parentSpec.BackgroundGradientAngle; } break; case WellknownCssPropertyName.Color: spec.Color = parentSpec.Color; break; case WellknownCssPropertyName.Display: spec.CssDisplay = parentSpec.CssDisplay; break; case WellknownCssPropertyName.Direction: spec.CssDirection = parentSpec.CssDirection; break; case WellknownCssPropertyName.EmptyCells: spec.EmptyCells = parentSpec.EmptyCells; break; case WellknownCssPropertyName.Float: spec.Float = parentSpec.Float; break; case WellknownCssPropertyName.Position: spec.Position = parentSpec.Position; break; case WellknownCssPropertyName.LineHeight: spec.LineHeight = parentSpec.LineHeight; break; case WellknownCssPropertyName.VerticalAlign: spec.VerticalAlign = parentSpec.VerticalAlign; break; case WellknownCssPropertyName.TextIndent: spec.TextIndent = parentSpec.TextIndent; break; case WellknownCssPropertyName.TextAlign: spec.CssTextAlign = parentSpec.CssTextAlign; break; case WellknownCssPropertyName.TextDecoration: spec.TextDecoration = parentSpec.TextDecoration; break; case WellknownCssPropertyName.Whitespace: spec.WhiteSpace = parentSpec.WhiteSpace; break; case WellknownCssPropertyName.WordBreak: spec.WordBreak = parentSpec.WordBreak; break; case WellknownCssPropertyName.Visibility: spec.Visibility = parentSpec.Visibility; break; case WellknownCssPropertyName.WordSpacing: spec.WordSpacing = parentSpec.WordSpacing; break; case WellknownCssPropertyName.FontFamily: spec.FontFamily = parentSpec.FontFamily; //cssBox.FontFamily = value; break; case WellknownCssPropertyName.FontSize: spec.FontSize = parentSpec.FontSize; break; case WellknownCssPropertyName.FontStyle: spec.FontStyle = parentSpec.FontStyle; break; case WellknownCssPropertyName.FontVariant: spec.FontVariant = parentSpec.FontVariant; break; case WellknownCssPropertyName.FontWeight: spec.FontWeight = parentSpec.FontWeight; break; case WellknownCssPropertyName.ListStyle: spec.ListStyle = parentSpec.ListStyle; break; case WellknownCssPropertyName.ListStylePosition: spec.ListStylePosition = parentSpec.ListStylePosition; break; case WellknownCssPropertyName.ListStyleImage: spec.ListStyleImage = parentSpec.ListStyleImage; break; case WellknownCssPropertyName.ListStyleType: spec.ListStyleType = parentSpec.ListStyleType; break; case WellknownCssPropertyName.Overflow: spec.Overflow = parentSpec.Overflow; break; case WellknownCssPropertyName.BoxSizing: spec.BoxSizing = parentSpec.BoxSizing; break; } }
public CssPropertyDeclaration(WellknownCssPropertyName wellNamePropertyName) { //convert from name to wellknown property name; this.WellknownPropertyName = wellNamePropertyName; }
void ExpandCssEdgeProperty(CssPropertyDeclaration decl, WellknownCssPropertyName left, WellknownCssPropertyName top, WellknownCssPropertyName right, WellknownCssPropertyName bottom, List<CssPropertyDeclaration> newProps) { switch (decl.ValueCount) { case 0: { } break; case 1: { CssCodeValueExpression value = decl.GetPropertyValue(0); newProps.Add(CloneProp(left, value)); newProps.Add(CloneProp(top, value)); newProps.Add(CloneProp(right, value)); newProps.Add(CloneProp(bottom, value)); } break; case 2: { newProps.Add(CloneProp(top, decl.GetPropertyValue(0))); newProps.Add(CloneProp(bottom, decl.GetPropertyValue(0))); newProps.Add(CloneProp(left, decl.GetPropertyValue(1))); newProps.Add(CloneProp(right, decl.GetPropertyValue(1))); } break; case 3: { newProps.Add(CloneProp(top, decl.GetPropertyValue(0))); newProps.Add(CloneProp(left, decl.GetPropertyValue(1))); newProps.Add(CloneProp(right, decl.GetPropertyValue(1))); newProps.Add(CloneProp(bottom, decl.GetPropertyValue(2))); } break; default://4 or more { newProps.Add(CloneProp(top, decl.GetPropertyValue(0))); newProps.Add(CloneProp(right, decl.GetPropertyValue(1))); newProps.Add(CloneProp(bottom, decl.GetPropertyValue(2))); newProps.Add(CloneProp(left, decl.GetPropertyValue(3))); } break; } }
static CssPropertyDeclaration CloneProp(WellknownCssPropertyName newName, CssCodeValueExpression prop) { return new CssPropertyDeclaration(newName, prop); }