Title: [141456] trunk
Revision
141456
Author
k...@webkit.org
Date
2013-01-31 11:46:50 -0800 (Thu, 31 Jan 2013)

Log Message

[canvas] Implement currentPath to get and set the current path of the context
https://bugs.webkit.org/show_bug.cgi?id=108246

Patch by Dirk Schulze <k...@webkit.org> on 2013-01-31
Reviewed by Dean Jackson.

Source/WebCore:

Add currentPath attribute to CanvasRenderingContext2d interface. This allows
setting the current context path by an existing Path object as well as getting
the current context path as new Path object. The returned and the set Paths
are not live.

This feature is behind the CANVAS_PATH compiler flag which is disabled by
default for now.

Test: fast/canvas/canvas-currentPath.html

* html/canvas/CanvasPathMethods.cpp: Rename transformIsInvertible to
    isTransformInvertible for harmonizing naming schema.
(WebCore::CanvasPathMethods::moveTo): Ditto.
(WebCore::CanvasPathMethods::lineTo): Ditto.
(WebCore::CanvasPathMethods::quadraticCurveTo): Ditto.
(WebCore::CanvasPathMethods::bezierCurveTo): Ditto.
(WebCore::CanvasPathMethods::arcTo): Ditto.
(WebCore::CanvasPathMethods::arc): Ditto.
(WebCore::CanvasPathMethods::rect): Ditto.
* html/canvas/CanvasPathMethods.h: Ditto.
(CanvasPathMethods):
(WebCore::CanvasPathMethods::isTransformInvertible):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore):
(WebCore::CanvasRenderingContext2D::currentPath): Getter for currentPath.
(WebCore::CanvasRenderingContext2D::setCurrentPath): Setter for currentPath.
* html/canvas/CanvasRenderingContext2D.h:
(WebCore):
(CanvasRenderingContext2D):
(WebCore::CanvasRenderingContext2D::isTransformInvertible):
* html/canvas/CanvasRenderingContext2D.idl: Add currentPath attribute.
* html/canvas/DOMPath.h: Add new constructor and getter for Path object.
(WebCore::DOMPath::create): New static function for new ctor.
(DOMPath):
(WebCore::DOMPath::path): Getter for Path object.
(WebCore::DOMPath::DOMPath):

LayoutTests:

Added tests for canvas.currentPath in various combinations of the context state.

* fast/canvas/canvas-currentPath-expected.txt: Added.
* fast/canvas/canvas-currentPath.html: Added.
* fast/canvas/script-tests/canvas-currentPath.js: Added.
(testPointCollection):
* platform/chromium/TestExpectations: Skip test until enabling CANVAS_PATH.
* platform/efl/TestExpectations: Ditto.
* platform/gtk/TestExpectations: Ditto.
* platform/mac/TestExpectations: Ditto.
* platform/qt/TestExpectations: Ditto.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (141455 => 141456)


--- trunk/LayoutTests/ChangeLog	2013-01-31 19:42:40 UTC (rev 141455)
+++ trunk/LayoutTests/ChangeLog	2013-01-31 19:46:50 UTC (rev 141456)
@@ -1,3 +1,22 @@
+2013-01-31  Dirk Schulze  <k...@webkit.org>
+
+        [canvas] Implement currentPath to get and set the current path of the context
+        https://bugs.webkit.org/show_bug.cgi?id=108246
+
+        Reviewed by Dean Jackson.
+
+        Added tests for canvas.currentPath in various combinations of the context state.
+
+        * fast/canvas/canvas-currentPath-expected.txt: Added.
+        * fast/canvas/canvas-currentPath.html: Added.
+        * fast/canvas/script-tests/canvas-currentPath.js: Added.
+        (testPointCollection):
+        * platform/chromium/TestExpectations: Skip test until enabling CANVAS_PATH.
+        * platform/efl/TestExpectations: Ditto.
+        * platform/gtk/TestExpectations: Ditto.
+        * platform/mac/TestExpectations: Ditto.
+        * platform/qt/TestExpectations: Ditto.
+
 2013-01-31  Tony Chang  <t...@chromium.org>
 
         Unreviewed, update expectation after the order of elements was codified.

Added: trunk/LayoutTests/fast/canvas/canvas-currentPath-expected.txt (0 => 141456)


