@@ -68,15 +68,28 @@ public class CssRuleSet : CssStatement {
6868 /// <summary>
6969 /// Creates a new
7070 /// <see cref="CssRuleSet"/>
71- /// .
71+ /// from selector and raw list of declarations.
72+ /// The declarations are split into normal and important under the hood.
73+ /// To construct the
74+ /// <see cref="CssRuleSet"/>
75+ /// instance from normal and important declarations, see
76+ /// <see cref="CssRuleSet(iText.Html2pdf.Css.Selector.ICssSelector, System.Collections.Generic.IList{E}, System.Collections.Generic.IList{E})
77+ /// "/>
7278 /// </summary>
7379 /// <param name="selector">the CSS selector</param>
7480 /// <param name="declarations">the CSS declarations</param>
7581 public CssRuleSet ( ICssSelector selector , IList < CssDeclaration > declarations ) {
7682 this . selector = selector ;
7783 this . normalDeclarations = new List < CssDeclaration > ( ) ;
7884 this . importantDeclarations = new List < CssDeclaration > ( ) ;
79- SplitDeclarationsIntoNormalAndImportant ( declarations ) ;
85+ SplitDeclarationsIntoNormalAndImportant ( declarations , normalDeclarations , importantDeclarations ) ;
86+ }
87+
88+ public CssRuleSet ( ICssSelector selector , IList < CssDeclaration > normalDeclarations , IList < CssDeclaration > importantDeclarations
89+ ) {
90+ this . selector = selector ;
91+ this . normalDeclarations = normalDeclarations ;
92+ this . importantDeclarations = importantDeclarations ;
8093 }
8194
8295 /* (non-Javadoc)
@@ -137,7 +150,8 @@ public virtual IList<CssDeclaration> GetImportantDeclarations() {
137150
138151 /// <summary>Split CSS declarations into normal and important CSS declarations.</summary>
139152 /// <param name="declarations">the declarations</param>
140- private void SplitDeclarationsIntoNormalAndImportant ( IList < CssDeclaration > declarations ) {
153+ private static void SplitDeclarationsIntoNormalAndImportant ( IList < CssDeclaration > declarations , IList < CssDeclaration
154+ > normalDeclarations , IList < CssDeclaration > importantDeclarations ) {
141155 foreach ( CssDeclaration declaration in declarations ) {
142156 int exclIndex = declaration . GetExpression ( ) . IndexOf ( '!' ) ;
143157 if ( exclIndex > 0 && iText . IO . Util . StringUtil . Match ( importantMatcher , declaration . GetExpression ( ) ) . Success
0 commit comments