MCPcopy Create free account
hub / github.com/w3c/epubcheck / startAtRule

Method startAtRule

src/main/java/com/adobe/epubcheck/css/CSSHandler.java:142–192  ·  view source on GitHub ↗
(CssAtRule atRule)

Source from the content-addressed store, hash-verified

140 .compile("@((keyframes)|(-moz-keyframes)|(-webkit-keyframes)|(-o-keyframes))");
141
142 @Override
143 public void startAtRule(CssAtRule atRule)
144 {
145 String ruleName = atRule.getName().get();
146 this.atRule = atRule;
147 if (ruleName.equals("@import"))
148 {
149 CssConstruct uriOrString = atRule.getComponents().get(0);
150 if (uriOrString != null)
151 {
152 int line = uriOrString.getLocation().getLine();
153 int col = uriOrString.getLocation().getColumn();
154 String uri = null;
155 if (uriOrString.getType() == CssConstruct.Type.URI)
156 {
157 uri = ((CssURI) uriOrString).toUriString();
158 }
159 else if (uriOrString.getType() == CssConstruct.Type.STRING)
160 {
161 uri = CharMatcher.anyOf("\"'").trimFrom(uriOrString.toCssString());
162 }
163 else
164 {
165 // syntax error, url must be first parameter
166 }
167 if (uri != null)
168 {
169 resolveAndRegister(uri, line, col, atRule.toCssString(), Reference.Type.STYLESHEET);
170 }
171 }
172 }
173 else if (atRule.getName().get().equals("@namespace"))
174 {
175 // do not register namespace URIs as resources...
176 }
177 else
178 {
179 // check generically for urls in other atrules
180 registerURIs(atRule.getComponents(), atRule.getLocation().getLine(),
181 atRule.getLocation().getColumn());
182 }
183
184 if (ruleName.equals("@font-face"))
185 {
186 inFontFace = true;
187 }
188 else if (keyframesPattern.matcher(ruleName).matches())
189 {
190 inKeyFrames = true;
191 }
192 }
193
194 @Override
195 public void endAtRule(String name)

Callers

nothing calls this directly

Calls 15

getLocationMethod · 0.95
getTypeMethod · 0.95
toCssStringMethod · 0.95
resolveAndRegisterMethod · 0.95
registerURIsMethod · 0.95
toUriStringMethod · 0.80
matchesMethod · 0.80
getMethod · 0.65
getNameMethod · 0.45
equalsMethod · 0.45
getComponentsMethod · 0.45
getLineMethod · 0.45

Tested by

no test coverage detected