--- trunk/LayoutTests/fast/canvas/canvas-currentPath-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-currentPath-expected.txt	2013-01-31 19:46:50 UTC (rev 141456)
@@ -0,0 +1,84 @@
+Test the behavior of currentPath in Canvas
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Create path object, replace current context path with the path of this object.
+PASS ctx.isPointInPath(49,49) is false
+PASS ctx.isPointInPath(99,99) is false
+PASS ctx.isPointInPath(149,149) is false
+PASS ctx.isPointInPath(199,199) is false
+PASS ctx.isPointInPath(249,249) is false
+PASS ctx.isPointInPath(49,49) is true
+PASS ctx.isPointInPath(99,99) is true
+PASS ctx.isPointInPath(149,149) is true
+PASS ctx.isPointInPath(199,199) is true
+PASS ctx.isPointInPath(249,249) is false
+
+Add new segment to context path and check that this is not added to the path object (not live).
+PASS ctx.isPointInPath(49,49) is true
+PASS ctx.isPointInPath(99,99) is true
+PASS ctx.isPointInPath(149,149) is true
+PASS ctx.isPointInPath(199,199) is true
+PASS ctx.isPointInPath(249,249) is true
+PASS ctx.isPointInPath(49,49) is true
+PASS ctx.isPointInPath(99,99) is true
+PASS ctx.isPointInPath(149,149) is true
+PASS ctx.isPointInPath(199,199) is true
+PASS ctx.isPointInPath(249,249) is false
+
+Test that path object can get applied to transformed context, respecting the CTM.
+PASS ctx.isPointInPath(49,49) is false
+PASS ctx.isPointInPath(99,99) is false
+PASS ctx.isPointInPath(149,149) is true
+PASS ctx.isPointInPath(199,199) is true
+PASS ctx.isPointInPath(249,249) is true
+
+Test that currentPath returns a path object.
+PASS p is null
+PASS p is an instance of Path
+
+Create context path and test that it exists.
+PASS ctx.isPointInPath(49,49) is true
+PASS ctx.isPointInPath(99,99) is true
+PASS ctx.isPointInPath(149,149) is true
+PASS ctx.isPointInPath(199,199) is true
+PASS ctx.isPointInPath(249,249) is false
+
+Clear context path.
+PASS ctx.isPointInPath(49,49) is false
+PASS ctx.isPointInPath(99,99) is false
+PASS ctx.isPointInPath(149,149) is false
+PASS ctx.isPointInPath(199,199) is false
+PASS ctx.isPointInPath(249,249) is false
+
+Apply stored (non-live) path object back to context.
+PASS ctx.isPointInPath(49,49) is true
+PASS ctx.isPointInPath(99,99) is true
+PASS ctx.isPointInPath(149,149) is true
+PASS ctx.isPointInPath(199,199) is true
+PASS ctx.isPointInPath(249,249) is false
+
+Transform CTM in the process of adding segments to context path. Check that currentPath's path object archive these transformations.
+PASS ctx.isPointInPath(49,49) is true
+PASS ctx.isPointInPath(99,99) is true
+PASS ctx.isPointInPath(149,149) is false
+PASS ctx.isPointInPath(199,199) is true
+PASS ctx.isPointInPath(249,249) is true
+Clear current path on object and check that it is cleaned up.
+PASS ctx.isPointInPath(49,49) is false
+PASS ctx.isPointInPath(99,99) is false
+PASS ctx.isPointInPath(149,149) is false
+PASS ctx.isPointInPath(199,199) is false
+PASS ctx.isPointInPath(249,249) is false
+
+Apply path back to context path.
+PASS ctx.isPointInPath(49,49) is true
+PASS ctx.isPointInPath(99,99) is true
+PASS ctx.isPointInPath(149,149) is false
+PASS ctx.isPointInPath(199,199) is true
+PASS ctx.isPointInPath(249,249) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/canvas/canvas-currentPath.html (0 => 141456)


--- trunk/LayoutTests/fast/canvas/canvas-currentPath.html	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-currentPath.html	2013-01-31 19:46:50 UTC (rev 141456)
@@ -0,0 +1,9 @@
+<!doctype html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
\ No newline at end of file

Added: trunk/LayoutTests/fast/canvas/script-tests/canvas-currentPath.js (0 => 141456)


