Changeset 205565 in webkit


Ignore:
Timestamp:
Sep 7, 2016 1:19:48 PM (8 years ago)
Author:
Chris Dumez
Message:

Fix handling of negative radius in HTMLAreaElement's coords when in circle state
https://bugs.webkit.org/show_bug.cgi?id=161690

Reviewed by Daniel Bates.

LayoutTests/imported/w3c:

Rebaseline existing test now that one more check is passing.

  • web-platform-tests/html/semantics/embedded-content/the-area-element/area-processing-expected.txt:

Source/WebCore:

Fix handling of negative radius in HTMLAreaElement's coords when in
circle state:

The radius must be non-negative as per the specification. However, our
code fails to check.

Firefox and Chrome both reject negative radius.

No new tests, rebaselined existing test.

  • html/HTMLAreaElement.cpp:

(WebCore::HTMLAreaElement::getRegion):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r205562 r205565  
     12016-09-07  Chris Dumez  <cdumez@apple.com>
     2
     3        Fix handling of negative radius in HTMLAreaElement's coords when in circle state
     4        https://bugs.webkit.org/show_bug.cgi?id=161690
     5
     6        Reviewed by Daniel Bates.
     7
     8        Rebaseline existing test now that one more check is passing.
     9
     10        * web-platform-tests/html/semantics/embedded-content/the-area-element/area-processing-expected.txt:
     11
    1122016-09-07  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-area-element/area-processing-expected.txt

    r196091 r205565  
    1010PASS negative: "-10,-10,-10,-10" (default)
    1111PASS too few numbers: "20,40" (circle)
    12 FAIL negative radius: "20,40,-10" (circle) assert_equals: elementFromPoint(21, 41) expected Element node <img src="/images/threecolors.png" usemap="#x" id="img" w... but got Element node <area id="area" shape="circle" coords="20,40,-10"></area>
     12PASS negative radius: "20,40,-10" (circle)
    1313PASS zero radius: "20,40,0" (circle)
    1414PASS too few numbers: "100,100,120,100,100" (poly)
  • trunk/Source/WebCore/ChangeLog

    r205562 r205565  
     12016-09-07  Chris Dumez  <cdumez@apple.com>
     2
     3        Fix handling of negative radius in HTMLAreaElement's coords when in circle state
     4        https://bugs.webkit.org/show_bug.cgi?id=161690
     5
     6        Reviewed by Daniel Bates.
     7
     8        Fix handling of negative radius in HTMLAreaElement's coords when in
     9        circle state:
     10        - https://html.spec.whatwg.org/#attr-area-shape-circle
     11
     12        The radius must be non-negative as per the specification. However, our
     13        code fails to check.
     14
     15        Firefox and Chrome both reject negative radius.
     16
     17        No new tests, rebaselined existing test.
     18
     19        * html/HTMLAreaElement.cpp:
     20        (WebCore::HTMLAreaElement::getRegion):
     21
    1222016-09-07  Chris Dumez  <cdumez@apple.com>
    223
  • trunk/Source/WebCore/html/HTMLAreaElement.cpp

    r205562 r205565  
    162162        case Circle:
    163163            if (m_coords.size() >= 3) {
    164                 double r = m_coords[2];
    165                 path.addEllipse(FloatRect(m_coords[0] - r, m_coords[1] - r, 2 * r, 2 * r));
     164                double radius = m_coords[2];
     165                if (radius > 0)
     166                    path.addEllipse(FloatRect(m_coords[0] - radius, m_coords[1] - radius, 2 * radius, 2 * radius));
    166167            }
    167168            break;
Note: See TracChangeset for help on using the changeset viewer.