Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (204668 => 204669)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-08-20 00:11:17 UTC (rev 204668)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-08-20 00:45:30 UTC (rev 204669)
@@ -1,5 +1,16 @@
2016-08-19 Chris Dumez <[email protected]>
+ Mark CanvasPath operations' parameters as mandatory when they should be
+ https://bugs.webkit.org/show_bug.cgi?id=161014
+
+ Reviewed by Sam Weinig.
+
+ Rebaseline W3C test now that more checks are passing.
+
+ * web-platform-tests/html/dom/interfaces-expected.txt:
+
+2016-08-19 Chris Dumez <[email protected]>
+
Re-sync html/dom/interfaces.html web-platform-test from upstream
https://bugs.webkit.org/show_bug.cgi?id=161012
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (204668 => 204669)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt 2016-08-20 00:11:17 UTC (rev 204668)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt 2016-08-20 00:45:30 UTC (rev 204669)
@@ -5041,14 +5041,14 @@
PASS Path2D interface: existence and properties of interface prototype object's "constructor" property
PASS Path2D interface: operation addPath(Path2D,DOMMatrixInit)
PASS Path2D interface: operation closePath()
-FAIL Path2D interface: operation moveTo(unrestricted double,unrestricted double) assert_equals: property has wrong .length expected 2 but got 0
-FAIL Path2D interface: operation lineTo(unrestricted double,unrestricted double) assert_equals: property has wrong .length expected 2 but got 0
-FAIL Path2D interface: operation quadraticCurveTo(unrestricted double,unrestricted double,unrestricted double,unrestricted double) assert_equals: property has wrong .length expected 4 but got 0
-FAIL Path2D interface: operation bezierCurveTo(unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double) assert_equals: property has wrong .length expected 6 but got 0
-FAIL Path2D interface: operation arcTo(unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double) assert_equals: property has wrong .length expected 5 but got 0
-FAIL Path2D interface: operation arcTo(unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double) assert_equals: property has wrong .length expected 5 but got 0
-FAIL Path2D interface: operation rect(unrestricted double,unrestricted double,unrestricted double,unrestricted double) assert_equals: property has wrong .length expected 4 but got 0
-FAIL Path2D interface: operation arc(unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double,boolean) assert_equals: property has wrong .length expected 5 but got 0
+PASS Path2D interface: operation moveTo(unrestricted double,unrestricted double)
+PASS Path2D interface: operation lineTo(unrestricted double,unrestricted double)
+PASS Path2D interface: operation quadraticCurveTo(unrestricted double,unrestricted double,unrestricted double,unrestricted double)
+PASS Path2D interface: operation bezierCurveTo(unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double)
+PASS Path2D interface: operation arcTo(unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double)
+PASS Path2D interface: operation arcTo(unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double)
+PASS Path2D interface: operation rect(unrestricted double,unrestricted double,unrestricted double,unrestricted double)
+PASS Path2D interface: operation arc(unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double,boolean)
PASS Path2D interface: operation ellipse(unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double,boolean)
PASS DataTransfer interface: existence and properties of interface object
PASS DataTransfer interface object length
Modified: trunk/Source/WebCore/CMakeLists.txt (204668 => 204669)
--- trunk/Source/WebCore/CMakeLists.txt 2016-08-20 00:11:17 UTC (rev 204668)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-08-20 00:45:30 UTC (rev 204669)
@@ -541,6 +541,7 @@
html/canvas/ANGLEInstancedArrays.idl
html/canvas/CanvasGradient.idl
+ html/canvas/CanvasPath.idl
html/canvas/CanvasPattern.idl
html/canvas/CanvasProxy.idl
html/canvas/CanvasRenderingContext.idl
@@ -1792,7 +1793,7 @@
html/canvas/ANGLEInstancedArrays.cpp
html/canvas/CanvasContextAttributes.cpp
html/canvas/CanvasGradient.cpp
- html/canvas/CanvasPathMethods.cpp
+ html/canvas/CanvasPath.cpp
html/canvas/CanvasPattern.cpp
html/canvas/CanvasProxy.cpp
html/canvas/CanvasRenderingContext.cpp
Modified: trunk/Source/WebCore/ChangeLog (204668 => 204669)
--- trunk/Source/WebCore/ChangeLog 2016-08-20 00:11:17 UTC (rev 204668)
+++ trunk/Source/WebCore/ChangeLog 2016-08-20 00:45:30 UTC (rev 204669)
@@ -1,3 +1,48 @@
+2016-08-19 Chris Dumez <[email protected]>
+
+ Mark CanvasPath operations' parameters as mandatory when they should be
+ https://bugs.webkit.org/show_bug.cgi?id=161014
+
+ Reviewed by Sam Weinig.
+
+ Mark CanvasPath operations as mandatory when they should be:
+ - https://html.spec.whatwg.org/multipage/scripting.html#canvaspath
+
+ This patch moves the CanvasPath methods from CanvasRenderingContext2D
+ and Path2D to a new CanvasPath interface, to avoid duplication and
+ match the specification.
+
+ The parameters were correctly marked as mandatory in WebKit on
+ CanvasRenderingContext2D but not on Path2D.
+
+ Those parameters are correctly marked as mandatory in Chrome and Firefox.
+
+ No new tests, rebaselined existing test.
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/canvas/CanvasPath.cpp: Renamed from Source/WebCore/html/canvas/CanvasPathMethods.cpp.
+ (WebCore::CanvasPath::closePath):
+ (WebCore::CanvasPath::moveTo):
+ (WebCore::CanvasPath::lineTo):
+ (WebCore::CanvasPath::quadraticCurveTo):
+ (WebCore::CanvasPath::bezierCurveTo):
+ (WebCore::CanvasPath::arcTo):
+ (WebCore::normalizeAngles):
+ (WebCore::CanvasPath::arc):
+ (WebCore::CanvasPath::ellipse):
+ (WebCore::CanvasPath::rect):
+ * html/canvas/CanvasPath.h: Renamed from Source/WebCore/html/canvas/CanvasPathMethods.h.
+ (WebCore::CanvasPath::~CanvasPath):
+ (WebCore::CanvasPath::CanvasPath):
+ (WebCore::CanvasPath::hasInvertibleTransform):
+ * html/canvas/CanvasPath.idl: Added.
+ * html/canvas/CanvasRenderingContext2D.h:
+ * html/canvas/CanvasRenderingContext2D.idl:
+ * html/canvas/DOMPath.h:
+ * html/canvas/DOMPath.idl:
+
2016-08-19 Zalan Bujtas <[email protected]>
RenderObject::containingBlock() cleanup.
Modified: trunk/Source/WebCore/DerivedSources.make (204668 => 204669)
--- trunk/Source/WebCore/DerivedSources.make 2016-08-20 00:11:17 UTC (rev 204668)
+++ trunk/Source/WebCore/DerivedSources.make 2016-08-20 00:45:30 UTC (rev 204669)
@@ -450,6 +450,7 @@
$(WebCore)/html/VoidCallback.idl \
$(WebCore)/html/canvas/ANGLEInstancedArrays.idl \
$(WebCore)/html/canvas/CanvasGradient.idl \
+ $(WebCore)/html/canvas/CanvasPath.idl \
$(WebCore)/html/canvas/CanvasPattern.idl \
$(WebCore)/html/canvas/CanvasProxy.idl \
$(WebCore)/html/canvas/CanvasRenderingContext.idl \
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (204668 => 204669)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-08-20 00:11:17 UTC (rev 204668)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-08-20 00:45:30 UTC (rev 204669)
@@ -1812,6 +1812,8 @@
463EB6231B8789E00096ED51 /* TagCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 463EB6211B8789CB0096ED51 /* TagCollection.h */; };
465A8E791C8A24CE00E7D3E4 /* RuntimeApplicationChecks.mm in Sources */ = {isa = PBXBuildFile; fileRef = 465A8E781C8A24CE00E7D3E4 /* RuntimeApplicationChecks.mm */; };
4669B2871B852A0B000F905F /* JSDOMNamedFlowCollectionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46F2768E1B85297F005C2556 /* JSDOMNamedFlowCollectionCustom.cpp */; };
+ 4671E0651D67A59600C6B497 /* CanvasPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4671E0631D67A57B00C6B497 /* CanvasPath.cpp */; };
+ 4671E0661D67A59600C6B497 /* CanvasPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 4671E0641D67A57B00C6B497 /* CanvasPath.h */; };
467302021C4EFE7800BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h in Headers */ = {isa = PBXBuildFile; fileRef = 467302011C4EFE6600BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h */; };
4689F1AF1267BAE100E8D380 /* FileMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 4689F1AE1267BAE100E8D380 /* FileMetadata.h */; };
46A58AC51D46B3FA00432036 /* JSClientRectCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A58AC41D46B3FA00432036 /* JSClientRectCustom.cpp */; };
@@ -6728,8 +6730,6 @@
FB484F4D171F821E00040755 /* TransformFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = FB484F4B171F821E00040755 /* TransformFunctions.h */; };
FB78AD2E151BF5E600FE54D3 /* CSSParserMode.h in Headers */ = {isa = PBXBuildFile; fileRef = FB78AD2C151BF5D200FE54D3 /* CSSParserMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
FB91392416AE4C17001FE682 /* DOMPath.h in Headers */ = {isa = PBXBuildFile; fileRef = FB91392016AE4B0B001FE682 /* DOMPath.h */; };
- FB91392616AE4C2F001FE682 /* CanvasPathMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = FB91391F16AE4B0B001FE682 /* CanvasPathMethods.h */; };
- FB91392716AE4C34001FE682 /* CanvasPathMethods.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB91391E16AE4B0B001FE682 /* CanvasPathMethods.cpp */; };
FB91392A16AE4FC0001FE682 /* JSDOMPath.h in Headers */ = {isa = PBXBuildFile; fileRef = FB91392816AE4FC0001FE682 /* JSDOMPath.h */; };
FB91392B16AE4FC0001FE682 /* JSDOMPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB91392916AE4FC0001FE682 /* JSDOMPath.cpp */; };
FB92DF4B15FED08700994433 /* ClipPathOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = FB92DF4915FED08700994433 /* ClipPathOperation.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9133,6 +9133,8 @@
463EB6201B8789CB0096ED51 /* TagCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagCollection.cpp; sourceTree = "<group>"; };
463EB6211B8789CB0096ED51 /* TagCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagCollection.h; sourceTree = "<group>"; };
465A8E781C8A24CE00E7D3E4 /* RuntimeApplicationChecks.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RuntimeApplicationChecks.mm; sourceTree = "<group>"; };
+ 4671E0631D67A57B00C6B497 /* CanvasPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasPath.cpp; sourceTree = "<group>"; };
+ 4671E0641D67A57B00C6B497 /* CanvasPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasPath.h; sourceTree = "<group>"; };
467302011C4EFE6600BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IgnoreOpensDuringUnloadCountIncrementer.h; sourceTree = "<group>"; };
4689F1AE1267BAE100E8D380 /* FileMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMetadata.h; sourceTree = "<group>"; };
46A58AC41D46B3FA00432036 /* JSClientRectCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSClientRectCustom.cpp; sourceTree = "<group>"; };
@@ -14707,8 +14709,6 @@
FB484F4A171F821E00040755 /* TransformFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TransformFunctions.cpp; sourceTree = "<group>"; };
FB484F4B171F821E00040755 /* TransformFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TransformFunctions.h; sourceTree = "<group>"; };
FB78AD2C151BF5D200FE54D3 /* CSSParserMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSParserMode.h; sourceTree = "<group>"; };
- FB91391E16AE4B0B001FE682 /* CanvasPathMethods.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasPathMethods.cpp; sourceTree = "<group>"; };
- FB91391F16AE4B0B001FE682 /* CanvasPathMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasPathMethods.h; sourceTree = "<group>"; };
FB91392016AE4B0B001FE682 /* DOMPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMPath.h; sourceTree = "<group>"; };
FB91392116AE4B0B001FE682 /* DOMPath.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMPath.idl; sourceTree = "<group>"; };
FB91392816AE4FC0001FE682 /* JSDOMPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMPath.h; sourceTree = "<group>"; };
@@ -17145,8 +17145,8 @@
49484FB3102CF23C00187DD3 /* CanvasGradient.cpp */,
49484FB4102CF23C00187DD3 /* CanvasGradient.h */,
49484FB5102CF23C00187DD3 /* CanvasGradient.idl */,
- FB91391E16AE4B0B001FE682 /* CanvasPathMethods.cpp */,
- FB91391F16AE4B0B001FE682 /* CanvasPathMethods.h */,
+ 4671E0631D67A57B00C6B497 /* CanvasPath.cpp */,
+ 4671E0641D67A57B00C6B497 /* CanvasPath.h */,
49484FB6102CF23C00187DD3 /* CanvasPattern.cpp */,
49484FB7102CF23C00187DD3 /* CanvasPattern.h */,
49484FB8102CF23C00187DD3 /* CanvasPattern.idl */,
@@ -24984,7 +24984,6 @@
B1D5ECB5134B58DA0087C78F /* CallbackFunction.h in Headers */,
6E4E91AD10F7FB3100A2779C /* CanvasContextAttributes.h in Headers */,
49484FC2102CF23C00187DD3 /* CanvasGradient.h in Headers */,
- FB91392616AE4C2F001FE682 /* CanvasPathMethods.h in Headers */,
49484FC5102CF23C00187DD3 /* CanvasPattern.h in Headers */,
49484FC5102CF23C00188DD3 /* CanvasProxy.h in Headers */,
49C7B9DD1042D32F0009D447 /* CanvasRenderingContext.h in Headers */,
@@ -28059,6 +28058,7 @@
1AF89A421518FDEA00E547B5 /* TiledBacking.h in Headers */,
7AA3A69C194A64E7001CBD24 /* TileGrid.h in Headers */,
498770F31242C535002226BA /* TilingData.h in Headers */,
+ 4671E0661D67A59600C6B497 /* CanvasPath.h in Headers */,
F55B3DDC1251F12D003EF269 /* TimeInputType.h in Headers */,
7553CFE8108F473F00EA281E /* TimelineRecordFactory.h in Headers */,
9305B24D098F1B6B00C28855 /* Timer.h in Headers */,
@@ -28865,7 +28865,6 @@
B1827493134CA4C100B98C2D /* CallbackFunction.cpp in Sources */,
6E4E91AC10F7FB3100A2779C /* CanvasContextAttributes.cpp in Sources */,
49484FC1102CF23C00187DD3 /* CanvasGradient.cpp in Sources */,
- FB91392716AE4C34001FE682 /* CanvasPathMethods.cpp in Sources */,
49484FC4102CF23C00187DD3 /* CanvasPattern.cpp in Sources */,
49C7B9DC1042D32F0009D447 /* CanvasRenderingContext.cpp in Sources */,
49484FCA102CF23C00187DD3 /* CanvasRenderingContext2D.cpp in Sources */,
@@ -29697,6 +29696,7 @@
5185FC901BB4C4E80012898F /* IDBIndex.cpp in Sources */,
51F798EF1BE880E7008AE491 /* IDBIndexInfo.cpp in Sources */,
5185FC941BB4C4E80012898F /* IDBKey.cpp in Sources */,
+ 4671E0651D67A59600C6B497 /* CanvasPath.cpp in Sources */,
5185FC961BB4C4E80012898F /* IDBKeyData.cpp in Sources */,
5185FC981BB4C4E80012898F /* IDBKeyPath.cpp in Sources */,
5185FC9A1BB4C4E80012898F /* IDBKeyRange.cpp in Sources */,
Copied: trunk/Source/WebCore/html/canvas/CanvasPath.cpp (from rev 204668, trunk/Source/WebCore/html/canvas/CanvasPathMethods.cpp) (0 => 204669)
--- trunk/Source/WebCore/html/canvas/CanvasPath.cpp (rev 0)
+++ trunk/Source/WebCore/html/canvas/CanvasPath.cpp 2016-08-20 00:45:30 UTC (rev 204669)
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2007 Alp Toker <[email protected]>
+ * Copyright (C) 2008 Eric Seidel <[email protected]>
+ * Copyright (C) 2008 Dirk Schulze <[email protected]>
+ * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CanvasPath.h"
+
+#include "AffineTransform.h"
+#include "ExceptionCode.h"
+#include "FloatRect.h"
+#include <wtf/MathExtras.h>
+
+namespace WebCore {
+
+void CanvasPath::closePath()
+{
+ if (m_path.isEmpty())
+ return;
+
+ FloatRect boundRect = m_path.fastBoundingRect();
+ if (boundRect.width() || boundRect.height())
+ m_path.closeSubpath();
+}
+
+void CanvasPath::moveTo(float x, float y)
+{
+ if (!std::isfinite(x) || !std::isfinite(y))
+ return;
+ if (!hasInvertibleTransform())
+ return;
+ m_path.moveTo(FloatPoint(x, y));
+}
+
+void CanvasPath::lineTo(FloatPoint point)
+{
+ lineTo(point.x(), point.y());
+}
+
+void CanvasPath::lineTo(float x, float y)
+{
+ if (!std::isfinite(x) || !std::isfinite(y))
+ return;
+ if (!hasInvertibleTransform())
+ return;
+
+ FloatPoint p1 = FloatPoint(x, y);
+ if (!m_path.hasCurrentPoint())
+ m_path.moveTo(p1);
+ else if (p1 != m_path.currentPoint())
+ m_path.addLineTo(p1);
+}
+
+void CanvasPath::quadraticCurveTo(float cpx, float cpy, float x, float y)
+{
+ if (!std::isfinite(cpx) || !std::isfinite(cpy) || !std::isfinite(x) || !std::isfinite(y))
+ return;
+ if (!hasInvertibleTransform())
+ return;
+ if (!m_path.hasCurrentPoint())
+ m_path.moveTo(FloatPoint(cpx, cpy));
+
+ FloatPoint p1 = FloatPoint(x, y);
+ FloatPoint cp = FloatPoint(cpx, cpy);
+ if (p1 != m_path.currentPoint() || p1 != cp)
+ m_path.addQuadCurveTo(cp, p1);
+}
+
+void CanvasPath::bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y)
+{
+ if (!std::isfinite(cp1x) || !std::isfinite(cp1y) || !std::isfinite(cp2x) || !std::isfinite(cp2y) || !std::isfinite(x) || !std::isfinite(y))
+ return;
+ if (!hasInvertibleTransform())
+ return;
+ if (!m_path.hasCurrentPoint())
+ m_path.moveTo(FloatPoint(cp1x, cp1y));
+
+ FloatPoint p1 = FloatPoint(x, y);
+ FloatPoint cp1 = FloatPoint(cp1x, cp1y);
+ FloatPoint cp2 = FloatPoint(cp2x, cp2y);
+ if (p1 != m_path.currentPoint() || p1 != cp1 || p1 != cp2)
+ m_path.addBezierCurveTo(cp1, cp2, p1);
+}
+
+void CanvasPath::arcTo(float x1, float y1, float x2, float y2, float r, ExceptionCode& ec)
+{
+ ec = 0;
+ if (!std::isfinite(x1) || !std::isfinite(y1) || !std::isfinite(x2) || !std::isfinite(y2) || !std::isfinite(r))
+ return;
+
+ if (r < 0) {
+ ec = INDEX_SIZE_ERR;
+ return;
+ }
+
+ if (!hasInvertibleTransform())
+ return;
+
+ FloatPoint p1 = FloatPoint(x1, y1);
+ FloatPoint p2 = FloatPoint(x2, y2);
+
+ if (!m_path.hasCurrentPoint())
+ m_path.moveTo(p1);
+ else if (p1 == m_path.currentPoint() || p1 == p2 || !r)
+ lineTo(x1, y1);
+ else
+ m_path.addArcTo(p1, p2, r);
+}
+
+static void normalizeAngles(float& startAngle, float& endAngle, bool anticlockwise)
+{
+ float newStartAngle = startAngle;
+ if (newStartAngle < 0)
+ newStartAngle = (2 * piFloat) + fmodf(newStartAngle, -(2 * piFloat));
+ else
+ newStartAngle = fmodf(newStartAngle, 2 * piFloat);
+
+ float delta = newStartAngle - startAngle;
+ startAngle = newStartAngle;
+ endAngle = endAngle + delta;
+ ASSERT(newStartAngle >= 0 && newStartAngle < 2 * piFloat);
+
+ if (anticlockwise && startAngle - endAngle >= 2 * piFloat)
+ endAngle = startAngle - 2 * piFloat;
+ else if (!anticlockwise && endAngle - startAngle >= 2 * piFloat)
+ endAngle = startAngle + 2 * piFloat;
+}
+
+void CanvasPath::arc(float x, float y, float radius, float startAngle, float endAngle, bool anticlockwise, ExceptionCode& ec)
+{
+ if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(radius) || !std::isfinite(startAngle) || !std::isfinite(endAngle))
+ return;
+
+ if (radius < 0) {
+ ec = INDEX_SIZE_ERR;
+ return;
+ }
+
+ if (!hasInvertibleTransform())
+ return;
+
+ normalizeAngles(startAngle, endAngle, anticlockwise);
+
+ if (!radius || startAngle == endAngle) {
+ // The arc is empty but we still need to draw the connecting line.
+ lineTo(x + radius * cosf(startAngle), y + radius * sinf(startAngle));
+ return;
+ }
+
+ m_path.addArc(FloatPoint(x, y), radius, startAngle, endAngle, anticlockwise);
+}
+
+void CanvasPath::ellipse(float x, float y, float radiusX, float radiusY, float rotation, float startAngle, float endAngle, bool anticlockwise, ExceptionCode& ec)
+{
+ if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(radiusX) || !std::isfinite(radiusY) || !std::isfinite(rotation) || !std::isfinite(startAngle) || !std::isfinite(endAngle))
+ return;
+
+ if (radiusX < 0 || radiusY < 0) {
+ ec = INDEX_SIZE_ERR;
+ return;
+ }
+
+ if (!hasInvertibleTransform())
+ return;
+
+ normalizeAngles(startAngle, endAngle, anticlockwise);
+
+ if ((!radiusX && !radiusY) || startAngle == endAngle) {
+ AffineTransform transform;
+ transform.translate(x, y).rotate(rad2deg(rotation));
+
+ lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(startAngle), radiusY * sinf(startAngle))));
+ return;
+ }
+
+ if (!radiusX || !radiusY) {
+ AffineTransform transform;
+ transform.translate(x, y).rotate(rad2deg(rotation));
+
+ lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(startAngle), radiusY * sinf(startAngle))));
+
+ if (!anticlockwise) {
+ for (float angle = startAngle - fmodf(startAngle, piOverTwoFloat) + piOverTwoFloat; angle < endAngle; angle += piOverTwoFloat)
+ lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(angle), radiusY * sinf(angle))));
+ } else {
+ for (float angle = startAngle - fmodf(startAngle, piOverTwoFloat); angle > endAngle; angle -= piOverTwoFloat)
+ lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(angle), radiusY * sinf(angle))));
+ }
+
+ lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(endAngle), radiusY * sinf(endAngle))));
+ return;
+ }
+
+ m_path.addEllipse(FloatPoint(x, y), radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
+}
+
+void CanvasPath::rect(float x, float y, float width, float height)
+{
+ if (!hasInvertibleTransform())
+ return;
+
+ if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(width) || !std::isfinite(height))
+ return;
+
+ if (!width && !height) {
+ m_path.moveTo(FloatPoint(x, y));
+ return;
+ }
+
+ m_path.addRect(FloatRect(x, y, width, height));
+}
+}
Copied: trunk/Source/WebCore/html/canvas/CanvasPath.h (from rev 204668, trunk/Source/WebCore/html/canvas/CanvasPathMethods.h) (0 => 204669)
--- trunk/Source/WebCore/html/canvas/CanvasPath.h (rev 0)
+++ trunk/Source/WebCore/html/canvas/CanvasPath.h 2016-08-20 00:45:30 UTC (rev 204669)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "Path.h"
+
+namespace WebCore {
+
+class FloatRect;
+
+typedef int ExceptionCode;
+
+class CanvasPath {
+public:
+ virtual ~CanvasPath() { }
+
+ void closePath();
+ void moveTo(float x, float y);
+ void lineTo(float x, float y);
+ void quadraticCurveTo(float cpx, float cpy, float x, float y);
+ void bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y);
+ 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 ellipse(float x, float y, float radiusX, float radiusY, float rotation, float startAngle, float endAngled, bool anticlockwise, ExceptionCode&);
+ void rect(float x, float y, float width, float height);
+
+protected:
+ CanvasPath() { }
+ CanvasPath(const Path& path)
+ : m_path(path)
+ { }
+
+ virtual bool hasInvertibleTransform() const { return true; }
+
+ void lineTo(FloatPoint);
+
+ Path m_path;
+};
+
+}
Added: trunk/Source/WebCore/html/canvas/CanvasPath.idl (0 => 204669)
--- trunk/Source/WebCore/html/canvas/CanvasPath.idl (rev 0)
+++ trunk/Source/WebCore/html/canvas/CanvasPath.idl 2016-08-20 00:45:30 UTC (rev 204669)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+[
+ NoInterfaceObject
+] interface CanvasPath {
+ void closePath();
+ void moveTo(unrestricted double x, unrestricted double y);
+ void lineTo(unrestricted double x, unrestricted double y);
+ void quadraticCurveTo(unrestricted double cpx, unrestricted double cpy, unrestricted double x, unrestricted double y);
+ void bezierCurveTo(unrestricted double cp1x, unrestricted double cp1y, unrestricted double cp2x, unrestricted double cp2y, unrestricted double x, unrestricted double y);
+ [RaisesException] void arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radius);
+ // [RaisesException] void arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation);
+ void rect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
+ [RaisesException] void arc(unrestricted double x, unrestricted double y, unrestricted double radius, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
+ [RaisesException] void ellipse(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
+};
Deleted: trunk/Source/WebCore/html/canvas/CanvasPathMethods.cpp (204668 => 204669)
--- trunk/Source/WebCore/html/canvas/CanvasPathMethods.cpp 2016-08-20 00:11:17 UTC (rev 204668)
+++ trunk/Source/WebCore/html/canvas/CanvasPathMethods.cpp 2016-08-20 00:45:30 UTC (rev 204669)
@@ -1,241 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
- * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2007 Alp Toker <[email protected]>
- * Copyright (C) 2008 Eric Seidel <[email protected]>
- * Copyright (C) 2008 Dirk Schulze <[email protected]>
- * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
- * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "CanvasPathMethods.h"
-
-#include "AffineTransform.h"
-#include "ExceptionCode.h"
-#include "FloatRect.h"
-#include <wtf/MathExtras.h>
-
-namespace WebCore {
-
-void CanvasPathMethods::closePath()
-{
- if (m_path.isEmpty())
- return;
-
- FloatRect boundRect = m_path.fastBoundingRect();
- if (boundRect.width() || boundRect.height())
- m_path.closeSubpath();
-}
-
-void CanvasPathMethods::moveTo(float x, float y)
-{
- if (!std::isfinite(x) || !std::isfinite(y))
- return;
- if (!hasInvertibleTransform())
- return;
- m_path.moveTo(FloatPoint(x, y));
-}
-
-void CanvasPathMethods::lineTo(FloatPoint point)
-{
- lineTo(point.x(), point.y());
-}
-
-void CanvasPathMethods::lineTo(float x, float y)
-{
- if (!std::isfinite(x) || !std::isfinite(y))
- return;
- if (!hasInvertibleTransform())
- return;
-
- FloatPoint p1 = FloatPoint(x, y);
- if (!m_path.hasCurrentPoint())
- m_path.moveTo(p1);
- else if (p1 != m_path.currentPoint())
- m_path.addLineTo(p1);
-}
-
-void CanvasPathMethods::quadraticCurveTo(float cpx, float cpy, float x, float y)
-{
- if (!std::isfinite(cpx) || !std::isfinite(cpy) || !std::isfinite(x) || !std::isfinite(y))
- return;
- if (!hasInvertibleTransform())
- return;
- if (!m_path.hasCurrentPoint())
- m_path.moveTo(FloatPoint(cpx, cpy));
-
- FloatPoint p1 = FloatPoint(x, y);
- FloatPoint cp = FloatPoint(cpx, cpy);
- if (p1 != m_path.currentPoint() || p1 != cp)
- m_path.addQuadCurveTo(cp, p1);
-}
-
-void CanvasPathMethods::bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y)
-{
- if (!std::isfinite(cp1x) || !std::isfinite(cp1y) || !std::isfinite(cp2x) || !std::isfinite(cp2y) || !std::isfinite(x) || !std::isfinite(y))
- return;
- if (!hasInvertibleTransform())
- return;
- if (!m_path.hasCurrentPoint())
- m_path.moveTo(FloatPoint(cp1x, cp1y));
-
- FloatPoint p1 = FloatPoint(x, y);
- FloatPoint cp1 = FloatPoint(cp1x, cp1y);
- FloatPoint cp2 = FloatPoint(cp2x, cp2y);
- if (p1 != m_path.currentPoint() || p1 != cp1 || p1 != cp2)
- m_path.addBezierCurveTo(cp1, cp2, p1);
-}
-
-void CanvasPathMethods::arcTo(float x1, float y1, float x2, float y2, float r, ExceptionCode& ec)
-{
- ec = 0;
- if (!std::isfinite(x1) || !std::isfinite(y1) || !std::isfinite(x2) || !std::isfinite(y2) || !std::isfinite(r))
- return;
-
- if (r < 0) {
- ec = INDEX_SIZE_ERR;
- return;
- }
-
- if (!hasInvertibleTransform())
- return;
-
- FloatPoint p1 = FloatPoint(x1, y1);
- FloatPoint p2 = FloatPoint(x2, y2);
-
- if (!m_path.hasCurrentPoint())
- m_path.moveTo(p1);
- else if (p1 == m_path.currentPoint() || p1 == p2 || !r)
- lineTo(x1, y1);
- else
- m_path.addArcTo(p1, p2, r);
-}
-
-static void normalizeAngles(float& startAngle, float& endAngle, bool anticlockwise)
-{
- float newStartAngle = startAngle;
- if (newStartAngle < 0)
- newStartAngle = (2 * piFloat) + fmodf(newStartAngle, -(2 * piFloat));
- else
- newStartAngle = fmodf(newStartAngle, 2 * piFloat);
-
- float delta = newStartAngle - startAngle;
- startAngle = newStartAngle;
- endAngle = endAngle + delta;
- ASSERT(newStartAngle >= 0 && newStartAngle < 2 * piFloat);
-
- if (anticlockwise && startAngle - endAngle >= 2 * piFloat)
- endAngle = startAngle - 2 * piFloat;
- else if (!anticlockwise && endAngle - startAngle >= 2 * piFloat)
- endAngle = startAngle + 2 * piFloat;
-}
-
-void CanvasPathMethods::arc(float x, float y, float radius, float startAngle, float endAngle, bool anticlockwise, ExceptionCode& ec)
-{
- if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(radius) || !std::isfinite(startAngle) || !std::isfinite(endAngle))
- return;
-
- if (radius < 0) {
- ec = INDEX_SIZE_ERR;
- return;
- }
-
- if (!hasInvertibleTransform())
- return;
-
- normalizeAngles(startAngle, endAngle, anticlockwise);
-
- if (!radius || startAngle == endAngle) {
- // The arc is empty but we still need to draw the connecting line.
- lineTo(x + radius * cosf(startAngle), y + radius * sinf(startAngle));
- return;
- }
-
- m_path.addArc(FloatPoint(x, y), radius, startAngle, endAngle, anticlockwise);
-}
-
-void CanvasPathMethods::ellipse(float x, float y, float radiusX, float radiusY, float rotation, float startAngle, float endAngle, bool anticlockwise, ExceptionCode& ec)
-{
- if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(radiusX) || !std::isfinite(radiusY) || !std::isfinite(rotation) || !std::isfinite(startAngle) || !std::isfinite(endAngle))
- return;
-
- if (radiusX < 0 || radiusY < 0) {
- ec = INDEX_SIZE_ERR;
- return;
- }
-
- if (!hasInvertibleTransform())
- return;
-
- normalizeAngles(startAngle, endAngle, anticlockwise);
-
- if ((!radiusX && !radiusY) || startAngle == endAngle) {
- AffineTransform transform;
- transform.translate(x, y).rotate(rad2deg(rotation));
-
- lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(startAngle), radiusY * sinf(startAngle))));
- return;
- }
-
- if (!radiusX || !radiusY) {
- AffineTransform transform;
- transform.translate(x, y).rotate(rad2deg(rotation));
-
- lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(startAngle), radiusY * sinf(startAngle))));
-
- if (!anticlockwise) {
- for (float angle = startAngle - fmodf(startAngle, piOverTwoFloat) + piOverTwoFloat; angle < endAngle; angle += piOverTwoFloat)
- lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(angle), radiusY * sinf(angle))));
- } else {
- for (float angle = startAngle - fmodf(startAngle, piOverTwoFloat); angle > endAngle; angle -= piOverTwoFloat)
- lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(angle), radiusY * sinf(angle))));
- }
-
- lineTo(transform.mapPoint(FloatPoint(radiusX * cosf(endAngle), radiusY * sinf(endAngle))));
- return;
- }
-
- m_path.addEllipse(FloatPoint(x, y), radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
-}
-
-void CanvasPathMethods::rect(float x, float y, float width, float height)
-{
- if (!hasInvertibleTransform())
- return;
-
- if (!std::isfinite(x) || !std::isfinite(y) || !std::isfinite(width) || !std::isfinite(height))
- return;
-
- if (!width && !height) {
- m_path.moveTo(FloatPoint(x, y));
- return;
- }
-
- m_path.addRect(FloatRect(x, y, width, height));
-}
-}
Deleted: trunk/Source/WebCore/html/canvas/CanvasPathMethods.h (204668 => 204669)
--- trunk/Source/WebCore/html/canvas/CanvasPathMethods.h 2016-08-20 00:11:17 UTC (rev 204668)
+++ trunk/Source/WebCore/html/canvas/CanvasPathMethods.h 2016-08-20 00:45:30 UTC (rev 204669)
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
- * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef CanvasPathMethods_h
-#define CanvasPathMethods_h
-
-#include "Path.h"
-
-namespace WebCore {
-
-class FloatRect;
-
-typedef int ExceptionCode;
-
-class CanvasPathMethods {
-public:
- virtual ~CanvasPathMethods() { }
-
- void closePath();
- void moveTo(float x, float y);
- void lineTo(float x, float y);
- void quadraticCurveTo(float cpx, float cpy, float x, float y);
- void bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y);
- 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 ellipse(float x, float y, float radiusX, float radiusY, float rotation, float startAngle, float endAngled, bool anticlockwise, ExceptionCode&);
- void rect(float x, float y, float width, float height);
-
-protected:
- CanvasPathMethods() { }
- CanvasPathMethods(const Path& path) : m_path(path) { }
-
- virtual bool hasInvertibleTransform() const { return true; }
-
- void lineTo(FloatPoint);
-
- Path m_path;
-};
-
-}
-
-#endif
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h (204668 => 204669)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h 2016-08-20 00:11:17 UTC (rev 204668)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h 2016-08-20 00:45:30 UTC (rev 204669)
@@ -26,7 +26,7 @@
#pragma once
#include "AffineTransform.h"
-#include "CanvasPathMethods.h"
+#include "CanvasPath.h"
#include "CanvasRenderingContext.h"
#include "CanvasStyle.h"
#include "Color.h"
@@ -57,7 +57,7 @@
typedef int ExceptionCode;
-class CanvasRenderingContext2D final : public CanvasRenderingContext, public CanvasPathMethods {
+class CanvasRenderingContext2D final : public CanvasRenderingContext, public CanvasPath {
public:
CanvasRenderingContext2D(HTMLCanvasElement*, bool usesCSSCompatibilityParseMode, bool usesDashboardCompatibilityMode);
virtual ~CanvasRenderingContext2D();
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl (204668 => 204669)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl 2016-08-20 00:11:17 UTC (rev 204668)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl 2016-08-20 00:45:30 UTC (rev 204669)
@@ -70,20 +70,6 @@
void beginPath();
- // FIXME: These methods should be shared with CanvasRenderingContext2D in the CanvasPathMethods interface.
- void closePath();
- void moveTo(unrestricted float x, unrestricted float y);
- void lineTo(unrestricted float x, unrestricted float y);
- void quadraticCurveTo(unrestricted float cpx, unrestricted float cpy, unrestricted float x, unrestricted float y);
- void bezierCurveTo(unrestricted float cp1x, unrestricted float cp1y, unrestricted float cp2x, unrestricted float cp2y,
- unrestricted float x, unrestricted float y);
- [RaisesException] void arcTo(unrestricted float x1, unrestricted float y1, unrestricted float x2, unrestricted float y2,
- unrestricted float radius);
- void rect(unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height);
- [RaisesException] void arc(unrestricted float x, unrestricted float y, unrestricted float radius, unrestricted float startAngle,
- unrestricted float endAngle, optional boolean anticlockwise = false);
- [RaisesException] void ellipse(unrestricted float x, unrestricted float y, unrestricted float radiusX, unrestricted float radiusY, unrestricted float rotation, unrestricted float startAngle, unrestricted float endAngle, optional boolean anticlockwise = false);
-
void fill(DOMPath path, optional CanvasWindingRule winding = "nonzero");
void stroke(DOMPath path);
void clip(DOMPath path, optional CanvasWindingRule winding = "nonzero");
@@ -199,3 +185,4 @@
attribute ImageSmoothingQuality imageSmoothingQuality;
};
+CanvasRenderingContext2D implements CanvasPath;
Modified: trunk/Source/WebCore/html/canvas/DOMPath.h (204668 => 204669)
--- trunk/Source/WebCore/html/canvas/DOMPath.h 2016-08-20 00:11:17 UTC (rev 204668)
+++ trunk/Source/WebCore/html/canvas/DOMPath.h 2016-08-20 00:45:30 UTC (rev 204669)
@@ -28,7 +28,7 @@
#ifndef DOMPath_h
#define DOMPath_h
-#include "CanvasPathMethods.h"
+#include "CanvasPath.h"
#include "SVGMatrix.h"
#include "SVGPathUtilities.h"
#include <wtf/RefCounted.h>
@@ -35,7 +35,7 @@
namespace WebCore {
-class WEBCORE_EXPORT DOMPath final : public RefCounted<DOMPath>, public CanvasPathMethods {
+class WEBCORE_EXPORT DOMPath final : public RefCounted<DOMPath>, public CanvasPath {
WTF_MAKE_FAST_ALLOCATED;
public:
virtual ~DOMPath();
@@ -65,7 +65,9 @@
private:
DOMPath() { }
- DOMPath(const Path& path) : CanvasPathMethods(path) { }
+ DOMPath(const Path& path)
+ : CanvasPath(path)
+ { }
};
}
Modified: trunk/Source/WebCore/html/canvas/DOMPath.idl (204668 => 204669)
--- trunk/Source/WebCore/html/canvas/DOMPath.idl 2016-08-20 00:11:17 UTC (rev 204668)
+++ trunk/Source/WebCore/html/canvas/DOMPath.idl 2016-08-20 00:45:30 UTC (rev 204669)
@@ -37,38 +37,6 @@
// [Conditional=CANVAS_PATH] void addPath(DOMPath path, optional SVGMatrix transform);
[Conditional=CANVAS_PATH] void addPath(DOMPath? path);
[Conditional=CANVAS_PATH] void addPath(DOMPath? path, SVGMatrix transform);
+};
- // FIXME: These methods should be shared with CanvasRenderingContext2D in the CanvasPathMethods interface.
- void closePath();
- void moveTo(optional float x = NaN,
- optional float y = NaN);
- void lineTo(optional float x = NaN,
- optional float y = NaN);
- void quadraticCurveTo(optional float cpx = NaN,
- optional float cpy = NaN,
- optional float x = NaN,
- optional float y = NaN);
- void bezierCurveTo(optional float cp1x = NaN,
- optional float cp1y = NaN,
- optional float cp2x = NaN,
- optional float cp2y = NaN,
- optional float x = NaN,
- optional float y = NaN);
- [RaisesException] void arcTo(optional float x1 = NaN,
- optional float y1 = NaN,
- optional float x2 = NaN,
- optional float y2 = NaN,
- optional float radius = NaN);
- void rect(optional float x = NaN,
- optional float y = NaN,
- optional float width = NaN,
- optional float height = NaN);
- [RaisesException] void arc(optional float x = NaN,
- optional float y = NaN,
- optional float radius = NaN,
- optional float startAngle = NaN,
- optional float endAngle = NaN,
- optional boolean anticlockwise = false);
- [RaisesException] void ellipse(unrestricted float x, unrestricted float y, unrestricted float radiusX, unrestricted float radiusY, unrestricted float rotation, unrestricted float startAngle, unrestricted float endAngle, optional boolean anticlockwise = false);
-
-};
+DOMPath implements CanvasPath;