CssStyleDeclaration
sealed class CssStyleDeclaration : ICssStyleDeclaration, IEnumerable<ICssProperty>, IEnumerable, IStyleFormattable, IBindable
Represents a single CSS declaration block.
using AngleSharp.Css;
using AngleSharp.Parser.Css;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace AngleSharp.Dom.Css
{
internal sealed class CssStyleDeclaration : ICssStyleDeclaration, IEnumerable<ICssProperty>, IEnumerable, IStyleFormattable, IBindable
{
private readonly List<CssProperty> _declarations;
private readonly CssRule _parent;
private readonly CssParser _parser;
public string CssText {
get {
return ToCss();
}
set {
Update(value);
RaiseChanged();
}
}
public bool IsReadOnly => _parser == null;
public int Length => _declarations.Count;
public ICssRule Parent => _parent;
public string this[int index] {
get {
if (index >= 0 && index < _declarations.Count)
return _declarations[index].Name;
return null;
}
}
public string this[string name] {
get {
return GetPropertyValue(name);
}
}
internal IEnumerable<CssProperty> Declarations => _declarations;
string ICssStyleDeclaration.AlignContent {
get {
return GetPropertyValue(PropertyNames.AlignContent);
}
set {
SetProperty(PropertyNames.AlignContent, value, null);
}
}
string ICssStyleDeclaration.AlignItems {
get {
return GetPropertyValue(PropertyNames.AlignItems);
}
set {
SetProperty(PropertyNames.AlignItems, value, null);
}
}
string ICssStyleDeclaration.AlignSelf {
get {
return GetPropertyValue(PropertyNames.AlignSelf);
}
set {
SetProperty(PropertyNames.AlignSelf, value, null);
}
}
string ICssStyleDeclaration.Accelerator {
get {
return GetPropertyValue(PropertyNames.Accelerator);
}
set {
SetProperty(PropertyNames.Accelerator, value, null);
}
}
string ICssStyleDeclaration.AlignmentBaseline {
get {
return GetPropertyValue(PropertyNames.AlignBaseline);
}
set {
SetProperty(PropertyNames.AlignBaseline, value, null);
}
}
string ICssStyleDeclaration.Animation {
get {
return GetPropertyValue(PropertyNames.Animation);
}
set {
SetProperty(PropertyNames.Animation, value, null);
}
}
string ICssStyleDeclaration.AnimationDelay {
get {
return GetPropertyValue(PropertyNames.AnimationDelay);
}
set {
SetProperty(PropertyNames.AnimationDelay, value, null);
}
}
string ICssStyleDeclaration.AnimationDirection {
get {
return GetPropertyValue(PropertyNames.AnimationDirection);
}
set {
SetProperty(PropertyNames.AnimationDirection, value, null);
}
}
string ICssStyleDeclaration.AnimationDuration {
get {
return GetPropertyValue(PropertyNames.AnimationDuration);
}
set {
SetProperty(PropertyNames.AnimationDuration, value, null);
}
}
string ICssStyleDeclaration.AnimationFillMode {
get {
return GetPropertyValue(PropertyNames.AnimationFillMode);
}
set {
SetProperty(PropertyNames.AnimationFillMode, value, null);
}
}
string ICssStyleDeclaration.AnimationIterationCount {
get {
return GetPropertyValue(PropertyNames.AnimationIterationCount);
}
set {
SetProperty(PropertyNames.AnimationIterationCount, value, null);
}
}
string ICssStyleDeclaration.AnimationName {
get {
return GetPropertyValue(PropertyNames.AnimationName);
}
set {
SetProperty(PropertyNames.AnimationName, value, null);
}
}
string ICssStyleDeclaration.AnimationPlayState {
get {
return GetPropertyValue(PropertyNames.AnimationPlayState);
}
set {
SetProperty(PropertyNames.AnimationPlayState, value, null);
}
}
string ICssStyleDeclaration.AnimationTimingFunction {
get {
return GetPropertyValue(PropertyNames.AnimationTimingFunction);
}
set {
SetProperty(PropertyNames.AnimationTimingFunction, value, null);
}
}
string ICssStyleDeclaration.BackfaceVisibility {
get {
return GetPropertyValue(PropertyNames.BackfaceVisibility);
}
set {
SetProperty(PropertyNames.BackfaceVisibility, value, null);
}
}
string ICssStyleDeclaration.Background {
get {
return GetPropertyValue(PropertyNames.Background);
}
set {
SetProperty(PropertyNames.Background, value, null);
}
}
string ICssStyleDeclaration.BackgroundAttachment {
get {
return GetPropertyValue(PropertyNames.BackgroundAttachment);
}
set {
SetProperty(PropertyNames.BackgroundAttachment, value, null);
}
}
string ICssStyleDeclaration.BackgroundClip {
get {
return GetPropertyValue(PropertyNames.BackgroundClip);
}
set {
SetProperty(PropertyNames.BackgroundClip, value, null);
}
}
string ICssStyleDeclaration.BackgroundColor {
get {
return GetPropertyValue(PropertyNames.BackgroundColor);
}
set {
SetProperty(PropertyNames.BackgroundColor, value, null);
}
}
string ICssStyleDeclaration.BackgroundImage {
get {
return GetPropertyValue(PropertyNames.BackgroundImage);
}
set {
SetProperty(PropertyNames.BackgroundImage, value, null);
}
}
string ICssStyleDeclaration.BackgroundOrigin {
get {
return GetPropertyValue(PropertyNames.BackgroundOrigin);
}
set {
SetProperty(PropertyNames.BackgroundOrigin, value, null);
}
}
string ICssStyleDeclaration.BackgroundPosition {
get {
return GetPropertyValue(PropertyNames.BackgroundPosition);
}
set {
SetProperty(PropertyNames.BackgroundPosition, value, null);
}
}
string ICssStyleDeclaration.BackgroundPositionX {
get {
return GetPropertyValue(PropertyNames.BackgroundPositionX);
}
set {
SetProperty(PropertyNames.BackgroundPositionX, value, null);
}
}
string ICssStyleDeclaration.BackgroundPositionY {
get {
return GetPropertyValue(PropertyNames.BackgroundPositionY);
}
set {
SetProperty(PropertyNames.BackgroundPositionY, value, null);
}
}
string ICssStyleDeclaration.BackgroundRepeat {
get {
return GetPropertyValue(PropertyNames.BackgroundRepeat);
}
set {
SetProperty(PropertyNames.BackgroundRepeat, value, null);
}
}
string ICssStyleDeclaration.BackgroundSize {
get {
return GetPropertyValue(PropertyNames.BackgroundSize);
}
set {
SetProperty(PropertyNames.BackgroundSize, value, null);
}
}
string ICssStyleDeclaration.BaselineShift {
get {
return GetPropertyValue(PropertyNames.BaselineShift);
}
set {
SetProperty(PropertyNames.BaselineShift, value, null);
}
}
string ICssStyleDeclaration.Behavior {
get {
return GetPropertyValue(PropertyNames.Behavior);
}
set {
SetProperty(PropertyNames.Behavior, value, null);
}
}
string ICssStyleDeclaration.Border {
get {
return GetPropertyValue(PropertyNames.Border);
}
set {
SetProperty(PropertyNames.Border, value, null);
}
}
string ICssStyleDeclaration.BorderBottom {
get {
return GetPropertyValue(PropertyNames.BorderBottom);
}
set {
SetProperty(PropertyNames.BorderBottom, value, null);
}
}
string ICssStyleDeclaration.BorderBottomColor {
get {
return GetPropertyValue(PropertyNames.BorderBottomColor);
}
set {
SetProperty(PropertyNames.BorderBottomColor, value, null);
}
}
string ICssStyleDeclaration.BorderBottomLeftRadius {
get {
return GetPropertyValue(PropertyNames.BorderBottomLeftRadius);
}
set {
SetProperty(PropertyNames.BorderBottomLeftRadius, value, null);
}
}
string ICssStyleDeclaration.BorderBottomRightRadius {
get {
return GetPropertyValue(PropertyNames.BorderBottomRightRadius);
}
set {
SetProperty(PropertyNames.BorderBottomRightRadius, value, null);
}
}
string ICssStyleDeclaration.BorderBottomStyle {
get {
return GetPropertyValue(PropertyNames.BorderBottomStyle);
}
set {
SetProperty(PropertyNames.BorderBottomStyle, value, null);
}
}
string ICssStyleDeclaration.BorderBottomWidth {
get {
return GetPropertyValue(PropertyNames.BorderBottomWidth);
}
set {
SetProperty(PropertyNames.BorderBottomWidth, value, null);
}
}
string ICssStyleDeclaration.BorderCollapse {
get {
return GetPropertyValue(PropertyNames.BorderCollapse);
}
set {
SetProperty(PropertyNames.BorderCollapse, value, null);
}
}
string ICssStyleDeclaration.BorderColor {
get {
return GetPropertyValue(PropertyNames.BorderColor);
}
set {
SetProperty(PropertyNames.BorderColor, value, null);
}
}
string ICssStyleDeclaration.BorderImage {
get {
return GetPropertyValue(PropertyNames.BorderImage);
}
set {
SetProperty(PropertyNames.BorderImage, value, null);
}
}
string ICssStyleDeclaration.BorderImageOutset {
get {
return GetPropertyValue(PropertyNames.BorderImageOutset);
}
set {
SetProperty(PropertyNames.BorderImageOutset, value, null);
}
}
string ICssStyleDeclaration.BorderImageRepeat {
get {
return GetPropertyValue(PropertyNames.BorderImageRepeat);
}
set {
SetProperty(PropertyNames.BorderImageRepeat, value, null);
}
}
string ICssStyleDeclaration.BorderImageSlice {
get {
return GetPropertyValue(PropertyNames.BorderImageSlice);
}
set {
SetProperty(PropertyNames.BorderImageSlice, value, null);
}
}
string ICssStyleDeclaration.BorderImageSource {
get {
return GetPropertyValue(PropertyNames.BorderImageSource);
}
set {
SetProperty(PropertyNames.BorderImageSource, value, null);
}
}
string ICssStyleDeclaration.BorderImageWidth {
get {
return GetPropertyValue(PropertyNames.BorderImageWidth);
}
set {
SetProperty(PropertyNames.BorderImageWidth, value, null);
}
}
string ICssStyleDeclaration.BorderLeft {
get {
return GetPropertyValue(PropertyNames.BorderLeft);
}
set {
SetProperty(PropertyNames.BorderLeft, value, null);
}
}
string ICssStyleDeclaration.BorderLeftColor {
get {
return GetPropertyValue(PropertyNames.BorderLeftColor);
}
set {
SetProperty(PropertyNames.BorderLeftColor, value, null);
}
}
string ICssStyleDeclaration.BorderLeftStyle {
get {
return GetPropertyValue(PropertyNames.BorderLeftStyle);
}
set {
SetProperty(PropertyNames.BorderLeftStyle, value, null);
}
}
string ICssStyleDeclaration.BorderLeftWidth {
get {
return GetPropertyValue(PropertyNames.BorderLeftWidth);
}
set {
SetProperty(PropertyNames.BorderLeftWidth, value, null);
}
}
string ICssStyleDeclaration.BorderRadius {
get {
return GetPropertyValue(PropertyNames.BorderRadius);
}
set {
SetProperty(PropertyNames.BorderRadius, value, null);
}
}
string ICssStyleDeclaration.BorderRight {
get {
return GetPropertyValue(PropertyNames.BorderRight);
}
set {
SetProperty(PropertyNames.BorderRight, value, null);
}
}
string ICssStyleDeclaration.BorderRightColor {
get {
return GetPropertyValue(PropertyNames.BorderRightColor);
}
set {
SetProperty(PropertyNames.BorderRightColor, value, null);
}
}
string ICssStyleDeclaration.BorderRightStyle {
get {
return GetPropertyValue(PropertyNames.BorderRightStyle);
}
set {
SetProperty(PropertyNames.BorderRightStyle, value, null);
}
}
string ICssStyleDeclaration.BorderRightWidth {
get {
return GetPropertyValue(PropertyNames.BorderRightWidth);
}
set {
SetProperty(PropertyNames.BorderRightWidth, value, null);
}
}
string ICssStyleDeclaration.BorderSpacing {
get {
return GetPropertyValue(PropertyNames.BorderSpacing);
}
set {
SetProperty(PropertyNames.BorderSpacing, value, null);
}
}
string ICssStyleDeclaration.BorderStyle {
get {
return GetPropertyValue(PropertyNames.BorderStyle);
}
set {
SetProperty(PropertyNames.BorderStyle, value, null);
}
}
string ICssStyleDeclaration.BorderTop {
get {
return GetPropertyValue(PropertyNames.BorderTop);
}
set {
SetProperty(PropertyNames.BorderTop, value, null);
}
}
string ICssStyleDeclaration.BorderTopColor {
get {
return GetPropertyValue(PropertyNames.BorderTopColor);
}
set {
SetProperty(PropertyNames.BorderTopColor, value, null);
}
}
string ICssStyleDeclaration.BorderTopLeftRadius {
get {
return GetPropertyValue(PropertyNames.BorderTopLeftRadius);
}
set {
SetProperty(PropertyNames.BorderTopLeftRadius, value, null);
}
}
string ICssStyleDeclaration.BorderTopRightRadius {
get {
return GetPropertyValue(PropertyNames.BorderTopRightRadius);
}
set {
SetProperty(PropertyNames.BorderTopRightRadius, value, null);
}
}
string ICssStyleDeclaration.BorderTopStyle {
get {
return GetPropertyValue(PropertyNames.BorderTopStyle);
}
set {
SetProperty(PropertyNames.BorderTopStyle, value, null);
}
}
string ICssStyleDeclaration.BorderTopWidth {
get {
return GetPropertyValue(PropertyNames.BorderTopWidth);
}
set {
SetProperty(PropertyNames.BorderTopWidth, value, null);
}
}
string ICssStyleDeclaration.BorderWidth {
get {
return GetPropertyValue(PropertyNames.BorderWidth);
}
set {
SetProperty(PropertyNames.BorderWidth, value, null);
}
}
string ICssStyleDeclaration.BoxShadow {
get {
return GetPropertyValue(PropertyNames.BoxShadow);
}
set {
SetProperty(PropertyNames.BoxShadow, value, null);
}
}
string ICssStyleDeclaration.BoxSizing {
get {
return GetPropertyValue(PropertyNames.BoxSizing);
}
set {
SetProperty(PropertyNames.BoxSizing, value, null);
}
}
string ICssStyleDeclaration.BreakAfter {
get {
return GetPropertyValue(PropertyNames.BreakAfter);
}
set {
SetProperty(PropertyNames.BreakAfter, value, null);
}
}
string ICssStyleDeclaration.BreakBefore {
get {
return GetPropertyValue(PropertyNames.BreakBefore);
}
set {
SetProperty(PropertyNames.BreakBefore, value, null);
}
}
string ICssStyleDeclaration.BreakInside {
get {
return GetPropertyValue(PropertyNames.BreakInside);
}
set {
SetProperty(PropertyNames.BreakInside, value, null);
}
}
string ICssStyleDeclaration.CaptionSide {
get {
return GetPropertyValue(PropertyNames.CaptionSide);
}
set {
SetProperty(PropertyNames.CaptionSide, value, null);
}
}
string ICssStyleDeclaration.Clear {
get {
return GetPropertyValue(PropertyNames.Clear);
}
set {
SetProperty(PropertyNames.Clear, value, null);
}
}
string ICssStyleDeclaration.Clip {
get {
return GetPropertyValue(PropertyNames.Clip);
}
set {
SetProperty(PropertyNames.Clip, value, null);
}
}
string ICssStyleDeclaration.ClipBottom {
get {
return GetPropertyValue(PropertyNames.ClipBottom);
}
set {
SetProperty(PropertyNames.ClipBottom, value, null);
}
}
string ICssStyleDeclaration.ClipLeft {
get {
return GetPropertyValue(PropertyNames.ClipLeft);
}
set {
SetProperty(PropertyNames.ClipLeft, value, null);
}
}
string ICssStyleDeclaration.ClipPath {
get {
return GetPropertyValue(PropertyNames.ClipPath);
}
set {
SetProperty(PropertyNames.ClipPath, value, null);
}
}
string ICssStyleDeclaration.ClipRight {
get {
return GetPropertyValue(PropertyNames.ClipRight);
}
set {
SetProperty(PropertyNames.ClipRight, value, null);
}
}
string ICssStyleDeclaration.ClipRule {
get {
return GetPropertyValue(PropertyNames.ClipRule);
}
set {
SetProperty(PropertyNames.ClipRule, value, null);
}
}
string ICssStyleDeclaration.ClipTop {
get {
return GetPropertyValue(PropertyNames.ClipTop);
}
set {
SetProperty(PropertyNames.ClipTop, value, null);
}
}
string ICssStyleDeclaration.Color {
get {
return GetPropertyValue(PropertyNames.Color);
}
set {
SetProperty(PropertyNames.Color, value, null);
}
}
string ICssStyleDeclaration.ColorInterpolationFilters {
get {
return GetPropertyValue(PropertyNames.ColorInterpolationFilters);
}
set {
SetProperty(PropertyNames.ColorInterpolationFilters, value, null);
}
}
string ICssStyleDeclaration.ColumnCount {
get {
return GetPropertyValue(PropertyNames.ColumnCount);
}
set {
SetProperty(PropertyNames.ColumnCount, value, null);
}
}
string ICssStyleDeclaration.ColumnFill {
get {
return GetPropertyValue(PropertyNames.ColumnFill);
}
set {
SetProperty(PropertyNames.ColumnFill, value, null);
}
}
string ICssStyleDeclaration.ColumnGap {
get {
return GetPropertyValue(PropertyNames.ColumnGap);
}
set {
SetProperty(PropertyNames.ColumnGap, value, null);
}
}
string ICssStyleDeclaration.ColumnRule {
get {
return GetPropertyValue(PropertyNames.ColumnRule);
}
set {
SetProperty(PropertyNames.ColumnRule, value, null);
}
}
string ICssStyleDeclaration.ColumnRuleColor {
get {
return GetPropertyValue(PropertyNames.ColumnRuleColor);
}
set {
SetProperty(PropertyNames.ColumnRuleColor, value, null);
}
}
string ICssStyleDeclaration.ColumnRuleStyle {
get {
return GetPropertyValue(PropertyNames.ColumnRuleStyle);
}
set {
SetProperty(PropertyNames.ColumnRuleStyle, value, null);
}
}
string ICssStyleDeclaration.ColumnRuleWidth {
get {
return GetPropertyValue(PropertyNames.ColumnRuleWidth);
}
set {
SetProperty(PropertyNames.ColumnRuleWidth, value, null);
}
}
string ICssStyleDeclaration.Columns {
get {
return GetPropertyValue(PropertyNames.Columns);
}
set {
SetProperty(PropertyNames.Columns, value, null);
}
}
string ICssStyleDeclaration.ColumnSpan {
get {
return GetPropertyValue(PropertyNames.ColumnSpan);
}
set {
SetProperty(PropertyNames.ColumnSpan, value, null);
}
}
string ICssStyleDeclaration.ColumnWidth {
get {
return GetPropertyValue(PropertyNames.ColumnWidth);
}
set {
SetProperty(PropertyNames.ColumnWidth, value, null);
}
}
string ICssStyleDeclaration.Content {
get {
return GetPropertyValue(PropertyNames.Content);
}
set {
SetProperty(PropertyNames.Content, value, null);
}
}
string ICssStyleDeclaration.CounterIncrement {
get {
return GetPropertyValue(PropertyNames.CounterIncrement);
}
set {
SetProperty(PropertyNames.CounterIncrement, value, null);
}
}
string ICssStyleDeclaration.CounterReset {
get {
return GetPropertyValue(PropertyNames.CounterReset);
}
set {
SetProperty(PropertyNames.CounterReset, value, null);
}
}
string ICssStyleDeclaration.Float {
get {
return GetPropertyValue(PropertyNames.Float);
}
set {
SetProperty(PropertyNames.Float, value, null);
}
}
string ICssStyleDeclaration.Cursor {
get {
return GetPropertyValue(PropertyNames.Cursor);
}
set {
SetProperty(PropertyNames.Cursor, value, null);
}
}
string ICssStyleDeclaration.Direction {
get {
return GetPropertyValue(PropertyNames.Direction);
}
set {
SetProperty(PropertyNames.Direction, value, null);
}
}
string ICssStyleDeclaration.Display {
get {
return GetPropertyValue(PropertyNames.Display);
}
set {
SetProperty(PropertyNames.Display, value, null);
}
}
string ICssStyleDeclaration.DominantBaseline {
get {
return GetPropertyValue(PropertyNames.DominantBaseline);
}
set {
SetProperty(PropertyNames.DominantBaseline, value, null);
}
}
string ICssStyleDeclaration.EmptyCells {
get {
return GetPropertyValue(PropertyNames.EmptyCells);
}
set {
SetProperty(PropertyNames.EmptyCells, value, null);
}
}
string ICssStyleDeclaration.EnableBackground {
get {
return GetPropertyValue(PropertyNames.EnableBackground);
}
set {
SetProperty(PropertyNames.EnableBackground, value, null);
}
}
string ICssStyleDeclaration.Fill {
get {
return GetPropertyValue(PropertyNames.Fill);
}
set {
SetProperty(PropertyNames.Fill, value, null);
}
}
string ICssStyleDeclaration.FillOpacity {
get {
return GetPropertyValue(PropertyNames.FillOpacity);
}
set {
SetProperty(PropertyNames.FillOpacity, value, null);
}
}
string ICssStyleDeclaration.FillRule {
get {
return GetPropertyValue(PropertyNames.FillRule);
}
set {
SetProperty(PropertyNames.FillRule, value, null);
}
}
string ICssStyleDeclaration.Filter {
get {
return GetPropertyValue(PropertyNames.Filter);
}
set {
SetProperty(PropertyNames.Filter, value, null);
}
}
string ICssStyleDeclaration.Flex {
get {
return GetPropertyValue(PropertyNames.Flex);
}
set {
SetProperty(PropertyNames.Flex, value, null);
}
}
string ICssStyleDeclaration.FlexBasis {
get {
return GetPropertyValue(PropertyNames.FlexBasis);
}
set {
SetProperty(PropertyNames.FlexBasis, value, null);
}
}
string ICssStyleDeclaration.FlexDirection {
get {
return GetPropertyValue(PropertyNames.FlexDirection);
}
set {
SetProperty(PropertyNames.FlexDirection, value, null);
}
}
string ICssStyleDeclaration.FlexFlow {
get {
return GetPropertyValue(PropertyNames.FlexFlow);
}
set {
SetProperty(PropertyNames.FlexFlow, value, null);
}
}
string ICssStyleDeclaration.FlexGrow {
get {
return GetPropertyValue(PropertyNames.FlexGrow);
}
set {
SetProperty(PropertyNames.FlexGrow, value, null);
}
}
string ICssStyleDeclaration.FlexShrink {
get {
return GetPropertyValue(PropertyNames.FlexShrink);
}
set {
SetProperty(PropertyNames.FlexShrink, value, null);
}
}
string ICssStyleDeclaration.FlexWrap {
get {
return GetPropertyValue(PropertyNames.FlexWrap);
}
set {
SetProperty(PropertyNames.FlexWrap, value, null);
}
}
string ICssStyleDeclaration.Font {
get {
return GetPropertyValue(PropertyNames.Font);
}
set {
SetProperty(PropertyNames.Font, value, null);
}
}
string ICssStyleDeclaration.FontFamily {
get {
return GetPropertyValue(PropertyNames.FontFamily);
}
set {
SetProperty(PropertyNames.FontFamily, value, null);
}
}
string ICssStyleDeclaration.FontFeatureSettings {
get {
return GetPropertyValue(PropertyNames.FontFeatureSettings);
}
set {
SetProperty(PropertyNames.FontFeatureSettings, value, null);
}
}
string ICssStyleDeclaration.FontSize {
get {
return GetPropertyValue(PropertyNames.FontSize);
}
set {
SetProperty(PropertyNames.FontSize, value, null);
}
}
string ICssStyleDeclaration.FontSizeAdjust {
get {
return GetPropertyValue(PropertyNames.FontSizeAdjust);
}
set {
SetProperty(PropertyNames.FontSizeAdjust, value, null);
}
}
string ICssStyleDeclaration.FontStretch {
get {
return GetPropertyValue(PropertyNames.FontStretch);
}
set {
SetProperty(PropertyNames.FontStretch, value, null);
}
}
string ICssStyleDeclaration.FontStyle {
get {
return GetPropertyValue(PropertyNames.FontStyle);
}
set {
SetProperty(PropertyNames.FontStyle, value, null);
}
}
string ICssStyleDeclaration.FontVariant {
get {
return GetPropertyValue(PropertyNames.FontVariant);
}
set {
SetProperty(PropertyNames.FontVariant, value, null);
}
}
string ICssStyleDeclaration.FontWeight {
get {
return GetPropertyValue(PropertyNames.FontWeight);
}
set {
SetProperty(PropertyNames.FontWeight, value, null);
}
}
string ICssStyleDeclaration.GlyphOrientationHorizontal {
get {
return GetPropertyValue(PropertyNames.GlyphOrientationHorizontal);
}
set {
SetProperty(PropertyNames.GlyphOrientationHorizontal, value, null);
}
}
string ICssStyleDeclaration.GlyphOrientationVertical {
get {
return GetPropertyValue(PropertyNames.GlyphOrientationVertical);
}
set {
SetProperty(PropertyNames.GlyphOrientationVertical, value, null);
}
}
string ICssStyleDeclaration.Height {
get {
return GetPropertyValue(PropertyNames.Height);
}
set {
SetProperty(PropertyNames.Height, value, null);
}
}
string ICssStyleDeclaration.ImeMode {
get {
return GetPropertyValue(PropertyNames.ImeMode);
}
set {
SetProperty(PropertyNames.ImeMode, value, null);
}
}
string ICssStyleDeclaration.JustifyContent {
get {
return GetPropertyValue(PropertyNames.JustifyContent);
}
set {
SetProperty(PropertyNames.JustifyContent, value, null);
}
}
string ICssStyleDeclaration.LayoutGrid {
get {
return GetPropertyValue(PropertyNames.LayoutGrid);
}
set {
SetProperty(PropertyNames.LayoutGrid, value, null);
}
}
string ICssStyleDeclaration.LayoutGridChar {
get {
return GetPropertyValue(PropertyNames.LayoutGridChar);
}
set {
SetProperty(PropertyNames.LayoutGridChar, value, null);
}
}
string ICssStyleDeclaration.LayoutGridLine {
get {
return GetPropertyValue(PropertyNames.LayoutGridLine);
}
set {
SetProperty(PropertyNames.LayoutGridLine, value, null);
}
}
string ICssStyleDeclaration.LayoutGridMode {
get {
return GetPropertyValue(PropertyNames.LayoutGridMode);
}
set {
SetProperty(PropertyNames.LayoutGridMode, value, null);
}
}
string ICssStyleDeclaration.LayoutGridType {
get {
return GetPropertyValue(PropertyNames.LayoutGridType);
}
set {
SetProperty(PropertyNames.LayoutGridType, value, null);
}
}
string ICssStyleDeclaration.Left {
get {
return GetPropertyValue(PropertyNames.Left);
}
set {
SetProperty(PropertyNames.Left, value, null);
}
}
string ICssStyleDeclaration.LetterSpacing {
get {
return GetPropertyValue(PropertyNames.LetterSpacing);
}
set {
SetProperty(PropertyNames.LetterSpacing, value, null);
}
}
string ICssStyleDeclaration.LineHeight {
get {
return GetPropertyValue(PropertyNames.LineHeight);
}
set {
SetProperty(PropertyNames.LineHeight, value, null);
}
}
string ICssStyleDeclaration.ListStyle {
get {
return GetPropertyValue(PropertyNames.ListStyle);
}
set {
SetProperty(PropertyNames.ListStyle, value, null);
}
}
string ICssStyleDeclaration.ListStyleImage {
get {
return GetPropertyValue(PropertyNames.ListStyleImage);
}
set {
SetProperty(PropertyNames.ListStyleImage, value, null);
}
}
string ICssStyleDeclaration.ListStylePosition {
get {
return GetPropertyValue(PropertyNames.ListStylePosition);
}
set {
SetProperty(PropertyNames.ListStylePosition, value, null);
}
}
string ICssStyleDeclaration.ListStyleType {
get {
return GetPropertyValue(PropertyNames.ListStyleType);
}
set {
SetProperty(PropertyNames.ListStyleType, value, null);
}
}
string ICssStyleDeclaration.Margin {
get {
return GetPropertyValue(PropertyNames.Margin);
}
set {
SetProperty(PropertyNames.Margin, value, null);
}
}
string ICssStyleDeclaration.MarginBottom {
get {
return GetPropertyValue(PropertyNames.MarginBottom);
}
set {
SetProperty(PropertyNames.MarginBottom, value, null);
}
}
string ICssStyleDeclaration.MarginLeft {
get {
return GetPropertyValue(PropertyNames.MarginLeft);
}
set {
SetProperty(PropertyNames.MarginLeft, value, null);
}
}
string ICssStyleDeclaration.MarginRight {
get {
return GetPropertyValue(PropertyNames.MarginRight);
}
set {
SetProperty(PropertyNames.MarginRight, value, null);
}
}
string ICssStyleDeclaration.MarginTop {
get {
return GetPropertyValue(PropertyNames.MarginTop);
}
set {
SetProperty(PropertyNames.MarginTop, value, null);
}
}
string ICssStyleDeclaration.Marker {
get {
return GetPropertyValue(PropertyNames.Marker);
}
set {
SetProperty(PropertyNames.Marker, value, null);
}
}
string ICssStyleDeclaration.MarkerEnd {
get {
return GetPropertyValue(PropertyNames.MarkerEnd);
}
set {
SetProperty(PropertyNames.MarkerEnd, value, null);
}
}
string ICssStyleDeclaration.MarkerMid {
get {
return GetPropertyValue(PropertyNames.MarkerMid);
}
set {
SetProperty(PropertyNames.MarkerMid, value, null);
}
}
string ICssStyleDeclaration.MarkerStart {
get {
return GetPropertyValue(PropertyNames.MarkerStart);
}
set {
SetProperty(PropertyNames.MarkerStart, value, null);
}
}
string ICssStyleDeclaration.Mask {
get {
return GetPropertyValue(PropertyNames.Mask);
}
set {
SetProperty(PropertyNames.Mask, value, null);
}
}
string ICssStyleDeclaration.MaxHeight {
get {
return GetPropertyValue(PropertyNames.MaxHeight);
}
set {
SetProperty(PropertyNames.MaxHeight, value, null);
}
}
string ICssStyleDeclaration.MaxWidth {
get {
return GetPropertyValue(PropertyNames.MaxWidth);
}
set {
SetProperty(PropertyNames.MaxWidth, value, null);
}
}
string ICssStyleDeclaration.MinHeight {
get {
return GetPropertyValue(PropertyNames.MinHeight);
}
set {
SetProperty(PropertyNames.MinHeight, value, null);
}
}
string ICssStyleDeclaration.MinWidth {
get {
return GetPropertyValue(PropertyNames.MinWidth);
}
set {
SetProperty(PropertyNames.MinWidth, value, null);
}
}
string ICssStyleDeclaration.Opacity {
get {
return GetPropertyValue(PropertyNames.Opacity);
}
set {
SetProperty(PropertyNames.Opacity, value, null);
}
}
string ICssStyleDeclaration.Order {
get {
return GetPropertyValue(PropertyNames.Order);
}
set {
SetProperty(PropertyNames.Order, value, null);
}
}
string ICssStyleDeclaration.Orphans {
get {
return GetPropertyValue(PropertyNames.Orphans);
}
set {
SetProperty(PropertyNames.Orphans, value, null);
}
}
string ICssStyleDeclaration.Outline {
get {
return GetPropertyValue(PropertyNames.Outline);
}
set {
SetProperty(PropertyNames.Outline, value, null);
}
}
string ICssStyleDeclaration.OutlineColor {
get {
return GetPropertyValue(PropertyNames.OutlineColor);
}
set {
SetProperty(PropertyNames.OutlineColor, value, null);
}
}
string ICssStyleDeclaration.OutlineStyle {
get {
return GetPropertyValue(PropertyNames.OutlineStyle);
}
set {
SetProperty(PropertyNames.OutlineStyle, value, null);
}
}
string ICssStyleDeclaration.OutlineWidth {
get {
return GetPropertyValue(PropertyNames.OutlineWidth);
}
set {
SetProperty(PropertyNames.OutlineWidth, value, null);
}
}
string ICssStyleDeclaration.Overflow {
get {
return GetPropertyValue(PropertyNames.Overflow);
}
set {
SetProperty(PropertyNames.Overflow, value, null);
}
}
string ICssStyleDeclaration.OverflowX {
get {
return GetPropertyValue(PropertyNames.OverflowX);
}
set {
SetProperty(PropertyNames.OverflowX, value, null);
}
}
string ICssStyleDeclaration.OverflowY {
get {
return GetPropertyValue(PropertyNames.OverflowY);
}
set {
SetProperty(PropertyNames.OverflowY, value, null);
}
}
string ICssStyleDeclaration.Padding {
get {
return GetPropertyValue(PropertyNames.Padding);
}
set {
SetProperty(PropertyNames.Padding, value, null);
}
}
string ICssStyleDeclaration.PaddingBottom {
get {
return GetPropertyValue(PropertyNames.PaddingBottom);
}
set {
SetProperty(PropertyNames.PaddingBottom, value, null);
}
}
string ICssStyleDeclaration.PaddingLeft {
get {
return GetPropertyValue(PropertyNames.PaddingLeft);
}
set {
SetProperty(PropertyNames.PaddingLeft, value, null);
}
}
string ICssStyleDeclaration.PaddingRight {
get {
return GetPropertyValue(PropertyNames.PaddingRight);
}
set {
SetProperty(PropertyNames.PaddingRight, value, null);
}
}
string ICssStyleDeclaration.PaddingTop {
get {
return GetPropertyValue(PropertyNames.PaddingTop);
}
set {
SetProperty(PropertyNames.PaddingTop, value, null);
}
}
string ICssStyleDeclaration.PageBreakAfter {
get {
return GetPropertyValue(PropertyNames.PageBreakAfter);
}
set {
SetProperty(PropertyNames.PageBreakAfter, value, null);
}
}
string ICssStyleDeclaration.PageBreakBefore {
get {
return GetPropertyValue(PropertyNames.PageBreakBefore);
}
set {
SetProperty(PropertyNames.PageBreakBefore, value, null);
}
}
string ICssStyleDeclaration.PageBreakInside {
get {
return GetPropertyValue(PropertyNames.PageBreakInside);
}
set {
SetProperty(PropertyNames.PageBreakInside, value, null);
}
}
string ICssStyleDeclaration.Perspective {
get {
return GetPropertyValue(PropertyNames.Perspective);
}
set {
SetProperty(PropertyNames.Perspective, value, null);
}
}
string ICssStyleDeclaration.PerspectiveOrigin {
get {
return GetPropertyValue(PropertyNames.PerspectiveOrigin);
}
set {
SetProperty(PropertyNames.PerspectiveOrigin, value, null);
}
}
string ICssStyleDeclaration.PointerEvents {
get {
return GetPropertyValue(PropertyNames.PointerEvents);
}
set {
SetProperty(PropertyNames.PointerEvents, value, null);
}
}
string ICssStyleDeclaration.Quotes {
get {
return GetPropertyValue(PropertyNames.Quotes);
}
set {
SetProperty(PropertyNames.Quotes, value, null);
}
}
string ICssStyleDeclaration.Position {
get {
return GetPropertyValue(PropertyNames.Position);
}
set {
SetProperty(PropertyNames.Position, value, null);
}
}
string ICssStyleDeclaration.Right {
get {
return GetPropertyValue(PropertyNames.Right);
}
set {
SetProperty(PropertyNames.Right, value, null);
}
}
string ICssStyleDeclaration.RubyAlign {
get {
return GetPropertyValue(PropertyNames.RubyAlign);
}
set {
SetProperty(PropertyNames.RubyAlign, value, null);
}
}
string ICssStyleDeclaration.RubyOverhang {
get {
return GetPropertyValue(PropertyNames.RubyOverhang);
}
set {
SetProperty(PropertyNames.RubyOverhang, value, null);
}
}
string ICssStyleDeclaration.RubyPosition {
get {
return GetPropertyValue(PropertyNames.RubyPosition);
}
set {
SetProperty(PropertyNames.RubyPosition, value, null);
}
}
string ICssStyleDeclaration.Scrollbar3dLightColor {
get {
return GetPropertyValue(PropertyNames.Scrollbar3dLightColor);
}
set {
SetProperty(PropertyNames.Scrollbar3dLightColor, value, null);
}
}
string ICssStyleDeclaration.ScrollbarArrowColor {
get {
return GetPropertyValue(PropertyNames.ScrollbarArrowColor);
}
set {
SetProperty(PropertyNames.ScrollbarArrowColor, value, null);
}
}
string ICssStyleDeclaration.ScrollbarDarkShadowColor {
get {
return GetPropertyValue(PropertyNames.ScrollbarDarkShadowColor);
}
set {
SetProperty(PropertyNames.ScrollbarDarkShadowColor, value, null);
}
}
string ICssStyleDeclaration.ScrollbarFaceColor {
get {
return GetPropertyValue(PropertyNames.ScrollbarFaceColor);
}
set {
SetProperty(PropertyNames.ScrollbarFaceColor, value, null);
}
}
string ICssStyleDeclaration.ScrollbarHighlightColor {
get {
return GetPropertyValue(PropertyNames.ScrollbarHighlightColor);
}
set {
SetProperty(PropertyNames.ScrollbarHighlightColor, value, null);
}
}
string ICssStyleDeclaration.ScrollbarShadowColor {
get {
return GetPropertyValue(PropertyNames.ScrollbarShadowColor);
}
set {
SetProperty(PropertyNames.ScrollbarShadowColor, value, null);
}
}
string ICssStyleDeclaration.ScrollbarTrackColor {
get {
return GetPropertyValue(PropertyNames.ScrollbarTrackColor);
}
set {
SetProperty(PropertyNames.ScrollbarTrackColor, value, null);
}
}
string ICssStyleDeclaration.Stroke {
get {
return GetPropertyValue(PropertyNames.Stroke);
}
set {
SetProperty(PropertyNames.Stroke, value, null);
}
}
string ICssStyleDeclaration.StrokeDasharray {
get {
return GetPropertyValue(PropertyNames.StrokeDasharray);
}
set {
SetProperty(PropertyNames.StrokeDasharray, value, null);
}
}
string ICssStyleDeclaration.StrokeDashoffset {
get {
return GetPropertyValue(PropertyNames.StrokeDashoffset);
}
set {
SetProperty(PropertyNames.StrokeDashoffset, value, null);
}
}
string ICssStyleDeclaration.StrokeLinecap {
get {
return GetPropertyValue(PropertyNames.StrokeLinecap);
}
set {
SetProperty(PropertyNames.StrokeLinecap, value, null);
}
}
string ICssStyleDeclaration.StrokeLinejoin {
get {
return GetPropertyValue(PropertyNames.StrokeLinejoin);
}
set {
SetProperty(PropertyNames.StrokeLinejoin, value, null);
}
}
string ICssStyleDeclaration.StrokeMiterlimit {
get {
return GetPropertyValue(PropertyNames.StrokeMiterlimit);
}
set {
SetProperty(PropertyNames.StrokeMiterlimit, value, null);
}
}
string ICssStyleDeclaration.StrokeOpacity {
get {
return GetPropertyValue(PropertyNames.StrokeOpacity);
}
set {
SetProperty(PropertyNames.StrokeOpacity, value, null);
}
}
string ICssStyleDeclaration.StrokeWidth {
get {
return GetPropertyValue(PropertyNames.StrokeWidth);
}
set {
SetProperty(PropertyNames.StrokeWidth, value, null);
}
}
string ICssStyleDeclaration.TableLayout {
get {
return GetPropertyValue(PropertyNames.TableLayout);
}
set {
SetProperty(PropertyNames.TableLayout, value, null);
}
}
string ICssStyleDeclaration.TextAlign {
get {
return GetPropertyValue(PropertyNames.TextAlign);
}
set {
SetProperty(PropertyNames.TextAlign, value, null);
}
}
string ICssStyleDeclaration.TextAlignLast {
get {
return GetPropertyValue(PropertyNames.TextAlignLast);
}
set {
SetProperty(PropertyNames.TextAlignLast, value, null);
}
}
string ICssStyleDeclaration.TextAnchor {
get {
return GetPropertyValue(PropertyNames.TextAnchor);
}
set {
SetProperty(PropertyNames.TextAnchor, value, null);
}
}
string ICssStyleDeclaration.TextAutospace {
get {
return GetPropertyValue(PropertyNames.TextAutospace);
}
set {
SetProperty(PropertyNames.TextAutospace, value, null);
}
}
string ICssStyleDeclaration.TextDecoration {
get {
return GetPropertyValue(PropertyNames.TextDecoration);
}
set {
SetProperty(PropertyNames.TextDecoration, value, null);
}
}
string ICssStyleDeclaration.TextIndent {
get {
return GetPropertyValue(PropertyNames.TextIndent);
}
set {
SetProperty(PropertyNames.TextIndent, value, null);
}
}
string ICssStyleDeclaration.TextJustify {
get {
return GetPropertyValue(PropertyNames.TextJustify);
}
set {
SetProperty(PropertyNames.TextJustify, value, null);
}
}
string ICssStyleDeclaration.TextOverflow {
get {
return GetPropertyValue(PropertyNames.TextOverflow);
}
set {
SetProperty(PropertyNames.TextOverflow, value, null);
}
}
string ICssStyleDeclaration.TextShadow {
get {
return GetPropertyValue(PropertyNames.TextShadow);
}
set {
SetProperty(PropertyNames.TextShadow, value, null);
}
}
string ICssStyleDeclaration.TextTransform {
get {
return GetPropertyValue(PropertyNames.TextTransform);
}
set {
SetProperty(PropertyNames.TextTransform, value, null);
}
}
string ICssStyleDeclaration.TextUnderlinePosition {
get {
return GetPropertyValue(PropertyNames.TextUnderlinePosition);
}
set {
SetProperty(PropertyNames.TextUnderlinePosition, value, null);
}
}
string ICssStyleDeclaration.Top {
get {
return GetPropertyValue(PropertyNames.Top);
}
set {
SetProperty(PropertyNames.Top, value, null);
}
}
string ICssStyleDeclaration.Transform {
get {
return GetPropertyValue(PropertyNames.Transform);
}
set {
SetProperty(PropertyNames.Transform, value, null);
}
}
string ICssStyleDeclaration.TransformOrigin {
get {
return GetPropertyValue(PropertyNames.TransformOrigin);
}
set {
SetProperty(PropertyNames.TransformOrigin, value, null);
}
}
string ICssStyleDeclaration.TransformStyle {
get {
return GetPropertyValue(PropertyNames.TransformStyle);
}
set {
SetProperty(PropertyNames.TransformStyle, value, null);
}
}
string ICssStyleDeclaration.Transition {
get {
return GetPropertyValue(PropertyNames.Transition);
}
set {
SetProperty(PropertyNames.Transition, value, null);
}
}
string ICssStyleDeclaration.TransitionDelay {
get {
return GetPropertyValue(PropertyNames.TransitionDelay);
}
set {
SetProperty(PropertyNames.TransitionDelay, value, null);
}
}
string ICssStyleDeclaration.TransitionDuration {
get {
return GetPropertyValue(PropertyNames.TransitionDuration);
}
set {
SetProperty(PropertyNames.TransitionDuration, value, null);
}
}
string ICssStyleDeclaration.TransitionProperty {
get {
return GetPropertyValue(PropertyNames.TransitionProperty);
}
set {
SetProperty(PropertyNames.TransitionProperty, value, null);
}
}
string ICssStyleDeclaration.TransitionTimingFunction {
get {
return GetPropertyValue(PropertyNames.TransitionTimingFunction);
}
set {
SetProperty(PropertyNames.TransitionTimingFunction, value, null);
}
}
string ICssStyleDeclaration.UnicodeBidi {
get {
return GetPropertyValue(PropertyNames.UnicodeBidi);
}
set {
SetProperty(PropertyNames.UnicodeBidi, value, null);
}
}
string ICssStyleDeclaration.VerticalAlign {
get {
return GetPropertyValue(PropertyNames.VerticalAlign);
}
set {
SetProperty(PropertyNames.VerticalAlign, value, null);
}
}
string ICssStyleDeclaration.Visibility {
get {
return GetPropertyValue(PropertyNames.Visibility);
}
set {
SetProperty(PropertyNames.Visibility, value, null);
}
}
string ICssStyleDeclaration.WhiteSpace {
get {
return GetPropertyValue(PropertyNames.WhiteSpace);
}
set {
SetProperty(PropertyNames.WhiteSpace, value, null);
}
}
string ICssStyleDeclaration.Widows {
get {
return GetPropertyValue(PropertyNames.Widows);
}
set {
SetProperty(PropertyNames.Widows, value, null);
}
}
string ICssStyleDeclaration.Width {
get {
return GetPropertyValue(PropertyNames.Width);
}
set {
SetProperty(PropertyNames.Width, value, null);
}
}
string ICssStyleDeclaration.WordBreak {
get {
return GetPropertyValue(PropertyNames.WordBreak);
}
set {
SetProperty(PropertyNames.WordBreak, value, null);
}
}
string ICssStyleDeclaration.WordSpacing {
get {
return GetPropertyValue(PropertyNames.WordSpacing);
}
set {
SetProperty(PropertyNames.WordSpacing, value, null);
}
}
string ICssStyleDeclaration.WordWrap {
get {
return GetPropertyValue(PropertyNames.WordWrap);
}
set {
SetProperty(PropertyNames.WordWrap, value, null);
}
}
string ICssStyleDeclaration.WritingMode {
get {
return GetPropertyValue(PropertyNames.WritingMode);
}
set {
SetProperty(PropertyNames.WritingMode, value, null);
}
}
string ICssStyleDeclaration.ZIndex {
get {
return GetPropertyValue(PropertyNames.ZIndex);
}
set {
SetProperty(PropertyNames.ZIndex, value, null);
}
}
string ICssStyleDeclaration.Zoom {
get {
return GetPropertyValue(PropertyNames.Zoom);
}
set {
SetProperty(PropertyNames.Zoom, value, null);
}
}
public event Action<string> Changed;
private CssStyleDeclaration(CssRule parent, CssParser parser)
{
_parent = parent;
_parser = parser;
_declarations = new List<CssProperty>();
}
internal CssStyleDeclaration(CssParser parser)
: this(null, parser)
{
}
internal CssStyleDeclaration()
: this(null, null)
{
}
internal CssStyleDeclaration(CssRule parent)
: this(parent, parent.Parser)
{
}
public void Update(string value)
{
if (IsReadOnly)
throw new DomException(DomError.NoModificationAllowed);
_declarations.Clear();
if (!string.IsNullOrEmpty(value))
_parser.AppendDeclarations(this, value);
}
public string ToCss()
{
return ToCss(CssStyleFormatter.Instance);
}
public string ToCss(IStyleFormatter formatter)
{
List<string> list = new List<string>();
List<string> serialized = new List<string>();
foreach (CssProperty declaration in _declarations) {
string name = declaration.Name;
if (!serialized.Contains(name)) {
IEnumerable<string> shorthands = Factory.Properties.GetShorthands(name);
if (shorthands.Any()) {
List<CssProperty> list2 = (from m in _declarations
where !serialized.Contains(m.Name)
select m).ToList();
foreach (string item in from m in shorthands
orderby Factory.Properties.GetLonghands(m).Count() descending
select m) {
CssShorthandProperty cssShorthandProperty = Factory.Properties.CreateShorthand(item);
string[] properties = Factory.Properties.GetLonghands(item);
CssProperty[] array = list2.Where((CssProperty m) => properties.Contains(m.Name)).ToArray();
if (array.Length != 0) {
int num = array.Count((CssProperty m) => m.IsImportant);
if ((num <= 0 || num == array.Length) && properties.Length == array.Length) {
string value = cssShorthandProperty.Stringify(array);
if (!string.IsNullOrEmpty(value)) {
list.Add(CssStyleFormatter.Instance.Declaration(item, value, num != 0));
CssProperty[] array2 = array;
foreach (CssProperty cssProperty in array2) {
serialized.Add(cssProperty.Name);
list2.Remove(cssProperty);
}
}
}
}
}
}
if (!serialized.Contains(name)) {
list.Add(declaration.ToCss(formatter));
serialized.Add(name);
}
}
}
return formatter.Declarations(list);
}
public string RemoveProperty(string propertyName)
{
if (IsReadOnly)
throw new DomException(DomError.NoModificationAllowed);
string propertyValue = GetPropertyValue(propertyName);
if (Factory.Properties.IsShorthand(propertyName)) {
string[] longhands = Factory.Properties.GetLonghands(propertyName);
string[] array = longhands;
foreach (string propertyName2 in array) {
RemoveProperty(propertyName2);
}
} else {
_declarations.RemoveAll((CssProperty rule) => rule.Name == propertyName);
RaiseChanged();
}
return propertyValue;
}
public string GetPropertyPriority(string propertyName)
{
CssProperty property = GetProperty(propertyName);
if (Factory.Properties.IsShorthand(propertyName)) {
string[] longhands = Factory.Properties.GetLonghands(propertyName);
string[] array = longhands;
foreach (string propertyName2 in array) {
if (GetPropertyPriority(propertyName2) != Keywords.Important)
return string.Empty;
}
return Keywords.Important;
}
if (property != null && property.IsImportant)
return Keywords.Important;
return string.Empty;
}
public string GetPropertyValue(string propertyName)
{
if (Factory.Properties.IsShorthand(propertyName)) {
CssShorthandProperty cssShorthandProperty = Factory.Properties.CreateShorthand(propertyName);
string[] longhands = Factory.Properties.GetLonghands(propertyName);
List<CssProperty> list = new List<CssProperty>();
string[] array = longhands;
foreach (string name in array) {
CssProperty property = GetProperty(name);
if (property == null)
return string.Empty;
list.Add(property);
}
return cssShorthandProperty.Stringify(list.ToArray());
}
CssProperty property2 = GetProperty(propertyName);
if (property2 != null)
return property2.Value;
return string.Empty;
}
public void SetPropertyValue(string propertyName, string propertyValue)
{
SetProperty(propertyName, propertyValue, null);
}
public void SetPropertyPriority(string propertyName, string priority)
{
if (IsReadOnly)
throw new DomException(DomError.NoModificationAllowed);
if (Factory.Properties.IsSupported(propertyName) && (string.IsNullOrEmpty(priority) || priority.Equals(Keywords.Important, StringComparison.OrdinalIgnoreCase))) {
bool isImportant = !string.IsNullOrEmpty(priority);
IEnumerable<string> enumerable = Factory.Properties.IsShorthand(propertyName) ? Factory.Properties.GetLonghands(propertyName) : Enumerable.Repeat(propertyName, 1);
foreach (string item in enumerable) {
CssProperty property = GetProperty(item);
if (property != null)
property.IsImportant = isImportant;
}
}
}
public void SetProperty(string propertyName, string propertyValue, string priority = null)
{
if (IsReadOnly)
throw new DomException(DomError.NoModificationAllowed);
if (Factory.Properties.IsSupported(propertyName)) {
if (!string.IsNullOrEmpty(propertyValue)) {
if (priority == null || priority.Equals(Keywords.Important, StringComparison.OrdinalIgnoreCase)) {
CssValue cssValue = _parser.ParseValue(propertyValue);
if (cssValue != null) {
CssProperty cssProperty = CreateProperty(propertyName);
if (cssProperty != null && cssProperty.TrySetValue(cssValue)) {
cssProperty.IsImportant = (priority != null);
SetProperty(cssProperty);
RaiseChanged();
}
}
}
} else
RemoveProperty(propertyName);
}
}
internal CssProperty CreateProperty(string propertyName)
{
return GetProperty(propertyName) ?? Factory.Properties.Create(propertyName);
}
internal CssProperty GetProperty(string name)
{
foreach (CssProperty declaration in _declarations) {
if (declaration.Name.Equals(name, StringComparison.OrdinalIgnoreCase))
return declaration;
}
return null;
}
internal void SetProperty(CssProperty property)
{
if (property is CssShorthandProperty)
SetShorthand((CssShorthandProperty)property);
else
SetLonghand(property);
}
internal void SetDeclarations(IEnumerable<CssProperty> decls)
{
ChangeDeclarations(decls, (CssProperty m) => false, delegate(CssProperty o, CssProperty n) {
if (o.IsImportant)
return n.IsImportant;
return true;
});
}
internal void UpdateDeclarations(IEnumerable<CssProperty> decls)
{
ChangeDeclarations(decls, (CssProperty m) => !m.CanBeInherited, (CssProperty o, CssProperty n) => o.IsInherited);
}
internal void Clear()
{
_declarations.Clear();
}
private void ChangeDeclarations(IEnumerable<CssProperty> decls, Predicate<CssProperty> defaultSkip, Func<CssProperty, CssProperty, bool> removeExisting)
{
List<CssProperty> list = new List<CssProperty>();
foreach (CssProperty decl in decls) {
bool flag = defaultSkip(decl);
foreach (CssProperty declaration in _declarations) {
if (declaration.Name == decl.Name) {
if (removeExisting(declaration, decl))
_declarations.Remove(declaration);
else
flag = true;
break;
}
}
if (!flag)
list.Add(decl);
}
_declarations.AddRange(list);
}
private void SetLonghand(CssProperty property)
{
for (int i = 0; i < _declarations.Count; i++) {
if (_declarations[i].Name == property.Name) {
_declarations.RemoveAt(i);
break;
}
if (_declarations[i] == property)
return;
}
_declarations.Add(property);
}
private void SetShorthand(CssShorthandProperty shorthand)
{
CssProperty[] array = Factory.Properties.CreateLonghandsFor(shorthand.Name);
shorthand.Export(array);
CssProperty[] array2 = array;
foreach (CssProperty longhand in array2) {
SetLonghand(longhand);
}
}
private void RaiseChanged()
{
if (this.Changed != null)
this.Changed(CssText);
}
public IEnumerator<ICssProperty> GetEnumerator()
{
return _declarations.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}