21
21
import java .util .Deque ;
22
22
import java .util .List ;
23
23
24
- import org .htmlunit .cssparser .dom .*;
24
+ import org .htmlunit .cssparser .dom .AbstractCSSRuleImpl ;
25
+ import org .htmlunit .cssparser .dom .CSSCharsetRuleImpl ;
26
+ import org .htmlunit .cssparser .dom .CSSFontFaceRuleImpl ;
27
+ import org .htmlunit .cssparser .dom .CSSImportRuleImpl ;
28
+ import org .htmlunit .cssparser .dom .CSSMediaRuleImpl ;
29
+ import org .htmlunit .cssparser .dom .CSSPageRuleImpl ;
30
+ import org .htmlunit .cssparser .dom .CSSRuleListImpl ;
31
+ import org .htmlunit .cssparser .dom .CSSStyleDeclarationImpl ;
32
+ import org .htmlunit .cssparser .dom .CSSStyleRuleImpl ;
33
+ import org .htmlunit .cssparser .dom .CSSStyleSheetImpl ;
34
+ import org .htmlunit .cssparser .dom .CSSUnknownRuleImpl ;
35
+ import org .htmlunit .cssparser .dom .CSSValueImpl ;
36
+ import org .htmlunit .cssparser .dom .MediaListImpl ;
37
+ import org .htmlunit .cssparser .dom .Property ;
25
38
import org .htmlunit .cssparser .parser .javacc .CSS3Parser ;
26
39
import org .htmlunit .cssparser .parser .media .MediaQueryList ;
27
40
import org .htmlunit .cssparser .parser .selector .SelectorList ;
@@ -100,7 +113,7 @@ public CSSStyleDeclarationImpl parseStyleDeclaration(final String styleDecl) thr
100
113
* @throws IOException if the underlying SAC parser throws an IOException
101
114
*/
102
115
public void parseStyleDeclaration (final CSSStyleDeclarationImpl sd , final String styleDecl ) throws IOException {
103
- try (final InputSource source = new InputSource (new StringReader (styleDecl ))) {
116
+ try (InputSource source = new InputSource (new StringReader (styleDecl ))) {
104
117
final Deque <Object > nodeStack = new ArrayDeque <>();
105
118
nodeStack .push (sd );
106
119
final CSSOMHandler handler = new CSSOMHandler (nodeStack );
@@ -117,7 +130,7 @@ public void parseStyleDeclaration(final CSSStyleDeclarationImpl sd, final String
117
130
* @throws IOException if the underlying SAC parser throws an IOException
118
131
*/
119
132
public CSSValueImpl parsePropertyValue (final String propertyValue ) throws IOException {
120
- try (final InputSource source = new InputSource (new StringReader (propertyValue ))) {
133
+ try (InputSource source = new InputSource (new StringReader (propertyValue ))) {
121
134
final CSSOMHandler handler = new CSSOMHandler ();
122
135
parser_ .setDocumentHandler (handler );
123
136
final LexicalUnit lu = parser_ .parsePropertyValue (source );
@@ -136,7 +149,7 @@ public CSSValueImpl parsePropertyValue(final String propertyValue) throws IOExce
136
149
* @throws IOException if the underlying SAC parser throws an IOException
137
150
*/
138
151
public AbstractCSSRuleImpl parseRule (final String rule ) throws IOException {
139
- try (final InputSource source = new InputSource (new StringReader (rule ))) {
152
+ try (InputSource source = new InputSource (new StringReader (rule ))) {
140
153
final CSSOMHandler handler = new CSSOMHandler ();
141
154
parser_ .setDocumentHandler (handler );
142
155
parser_ .parseRule (source );
@@ -152,7 +165,7 @@ public AbstractCSSRuleImpl parseRule(final String rule) throws IOException {
152
165
* @throws IOException if the underlying SAC parser throws an IOException
153
166
*/
154
167
public SelectorList parseSelectors (final String selectors ) throws IOException {
155
- try (final InputSource source = new InputSource (new StringReader (selectors ))) {
168
+ try (InputSource source = new InputSource (new StringReader (selectors ))) {
156
169
final HandlerBase handler = new HandlerBase ();
157
170
parser_ .setDocumentHandler (handler );
158
171
return parser_ .parseSelectors (source );
@@ -167,7 +180,7 @@ public SelectorList parseSelectors(final String selectors) throws IOException {
167
180
* @throws IOException if the underlying SAC parser throws an IOException
168
181
*/
169
182
public MediaQueryList parseMedia (final String media ) throws IOException {
170
- try (final InputSource source = new InputSource (new StringReader (media ))) {
183
+ try (InputSource source = new InputSource (new StringReader (media ))) {
171
184
final HandlerBase handler = new HandlerBase ();
172
185
parser_ .setDocumentHandler (handler );
173
186
return parser_ .parseMedia (source );
@@ -410,8 +423,8 @@ public void property(final String name, final LexicalUnit value, final boolean i
410
423
411
424
private AbstractCSSRuleImpl getParentRule () {
412
425
if (!nodeStack_ .isEmpty () && nodeStack_ .size () > 1 ) {
413
- final List <Object > nodesStack_ = new ArrayList <>(nodeStack_ );
414
- final Object node = nodesStack_ .get (nodesStack_ .size () - 2 );
426
+ final List <Object > nodesStack = new ArrayList <>(nodeStack_ );
427
+ final Object node = nodesStack .get (nodesStack .size () - 2 );
415
428
if (node instanceof AbstractCSSRuleImpl ) {
416
429
return (AbstractCSSRuleImpl ) node ;
417
430
}
0 commit comments