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

Method containsPoint

src/main/java/org/htmlunit/html/HtmlArea.java:220–243  ·  view source on GitHub ↗

Indicates if this area contains the specified point. @param x the x coordinate of the point @param y the y coordinate of the point @return true if the point is contained in this area

(final int x, final int y)

Source from the content-addressed store, hash-verified

218 * @return {@code true} if the point is contained in this area
219 */
220 boolean containsPoint(final int x, final int y) {
221 final String shape = StringUtils.defaultIfEmptyOrNull(getShapeAttribute(), SHAPE_RECT);
222
223 if ("default".equalsIgnoreCase(shape) && getCoordsAttribute() != null) {
224 return true;
225 }
226
227 if (SHAPE_RECT.equalsIgnoreCase(shape) && getCoordsAttribute() != null) {
228 final Shape2D rectangle = parseRect();
229 return rectangle.contains(x, y);
230 }
231
232 if (SHAPE_CIRCLE.equalsIgnoreCase(shape) && getCoordsAttribute() != null) {
233 final Shape2D circle = parseCircle();
234 return circle.contains(x, y);
235 }
236
237 if (SHAPE_POLY.equalsIgnoreCase(shape) && getCoordsAttribute() != null) {
238 final Shape2D path = parsePoly();
239 return path.contains(x, y);
240 }
241
242 return false;
243 }
244
245 /**
246 * {@inheritDoc}

Callers 1

doClickStateUpdateMethod · 0.80

Calls 7

defaultIfEmptyOrNullMethod · 0.95
getShapeAttributeMethod · 0.95
getCoordsAttributeMethod · 0.95
parseRectMethod · 0.95
containsMethod · 0.95
parseCircleMethod · 0.95
parsePolyMethod · 0.95

Tested by

no test coverage detected