Add new renderer for circles and ellipses
https://bugs.webkit.org/show_bug.cgi?id=80423

Patch by Philip Rogers <pdr@google.com> on 2012-03-30
Reviewed by Eric Seidel.

Source/WebCore: 

This patch introduces a special renderer for SVGCircleElements
and SVGEllipseElements to avoid having to use the slower path
rendering code. This patch includes optimized circle code for
the CG platform, and hooks (GC::fillEllipse, GC::strokeEllipse)
are available for other platforms as well.

Tests: svg/hittest/svg-ellipse-non-scale-stroke.xhtml
       svg/hittest/svg-ellipse.xhtml

Added a test to exercise hit testing on an ellipse, and on
an ellipse's stroke, to make sure the formulae in this patch
are correct.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::fillEllipse):
(WebCore):
(WebCore::GraphicsContext::strokeEllipse):
(WebCore::GraphicsContext::fillEllipseAsPath):
(WebCore::GraphicsContext::strokeEllipseAsPath):
(WebCore::GraphicsContext::platformFillEllipse):
(WebCore::GraphicsContext::platformStrokeEllipse):
* platform/graphics/GraphicsContext.h:
(GraphicsContext):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::platformFillEllipse):
(WebCore):
(WebCore::GraphicsContext::platformStrokeEllipse):
* platform/graphics/skia/GraphicsContextSkia.cpp:
(WebCore::GraphicsContext::platformFillEllipse):
(WebCore):
(WebCore::GraphicsContext::platformStrokeEllipse):
* rendering/svg/RenderSVGAllInOne.cpp:
* rendering/svg/RenderSVGEllipse.cpp: Added.
(WebCore):
(WebCore::RenderSVGEllipse::RenderSVGEllipse):
(WebCore::RenderSVGEllipse::~RenderSVGEllipse):
(WebCore::RenderSVGEllipse::createShape):
(WebCore::RenderSVGEllipse::calculateRadiiAndCenter):
(WebCore::RenderSVGEllipse::objectBoundingBox):
(WebCore::RenderSVGEllipse::strokeBoundingBox):
(WebCore::RenderSVGEllipse::fillShape):
(WebCore::RenderSVGEllipse::strokeShape):
(WebCore::RenderSVGEllipse::shapeDependentStrokeContains):
(WebCore::RenderSVGEllipse::shapeDependentFillContains):
* rendering/svg/RenderSVGEllipse.h: Added.
(WebCore):
(RenderSVGEllipse):
(WebCore::RenderSVGEllipse::isSVGEllipse):
(WebCore::RenderSVGEllipse::renderName):
(WebCore::RenderSVGEllipse::isEmpty):
* svg/SVGCircleElement.cpp:
(WebCore::SVGCircleElement::svgAttributeChanged):
(WebCore):
(WebCore::SVGCircleElement::createRenderer):
* svg/SVGCircleElement.h:
(SVGCircleElement):
* svg/SVGEllipseElement.cpp:
(WebCore::SVGEllipseElement::svgAttributeChanged):
(WebCore::SVGEllipseElement::createRenderer):
(WebCore):
* svg/SVGEllipseElement.h:
(SVGEllipseElement):

LayoutTests: 

