CollectProperty() публичный Метод

public CollectProperty ( string name, int specificity, CssValue cssValue, CssStyleSheetType origin, string priority ) : void
name string
specificity int
cssValue CssValue
origin CssStyleSheetType
priority string
Результат void
 public void CollectOverrideLowerSpecificity()
 {
     XmlElement elm = getElm();
             CssCollectedStyleDeclaration csd = new CssCollectedStyleDeclaration(elm);
             csd.CollectProperty("foo", 100, _getCssValue("value1"), CssStyleSheetType.Author, "");
             csd.CollectProperty("foo", 1, _getCssValue("value2"), CssStyleSheetType.Author, "");
             Assert.AreEqual("foo:value1;", csd.CssText);
 }
 public void CollectOverrideImportantUserAgent()
 {
     XmlElement elm = getElm();
             CssCollectedStyleDeclaration csd = new CssCollectedStyleDeclaration(elm);
             csd.CollectProperty("foo", 100, _getCssValue("value1"), CssStyleSheetType.UserAgent, "");
             csd.CollectProperty("foo", 1, _getCssValue("value2"), CssStyleSheetType.UserAgent, "important");
             Assert.AreEqual("foo:value1;", csd.CssText);
 }
    public void Collect()
    {
        XmlElement elm = getElm();
                CssCollectedStyleDeclaration csd = new CssCollectedStyleDeclaration(elm);
                Assert.AreEqual(0, csd.Length);
                csd.CollectProperty("foo", 1, _getCssValue("12px"), CssStyleSheetType.Author, "important");
                Assert.AreEqual(1, csd.Length);
                Assert.AreEqual("foo:12px !important;", csd.CssText);

                csd.CollectProperty("bar", 1, _getCssValue("test"), CssStyleSheetType.Author, "");
                Assert.AreEqual(2, csd.Length);
                Assert.AreEqual("foo:12px !important;bar:test;", csd.CssText);
    }
Пример #4
0
 /// <summary>
 /// Used to find matching style rules in the cascading order
 /// </summary>
 internal void GetStylesForElement(CssCollectedStyleDeclaration csd, int specificity)
 {
     foreach (DictionaryEntry de in styles)
     {
         SharpCssStyle scs = (SharpCssStyle)de.Value;
         csd.CollectProperty(scs.Name, specificity, (CssValue)GetPropertyCssValue(scs.Name), scs.Origin, scs.Priority);
     }
 }
Пример #5
0
 /// <summary>
 /// Used to find matching style rules in the cascading order
 /// </summary>
 public void GetStylesForElement(CssCollectedStyleDeclaration csd, int specificity)
 {
     foreach (KeyValuePair <string, CssStyleBlock> de in _styles)
     {
         CssStyleBlock scs = de.Value;
         csd.CollectProperty(scs.Name, specificity,
                             (CssValue)GetPropertyCssValue(scs.Name), scs.Origin, scs.Priority);
     }
 }
Пример #6
0
 /// <summary>
 /// Used to find matching style rules in the cascading order
 /// </summary>
 internal void GetStylesForElement(CssCollectedStyleDeclaration csd, int specificity)
 {
     foreach (KeyValuePair<string, CssStyleBlock> de in styles)
     {
         CssStyleBlock scs = de.Value;
         csd.CollectProperty(scs.Name, specificity,
             (CssValue)GetPropertyCssValue(scs.Name), scs.Origin, scs.Priority);
     }
 }
 protected override CssStyleDeclaration getCSD()
 {
     CssCollectedStyleDeclaration csd = new CssCollectedStyleDeclaration(getElm());
             csd.CollectProperty("foo", 1, _getCssValue("bar"), CssStyleSheetType.Author, String.Empty);
             csd.CollectProperty("length", 1, _getCssValue("23cm"), CssStyleSheetType.Author, "important");
             return csd;
 }
    public void TestFuncAttr()
    {
        XmlElement elm = getElm();
                elm.SetAttribute("kalle", "", "roffe");
                CssCollectedStyleDeclaration csd = new CssCollectedStyleDeclaration(elm);
                csd.CollectProperty("foo", 1, CssValue.GetCssValue("attr(kalle)", false), CssStyleSheetType.Author, "");

                CssPrimitiveValue cssPrimValue = csd.GetPropertyCssValue("foo") as CssPrimitiveValue;
                Assert.IsNotNull(cssPrimValue);
                Assert.AreEqual("roffe", cssPrimValue.GetStringValue());
    }
    public void TestExsNotFontSize()
    {
        CssCollectedStyleDeclaration csd = new CssCollectedStyleDeclaration(getElm());
                csd.CollectProperty("notFontSize", 1, CssValue.GetCssValue("2ex", false), CssStyleSheetType.Author, "");

                CssPrimitiveValue cssPrimValue = csd.GetPropertyCssValue("notFontSize") as CssPrimitiveValue;
                Assert.AreEqual(10, cssPrimValue.GetFloatValue(CssPrimitiveType.Px));
    }
Пример #10
0
 /// <summary>
 /// Used to find matching style rules in the cascading order
 /// </summary>
 internal void GetStylesForElement(CssCollectedStyleDeclaration csd, int specificity)
 {
     foreach(DictionaryEntry de in styles)
     {
         SharpCssStyle scs = (SharpCssStyle)de.Value;
         csd.CollectProperty(scs.Name, specificity, (CssValue)GetPropertyCssValue(scs.Name), scs.Origin, scs.Priority);
     }
 }