--- trunk/LayoutTests/fast/canvas/script-tests/canvas-currentPath.js	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-currentPath.js	2013-01-31 19:46:50 UTC (rev 141456)
@@ -0,0 +1,96 @@
+description("Test the behavior of currentPath in Canvas");
+var ctx = document.createElement('canvas').getContext('2d');
+
+var testStrings = [
+    "ctx.isPointInPath(49,49)",
+    "ctx.isPointInPath(99,99)",
+    "ctx.isPointInPath(149,149)",
+    "ctx.isPointInPath(199,199)",
+    "ctx.isPointInPath(249,249)"
+];
+
+// Test collection of points. Each point has an offset of 50,50 to previous point.
+function testPointCollection(hitResults) {
+    for (var i = 0; i < hitResults.length; i++) {
+        if (hitResults[i])
+            shouldBeTrue(testStrings[i]);
+        else
+            shouldBeFalse(testStrings[i]);
+    }
+}
+
+document.body.appendChild(ctx.canvas);
+
+ctx.fillStyle = '#0f0';
+ctx.beginPath();
+
+debug("Create path object, replace current context path with the path of this object.");
+var p = new Path();
+p.rect(0,0,200,200);
+testPointCollection([false, false, false, false, false]);
+
+ctx.currentPath = p;
+
+testPointCollection([true, true, true, true, false]);
+debug("");
+
+debug("Add new segment to context path and check that this is not added to the path object (not live).")
+
+ctx.rect(50,50,200,200);
+testPointCollection([true, true, true, true, true]);
+
+ctx.currentPath = p;
+
+testPointCollection([true, true, true, true, false]);
+debug("");
+
+debug("Test that path object can get applied to transformed context, respecting the CTM.");
+
+ctx.beginPath();
+ctx.translate(100,100);
+ctx.currentPath = p;
+ctx.translate(-100,-100);
+testPointCollection([false, false, true, true, true]);
+
+debug("");
+
+debug("Test that currentPath returns a path object.");
+p = null;
+shouldBeNull("p");
+ctx.beginPath();
+ctx.rect(0,0,200,200);
+p = ctx.currentPath;
+shouldBeType("p", "Path");
+debug("");
+
+debug("Create context path and test that it exists.");
+testPointCollection([true, true, true, true, false]);
+debug("");
+
+debug("Clear context path.");
+ctx.beginPath();
+testPointCollection([false, false, false, false, false]);
+debug("");
+
+debug("Apply stored (non-live) path object back to context.");
+ctx.currentPath = p;
+testPointCollection([true, true, true, true, false]);
+debug("");
+
+debug("Transform CTM in the process of adding segments to context path. Check that currentPath's path object archive these transformations.");
+ctx.beginPath();
+ctx.rect(0,0,100,100);
+ctx.translate(150,150);
+ctx.rect(0,0,100,100);
+ctx.translate(-150,-150);
+testPointCollection([true, true, false, true, true]);
+p = ctx.currentPath;
+
+debug("Clear current path on object and check that it is cleaned up.");
+ctx.beginPath();
+testPointCollection([false, false, false, false, false]);
+debug("");
+
+debug("Apply path back to context path.")
+ctx.currentPath = p;
+testPointCollection([true, true, false, true, true]);

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (141455 => 141456)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2013-01-31 19:42:40 UTC (rev 141455)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2013-01-31 19:46:50 UTC (rev 141456)
@@ -4253,7 +4253,11 @@
 webkit.org/b/107508 platform/chromium/fast/forms/calendar-picker/month-picker-appearance.html [ ImageOnlyFailure Pass ]
 webkit.org/b/107508 platform/chromium/fast/forms/calendar-picker/calendar-picker-appearance-step.html [ ImageOnlyFailure Pass ]
 webkit.org/b/107508 platform/chromium/fast/forms/calendar-picker/calendar-picker-appearance.html [ ImageOnlyFailure Pass ]
-                    
+
+# Rebaseline after currentPath
+webkit.org/b/108246 fast/canvas/canvas-currentPath.html [ Failure ]
+webkit.org/b/108246 platform/chromium/virtual/gpu/fast/canvas/canvas-currentPath.html [ Failure ]
+
 # Broken by Skia flag changes in r139445
 crbug.com/169550 [ Debug ] fast/lists/big-list-marker.html [ Crash ]
 crbug.com/169550 [ Debug ] platform/chromium/virtual/deferred/fast/images/icon-decoding.html [ Crash ]

Modified: trunk/LayoutTests/platform/efl/TestExpectations (141455 => 141456)


