Implement Canvas Path object
authorkrit@webkit.org <krit@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2013 23:03:30 +0000 (23:03 +0000)
committerkrit@webkit.org <krit@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2013 23:03:30 +0000 (23:03 +0000)
commitb2ce94f65c9b85393328f44fbd489cebf7b32187
tree0bed2c2dc31c0d9958ed1cdec69aed35b21d144d
parenta36989dc3b11c843262c8eca68910a367614eeff
Implement Canvas Path object
https://bugs.webkit.org/show_bug.cgi?id=97333

Reviewed by Dean Jackson.

Source/WebCore:

The Canvas part of the WHATWG specification defines a Path object. This Path object
shares several path segment functions (path methods) with the CanvasRenderingContext2D
interface. This patch introduces the Path object and shares the path segment functions
in the class CanvasPathMethods.
This patch does just implement the basic path functions that have a general agreement on
the WHAT WG and W3C mailing lists.
This feature is behind a flag and won't be activated by default.

http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#path-objects

Test: fast/canvas/canvas-path-object.html

* CMakeLists.txt: Add DOMPath and CanvasPathMedthods to build system.
* DerivedSources.cpp: Ditto.
* DerivedSources.make: Ditto.
* DerivedSources.pri: Ditto.
* GNUmakefile.list.am: Ditto.
* Target.pri: Ditto.
* WebCore.gypi: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* html/canvas/CanvasPathMethods.cpp: Added.
(WebCore): This class shares the path segment functions (moveTo, lineTo, ...) between
    DOMPath (the Path object) and CanvasRenderingContext2D.
(WebCore::CanvasPathMethods::closePath):
(WebCore::CanvasPathMethods::moveTo):
(WebCore::CanvasPathMethods::lineTo):
(WebCore::CanvasPathMethods::quadraticCurveTo):
(WebCore::CanvasPathMethods::bezierCurveTo):
(WebCore::CanvasPathMethods::arcTo):
(WebCore::CanvasPathMethods::arc):
(WebCore::CanvasPathMethods::rect):
* html/canvas/CanvasPathMethods.h: Added.
(WebCore):
(CanvasPathMethods):
(WebCore::CanvasPathMethods::~CanvasPathMethods):
(WebCore::CanvasPathMethods::transformIsInvertible):
(WebCore::CanvasPathMethods::CanvasPathMethods):
* html/canvas/CanvasRenderingContext2D.cpp:
* html/canvas/CanvasRenderingContext2D.h: Remove the path segment functions here.
(CanvasRenderingContext2D):
(WebCore::CanvasRenderingContext2D::transformIsInvertible): This checks if the CTM
    of the context is still invertible. Drawing should stop if it is not.
* html/canvas/CanvasRenderingContext2D.idl:
* html/canvas/DOMPath.h: Added.
(WebCore):
(DOMPath):
(WebCore::DOMPath::create):
(WebCore::DOMPath::~DOMPath):
(WebCore::DOMPath::DOMPath):
* html/canvas/DOMPath.idl: Added.
* page/DOMWindow.idl: Added CTOR for Path.

LayoutTests:

Add a test for checking existence of Path object and dependent functions.
The test is supposed to fail if canvas-path is not activated on compile time.

* fast/canvas/canvas-path-object-expected.txt: Added.
* fast/canvas/canvas-path-object.html: Added.
* fast/canvas/script-tests/canvas-path-object.js: Added.
* platform/chromium/TestExpectations: Different error handling on Chromium. Needs rebaseline.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140604 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/canvas/canvas-path-object-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-path-object.html [new file with mode: 0644]
LayoutTests/fast/canvas/script-tests/canvas-path-object.js [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/DerivedSources.pri
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/canvas/CanvasPathMethods.cpp [new file with mode: 0644]
Source/WebCore/html/canvas/CanvasPathMethods.h [new file with mode: 0644]
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2D.h
Source/WebCore/html/canvas/CanvasRenderingContext2D.idl
Source/WebCore/html/canvas/DOMPath.h [new file with mode: 0644]
Source/WebCore/html/canvas/DOMPath.idl [new file with mode: 0644]
Source/WebCore/page/DOMWindow.idl