Changeset 140604 in webkit
- Timestamp:
- Jan 23, 2013 3:03:30 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r140602 r140604 1 2013-01-23 Dirk Schulze <dschulze@adobe.com> 2 3 Implement Canvas Path object 4 https://bugs.webkit.org/show_bug.cgi?id=97333 5 6 Reviewed by Dean Jackson. 7 8 Add a test for checking existence of Path object and dependent functions. 9 The test is supposed to fail if canvas-path is not activated on compile time. 10 11 * fast/canvas/canvas-path-object-expected.txt: Added. 12 * fast/canvas/canvas-path-object.html: Added. 13 * fast/canvas/script-tests/canvas-path-object.js: Added. 14 * platform/chromium/TestExpectations: Different error handling on Chromium. Needs rebaseline. 15 1 16 2013-01-23 Joshua Bell <jsbell@chromium.org> 2 17 -
trunk/LayoutTests/platform/chromium/TestExpectations
r140585 r140604 4324 4324 webkit.org/b/105574 platform/chromium/fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar.html [ ImageOnlyFailure ] 4325 4325 4326 webkit.org/b/97333 fast/canvas/canvas-path-object.html [ Failure ] 4327 webkit.org/b/97333 platform/chromium/virtual/gpu/fast/canvas/canvas-path-object.html [ Failure ] 4328 4326 4329 # This is won't fix, as the debug and release versions differ. 4327 4330 webkit.org/b/99138 [ Debug SnowLeopard ] svg/custom/foreign-object-skew.svg [ ImageOnlyFailure ] -
trunk/Source/WebCore/CMakeLists.txt
r140602 r140604 517 517 html/canvas/CanvasRenderingContext.idl 518 518 html/canvas/DataView.idl 519 html/canvas/DOMPath.idl 519 520 html/canvas/EXTTextureFilterAnisotropic.idl 520 521 html/canvas/Float32Array.idl … … 1496 1497 html/canvas/CanvasContextAttributes.cpp 1497 1498 html/canvas/CanvasGradient.cpp 1499 html/canvas/CanvasPathMethods.cpp 1498 1500 html/canvas/CanvasPattern.cpp 1499 1501 html/canvas/CanvasProxy.cpp -
trunk/Source/WebCore/ChangeLog
r140602 r140604 1 2013-01-23 Dirk Schulze <dschulze@adobe.com> 2 3 Implement Canvas Path object 4 https://bugs.webkit.org/show_bug.cgi?id=97333 5 6 Reviewed by Dean Jackson. 7 8 The Canvas part of the WHATWG specification defines a Path object. This Path object 9 shares several path segment functions (path methods) with the CanvasRenderingContext2D 10 interface. This patch introduces the Path object and shares the path segment functions 11 in the class CanvasPathMethods. 12 This patch does just implement the basic path functions that have a general agreement on 13 the WHAT WG and W3C mailing lists. 14 This feature is behind a flag and won't be activated by default. 15 16 http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#path-objects 17 18 Test: fast/canvas/canvas-path-object.html 19 20 * CMakeLists.txt: Add DOMPath and CanvasPathMedthods to build system. 21 * DerivedSources.cpp: Ditto. 22 * DerivedSources.make: Ditto. 23 * DerivedSources.pri: Ditto. 24 * GNUmakefile.list.am: Ditto. 25 * Target.pri: Ditto. 26 * WebCore.gypi: Ditto. 27 * WebCore.vcproj/WebCore.vcproj: Ditto. 28 * WebCore.xcodeproj/project.pbxproj: Ditto. 29 * html/canvas/CanvasPathMethods.cpp: Added. 30 (WebCore): This class shares the path segment functions (moveTo, lineTo, ...) between 31 DOMPath (the Path object) and CanvasRenderingContext2D. 32 (WebCore::CanvasPathMethods::closePath): 33 (WebCore::CanvasPathMethods::moveTo): 34 (WebCore::CanvasPathMethods::lineTo): 35 (WebCore::CanvasPathMethods::quadraticCurveTo): 36 (WebCore::CanvasPathMethods::bezierCurveTo): 37 (WebCore::CanvasPathMethods::arcTo): 38 (WebCore::CanvasPathMethods::arc): 39 (WebCore::CanvasPathMethods::rect): 40 * html/canvas/CanvasPathMethods.h: Added. 41 (WebCore): 42 (CanvasPathMethods): 43 (WebCore::CanvasPathMethods::~CanvasPathMethods): 44 (WebCore::CanvasPathMethods::transformIsInvertible): 45 (WebCore::CanvasPathMethods::CanvasPathMethods): 46 * html/canvas/CanvasRenderingContext2D.cpp: 47 * html/canvas/CanvasRenderingContext2D.h: Remove the path segment functions here. 48 (CanvasRenderingContext2D): 49 (WebCore::CanvasRenderingContext2D::transformIsInvertible): This checks if the CTM 50 of the context is still invertible. Drawing should stop if it is not. 51 * html/canvas/CanvasRenderingContext2D.idl: 52 * html/canvas/DOMPath.h: Added. 53 (WebCore): 54 (DOMPath): 55 (WebCore::DOMPath::create): 56 (WebCore::DOMPath::~DOMPath): 57 (WebCore::DOMPath::DOMPath): 58 * html/canvas/DOMPath.idl: Added. 59 * page/DOMWindow.idl: Added CTOR for Path. 60 1 61 2013-01-23 Joshua Bell <jsbell@chromium.org> 2 62 -
trunk/Source/WebCore/DerivedSources.cpp
r140488 r140604 96 96 #include "JSDOMNamedFlowCollection.cpp" 97 97 #include "JSDOMParser.cpp" 98 #include "JSDOMPath.cpp" 98 99 #include "JSDOMPlugin.cpp" 99 100 #include "JSDOMPluginArray.cpp" -
trunk/Source/WebCore/DerivedSources.make
r140602 r140604 382 382 $(WebCore)/html/canvas/CanvasRenderingContext2D.idl \ 383 383 $(WebCore)/html/canvas/DataView.idl \ 384 $(WebCore)/html/canvas/DOMPath.idl \ 384 385 $(WebCore)/html/canvas/EXTTextureFilterAnisotropic.idl \ 385 386 $(WebCore)/html/canvas/Float32Array.idl \ -
trunk/Source/WebCore/DerivedSources.pri
r140488 r140604 306 306 $$PWD/html/canvas/CanvasRenderingContext.idl \ 307 307 $$PWD/html/canvas/CanvasRenderingContext2D.idl \ 308 $$PWD/html/canvas/DOMPath.idl \ 308 309 $$PWD/html/canvas/EXTTextureFilterAnisotropic.idl \ 309 310 $$PWD/html/canvas/OESStandardDerivatives.idl \ -
trunk/Source/WebCore/GNUmakefile.list.am
r140602 r140604 198 198 DerivedSources/WebCore/JSDOMNamedFlowCollection.cpp \ 199 199 DerivedSources/WebCore/JSDOMNamedFlowCollection.h \ 200 DerivedSources/WebCore/JSDOMPath.cpp \ 201 DerivedSources/WebCore/JSDOMPath.h \ 200 202 DerivedSources/WebCore/JSDOMParser.cpp \ 201 203 DerivedSources/WebCore/JSDOMParser.h \ … … 1525 1527 $(WebCore)/html/canvas/CanvasRenderingContext2D.idl \ 1526 1528 $(WebCore)/html/canvas/DataView.idl \ 1529 $(WebCore)/html/canvas/DOMPath.idl \ 1527 1530 $(WebCore)/html/canvas/EXTTextureFilterAnisotropic.idl \ 1528 1531 $(WebCore)/html/canvas/Float32Array.idl \ … … 3216 3219 Source/WebCore/html/canvas/CanvasGradient.cpp \ 3217 3220 Source/WebCore/html/canvas/CanvasGradient.h \ 3221 Source/WebCore/html/canvas/CanvasPathMethods.cpp \ 3222 Source/WebCore/html/canvas/CanvasPathMethods.h \ 3218 3223 Source/WebCore/html/canvas/CanvasPattern.cpp \ 3219 3224 Source/WebCore/html/canvas/CanvasPattern.h \ … … 3229 3234 Source/WebCore/html/canvas/DataView.cpp \ 3230 3235 Source/WebCore/html/canvas/DataView.h \ 3236 Source/WebCore/html/canvas/DOMPath.h \ 3231 3237 Source/WebCore/html/canvas/EXTTextureFilterAnisotropic.cpp \ 3232 3238 Source/WebCore/html/canvas/EXTTextureFilterAnisotropic.h \ -
trunk/Source/WebCore/Target.pri
r140518 r140604 704 704 html/WeekInputType.cpp \ 705 705 html/canvas/CanvasGradient.cpp \ 706 html/canvas/CanvasPathMethods.cpp \ 706 707 html/canvas/CanvasPattern.cpp \ 707 708 html/canvas/CanvasProxy.cpp \ … … 1762 1763 history/PageCache.h \ 1763 1764 html/canvas/CanvasGradient.h \ 1765 html/canvas/CanvasPathMethods.h \ 1764 1766 html/canvas/CanvasPattern.h \ 1765 1767 html/canvas/CanvasProxy.h \ … … 1768 1770 html/canvas/CanvasStyle.h \ 1769 1771 html/canvas/DataView.h \ 1772 html/canvas/DOMPath.h \ 1770 1773 html/ClassList.h \ 1771 1774 html/DOMFormData.h \ -
trunk/Source/WebCore/WebCore.gypi
r140602 r140604 371 371 'html/canvas/CanvasRenderingContext2D.idl', 372 372 'html/canvas/DataView.idl', 373 'html/canvas/DOMPath.idl', 373 374 'html/canvas/EXTTextureFilterAnisotropic.idl', 374 375 'html/canvas/Float32Array.idl', … … 3271 3272 'html/canvas/CanvasGradient.cpp', 3272 3273 'html/canvas/CanvasGradient.h', 3274 'html/canvas/CanvasPathMethods.cpp', 3275 'html/canvas/CanvasPathMethods.h', 3273 3276 'html/canvas/CanvasPattern.cpp', 3274 3277 'html/canvas/CanvasPattern.h', … … 3284 3287 'html/canvas/DataView.cpp', 3285 3288 'html/canvas/DataView.h', 3289 'html/canvas/DOMPath.h', 3286 3290 'html/canvas/EXTTextureFilterAnisotropic.cpp', 3287 3291 'html/canvas/EXTTextureFilterAnisotropic.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r140498 r140604 3843 3843 </File> 3844 3844 <File 3845 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSDOMPath.cpp" 3846 > 3847 <FileConfiguration 3848 Name="Debug|Win32" 3849 ExcludedFromBuild="true" 3850 > 3851 <Tool 3852 Name="VCCLCompilerTool" 3853 /> 3854 </FileConfiguration> 3855 <FileConfiguration 3856 Name="Release|Win32" 3857 ExcludedFromBuild="true" 3858 > 3859 <Tool 3860 Name="VCCLCompilerTool" 3861 /> 3862 </FileConfiguration> 3863 <FileConfiguration 3864 Name="Debug_Cairo_CFLite|Win32" 3865 ExcludedFromBuild="true" 3866 > 3867 <Tool 3868 Name="VCCLCompilerTool" 3869 /> 3870 </FileConfiguration> 3871 <FileConfiguration 3872 Name="Release_Cairo_CFLite|Win32" 3873 ExcludedFromBuild="true" 3874 > 3875 <Tool 3876 Name="VCCLCompilerTool" 3877 /> 3878 </FileConfiguration> 3879 <FileConfiguration 3880 Name="Debug_All|Win32" 3881 ExcludedFromBuild="true" 3882 > 3883 <Tool 3884 Name="VCCLCompilerTool" 3885 /> 3886 </FileConfiguration> 3887 <FileConfiguration 3888 Name="Production|Win32" 3889 ExcludedFromBuild="true" 3890 > 3891 <Tool 3892 Name="VCCLCompilerTool" 3893 /> 3894 </FileConfiguration> 3895 </File> 3896 <File 3897 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSDOMPath.h" 3898 > 3899 </File> 3900 <File 3845 3901 RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSDOMParser.cpp" 3846 3902 > … … 59855 59911 </File> 59856 59912 <File 59913 RelativePath="..\html\canvas\CanvasPathMethods.cpp" 59914 > 59915 </File> 59916 <File 59917 RelativePath="..\html\canvas\CanvasPathMethods.h" 59918 > 59919 </File> 59920 <File 59857 59921 RelativePath="..\html\canvas\CanvasPattern.cpp" 59858 59922 > … … 59920 59984 <File 59921 59985 RelativePath="..\html\canvas\DataView.h" 59986 > 59987 </File> 59988 <File 59989 RelativePath="..\html\canvas\DOMPath.h" 59922 59990 > 59923 59991 </File> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r140602 r140604 6463 6463 FB49C39D16784947007FFB5D /* CSSHostRule.h in Headers */ = {isa = PBXBuildFile; fileRef = FB49C39C16784947007FFB5D /* CSSHostRule.h */; }; 6464 6464 FB78AD2E151BF5E600FE54D3 /* CSSParserMode.h in Headers */ = {isa = PBXBuildFile; fileRef = FB78AD2C151BF5D200FE54D3 /* CSSParserMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6465 FB91392416AE4C17001FE682 /* DOMPath.h in Headers */ = {isa = PBXBuildFile; fileRef = FB91392016AE4B0B001FE682 /* DOMPath.h */; }; 6466 FB91392616AE4C2F001FE682 /* CanvasPathMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = FB91391F16AE4B0B001FE682 /* CanvasPathMethods.h */; }; 6467 FB91392716AE4C34001FE682 /* CanvasPathMethods.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB91391E16AE4B0B001FE682 /* CanvasPathMethods.cpp */; }; 6468 FB91392A16AE4FC0001FE682 /* JSDOMPath.h in Headers */ = {isa = PBXBuildFile; fileRef = FB91392816AE4FC0001FE682 /* JSDOMPath.h */; }; 6469 FB91392B16AE4FC0001FE682 /* JSDOMPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FB91392916AE4FC0001FE682 /* JSDOMPath.cpp */; }; 6465 6470 FB92DF4B15FED08700994433 /* ClipPathOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = FB92DF4915FED08700994433 /* ClipPathOperation.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6466 6471 FBC220DF1237FBEB00BCF788 /* GraphicsContext3DOpenGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FBC220DE1237FBEB00BCF788 /* GraphicsContext3DOpenGL.cpp */; }; … … 14082 14087 FB49C39E16784954007FFB5D /* CSSHostRule.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CSSHostRule.idl; sourceTree = "<group>"; }; 14083 14088 FB78AD2C151BF5D200FE54D3 /* CSSParserMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSParserMode.h; sourceTree = "<group>"; }; 14089 FB91391E16AE4B0B001FE682 /* CanvasPathMethods.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CanvasPathMethods.cpp; path = canvas/CanvasPathMethods.cpp; sourceTree = "<group>"; }; 14090 FB91391F16AE4B0B001FE682 /* CanvasPathMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CanvasPathMethods.h; path = canvas/CanvasPathMethods.h; sourceTree = "<group>"; }; 14091 FB91392016AE4B0B001FE682 /* DOMPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DOMPath.h; path = canvas/DOMPath.h; sourceTree = "<group>"; }; 14092 FB91392116AE4B0B001FE682 /* DOMPath.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DOMPath.idl; path = canvas/DOMPath.idl; sourceTree = "<group>"; }; 14093 FB91392816AE4FC0001FE682 /* JSDOMPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMPath.h; sourceTree = "<group>"; }; 14094 FB91392916AE4FC0001FE682 /* JSDOMPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMPath.cpp; sourceTree = "<group>"; }; 14084 14095 FB92DF4915FED08700994433 /* ClipPathOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClipPathOperation.h; sourceTree = "<group>"; }; 14085 14096 FBC220DE1237FBEB00BCF788 /* GraphicsContext3DOpenGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3DOpenGL.cpp; sourceTree = "<group>"; }; … … 15500 15511 isa = PBXGroup; 15501 15512 children = ( 15513 FB91391E16AE4B0B001FE682 /* CanvasPathMethods.cpp */, 15514 FB91391F16AE4B0B001FE682 /* CanvasPathMethods.h */, 15515 FB91392016AE4B0B001FE682 /* DOMPath.h */, 15516 FB91392116AE4B0B001FE682 /* DOMPath.idl */, 15502 15517 49EECDCC10503C2300099FAB /* ArrayBuffer.idl */, 15503 15518 49EECDC910503C2300099FAB /* ArrayBufferView.idl */, … … 18722 18737 2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */, 18723 18738 2E0888D31148848A00AF4265 /* JSDOMFormData.h */, 18739 FB91392916AE4FC0001FE682 /* JSDOMPath.cpp */, 18740 FB91392816AE4FC0001FE682 /* JSDOMPath.h */, 18724 18741 4ACBC0C812713D0A0094F9B2 /* JSDOMSettableTokenList.cpp */, 18725 18742 4ACBC0C912713D0A0094F9B2 /* JSDOMSettableTokenList.h */, … … 26252 26269 977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */, 26253 26270 FD537353137B651800008DCE /* ZeroPole.h in Headers */, 26271 FB91392416AE4C17001FE682 /* DOMPath.h in Headers */, 26272 FB91392616AE4C2F001FE682 /* CanvasPathMethods.h in Headers */, 26273 FB91392A16AE4FC0001FE682 /* JSDOMPath.h in Headers */, 26254 26274 ); 26255 26275 runOnlyForDeploymentPostprocessing = 0; … … 29400 29420 977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */, 29401 29421 FD537352137B651800008DCE /* ZeroPole.cpp in Sources */, 29422 FB91392716AE4C34001FE682 /* CanvasPathMethods.cpp in Sources */, 29423 FB91392B16AE4FC0001FE682 /* JSDOMPath.cpp in Sources */, 29402 29424 ); 29403 29425 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r140352 r140604 853 853 } 854 854 855 void CanvasRenderingContext2D::closePath()856 {857 if (m_path.isEmpty())858 return;859 860 FloatRect boundRect = m_path.fastBoundingRect();861 if (boundRect.width() || boundRect.height())862 m_path.closeSubpath();863 }864 865 void CanvasRenderingContext2D::moveTo(float x, float y)866 {867 if (!isfinite(x) | !isfinite(y))868 return;869 if (!state().m_invertibleCTM)870 return;871 m_path.moveTo(FloatPoint(x, y));872 }873 874 void CanvasRenderingContext2D::lineTo(float x, float y)875 {876 if (!isfinite(x) | !isfinite(y))877 return;878 if (!state().m_invertibleCTM)879 return;880 881 FloatPoint p1 = FloatPoint(x, y);882 if (!m_path.hasCurrentPoint())883 m_path.moveTo(p1);884 else if (p1 != m_path.currentPoint())885 m_path.addLineTo(FloatPoint(x, y));886 }887 888 void CanvasRenderingContext2D::quadraticCurveTo(float cpx, float cpy, float x, float y)889 {890 if (!isfinite(cpx) | !isfinite(cpy) | !isfinite(x) | !isfinite(y))891 return;892 if (!state().m_invertibleCTM)893 return;894 if (!m_path.hasCurrentPoint())895 m_path.moveTo(FloatPoint(cpx, cpy));896 897 FloatPoint p1 = FloatPoint(x, y);898 if (p1 != m_path.currentPoint())899 m_path.addQuadCurveTo(FloatPoint(cpx, cpy), p1);900 }901 902 void CanvasRenderingContext2D::bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y)903 {904 if (!isfinite(cp1x) | !isfinite(cp1y) | !isfinite(cp2x) | !isfinite(cp2y) | !isfinite(x) | !isfinite(y))905 return;906 if (!state().m_invertibleCTM)907 return;908 if (!m_path.hasCurrentPoint())909 m_path.moveTo(FloatPoint(cp1x, cp1y));910 911 FloatPoint p1 = FloatPoint(x, y);912 if (p1 != m_path.currentPoint())913 m_path.addBezierCurveTo(FloatPoint(cp1x, cp1y), FloatPoint(cp2x, cp2y), p1);914 }915 916 void CanvasRenderingContext2D::arcTo(float x1, float y1, float x2, float y2, float r, ExceptionCode& ec)917 {918 ec = 0;919 if (!isfinite(x1) | !isfinite(y1) | !isfinite(x2) | !isfinite(y2) | !isfinite(r))920 return;921 922 if (r < 0) {923 ec = INDEX_SIZE_ERR;924 return;925 }926 927 if (!state().m_invertibleCTM)928 return;929 930 FloatPoint p1 = FloatPoint(x1, y1);931 FloatPoint p2 = FloatPoint(x2, y2);932 933 if (!m_path.hasCurrentPoint())934 m_path.moveTo(p1);935 else if (p1 == m_path.currentPoint() || p1 == p2 || !r)936 lineTo(x1, y1);937 else938 m_path.addArcTo(p1, p2, r);939 }940 941 void CanvasRenderingContext2D::arc(float x, float y, float r, float sa, float ea, bool anticlockwise, ExceptionCode& ec)942 {943 ec = 0;944 if (!isfinite(x) | !isfinite(y) | !isfinite(r) | !isfinite(sa) | !isfinite(ea))945 return;946 947 if (r < 0) {948 ec = INDEX_SIZE_ERR;949 return;950 }951 952 if (!r || sa == ea) {953 // The arc is empty but we still need to draw the connecting line954 lineTo(x + r * cosf(sa), y + r * sinf(sa));955 return;956 }957 958 if (!state().m_invertibleCTM)959 return;960 961 // If 'sa' and 'ea' differ by more than 2Pi, just add a circle starting/ending at 'sa'962 if (anticlockwise && sa - ea >= 2 * piFloat) {963 m_path.addArc(FloatPoint(x, y), r, sa, sa - 2 * piFloat, anticlockwise);964 return;965 }966 if (!anticlockwise && ea - sa >= 2 * piFloat) {967 m_path.addArc(FloatPoint(x, y), r, sa, sa + 2 * piFloat, anticlockwise);968 return;969 }970 971 m_path.addArc(FloatPoint(x, y), r, sa, ea, anticlockwise);972 }973 974 855 static bool validateRectForCanvas(float& x, float& y, float& width, float& height) 975 856 { … … 991 872 992 873 return true; 993 }994 995 void CanvasRenderingContext2D::rect(float x, float y, float width, float height)996 {997 if (!state().m_invertibleCTM)998 return;999 1000 if (!isfinite(x) || !isfinite(y) || !isfinite(width) || !isfinite(height))1001 return;1002 1003 if (!width && !height) {1004 m_path.moveTo(FloatPoint(x, y));1005 return;1006 }1007 1008 m_path.addRect(FloatRect(x, y, width, height));1009 874 } 1010 875 -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h
r140352 r140604 28 28 29 29 #include "AffineTransform.h" 30 #include "CanvasPathMethods.h" 30 31 #include "CanvasRenderingContext.h" 31 32 #include "Color.h" … … 59 60 typedef int ExceptionCode; 60 61 61 class CanvasRenderingContext2D : public CanvasRenderingContext {62 class CanvasRenderingContext2D : public CanvasRenderingContext, public CanvasPathMethods { 62 63 public: 63 64 static PassOwnPtr<CanvasRenderingContext2D> create(HTMLCanvasElement* canvas, bool usesCSSCompatibilityParseMode, bool usesDashboardCompatibilityMode) … … 136 137 137 138 void beginPath(); 138 void closePath();139 140 void moveTo(float x, float y);141 void lineTo(float x, float y);142 void quadraticCurveTo(float cpx, float cpy, float x, float y);143 void bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y);144 void arcTo(float x0, float y0, float x1, float y1, float radius, ExceptionCode&);145 void arc(float x, float y, float r, float sa, float ea, bool clockwise, ExceptionCode&);146 void rect(float x, float y, float width, float height);147 139 148 140 void fill(const String& winding = "nonzero"); … … 332 324 virtual bool isAccelerated() const OVERRIDE; 333 325 326 virtual bool transformIsInvertible() { return state().m_invertibleCTM; } 327 334 328 #if ENABLE(ACCELERATED_2D_CANVAS) && USE(ACCELERATED_COMPOSITING) 335 329 virtual PlatformLayer* platformLayer() const OVERRIDE; 336 330 #endif 337 331 338 Path m_path;339 332 Vector<State, 1> m_stateStack; 340 333 unsigned m_unrealizedSaveCount; -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl
r140352 r140604 96 96 97 97 void beginPath(); 98 99 // FIXME: These methods should be shared with CanvasRenderingContext2D in the CanvasPathMethods interface. 98 100 void closePath(); 99 101 void moveTo(in [Optional=DefaultIsUndefined] float x, … … 128 130 in [Optional=DefaultIsUndefined] boolean anticlockwise) 129 131 raises (DOMException); 132 130 133 void fill(in [Optional] DOMString winding); 131 134 void stroke(); -
trunk/Source/WebCore/page/DOMWindow.idl
r140448 r140604 399 399 attribute EntityConstructor Entity; 400 400 attribute EntityReferenceConstructor EntityReference; 401 [Conditional=CANVAS_PATH] attribute DOMPathConstructor Path; 401 402 attribute ProcessingInstructionConstructor ProcessingInstruction; 402 403 [Conditional=SHADOW_DOM, V8EnabledAtRuntime=shadowDOM] attribute ShadowRootConstructor WebKitShadowRoot;
Note: See TracChangeset
for help on using the changeset viewer.