MCPcopy Index your code
hub / github.com/HtmlUnit/htmlunit / parseRect

Method parseRect

src/main/java/org/htmlunit/html/HtmlArea.java:268–298  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

266 }
267
268 private Rectangle2D parseRect() {
269 // browsers seem to support comma and blank
270 final String[] coords = StringUtils.splitAtCommaOrBlank(getCoordsAttribute());
271
272 double leftX = 0;
273 double topY = 0;
274 double rightX = 0;
275 double bottomY = 0;
276
277 try {
278 if (coords.length > 0) {
279 leftX = Double.parseDouble(coords[0].trim());
280 }
281 if (coords.length > 1) {
282 topY = Double.parseDouble(coords[1].trim());
283 }
284 if (coords.length > 2) {
285 rightX = Double.parseDouble(coords[2].trim());
286 }
287 if (coords.length > 3) {
288 bottomY = Double.parseDouble(coords[3].trim());
289 }
290 }
291 catch (final NumberFormatException e) {
292 if (LOG.isWarnEnabled()) {
293 LOG.warn("Invalid rect coords '" + Arrays.toString(coords) + "'", e);
294 }
295 }
296
297 return new Rectangle2D(leftX, topY, rightX, bottomY);
298 }
299
300 private Circle2D parseCircle() {
301 // browsers seem to support comma and blank

Callers 2

containsPointMethod · 0.95
isEmptyMethod · 0.95

Calls 6

splitAtCommaOrBlankMethod · 0.95
getCoordsAttributeMethod · 0.95
trimMethod · 0.80
isWarnEnabledMethod · 0.65
warnMethod · 0.65
toStringMethod · 0.45

Tested by

no test coverage detected