--- trunk/LayoutTests/platform/efl/TestExpectations	2013-01-31 19:42:40 UTC (rev 141455)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2013-01-31 19:46:50 UTC (rev 141456)
@@ -1810,6 +1810,9 @@
 inspector/editor/text-editor-formatter.html
 inspector/editor/text-editor-ctrl-movements.html
 
+# Remove from list after enabling CANVAS_PATH
+webkit.org/b/108508 fast/canvas/canvas-currentPath.html [ Failure ]
+
 # Test fails on JSC platforms due to GC timing problems
 webkit.org/b/106957 svg/dom/SVGViewSpec-invalid-ref-crash.html [ Failure ]
 

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (141455 => 141456)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2013-01-31 19:42:40 UTC (rev 141455)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2013-01-31 19:46:50 UTC (rev 141456)
@@ -1369,6 +1369,9 @@
 
 webkit.org/b/103740 editing/selection/caret-alignment-for-vertical-text.html [ Failure ]
 
+# Remove from list after enabling CANVAS_PATH
+webkit.org/b/108508 fast/canvas/canvas-currentPath.html [ Failure ]
+
 # volume is reset when mediaelement.src is modified
 webkit.org/b/103893 media/video-volume.html [ Failure ]
 

Modified: trunk/LayoutTests/platform/mac/TestExpectations (141455 => 141456)


--- trunk/LayoutTests/platform/mac/TestExpectations	2013-01-31 19:42:40 UTC (rev 141455)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2013-01-31 19:46:50 UTC (rev 141456)
@@ -140,6 +140,9 @@
 http/tests/security/cross-origin-worker-indexeddb-allowed.html
 http/tests/security/cross-origin-worker-indexeddb.html
 
+# Remove from list after enabling CANVAS_PATH
+fast/canvas/canvas-currentPath.html
+
 # This port doesn't support DeviceMotion or DeviceOrientation.
 fast/dom/DeviceMotion
 fast/dom/DeviceOrientation

Modified: trunk/LayoutTests/platform/qt/TestExpectations (141455 => 141456)


--- trunk/LayoutTests/platform/qt/TestExpectations	2013-01-31 19:42:40 UTC (rev 141455)
+++ trunk/LayoutTests/platform/qt/TestExpectations	2013-01-31 19:46:50 UTC (rev 141456)
@@ -90,6 +90,9 @@
 # ENABLE_GAMEPAD not enabled.
 gamepad/
 
+# Remove from list after enabling CANVAS_PATH
+fast/canvas/canvas-currentPath.html
+
 # ENABLE(INPUT_SPEECH) is disabled.
 fast/speech
 

Modified: trunk/LayoutTests/platform/win/TestExpectations (141455 => 141456)


--- trunk/LayoutTests/platform/win/TestExpectations	2013-01-31 19:42:40 UTC (rev 141455)
+++ trunk/LayoutTests/platform/win/TestExpectations	2013-01-31 19:46:50 UTC (rev 141456)
@@ -44,6 +44,9 @@
 # Custom filters not yet supported on Windows
 css3/filters/custom
 
+# Remove from list after enabling CANVAS_PATH
+fast/canvas/canvas-currentPath.html
+
 # Needs rebaseline after bug 97217 is fixed
 # https://bugs.webkit.org/show_bug.cgi?id=97325
 css3/masking/clip-path-circle-relative-overflow.html

Modified: trunk/Source/WebCore/ChangeLog (141455 => 141456)


