Commit cd87cdf5 authored by fs's avatar fs Committed by Commit bot

Negative or zero radius for <area shape=circle> gives an empty shape

Step 7 in

https://html.spec.whatwg.org/multipage/embedded-content.html#processing-model

BUG=578125

Review URL: https://codereview.chromium.org/1631303002

Cr-Commit-Position: refs/heads/master@{#371742}
parent 946f3c57
This is a testharness.js-based test.
PASS too few numbers: "2,2,10" (rect)
PASS negative: "-10,-10,10,10" (rect)
PASS empty string: "" (rect)
PASS omitted coords: null (rect)
PASS first > third: "10,2,2,10" (rect)
PASS second > fourth: "2,10,10,2" (rect)
PASS first > third, second > fourth: "10,10,2,2" (rect)
PASS negative: "-10,-10,-10,-10" (default)
PASS too few numbers: "20,40" (circle)
FAIL negative radius: "20,40,-10" (circle) assert_equals: elementFromPoint(21, 41) expected Element node <img src="resources/images/blue-border.png" usemap="#x" i... but got Element node <area id="area" shape="circle" coords="20,40,-10"></area>
PASS zero radius: "20,40,0" (circle)
PASS too few numbers: "100,100,120,100,100" (poly)
PASS one too many numbers: "100,100,120,100,100,120,300" (poly)
PASS even-odd rule: "100,100,200,100,100,200,150,50,200,200" (poly)
Harness: the test ran to completion.
......@@ -152,7 +152,7 @@ Path HTMLAreaElement::getRegion(const LayoutSize& size) const
}
break;
case Circle:
if (m_coords.size() >= 3) {
if (m_coords.size() >= 3 && m_coords[2].value() > 0) {
float r = clampCoordinate(m_coords[2]);
path.addEllipse(FloatRect(clampCoordinate(m_coords[0]) - r, clampCoordinate(m_coords[1]) - r, 2 * r, 2 * r));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment