Refactor Path to Path2D and remove currentPath
authorkrit@webkit.org <krit@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Mar 2014 21:43:26 +0000 (21:43 +0000)
committerkrit@webkit.org <krit@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Mar 2014 21:43:26 +0000 (21:43 +0000)
commit51a5670a4f5b06d6ca869a9e919ba4369fad47c4
tree462ad9dffe3d5b935f9ba551da643fbe91f02f3e
parent89a37043018bf41a49122322937d6c661e8c6cad
Refactor Path to Path2D and remove currentPath
https://bugs.webkit.org/show_bug.cgi?id=130236

Reviewed by Dean Jackson.

Source/WebCore:

Other implementations prefer Path2D over Path. Furthermore, currentPath is not the right
way to apply a Path2D object to a context. Main argument is that currentPath creates a copy
of the Path2D object. Instead we pass Path2D as argument to fill, stroke and clip now.

Tests: fast/canvas/canvas-clip-path.html
       fast/canvas/canvas-fill-path.html
       fast/canvas/canvas-stroke-path.html

* bindings/scripts/CodeGeneratorJS.pm: WebIDL parser didn't handle enumerations
    for overloaded methods at all.
(GenerateParametersCheckExpression):
* html/canvas/CanvasRenderingContext2D.cpp: New functions with DOMPath argument.
(WebCore::CanvasRenderingContext2D::fill):
(WebCore::CanvasRenderingContext2D::stroke):
(WebCore::CanvasRenderingContext2D::clip):
(WebCore::CanvasRenderingContext2D::fillInternal): Internal method to avoid code duplication
    and copy operation.
(WebCore::CanvasRenderingContext2D::strokeInternal): Ditto.
(WebCore::CanvasRenderingContext2D::clipInternal): Ditto.
* html/canvas/CanvasRenderingContext2D.h:
* html/canvas/CanvasRenderingContext2D.idl:
* html/canvas/DOMPath.idl: Rename Path to Path2D.

LayoutTests:

Add new tests for Path2D object and new functions fill(),
stroke() and clip() with Path2D argument.

* fast/canvas/canvas-clip-path-expected.txt: Added.
* fast/canvas/canvas-clip-path.html: Added.
* fast/canvas/canvas-currentPath-crash-expected.txt: Removed.
* fast/canvas/canvas-currentPath-crash.html: Removed.
* fast/canvas/canvas-currentPath-expected.txt: Removed.
* fast/canvas/canvas-currentPath.html: Removed.
* fast/canvas/canvas-fill-path-expected.txt: Added.
* fast/canvas/canvas-fill-path.html: Added.
* fast/canvas/canvas-path-constructors-expected.txt:
* fast/canvas/canvas-path-object-expected.txt:
* fast/canvas/canvas-stroke-path-expected.txt: Added.
* fast/canvas/canvas-stroke-path.html: Added.
* fast/canvas/script-tests/canvas-clip-path.js: Added.
(areaColor):
* fast/canvas/script-tests/canvas-currentPath-crash.js: Removed.
* fast/canvas/script-tests/canvas-currentPath.js: Removed.
* fast/canvas/script-tests/canvas-fill-path.js: Added.
(areaColor):
* fast/canvas/script-tests/canvas-path-constructors.js:
* fast/canvas/script-tests/canvas-path-object.js:
* fast/canvas/script-tests/canvas-stroke-path.js: Added.
(areaColor):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165651 268f45cc-cd09-0410-ab3c-d52691b4dbfc
29 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/canvas/canvas-clip-path-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-clip-path.html [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-currentPath-crash-expected.txt [deleted file]
LayoutTests/fast/canvas/canvas-currentPath-crash.html [deleted file]
LayoutTests/fast/canvas/canvas-currentPath-expected.txt [deleted file]
LayoutTests/fast/canvas/canvas-currentPath.html [deleted file]
LayoutTests/fast/canvas/canvas-fill-path-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-fill-path.html [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-path-constructors-expected.txt
LayoutTests/fast/canvas/canvas-path-object-expected.txt
LayoutTests/fast/canvas/canvas-stroke-path-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-stroke-path.html [new file with mode: 0644]
LayoutTests/fast/canvas/script-tests/canvas-clip-path.js [new file with mode: 0644]
LayoutTests/fast/canvas/script-tests/canvas-currentPath-crash.js [deleted file]
LayoutTests/fast/canvas/script-tests/canvas-currentPath.js [deleted file]
LayoutTests/fast/canvas/script-tests/canvas-fill-path.js [new file with mode: 0644]
LayoutTests/fast/canvas/script-tests/canvas-path-constructors.js
LayoutTests/fast/canvas/script-tests/canvas-path-object.js
LayoutTests/fast/canvas/script-tests/canvas-stroke-path.js [new file with mode: 0644]
LayoutTests/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-mountainlion/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.h
Source/WebCore/html/canvas/CanvasRenderingContext2D.idl
Source/WebCore/html/canvas/DOMPath.idl