* platform/chromium/test_expectations.txt:
* platform/gtk/Skipped:
* platform/mac/Skipped:
* platform/mac/svg/W3C-SVG-1.1-SE/coords-dom-01-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/coords-dom-02-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/filters-felem-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/linking-uri-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/pservers-pattern-04-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/struct-use-11-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/styling-pres-02-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/types-dom-02-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/types-dom-04-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1-SE/types-dom-07-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-21-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-23-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-26-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-28-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-29-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-30-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-31-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-32-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-33-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-37-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-39-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-44-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-80-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-81-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-82-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/animate-elem-83-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/color-prop-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/color-prop-02-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/color-prop-03-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/coords-units-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/coords-units-02-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/filters-felem-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/filters-offset-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/interact-cursor-01-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/interact-order-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/interact-order-02-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/interact-zoom-01-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/linking-a-04-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/linking-a-05-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/linking-uri-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/linking-uri-02-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/masking-intro-01-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/metadata-example-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/painting-marker-01-f-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/painting-render-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/script-handle-02-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/script-handle-03-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/script-handle-04-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/shapes-circle-01-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/shapes-circle-02-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/shapes-ellipse-01-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/shapes-ellipse-02-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/shapes-intro-01-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/struct-frag-02-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/struct-frag-03-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/struct-frag-04-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/struct-use-01-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/styling-css-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/styling-css-02-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/styling-css-03-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/styling-inherit-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/styling-pres-01-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/text-align-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/text-align-05-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/types-basicDOM-01-b-expected.txt:
* platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-01-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-02-t-expected.txt:
* platform/mac/svg/W3C-SVG-1.2-Tiny/struct-use-recursion-03-t-expected.txt:
* platform/mac/svg/as-image/img-preserveAspectRatio-support-1-expected.txt:
* platform/mac/svg/as-image/img-preserveAspectRatio-support-2-expected.txt:
* platform/mac/svg/as-object/object-box-sizing-no-width-height-expected.txt:
* platform/mac/svg/as-object/svg-embedded-in-html-in-iframe-expected.txt:
* platform/mac/svg/batik/masking/maskRegions-expected.txt:
* platform/mac/svg/batik/paints/patternPreserveAspectRatioA-expected.txt:
* platform/mac/svg/batik/paints/patternRegions-expected.txt:
* platform/mac/svg/batik/paints/patternRegions-positioned-objects-expected.txt:
* platform/mac/svg/batik/text/verticalText-expected.txt:
* platform/mac/svg/carto.net/button-expected.txt:
* platform/mac/svg/clip-path/clip-in-mask-expected.txt:
* platform/mac/svg/clip-path/clip-path-child-clipped-expected.txt:
* platform/mac/svg/clip-path/clip-path-evenodd-nonzero-expected.txt:
* platform/mac/svg/clip-path/clip-path-nonzero-evenodd-expected.txt:
* platform/mac/svg/clip-path/clip-path-nonzero-expected.txt:
* platform/mac/svg/clip-path/clip-path-pixelation-expected.txt:
* platform/mac/svg/clip-path/clip-path-transform-1-expected.txt:
* platform/mac/svg/clip-path/clip-path-use-as-child2-expected.txt:
* platform/mac/svg/clip-path/clip-path-use-as-child3-expected.txt:
* platform/mac/svg/clip-path/clip-path-use-as-child4-expected.txt:
* platform/mac/svg/clip-path/clip-path-use-as-child5-expected.txt:
* platform/mac/svg/clip-path/clip-path-with-different-unittypes-expected.txt:
* platform/mac/svg/clip-path/clip-path-with-different-unittypes2-expected.txt:
* platform/mac/svg/clip-path/deep-nested-clip-in-mask-different-unitTypes-expected.txt:
* platform/mac/svg/clip-path/deep-nested-clip-in-mask-expected.txt:
* platform/mac/svg/clip-path/deep-nested-clip-in-mask-panning-expected.txt:
* platform/mac/svg/clip-path/nested-clip-in-mask-image-based-clipping-expected.txt:
* platform/mac/svg/clip-path/nested-clip-in-mask-path-and-image-based-clipping-expected.txt:
* platform/mac/svg/clip-path/nested-clip-in-mask-path-based-clipping-expected.txt:
* platform/mac/svg/css/shadow-changes-expected.txt:
* platform/mac/svg/custom/absolute-sized-content-with-resources-expected.txt:
* platform/mac/svg/custom/circle-move-invalidation-expected.txt:
* platform/mac/svg/custom/circular-marker-reference-2-expected.txt:
* platform/mac/svg/custom/clone-element-with-animated-svg-properties-expected.txt:
* platform/mac/svg/custom/dasharrayOrigin-expected.txt:
* platform/mac/svg/custom/focus-ring-expected.txt:
* platform/mac/svg/custom/getscreenctm-in-scrollable-div-area-expected.txt:
* platform/mac/svg/custom/getscreenctm-in-scrollable-div-area-nested-expected.txt:
* platform/mac/svg/custom/getscreenctm-in-scrollable-svg-area-expected.txt:
* platform/mac/svg/custom/inline-svg-in-xhtml-expected.txt:
* platform/mac/svg/custom/invalid-css-expected.txt:
* platform/mac/svg/custom/linking-a-03-b-all-expected.txt:
* platform/mac/svg/custom/linking-a-03-b-preserveAspectRatio-expected.txt:
* platform/mac/svg/custom/linking-a-03-b-transform-expected.txt:
* platform/mac/svg/custom/linking-a-03-b-viewBox-expected.txt:
* platform/mac/svg/custom/linking-a-03-b-viewBox-transform-expected.txt:
* platform/mac/svg/custom/linking-a-03-b-viewTarget-expected.txt:
* platform/mac/svg/custom/linking-a-03-b-zoomAndPan-expected.txt:
* platform/mac/svg/custom/linking-uri-01-b-expected.txt:
* platform/mac/svg/custom/marker-opacity-expected.txt:
* platform/mac/svg/custom/mask-colorspace-expected.txt:
* platform/mac/svg/custom/mask-on-multiple-objects-expected.txt:
* platform/mac/svg/custom/mouse-move-on-svg-container-expected.txt:
* platform/mac/svg/custom/mouse-move-on-svg-container-standalone-expected.txt:
* platform/mac/svg/custom/mouse-move-on-svg-root-expected.txt:
* platform/mac/svg/custom/mouse-move-on-svg-root-standalone-expected.txt:
* platform/mac/svg/custom/non-circular-marker-reference-expected.txt:
* platform/mac/svg/custom/object-sizing-expected.txt:
* platform/mac/svg/custom/object-sizing-explicit-height-expected.txt:
* platform/mac/svg/custom/object-sizing-explicit-width-expected.txt:
* platform/mac/svg/custom/object-sizing-explicit-width-height-expected.txt:
* platform/mac/svg/custom/object-sizing-no-width-height-expected.txt:
* platform/mac/svg/custom/path-zero-strokewidth-expected.txt:
* platform/mac/svg/custom/pattern-incorrect-tiling-expected.txt:
* platform/mac/svg/custom/pattern-no-pixelation-expected.txt:
* platform/mac/svg/custom/pattern-referencing-preserve-aspect-ratio-expected.txt:
* platform/mac/svg/custom/pattern-rotate-expected.txt:
* platform/mac/svg/custom/relative-sized-content-with-resources-expected.txt:
* platform/mac/svg/custom/shapes-supporting-markers-expected.txt:
* platform/mac/svg/custom/stroked-pattern-expected.txt:
* platform/mac/svg/custom/transform-with-shadow-and-gradient-expected.txt:
* platform/mac/svg/custom/use-css-events-expected.txt:
* platform/mac/svg/custom/use-detach-expected.txt:
* platform/mac/svg/custom/use-elementInstance-methods-expected.txt:
* platform/mac/svg/custom/use-instanceRoot-modifications-expected.txt:
* platform/mac/svg/custom/use-modify-container-in-target-expected.txt:
* platform/mac/svg/custom/use-modify-target-container-expected.txt:
* platform/mac/svg/custom/use-on-g-containing-use-expected.txt:
* platform/mac/svg/custom/use-on-g-expected.txt:
* platform/mac/svg/custom/use-on-use-expected.txt:
* platform/mac/svg/custom/use-transform-expected.txt:
* platform/mac/svg/custom/width-full-percentage-expected.txt:
* platform/mac/svg/filters/feDropShadow-expected.txt:
* platform/mac/svg/filters/feImage-filterUnits-objectBoundingBox-primitiveUnits-objectBoundingBox-expected.txt:
* platform/mac/svg/filters/feImage-filterUnits-objectBoundingBox-primitiveUnits-userSpaceOnUse-expected.txt:
* platform/mac/svg/filters/feImage-filterUnits-userSpaceOnUse-primitiveUnits-objectBoundingBox-expected.txt:
* platform/mac/svg/filters/feImage-filterUnits-userSpaceOnUse-primitiveUnits-userSpaceOnUse-expected.txt:
* platform/mac/svg/filters/feImage-late-indirect-update-expected.txt:
* platform/mac/svg/hixie/cascade/001-broken-expected.txt:
* platform/mac/svg/hixie/cascade/002-expected.txt:
* platform/mac/svg/hixie/error/001-expected.txt:
* platform/mac/svg/hixie/error/003-expected.txt:
* platform/mac/svg/hixie/error/017-expected.txt:
* platform/mac/svg/hixie/mixed/003-expected.txt:
* platform/mac/svg/hixie/mixed/004-expected.txt:
* platform/mac/svg/hixie/mixed/005-expected.txt:
* platform/mac/svg/hixie/mixed/006-expected.txt:
* platform/mac/svg/hixie/mixed/008-expected.txt:
* platform/mac/svg/hixie/mixed/011-expected.txt:
* platform/mac/svg/hixie/perf/001-expected.txt:
* platform/mac/svg/hixie/perf/002-expected.txt:
* platform/mac/svg/hixie/perf/007-expected.txt:
* platform/mac/svg/hixie/rendering-model/001-expected.txt:
* platform/mac/svg/hixie/rendering-model/002-expected.txt:
* platform/mac/svg/hixie/shapes/path/001-expected.txt:
* platform/mac/svg/hixie/transform/001-expected.txt:
* platform/mac/svg/in-html/circle-expected.txt:
* platform/mac/svg/stroke/zero-length-arc-linecaps-rendering-expected.txt:
* platform/mac/svg/stroke/zero-length-path-linecap-rendering-expected.txt:
* platform/mac/svg/stroke/zero-length-subpaths-linecap-rendering-expected.txt:
* platform/mac/svg/text/small-fonts-3-expected.txt:
* platform/mac/svg/text/text-align-01-b-expected.txt:
* platform/mac/svg/text/text-align-05-b-expected.txt:
* platform/mac/svg/text/text-fill-opacity-expected.txt:
* platform/mac/svg/transforms/svg-css-transforms-clip-path-expected.txt:
* platform/mac/svg/wicd/rightsizing-grid-expected.txt:
* platform/mac/svg/wicd/test-rightsizing-b-expected.txt:
* platform/mac/svg/zoom/page/zoom-hixie-mixed-008-expected.txt:
* platform/mac/svg/zoom/page/zoom-img-preserveAspectRatio-support-1-expected.txt:
* platform/mac/svg/zoom/page/zoom-mask-with-percentages-expected.txt:
* platform/mac/svg/zoom/page/zoom-svg-through-object-with-auto-size-expected.txt:
* platform/mac/svg/zoom/text/zoom-hixie-mixed-008-expected.txt:
* platform/qt/Skipped:
* platform/win/Skipped:
* svg/clip-path/clip-in-mask-objectBoundingBox-expected.txt:
* svg/clip-path/clip-in-mask-userSpaceOnUse-expected.txt:
* svg/clip-path/clip-path-childs-clipped-expected.txt:
* svg/clip-path/clip-path-clipped-evenodd-twice-expected.txt:
* svg/clip-path/clip-path-clipped-expected.txt:
* svg/clip-path/clip-path-clipped-nonzero-expected.txt:
* svg/clip-path/clip-path-css-transform-1-expected.txt:
* svg/clip-path/clip-path-css-transform-2-expected.txt:
* svg/clip-path/clip-path-objectBoundingBox-expected.txt:
* svg/clip-path/clip-path-on-clipped-use-expected.txt:
* svg/clip-path/clip-path-on-g-and-child-expected.txt:
* svg/clip-path/clip-path-on-g-expected.txt:
* svg/clip-path/clip-path-on-svg-and-child-expected.txt:
* svg/clip-path/clip-path-on-svg-expected.txt:
* svg/clip-path/clip-path-transform-2-expected.txt:
* svg/clip-path/clip-path-use-as-child-expected.txt:
* svg/css/circle-in-mask-with-shadow-expected.txt:
* svg/css/mask-with-shadow-expected.txt:
* svg/custom/absolute-root-position-masking-expected.txt:
* svg/custom/fill-opacity-update-expected.txt:
* svg/custom/gradient-stroke-width-expected.txt:
* svg/custom/js-late-marker-and-object-creation-expected.txt:
* svg/custom/js-late-marker-creation-expected.txt:
* svg/custom/js-update-bounce-expected.txt:
* svg/custom/marker-changes-expected.txt:
* svg/custom/marker-child-changes-css-expected.txt:
* svg/custom/marker-child-changes-expected.txt:
* svg/custom/marker-strokeWidth-changes-expected.txt:
* svg/custom/marker-viewBox-changes-expected.txt:
* svg/custom/object-sizing-no-width-height-change-content-box-size-expected.txt:
* svg/custom/pattern-scaled-pattern-space-expected.txt:
* svg/custom/resource-invalidate-on-target-update-expected.txt:
* svg/custom/stroke-opacity-update-expected.txt:
* svg/custom/use-setAttribute-crash-expected.txt:
* svg/custom/viewBox-hit-expected.txt:
* svg/filters/feImage-reference-svg-primitive-expected.txt:
* svg/filters/filter-clip-expected.txt:
* svg/filters/invalidate-on-child-layout-expected.txt:
* svg/hittest/svg-ellipse-expected.txt: Added.
* svg/hittest/svg-ellipse-non-scale-stroke-expected.txt: Added.
* svg/hittest/svg-ellipse-non-scale-stroke.xhtml: Added.
* svg/hittest/svg-ellipse.xhtml: Added.
* svg/hixie/links/001-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@112667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
257 files changed