--- trunk/Source/WebCore/ChangeLog	2013-01-31 19:42:40 UTC (rev 141455)
+++ trunk/Source/WebCore/ChangeLog	2013-01-31 19:46:50 UTC (rev 141456)
@@ -1,3 +1,47 @@
+2013-01-31  Dirk Schulze  <k...@webkit.org>
+
+        [canvas] Implement currentPath to get and set the current path of the context
+        https://bugs.webkit.org/show_bug.cgi?id=108246
+
+        Reviewed by Dean Jackson.
+
+        Add currentPath attribute to CanvasRenderingContext2d interface. This allows
+        setting the current context path by an existing Path object as well as getting
+        the current context path as new Path object. The returned and the set Paths
+        are not live.
+
+        This feature is behind the CANVAS_PATH compiler flag which is disabled by
+        default for now.
+
+        Test: fast/canvas/canvas-currentPath.html
+
+        * html/canvas/CanvasPathMethods.cpp: Rename transformIsInvertible to
+            isTransformInvertible for harmonizing naming schema.
+        (WebCore::CanvasPathMethods::moveTo): Ditto.
+        (WebCore::CanvasPathMethods::lineTo): Ditto.
+        (WebCore::CanvasPathMethods::quadraticCurveTo): Ditto.
+        (WebCore::CanvasPathMethods::bezierCurveTo): Ditto.
+        (WebCore::CanvasPathMethods::arcTo): Ditto.
+        (WebCore::CanvasPathMethods::arc): Ditto.
+        (WebCore::CanvasPathMethods::rect): Ditto.
+        * html/canvas/CanvasPathMethods.h: Ditto.
+        (CanvasPathMethods):
+        (WebCore::CanvasPathMethods::isTransformInvertible):
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore):
+        (WebCore::CanvasRenderingContext2D::currentPath): Getter for currentPath.
+        (WebCore::CanvasRenderingContext2D::setCurrentPath): Setter for currentPath.
+        * html/canvas/CanvasRenderingContext2D.h:
+        (WebCore):
+        (CanvasRenderingContext2D):
+        (WebCore::CanvasRenderingContext2D::isTransformInvertible):
+        * html/canvas/CanvasRenderingContext2D.idl: Add currentPath attribute.
+        * html/canvas/DOMPath.h: Add new constructor and getter for Path object.
+        (WebCore::DOMPath::create): New static function for new ctor.
+        (DOMPath):
+        (WebCore::DOMPath::path): Getter for Path object.
+        (WebCore::DOMPath::DOMPath):
+
 2013-01-31  Alexandre Elias  <ael...@chromium.org>
 
         Call FrameView::contentsResized() when setting fixed layout size

Modified: trunk/Source/WebCore/html/canvas/CanvasPathMethods.cpp (141455 => 141456)


--- trunk/Source/WebCore/html/canvas/CanvasPathMethods.cpp	2013-01-31 19:42:40 UTC (rev 141455)
+++ trunk/Source/WebCore/html/canvas/CanvasPathMethods.cpp	2013-01-31 19:46:50 UTC (rev 141456)
@@ -55,7 +55,7 @@
 {
     if (!isfinite(x) || !isfinite(y))
         return;
-    if (!transformIsInvertible())
+    if (!isTransformInvertible())
         return;
     m_path.moveTo(FloatPoint(x, y));
 }
