[Canvas] Split CanvasRenderingContext2D.idl into separate IDLs to match current HTML spec
https://bugs.webkit.org/show_bug.cgi?id=176276
Reviewed by Dean Jackson.
Source/WebCore:
- Splits CanvasRenderingContext2D.idl out into:
CanvasState
CanvasTransform
CanvasCompositing
CanvasImageSmoothing
CanvasFillStrokeStyles
CanvasShadowStyles
CanvasFilters
CanvasRect
CanvasDrawPath
CanvasUserInterface
CanvasText
CanvasDrawImage
CanvasImageData
CanvasPathDrawingStyles
CanvasTextDrawingStyles
- Renames CanvasWindingRule enum to CanvasFillRule, and moves it to its own file
so it can be reused by multiple IDLs.
- Renames DOMPath to Path2D, which is what it is supposed to be called, and doesn't
conflict with any WebCore names.
- Converts lineCap, lineJoin, textAlign, textBaseline, direction to use enums, rather
than DOMStrings, allowing us to remove a bunch of custom parsing.
- Non-standard canvas API was grouped with related functionality in the broken out
IDLs and clearly marked as non-standard.
- Comments were added for places where we break with the standard, mostly around use
of float where we should be using double.
* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
Add new files.
* bindings/js/CallTracerTypes.h:
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::buildInitialState):
(WebCore::InspectorCanvas::buildAction):
Update for renames, and use new convertEnumerationToString to
serialize enumerations.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateEnumerationImplementationContent):
(GenerateEnumerationHeaderContent):
Split string conversion out of convertEnumerationToJS, and into
its own function, convertEnumerationToString, to allow serialization
to string outside of the bindings context, in this case, for the
InspectorCanvas.
(GenerateParametersCheck):
Improve error message to make it clear which operation has the issue
in order to make debugging easier.
* html/ImageData.idl:
Re-order constructors to match specification, and add FIXME for incorrect
default argument.
* html/TextMetrics.idl:
Add spec'd exposure and spec comments, as well a FIXME to convert the
unrestricted float parameters should be doubles.
* html/canvas/CanvasCompositing.idl: Added.
* html/canvas/CanvasDirection.h: Added.
* html/canvas/CanvasDirection.idl: Added.
* html/canvas/CanvasDrawImage.idl: Added.
* html/canvas/CanvasDrawPath.idl: Added.
* html/canvas/CanvasFillRule.h: Added.
* html/canvas/CanvasFillRule.idl: Added.
* html/canvas/CanvasFillStrokeStyles.idl: Added.
* html/canvas/CanvasFilters.idl: Added.
* html/canvas/CanvasImageData.idl: Added.
* html/canvas/CanvasImageSmoothing.idl: Added.
* html/canvas/CanvasLineCap.h: Added.
* html/canvas/CanvasLineCap.idl: Added.
* html/canvas/CanvasLineJoin.h: Added.
* html/canvas/CanvasLineJoin.idl: Added.
* html/canvas/CanvasPathDrawingStyles.idl: Added.
* html/canvas/CanvasRect.idl: Added.
* html/canvas/CanvasShadowStyles.idl: Added.
* html/canvas/CanvasState.idl: Added.
* html/canvas/CanvasText.idl: Added.
* html/canvas/CanvasTextAlign.h: Added.
* html/canvas/CanvasTextAlign.idl: Added.
* html/canvas/CanvasTextBaseline.h: Added.
* html/canvas/CanvasTextBaseline.idl: Added.
* html/canvas/CanvasTextDrawingStyles.idl: Added.
* html/canvas/CanvasTransform.idl: Added.
* html/canvas/CanvasUserInterface.idl: Added.
* html/canvas/ImageSmoothingQuality.h: Added.
* html/canvas/ImageSmoothingQuality.idl: Added.
Move CanvasRenderingContext2D.idl content into separate files to
match the specification.
* html/canvas/CanvasGradient.idl:
* html/canvas/CanvasPath.idl:
* html/canvas/CanvasPattern.idl:
Add exposure and FIXMEs on changes need to match the spec.
* html/canvas/CanvasRenderingContext2D.cpp:
* html/canvas/CanvasRenderingContext2D.h:
Switch to using enums for lineCap, lineJoin, textAlign, textBaseline, and direction.
Rather than using the parsing / stringifying functions from GraphicsTypes, add simple
switch based to/from converters to convert to/from the canvas type to the platform
type. Also update for rename of DOMPath -> Path2D and WindingRule -> CanvasFillRule.
Unfortunately, not all custom parsing could be removed. To support the legacy functions
setLineCap and setLineJoin, which take Strings, two simply parse paths had to be
brought back. They can't use the enums, because the rules for enums as parameters
is stricter that what was implemented in the custom code (e.g. the bindings would
have thrown for strings not in the enum set).
* html/canvas/CanvasRenderingContext2D.idl:
Move most of the functions into the new files, which are then 'implemented' by
this.
* html/canvas/DOMPath.cpp: Removed.
* html/canvas/DOMPath.h: Removed.
* html/canvas/DOMPath.idl: Removed.
* html/canvas/Path2D.cpp: Copied from Source/WebCore/html/canvas/DOMPath.cpp.
* html/canvas/Path2D.h: Copied from Source/WebCore/html/canvas/DOMPath.h.
* html/canvas/Path2D.idl: Copied from Source/WebCore/html/canvas/DOMPath.idl.
Rename DOMPath to Path2D to match the spec..
* platform/graphics/GraphicsTypes.cpp:
(WebCore::parseLineCap): Deleted.
(WebCore::lineCapName): Deleted.
(WebCore::parseLineJoin): Deleted.
(WebCore::lineJoinName): Deleted.
(WebCore::textAlignName): Deleted.
(WebCore::parseTextAlign): Deleted.
(WebCore::textBaselineName): Deleted.
(WebCore::parseTextBaseline): Deleted.
* platform/graphics/GraphicsTypes.h:
Remove now unused parsing / stringifying functions.
* testing/Internals.cpp:
Remove unused #include.
* bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
* bindings/scripts/test/JS/JSTestCallbackInterface.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
* bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
* bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp:
* bindings/scripts/test/JS/JSTestStandaloneEnumeration.h:
Update test results to add convertEnumerationToString.
LayoutTests:
* fast/canvas/canvas-clip-path-expected.txt:
* fast/canvas/canvas-fill-path-expected.txt:
* fast/canvas/canvas-path-addPath-expected.txt:
* fast/canvas/canvas-path-isPointInPath-expected.txt:
* fast/canvas/canvas-path-isPointInStroke-expected.txt:
* fast/canvas/canvas-stroke-path-expected.txt:
* fast/canvas/winding-enumeration-expected.txt:
* inspector/canvas/recording-2d-expected.txt:
* js/dom/global-constructors-attributes-dedicated-worker-expected.txt:
Update results.
Canonical link: https://commits.webkit.org/192969@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221598 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-09-05 00:23:03 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017 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 APPLE INC. AND ITS CONTRIBUTORS ``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 APPLE INC. OR ITS CONTRIBUTORS
|
|
|
|
* 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
|
|
|
|
|
|
|
|
namespace WebCore {
|
|
|
|
|
|
|
|
enum class CanvasLineJoin { Round, Bevel, Miter };
|
|
|
|
|
|
|
|
}
|