Implement SVGGeometryElement's isPointInFill and isPointInStroke
authorkrit@webkit.org <krit@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 May 2018 09:25:44 +0000 (09:25 +0000)
committerkrit@webkit.org <krit@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 May 2018 09:25:44 +0000 (09:25 +0000)
commit9b05484f0a0bff403ed2d8cc3fff4bc345cd1b15
tree5fa50bcd8fee1c02838bf07a74b3669f47a24557
parentaecc442be6b4d092c51e5d0d9459b8714eac4439
Implement SVGGeometryElement's isPointInFill and isPointInStroke
https://bugs.webkit.org/show_bug.cgi?id=185580

Reviewed by Antti Koivisto.

Implement isPointInFill and isPointInStroke methods for
SVGGeometryElement interface from SVG2.

https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement

Source/WebCore:

Tests: svg/dom/SVGGeometry-isPointInFill.xhtml
       svg/dom/SVGGeometry-isPointInStroke.xhtml

* rendering/svg/RenderSVGEllipse.cpp:
(WebCore::RenderSVGEllipse::shapeDependentStrokeContains): Flag
        to switch between local and "global" coordinate space for hit testing.
* rendering/svg/RenderSVGEllipse.h:
* rendering/svg/RenderSVGPath.cpp:
(WebCore::RenderSVGPath::shapeDependentStrokeContains): Flag
        to switch between local and "global" coordinate space for hit testing.
* rendering/svg/RenderSVGPath.h:
* rendering/svg/RenderSVGRect.cpp:
(WebCore::RenderSVGRect::shapeDependentStrokeContains): Flag
        to switch between local and "global" coordinate space for hit testing.
* rendering/svg/RenderSVGRect.h:
* rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::shapeDependentStrokeContains): Flag
        to switch between local and "global" coordinate space for hit testing.
(WebCore::RenderSVGShape::isPointInFill): Take the winding rule given by
        `fill-rule` to test if a given point is in the fill area of a path.
(WebCore::RenderSVGShape::isPointInStroke): Take stroke properties into
        account to check if a point is on top of the stroke area.
* rendering/svg/RenderSVGShape.h:
* svg/SVGGeometryElement.cpp:
(WebCore::SVGGeometryElement::isPointInFill):
(WebCore::SVGGeometryElement::isPointInStroke):
(WebCore::SVGGeometryElement::createElementRenderer): Deleted. This is getting implemented
        by inheriting classes. No need to create RenderSVGPath here.
* svg/SVGGeometryElement.h:
* svg/SVGGeometryElement.idl:

LayoutTests:

* svg/dom/SVGGeometry-isPointInFill-expected.txt: Added.
* svg/dom/SVGGeometry-isPointInFill.xhtml: Added.
* svg/dom/SVGGeometry-isPointInStroke-expected.txt: Added.
* svg/dom/SVGGeometry-isPointInStroke.xhtml: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231739 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/dom/SVGGeometry-isPointInFill-expected.txt [new file with mode: 0644]
LayoutTests/svg/dom/SVGGeometry-isPointInFill.xhtml [new file with mode: 0644]
LayoutTests/svg/dom/SVGGeometry-isPointInStroke-expected.txt [new file with mode: 0644]
LayoutTests/svg/dom/SVGGeometry-isPointInStroke.xhtml [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/svg/RenderSVGEllipse.cpp
Source/WebCore/rendering/svg/RenderSVGEllipse.h
Source/WebCore/rendering/svg/RenderSVGPath.cpp
Source/WebCore/rendering/svg/RenderSVGPath.h
Source/WebCore/rendering/svg/RenderSVGRect.cpp
Source/WebCore/rendering/svg/RenderSVGRect.h
Source/WebCore/rendering/svg/RenderSVGShape.cpp
Source/WebCore/rendering/svg/RenderSVGShape.h
Source/WebCore/svg/SVGGeometryElement.cpp
Source/WebCore/svg/SVGGeometryElement.h
Source/WebCore/svg/SVGGeometryElement.idl