Changeset 279093 in webkit
- Timestamp:
- Jun 21, 2021, 5:22:44 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 21 edited
-
ChangeLog (modified) (1 diff)
-
html/canvas/CanvasCompositing.idl (modified) (1 diff)
-
html/canvas/CanvasDrawImage.idl (modified) (1 diff)
-
html/canvas/CanvasDrawPath.idl (modified) (1 diff)
-
html/canvas/CanvasGradient.cpp (modified) (2 diffs)
-
html/canvas/CanvasGradient.h (modified) (1 diff)
-
html/canvas/CanvasGradient.idl (modified) (1 diff)
-
html/canvas/CanvasPathDrawingStyles.idl (modified) (1 diff)
-
html/canvas/CanvasRect.idl (modified) (1 diff)
-
html/canvas/CanvasRenderingContext2D.cpp (modified) (2 diffs)
-
html/canvas/CanvasRenderingContext2D.h (modified) (2 diffs)
-
html/canvas/CanvasRenderingContext2D.idl (modified) (1 diff)
-
html/canvas/CanvasRenderingContext2DBase.cpp (modified) (21 diffs)
-
html/canvas/CanvasRenderingContext2DBase.h (modified) (8 diffs)
-
html/canvas/CanvasShadowStyles.idl (modified) (1 diff)
-
html/canvas/CanvasText.idl (modified) (1 diff)
-
html/canvas/CanvasTransform.idl (modified) (1 diff)
-
html/canvas/OffscreenCanvasRenderingContext2D.cpp (modified) (1 diff)
-
html/canvas/OffscreenCanvasRenderingContext2D.h (modified) (1 diff)
-
inspector/InspectorCanvas.cpp (modified) (2 diffs)
-
inspector/InspectorCanvasCallTracer.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r279085 r279093 1 2021-06-21 Chris Dumez <cdumez@apple.com> 2 3 Use double instead of float where appropriate in HTML Canvas IDL 4 https://bugs.webkit.org/show_bug.cgi?id=227238 5 6 Reviewed by Sam Weinig. 7 8 There are a lot of places in our HTML Canvas IDL where we're using float type, even though 9 the specification is using double. This patch fixes those. 10 11 * html/canvas/CanvasCompositing.idl: 12 * html/canvas/CanvasDrawImage.idl: 13 * html/canvas/CanvasDrawPath.idl: 14 * html/canvas/CanvasGradient.cpp: 15 (WebCore::CanvasGradient::addColorStop): 16 * html/canvas/CanvasGradient.h: 17 * html/canvas/CanvasGradient.idl: 18 * html/canvas/CanvasPathDrawingStyles.idl: 19 * html/canvas/CanvasRect.idl: 20 * html/canvas/CanvasRenderingContext2D.cpp: 21 (WebCore::CanvasRenderingContext2D::fillText): 22 (WebCore::CanvasRenderingContext2D::strokeText): 23 (WebCore::CanvasRenderingContext2D::drawTextInternal): 24 * html/canvas/CanvasRenderingContext2D.h: 25 * html/canvas/CanvasRenderingContext2D.idl: 26 * html/canvas/CanvasRenderingContext2DBase.cpp: 27 (WebCore::CanvasRenderingContext2DBase::setLineWidth): 28 (WebCore::CanvasRenderingContext2DBase::setMiterLimit): 29 (WebCore::lineDashSequenceIsValid): 30 (WebCore::CanvasRenderingContext2DBase::setLineDash): 31 (WebCore::CanvasRenderingContext2DBase::setWebkitLineDash): 32 (WebCore::CanvasRenderingContext2DBase::setLineDashOffset): 33 (WebCore::CanvasRenderingContext2DBase::setGlobalAlpha): 34 (WebCore::CanvasRenderingContext2DBase::scale): 35 (WebCore::CanvasRenderingContext2DBase::rotate): 36 (WebCore::CanvasRenderingContext2DBase::translate): 37 (WebCore::CanvasRenderingContext2DBase::transform): 38 (WebCore::CanvasRenderingContext2DBase::setTransform): 39 (WebCore::validateRectForCanvas): 40 (WebCore::CanvasRenderingContext2DBase::isPointInPath): 41 (WebCore::CanvasRenderingContext2DBase::isPointInStroke): 42 (WebCore::CanvasRenderingContext2DBase::isPointInPathInternal): 43 (WebCore::CanvasRenderingContext2DBase::isPointInStrokeInternal): 44 (WebCore::CanvasRenderingContext2DBase::clearRect): 45 (WebCore::CanvasRenderingContext2DBase::fillRect): 46 (WebCore::CanvasRenderingContext2DBase::strokeRect): 47 (WebCore::CanvasRenderingContext2DBase::canDrawText): 48 (WebCore::CanvasRenderingContext2DBase::drawText): 49 (WebCore::CanvasRenderingContext2DBase::drawTextUnchecked): 50 * html/canvas/CanvasRenderingContext2DBase.h: 51 (WebCore::CanvasRenderingContext2DBase::lineWidth const): 52 (WebCore::CanvasRenderingContext2DBase::miterLimit const): 53 (WebCore::CanvasRenderingContext2DBase::getLineDash const): 54 (WebCore::CanvasRenderingContext2DBase::webkitLineDash const): 55 (WebCore::CanvasRenderingContext2DBase::lineDashOffset const): 56 (WebCore::CanvasRenderingContext2DBase::globalAlpha const): 57 * html/canvas/CanvasShadowStyles.idl: 58 * html/canvas/CanvasText.idl: 59 * html/canvas/CanvasTransform.idl: 60 * html/canvas/OffscreenCanvasRenderingContext2D.cpp: 61 (WebCore::OffscreenCanvasRenderingContext2D::fillText): 62 (WebCore::OffscreenCanvasRenderingContext2D::strokeText): 63 * html/canvas/OffscreenCanvasRenderingContext2D.h: 64 * inspector/InspectorCanvas.cpp: 65 (WebCore::InspectorCanvas::processArgument): 66 * inspector/InspectorCanvasCallTracer.h: 67 1 68 2021-06-21 Fujii Hironori <Hironori.Fujii@sony.com> 2 69 -
trunk/Source/WebCore/html/canvas/CanvasCompositing.idl
r267813 r279093 26 26 // https://html.spec.whatwg.org/multipage/canvas.html#canvascompositing 27 27 interface mixin CanvasCompositing { 28 // FIXME: All the unrestricted float attributes below should be unrestricted doubles.29 30 28 // compositing 31 attribute unrestricted floatglobalAlpha; // (default 1.0)29 attribute unrestricted double globalAlpha; // (default 1.0) 32 30 attribute DOMString globalCompositeOperation; // (default source-over) 33 31 }; -
trunk/Source/WebCore/html/canvas/CanvasDrawImage.idl
r274832 r279093 39 39 // https://html.spec.whatwg.org/multipage/canvas.html#canvasdrawimage 40 40 interface mixin CanvasDrawImage { 41 // FIXME: All the unrestricted float arguments below should be unrestricted doubles.42 43 41 // drawing images 44 42 undefined drawImage(CanvasImageSource image, unrestricted double dx, unrestricted double dy); -
trunk/Source/WebCore/html/canvas/CanvasDrawPath.idl
r267813 r279093 37 37 // undefined resetClip(); 38 38 39 // FIXME: All the unrestricted float parameters below should be unrestricted doubles. 40 boolean isPointInPath(unrestricted float x, unrestricted float y, optional CanvasFillRule fillRule = "nonzero"); 41 boolean isPointInPath(Path2D path, unrestricted float x, unrestricted float y, optional CanvasFillRule fillRule = "nonzero"); 42 boolean isPointInStroke(unrestricted float x, unrestricted float y); 43 boolean isPointInStroke(Path2D path, unrestricted float x, unrestricted float y); 39 boolean isPointInPath(unrestricted double x, unrestricted double y, optional CanvasFillRule fillRule = "nonzero"); 40 boolean isPointInPath(Path2D path, unrestricted double x, unrestricted double y, optional CanvasFillRule fillRule = "nonzero"); 41 boolean isPointInStroke(unrestricted double x, unrestricted double y); 42 boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y); 44 43 }; -
trunk/Source/WebCore/html/canvas/CanvasGradient.cpp
r277547 r279093 69 69 CanvasGradient::~CanvasGradient() = default; 70 70 71 ExceptionOr<void> CanvasGradient::addColorStop( floatvalue, const String& colorString)71 ExceptionOr<void> CanvasGradient::addColorStop(double value, const String& colorString) 72 72 { 73 73 if (!(value >= 0 && value <= 1)) … … 79 79 return Exception { SyntaxError }; 80 80 81 m_gradient->addColorStop({ value, WTFMove(color) });81 m_gradient->addColorStop({ static_cast<float>(value), WTFMove(color) }); 82 82 return { }; 83 83 } -
trunk/Source/WebCore/html/canvas/CanvasGradient.h
r277547 r279093 45 45 const Gradient& gradient() const { return m_gradient; } 46 46 47 ExceptionOr<void> addColorStop( floatvalue, const String& color);47 ExceptionOr<void> addColorStop(double value, const String& color); 48 48 49 49 private: -
trunk/Source/WebCore/html/canvas/CanvasGradient.idl
r274832 r279093 29 29 ImplementationLacksVTable 30 30 ] interface CanvasGradient { 31 // FIXME: The float parameters below should be a double.32 33 31 // opaque object 34 undefined addColorStop( floatoffset, DOMString color);32 undefined addColorStop(double offset, DOMString color); 35 33 }; -
trunk/Source/WebCore/html/canvas/CanvasPathDrawingStyles.idl
r267813 r279093 26 26 // https://html.spec.whatwg.org/multipage/canvas.html#canvaspathdrawingstyles 27 27 interface mixin CanvasPathDrawingStyles { 28 // FIXME: All the unrestricted float arguments / attributes below should be unrestricted doubles.29 30 28 // line caps/joins 31 attribute unrestricted floatlineWidth; // (default 1)29 attribute unrestricted double lineWidth; // (default 1) 32 30 attribute CanvasLineCap lineCap; // (default "butt") 33 31 attribute CanvasLineJoin lineJoin; // (default "miter") 34 attribute unrestricted floatmiterLimit; // (default 10)32 attribute unrestricted double miterLimit; // (default 10) 35 33 36 34 // dashed lines 37 undefined setLineDash(sequence<unrestricted float> segments); // default empty38 sequence<unrestricted float> getLineDash();39 attribute unrestricted floatlineDashOffset;35 undefined setLineDash(sequence<unrestricted double> segments); // default empty 36 sequence<unrestricted double> getLineDash(); 37 attribute unrestricted double lineDashOffset; 40 38 }; -
trunk/Source/WebCore/html/canvas/CanvasRect.idl
r267813 r279093 26 26 // https://html.spec.whatwg.org/multipage/canvas.html#canvasrect 27 27 interface mixin CanvasRect { 28 // FIXME: All the unrestricted float parameters below should be unrestricted doubles.29 30 28 // rects 31 undefined clearRect(unrestricted float x, unrestricted float y, unrestricted float w, unrestricted floath);32 undefined fillRect(unrestricted float x, unrestricted float y, unrestricted float w, unrestricted floath);33 undefined strokeRect(unrestricted float x, unrestricted float y, unrestricted float w, unrestricted floath);29 undefined clearRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); 30 undefined fillRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); 31 undefined strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); 34 32 }; -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r278253 r279093 182 182 } 183 183 184 void CanvasRenderingContext2D::fillText(const String& text, float x, float y, std::optional<float> maxWidth)184 void CanvasRenderingContext2D::fillText(const String& text, double x, double y, std::optional<double> maxWidth) 185 185 { 186 186 drawTextInternal(text, x, y, true, maxWidth); 187 187 } 188 188 189 void CanvasRenderingContext2D::strokeText(const String& text, float x, float y, std::optional<float> maxWidth)189 void CanvasRenderingContext2D::strokeText(const String& text, double x, double y, std::optional<double> maxWidth) 190 190 { 191 191 drawTextInternal(text, x, y, false, maxWidth); … … 225 225 } 226 226 227 void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, float y, bool fill, std::optional<float> maxWidth)227 void CanvasRenderingContext2D::drawTextInternal(const String& text, double x, double y, bool fill, std::optional<double> maxWidth) 228 228 { 229 229 downcast<HTMLCanvasElement>(canvasBase()).document().updateStyleIfNeeded(); -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h
r278253 r279093 50 50 CanvasDirection direction() const; 51 51 52 void fillText(const String& text, float x, float y, std::optional<float> maxWidth = std::nullopt);53 void strokeText(const String& text, float x, float y, std::optional<float> maxWidth = std::nullopt);52 void fillText(const String& text, double x, double y, std::optional<double> maxWidth = std::nullopt); 53 void strokeText(const String& text, double x, double y, std::optional<double> maxWidth = std::nullopt); 54 54 Ref<TextMetrics> measureText(const String& text); 55 55 … … 62 62 void setFontWithoutUpdatingStyle(const String&); 63 63 64 void drawTextInternal(const String& text, float x, float y, bool fill, std::optional<float> maxWidth = std::nullopt);64 void drawTextInternal(const String& text, double x, double y, bool fill, std::optional<double> maxWidth = std::nullopt); 65 65 66 66 void drawFocusIfNeededInternal(const Path&, Element&); -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl
r276777 r279093 65 65 undefined setLineJoin(optional DOMString join); 66 66 undefined setMiterLimit(optional unrestricted float limit = NaN); 67 attribute sequence<unrestricted float> webkitLineDash;68 [ImplementedAs=lineDashOffset] attribute unrestricted floatwebkitLineDashOffset;67 attribute sequence<unrestricted double> webkitLineDash; 68 [ImplementedAs=lineDashOffset] attribute unrestricted double webkitLineDashOffset; 69 69 70 70 // Non-standard legacy aliases (CanvasShadowStyles). -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
r278863 r279093 516 516 } 517 517 518 void CanvasRenderingContext2DBase::setLineWidth( floatwidth)518 void CanvasRenderingContext2DBase::setLineWidth(double width) 519 519 { 520 520 if (!(std::isfinite(width) && width > 0)) … … 586 586 } 587 587 588 void CanvasRenderingContext2DBase::setMiterLimit( floatlimit)588 void CanvasRenderingContext2DBase::setMiterLimit(double limit) 589 589 { 590 590 if (!(std::isfinite(limit) && limit > 0)) … … 645 645 } 646 646 647 static bool lineDashSequenceIsValid(const Vector< float>& dash)647 static bool lineDashSequenceIsValid(const Vector<double>& dash) 648 648 { 649 649 for (size_t i = 0; i < dash.size(); i++) { … … 654 654 } 655 655 656 void CanvasRenderingContext2DBase::setLineDash(const Vector< float>& dash)656 void CanvasRenderingContext2DBase::setLineDash(const Vector<double>& dash) 657 657 { 658 658 if (!lineDashSequenceIsValid(dash)) … … 669 669 } 670 670 671 void CanvasRenderingContext2DBase::setWebkitLineDash(const Vector< float>& dash)671 void CanvasRenderingContext2DBase::setWebkitLineDash(const Vector<double>& dash) 672 672 { 673 673 if (!lineDashSequenceIsValid(dash)) … … 680 680 } 681 681 682 void CanvasRenderingContext2DBase::setLineDashOffset( floatoffset)682 void CanvasRenderingContext2DBase::setLineDashOffset(double offset) 683 683 { 684 684 if (!std::isfinite(offset) || state().lineDashOffset == offset) … … 701 701 } 702 702 703 void CanvasRenderingContext2DBase::setGlobalAlpha( floatalpha)703 void CanvasRenderingContext2DBase::setGlobalAlpha(double alpha) 704 704 { 705 705 if (!(alpha >= 0 && alpha <= 1)) … … 732 732 } 733 733 734 void CanvasRenderingContext2DBase::scale( float sx, floatsy)734 void CanvasRenderingContext2DBase::scale(double sx, double sy) 735 735 { 736 736 GraphicsContext* c = drawingContext(); … … 760 760 } 761 761 762 void CanvasRenderingContext2DBase::rotate( floatangleInRadians)762 void CanvasRenderingContext2DBase::rotate(double angleInRadians) 763 763 { 764 764 GraphicsContext* c = drawingContext(); … … 783 783 } 784 784 785 void CanvasRenderingContext2DBase::translate( float tx, floatty)785 void CanvasRenderingContext2DBase::translate(double tx, double ty) 786 786 { 787 787 GraphicsContext* c = drawingContext(); … … 806 806 } 807 807 808 void CanvasRenderingContext2DBase::transform( float m11, float m12, float m21, float m22, float dx, floatdy)808 void CanvasRenderingContext2DBase::transform(double m11, double m12, double m21, double m22, double dx, double dy) 809 809 { 810 810 GraphicsContext* c = drawingContext(); … … 838 838 } 839 839 840 void CanvasRenderingContext2DBase::setTransform( float m11, float m12, float m21, float m22, float dx, floatdy)840 void CanvasRenderingContext2DBase::setTransform(double m11, double m12, double m21, double m22, double dx, double dy) 841 841 { 842 842 GraphicsContext* c = drawingContext(); … … 966 966 } 967 967 968 static bool validateRectForCanvas( float& x, float& y, float& width, float& height)968 static bool validateRectForCanvas(double& x, double& y, double& width, double& height) 969 969 { 970 970 if (!std::isfinite(x) | !std::isfinite(y) | !std::isfinite(width) | !std::isfinite(height)) … … 1138 1138 } 1139 1139 1140 bool CanvasRenderingContext2DBase::isPointInPath( float x, floaty, CanvasFillRule windingRule)1140 bool CanvasRenderingContext2DBase::isPointInPath(double x, double y, CanvasFillRule windingRule) 1141 1141 { 1142 1142 return isPointInPathInternal(m_path, x, y, windingRule); 1143 1143 } 1144 1144 1145 bool CanvasRenderingContext2DBase::isPointInStroke( float x, floaty)1145 bool CanvasRenderingContext2DBase::isPointInStroke(double x, double y) 1146 1146 { 1147 1147 return isPointInStrokeInternal(m_path, x, y); 1148 1148 } 1149 1149 1150 bool CanvasRenderingContext2DBase::isPointInPath(Path2D& path, float x, floaty, CanvasFillRule windingRule)1150 bool CanvasRenderingContext2DBase::isPointInPath(Path2D& path, double x, double y, CanvasFillRule windingRule) 1151 1151 { 1152 1152 return isPointInPathInternal(path.path(), x, y, windingRule); 1153 1153 } 1154 1154 1155 bool CanvasRenderingContext2DBase::isPointInStroke(Path2D& path, float x, floaty)1155 bool CanvasRenderingContext2DBase::isPointInStroke(Path2D& path, double x, double y) 1156 1156 { 1157 1157 return isPointInStrokeInternal(path.path(), x, y); 1158 1158 } 1159 1159 1160 bool CanvasRenderingContext2DBase::isPointInPathInternal(const Path& path, float x, floaty, CanvasFillRule windingRule)1160 bool CanvasRenderingContext2DBase::isPointInPathInternal(const Path& path, double x, double y, CanvasFillRule windingRule) 1161 1161 { 1162 1162 if (!drawingContext()) … … 1173 1173 } 1174 1174 1175 bool CanvasRenderingContext2DBase::isPointInStrokeInternal(const Path& path, float x, floaty)1175 bool CanvasRenderingContext2DBase::isPointInStrokeInternal(const Path& path, double x, double y) 1176 1176 { 1177 1177 if (!drawingContext()) … … 1198 1198 } 1199 1199 1200 void CanvasRenderingContext2DBase::clearRect( float x, float y, float width, floatheight)1200 void CanvasRenderingContext2DBase::clearRect(double x, double y, double width, double height) 1201 1201 { 1202 1202 if (!validateRectForCanvas(x, y, width, height)) … … 1235 1235 } 1236 1236 1237 void CanvasRenderingContext2DBase::fillRect( float x, float y, float width, floatheight)1237 void CanvasRenderingContext2DBase::fillRect(double x, double y, double width, double height) 1238 1238 { 1239 1239 if (!validateRectForCanvas(x, y, width, height)) … … 1279 1279 } 1280 1280 1281 void CanvasRenderingContext2DBase::strokeRect( float x, float y, float width, floatheight)1281 void CanvasRenderingContext2DBase::strokeRect(double x, double y, double width, double height) 1282 1282 { 1283 1283 if (!validateRectForCanvas(x, y, width, height)) … … 2353 2353 } 2354 2354 2355 bool CanvasRenderingContext2DBase::canDrawText( float x, float y, bool fill, std::optional<float> maxWidth)2355 bool CanvasRenderingContext2DBase::canDrawText(double x, double y, bool fill, std::optional<double> maxWidth) 2356 2356 { 2357 2357 if (!fontProxy()->realized()) … … 2410 2410 } 2411 2411 2412 void CanvasRenderingContext2DBase::drawText(const String& text, float x, float y, bool fill, std::optional<float> maxWidth)2412 void CanvasRenderingContext2DBase::drawText(const String& text, double x, double y, bool fill, std::optional<double> maxWidth) 2413 2413 { 2414 2414 if (!canDrawText(x, y, fill, maxWidth)) … … 2421 2421 } 2422 2422 2423 void CanvasRenderingContext2DBase::drawTextUnchecked(const TextRun& textRun, float x, float y, bool fill, std::optional<float> maxWidth)2423 void CanvasRenderingContext2DBase::drawTextUnchecked(const TextRun& textRun, double x, double y, bool fill, std::optional<double> maxWidth) 2424 2424 { 2425 2425 auto* c = drawingContext(); -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h
r278253 r279093 88 88 const CanvasRenderingContext2DSettings& getContextAttributes() const { return m_settings; } 89 89 90 floatlineWidth() const { return state().lineWidth; }91 void setLineWidth( float);90 double lineWidth() const { return state().lineWidth; } 91 void setLineWidth(double); 92 92 93 93 CanvasLineCap lineCap() const { return state().canvasLineCap(); } … … 99 99 void setLineJoin(const String&); 100 100 101 floatmiterLimit() const { return state().miterLimit; }102 void setMiterLimit( float);103 104 const Vector< float>& getLineDash() const { return state().lineDash; }105 void setLineDash(const Vector< float>&);106 107 const Vector< float>& webkitLineDash() const { return getLineDash(); }108 void setWebkitLineDash(const Vector< float>&);109 110 floatlineDashOffset() const { return state().lineDashOffset; }111 void setLineDashOffset( float);101 double miterLimit() const { return state().miterLimit; } 102 void setMiterLimit(double); 103 104 const Vector<double>& getLineDash() const { return state().lineDash; } 105 void setLineDash(const Vector<double>&); 106 107 const Vector<double>& webkitLineDash() const { return getLineDash(); } 108 void setWebkitLineDash(const Vector<double>&); 109 110 double lineDashOffset() const { return state().lineDashOffset; } 111 void setLineDashOffset(double); 112 112 113 113 float shadowOffsetX() const { return state().shadowOffset.width(); } … … 123 123 void setShadowColor(const String&); 124 124 125 floatglobalAlpha() const { return state().globalAlpha; }126 void setGlobalAlpha( float);125 double globalAlpha() const { return state().globalAlpha; } 126 void setGlobalAlpha(double); 127 127 128 128 String globalCompositeOperation() const { return state().globalCompositeOperationString(); } … … 132 132 void restore(); 133 133 134 void scale( float sx, floatsy);135 void rotate( floatangleInRadians);136 void translate( float tx, floatty);137 void transform( float m11, float m12, float m21, float m22, float dx, floatdy);134 void scale(double sx, double sy); 135 void rotate(double angleInRadians); 136 void translate(double tx, double ty); 137 void transform(double m11, double m12, double m21, double m22, double dx, double dy); 138 138 139 139 Ref<DOMMatrix> getTransform() const; 140 void setTransform( float m11, float m12, float m21, float m22, float dx, floatdy);140 void setTransform(double m11, double m12, double m21, double m22, double dx, double dy); 141 141 ExceptionOr<void> setTransform(DOMMatrix2DInit&&); 142 142 void resetTransform(); … … 160 160 void clip(Path2D&, CanvasFillRule = CanvasFillRule::Nonzero); 161 161 162 bool isPointInPath( float x, floaty, CanvasFillRule = CanvasFillRule::Nonzero);163 bool isPointInStroke( float x, floaty);164 165 bool isPointInPath(Path2D&, float x, floaty, CanvasFillRule = CanvasFillRule::Nonzero);166 bool isPointInStroke(Path2D&, float x, floaty);167 168 void clearRect( float x, float y, float width, floatheight);169 void fillRect( float x, float y, float width, floatheight);170 void strokeRect( float x, float y, float width, floatheight);162 bool isPointInPath(double x, double y, CanvasFillRule = CanvasFillRule::Nonzero); 163 bool isPointInStroke(double x, double y); 164 165 bool isPointInPath(Path2D&, double x, double y, CanvasFillRule = CanvasFillRule::Nonzero); 166 bool isPointInStroke(Path2D&, double x, double y); 167 168 void clearRect(double x, double y, double width, double height); 169 void fillRect(double x, double y, double width, double height); 170 void strokeRect(double x, double y, double width, double height); 171 171 172 172 void setShadow(float width, float height, float blur, const String& color = String(), std::optional<float> alpha = std::nullopt); … … 258 258 CanvasStyle strokeStyle; 259 259 CanvasStyle fillStyle; 260 floatlineWidth;260 double lineWidth; 261 261 LineCap lineCap; 262 262 LineJoin lineJoin; 263 floatmiterLimit;263 double miterLimit; 264 264 FloatSize shadowOffset; 265 265 float shadowBlur; 266 266 Color shadowColor; 267 floatglobalAlpha;267 double globalAlpha; 268 268 CompositeOperator globalComposite; 269 269 BlendMode globalBlend; 270 270 AffineTransform transform; 271 271 bool hasInvertibleTransform; 272 Vector< float> lineDash;273 floatlineDashOffset;272 Vector<double> lineDash; 273 double lineDashOffset; 274 274 bool imageSmoothingEnabled; 275 275 ImageSmoothingQuality imageSmoothingQuality; … … 303 303 static String normalizeSpaces(const String&); 304 304 305 void drawText(const String& text, float x, float y, bool fill, std::optional<float> maxWidth = std::nullopt);306 bool canDrawText( float x, float y, bool fill, std::optional<float> maxWidth = std::nullopt);307 void drawTextUnchecked(const TextRun&, float x, float y, bool fill, std::optional<float> maxWidth = std::nullopt);305 void drawText(const String& text, double x, double y, bool fill, std::optional<double> maxWidth = std::nullopt); 306 bool canDrawText(double x, double y, bool fill, std::optional<double> maxWidth = std::nullopt); 307 void drawTextUnchecked(const TextRun&, double x, double y, bool fill, std::optional<double> maxWidth = std::nullopt); 308 308 309 309 Ref<TextMetrics> measureTextInternal(const TextRun&); … … 372 372 void clipInternal(const Path&, CanvasFillRule); 373 373 374 bool isPointInPathInternal(const Path&, float x, floaty, CanvasFillRule);375 bool isPointInStrokeInternal(const Path&, float x, floaty);374 bool isPointInPathInternal(const Path&, double x, double y, CanvasFillRule); 375 bool isPointInStrokeInternal(const Path&, double x, double y); 376 376 377 377 Path transformAreaToDevice(const Path&) const; -
trunk/Source/WebCore/html/canvas/CanvasShadowStyles.idl
r267813 r279093 26 26 // https://html.spec.whatwg.org/multipage/canvas.html#canvasshadowstyles 27 27 interface mixin CanvasShadowStyles { 28 // FIXME: All the unrestricted float attributes below should be unrestricted doubles.29 30 28 // shadows 31 29 attribute unrestricted double shadowOffsetX; // (default 0) -
trunk/Source/WebCore/html/canvas/CanvasText.idl
r267813 r279093 26 26 // https://html.spec.whatwg.org/multipage/canvas.html#canvastext 27 27 interface mixin CanvasText { 28 // FIXME: All the unrestricted float parameters below should be unrestricted doubles.29 30 28 // text (see also the CanvasPathDrawingStyles and CanvasTextDrawingStyles interfaces) 31 undefined fillText(DOMString text, unrestricted float x, unrestricted float y, optional unrestricted floatmaxWidth);32 undefined strokeText(DOMString text, unrestricted float x, unrestricted float y, optional unrestricted floatmaxWidth);29 undefined fillText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth); 30 undefined strokeText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth); 33 31 TextMetrics measureText(DOMString text); 34 32 }; -
trunk/Source/WebCore/html/canvas/CanvasTransform.idl
r274832 r279093 26 26 // https://html.spec.whatwg.org/multipage/canvas.html#canvastransform 27 27 interface mixin CanvasTransform { 28 // FIXME: All the unrestricted float parameters below should be unrestricted doubles.29 30 28 // transformations (default transform is the identity matrix) 31 undefined scale(unrestricted float x, unrestricted floaty);32 undefined rotate(unrestricted floatangle);33 undefined translate(unrestricted float x, unrestricted floaty);34 undefined transform(unrestricted float a, unrestricted float b, unrestricted float c, unrestricted float d, unrestricted float e, unrestricted floatf);29 undefined scale(unrestricted double x, unrestricted double y); 30 undefined rotate(unrestricted double angle); 31 undefined translate(unrestricted double x, unrestricted double y); 32 undefined transform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f); 35 33 36 34 [NewObject] DOMMatrix getTransform(); 37 undefined setTransform(unrestricted float a, unrestricted float b, unrestricted float c, unrestricted float d, unrestricted float e, unrestricted floatf);35 undefined setTransform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f); 38 36 undefined setTransform(optional DOMMatrix2DInit transform); 39 37 undefined resetTransform(); -
trunk/Source/WebCore/html/canvas/OffscreenCanvasRenderingContext2D.cpp
r278253 r279093 127 127 } 128 128 129 void OffscreenCanvasRenderingContext2D::fillText(const String& text, float x, float y, std::optional<float> maxWidth)129 void OffscreenCanvasRenderingContext2D::fillText(const String& text, double x, double y, std::optional<double> maxWidth) 130 130 { 131 131 drawText(text, x, y, true, maxWidth); 132 132 } 133 133 134 void OffscreenCanvasRenderingContext2D::strokeText(const String& text, float x, float y, std::optional<float> maxWidth)134 void OffscreenCanvasRenderingContext2D::strokeText(const String& text, double x, double y, std::optional<double> maxWidth) 135 135 { 136 136 drawText(text, x, y, false, maxWidth); -
trunk/Source/WebCore/html/canvas/OffscreenCanvasRenderingContext2D.h
r278253 r279093 48 48 void setFont(const String&); 49 49 CanvasDirection direction() const; 50 void fillText(const String& text, float x, float y, std::optional<float> maxWidth = std::nullopt);51 void strokeText(const String& text, float x, float y, std::optional<float> maxWidth = std::nullopt);50 void fillText(const String& text, double x, double y, std::optional<double> maxWidth = std::nullopt); 51 void strokeText(const String& text, double x, double y, std::optional<double> maxWidth = std::nullopt); 52 52 Ref<TextMetrics> measureText(const String& text); 53 53 -
trunk/Source/WebCore/inspector/InspectorCanvas.cpp
r278340 r279093 439 439 } 440 440 441 std::optional<InspectorCanvasCallTracer::ProcessedArgument> InspectorCanvas::processArgument(std::optional<double>& argument) 442 { 443 if (!argument) 444 return std::nullopt; 445 return {{ JSON::Value::create(*argument), RecordingSwizzleType::Number }}; 446 } 447 441 448 std::optional<InspectorCanvasCallTracer::ProcessedArgument> InspectorCanvas::processArgument(std::optional<float>& argument) 442 449 { … … 535 542 }); 536 543 return {{ buildArrayForVector(WTFMove(deduplicated)), RecordingSwizzleType::String }}; 544 } 545 546 std::optional<InspectorCanvasCallTracer::ProcessedArgument> InspectorCanvas::processArgument(Vector<double>& argument) 547 { 548 return {{ buildArrayForVector(argument), RecordingSwizzleType::Array }}; 537 549 } 538 550 -
trunk/Source/WebCore/inspector/InspectorCanvasCallTracer.h
r278340 r279093 154 154 macro(ImageSmoothingQuality) \ 155 155 macro(std::optional<float>&) \ 156 macro(std::optional<double>&) \ 156 157 macro(Path2D*) \ 157 158 macro(RefPtr<CanvasGradient>&) \ … … 169 170 macro(Vector<String>&) \ 170 171 macro(Vector<float>&) \ 172 macro(Vector<double>&) \ 171 173 macro(Vector<uint32_t>&) \ 172 174 macro(Vector<int32_t>&) \
Note:
See TracChangeset
for help on using the changeset viewer.