@@ -64,7 +64,7 @@
 {
     if (!isfinite(x) || !isfinite(y))
         return;
-    if (!transformIsInvertible())
+    if (!isTransformInvertible())
         return;
 
     FloatPoint p1 = FloatPoint(x, y);
@@ -78,7 +78,7 @@
 {
     if (!isfinite(cpx) || !isfinite(cpy) || !isfinite(x) || !isfinite(y))
         return;
-    if (!transformIsInvertible())
+    if (!isTransformInvertible())
         return;
     if (!m_path.hasCurrentPoint())
         m_path.moveTo(FloatPoint(cpx, cpy));
@@ -92,7 +92,7 @@
 {
     if (!isfinite(cp1x) || !isfinite(cp1y) || !isfinite(cp2x) || !isfinite(cp2y) || !isfinite(x) || !isfinite(y))
         return;
-    if (!transformIsInvertible())
+    if (!isTransformInvertible())
         return;
     if (!m_path.hasCurrentPoint())
         m_path.moveTo(FloatPoint(cp1x, cp1y));
@@ -113,7 +113,7 @@
         return;
     }
 
-    if (!transformIsInvertible())
+    if (!isTransformInvertible())
         return;
 
     FloatPoint p1 = FloatPoint(x1, y1);
@@ -144,7 +144,7 @@
         return;
     }
 
-    if (!transformIsInvertible())
+    if (!isTransformInvertible())
         return;
 
     // If 'sa' and 'ea' differ by more than 2Pi, just add a circle starting/ending at 'sa'.
@@ -162,7 +162,7 @@
 
 void CanvasPathMethods::rect(float x, float y, float width, float height)
 {
-    if (!transformIsInvertible())
+    if (!isTransformInvertible())
         return;
 
     if (!isfinite(x) || !isfinite(y) || !isfinite(width) || !isfinite(height))

Modified: trunk/Source/WebCore/html/canvas/CanvasPathMethods.h (141455 => 141456)


--- trunk/Source/WebCore/html/canvas/CanvasPathMethods.h	2013-01-31 19:42:40 UTC (rev 141455)
+++ trunk/Source/WebCore/html/canvas/CanvasPathMethods.h	2013-01-31 19:46:50 UTC (rev 141456)
@@ -51,9 +51,9 @@
     void arcTo(float x0, float y0, float x1, float y1, float radius, ExceptionCode&);
     void arc(float x, float y, float r, float sa, float ea, bool anticlockwise, ExceptionCode&);
     void rect(float x, float y, float width, float height);
-    
-    virtual bool transformIsInvertible() { return true; }
 
+    virtual bool isTransformInvertible() const { return true; }
+
 protected:
     CanvasPathMethods() { }
     Path m_path;

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (141455 => 141456)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2013-01-31 19:42:40 UTC (rev 141455)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2013-01-31 19:46:50 UTC (rev 141456)
@@ -42,6 +42,7 @@
 #include "CanvasPattern.h"
 #include "CanvasStyle.h"
 #include "Console.h"
+#include "DOMPath.h"
 #include "ExceptionCode.h"
 #include "FloatConversion.h"
 #include "FloatQuad.h"
@@ -858,6 +859,18 @@
     m_path.clear();
 }
 
+#if ENABLE(CANVAS_PATH)
+PassRefPtr<DOMPath> CanvasRenderingContext2D::currentPath()
+{
+    return DOMPath::create(m_path);
+}
+
+void CanvasRenderingContext2D::setCurrentPath(DOMPath* path)
+{
+    m_path = path->path();
+}
+#endif
+
 static bool validateRectForCanvas(float& x, float& y, float& width, float& height)
 {
     if (!isfinite(x) | !isfinite(y) | !isfinite(width) | !isfinite(height))

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h (141455 => 141456)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h	2013-01-31 19:42:40 UTC (rev 141455)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h	2013-01-31 19:46:50 UTC (rev 141456)
@@ -49,6 +49,9 @@
 class CanvasGradient;
 class CanvasPattern;
 class CanvasStyle;
+#if ENABLE(CANVAS_PATH)
+class DOMPath;
+#endif
 class FloatRect;
 class GraphicsContext;
 class HTMLCanvasElement;
@@ -137,6 +140,10 @@
 
     void beginPath();
 
+#if ENABLE(CANVAS_PATH)
+    PassRefPtr<DOMPath> currentPath();
+    void setCurrentPath(DOMPath*);
+#endif
     void fill(const String& winding = "nonzero");
     void stroke();
     void clip(const String& winding = "nonzero");
@@ -324,7 +331,7 @@
     virtual bool is2d() const OVERRIDE { return true; }
     virtual bool isAccelerated() const OVERRIDE;
 
-    virtual bool transformIsInvertible() { return state().m_invertibleCTM; }
+    virtual bool isTransformInvertible() const { return state().m_invertibleCTM; }
 
 #if ENABLE(ACCELERATED_2D_CANVAS) && USE(ACCELERATED_COMPOSITING)
     virtual PlatformLayer* platformLayer() const OVERRIDE;

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl (141455 => 141456)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl	2013-01-31 19:42:40 UTC (rev 141455)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl	2013-01-31 19:46:50 UTC (rev 141456)
@@ -96,6 +96,10 @@
 
     void beginPath();
 
+#if defined(ENABLE_CANVAS_PATH) && ENABLE_CANVAS_PATH
+    attribute DOMPath currentPath;
+#endif
+
     // FIXME: These methods should be shared with CanvasRenderingContext2D in the CanvasPathMethods interface.
     void closePath();
     void moveTo(in [Optional=DefaultIsUndefined] float x,

Modified: trunk/Source/WebCore/html/canvas/DOMPath.h (141455 => 141456)


--- trunk/Source/WebCore/html/canvas/DOMPath.h	2013-01-31 19:42:40 UTC (rev 141455)
+++ trunk/Source/WebCore/html/canvas/DOMPath.h	2013-01-31 19:46:50 UTC (rev 141456)
@@ -39,9 +39,18 @@
     WTF_MAKE_NONCOPYABLE(DOMPath); WTF_MAKE_FAST_ALLOCATED;
 public:
     static PassRefPtr<DOMPath> create() { return adoptRef(new DOMPath); }
+    static PassRefPtr<DOMPath> create(const Path& path) { return adoptRef(new DOMPath(path)); }
+
+    const Path& path() const { return m_path; }
+
     virtual ~DOMPath() { }
 private:
     DOMPath() : CanvasPathMethods() { }
+    DOMPath(const Path& path)
+        : CanvasPathMethods()
+    {
+        m_path = path;
+    }
 };
 }
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to