⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 279093 in webkit


Ignore:
Timestamp:
Jun 21, 2021, 5:22:44 PM (5 years ago)
Author:
Chris Dumez
Message:

Use double instead of float where appropriate in HTML Canvas IDL
https://bugs.webkit.org/show_bug.cgi?id=227238

Reviewed by Sam Weinig.

There are a lot of places in our HTML Canvas IDL where we're using float type, even though
the specification is using double. This patch fixes those.

  • html/canvas/CanvasCompositing.idl:
  • html/canvas/CanvasDrawImage.idl:
  • html/canvas/CanvasDrawPath.idl:
  • html/canvas/CanvasGradient.cpp:

(WebCore::CanvasGradient::addColorStop):

  • html/canvas/CanvasGradient.h:
  • html/canvas/CanvasGradient.idl:
  • html/canvas/CanvasPathDrawingStyles.idl:
  • html/canvas/CanvasRect.idl:
  • html/canvas/CanvasRenderingContext2D.cpp:

(WebCore::CanvasRenderingContext2D::fillText):
(WebCore::CanvasRenderingContext2D::strokeText):
(WebCore::CanvasRenderingContext2D::drawTextInternal):

  • html/canvas/CanvasRenderingContext2D.h:
  • html/canvas/CanvasRenderingContext2D.idl:
  • html/canvas/CanvasRenderingContext2DBase.cpp:

(WebCore::CanvasRenderingContext2DBase::setLineWidth):
(WebCore::CanvasRenderingContext2DBase::setMiterLimit):
(WebCore::lineDashSequenceIsValid):
(WebCore::CanvasRenderingContext2DBase::setLineDash):
(WebCore::CanvasRenderingContext2DBase::setWebkitLineDash):
(WebCore::CanvasRenderingContext2DBase::setLineDashOffset):
(WebCore::CanvasRenderingContext2DBase::setGlobalAlpha):
(WebCore::CanvasRenderingContext2DBase::scale):
(WebCore::CanvasRenderingContext2DBase::rotate):
(WebCore::CanvasRenderingContext2DBase::translate):
(WebCore::CanvasRenderingContext2DBase::transform):
(WebCore::CanvasRenderingContext2DBase::setTransform):
(WebCore::validateRectForCanvas):
(WebCore::CanvasRenderingContext2DBase::isPointInPath):
(WebCore::CanvasRenderingContext2DBase::isPointInStroke):
(WebCore::CanvasRenderingContext2DBase::isPointInPathInternal):
(WebCore::CanvasRenderingContext2DBase::isPointInStrokeInternal):
(WebCore::CanvasRenderingContext2DBase::clearRect):
(WebCore::CanvasRenderingContext2DBase::fillRect):
(WebCore::CanvasRenderingContext2DBase::strokeRect):
(WebCore::CanvasRenderingContext2DBase::canDrawText):
(WebCore::CanvasRenderingContext2DBase::drawText):
(WebCore::CanvasRenderingContext2DBase::drawTextUnchecked):

  • html/canvas/CanvasRenderingContext2DBase.h:

(WebCore::CanvasRenderingContext2DBase::lineWidth const):
(WebCore::CanvasRenderingContext2DBase::miterLimit const):
(WebCore::CanvasRenderingContext2DBase::getLineDash const):
(WebCore::CanvasRenderingContext2DBase::webkitLineDash const):
(WebCore::CanvasRenderingContext2DBase::lineDashOffset const):
(WebCore::CanvasRenderingContext2DBase::globalAlpha const):

  • html/canvas/CanvasShadowStyles.idl:
  • html/canvas/CanvasText.idl:
  • html/canvas/CanvasTransform.idl:
  • html/canvas/OffscreenCanvasRenderingContext2D.cpp:

(WebCore::OffscreenCanvasRenderingContext2D::fillText):
(WebCore::OffscreenCanvasRenderingContext2D::strokeText):

  • html/canvas/OffscreenCanvasRenderingContext2D.h:
  • inspector/InspectorCanvas.cpp:

(WebCore::InspectorCanvas::processArgument):

  • inspector/InspectorCanvasCallTracer.h:
Location:
trunk/Source/WebCore
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r279085 r279093  
     12021-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
    1682021-06-21  Fujii Hironori  <Hironori.Fujii@sony.com>
    269
  • trunk/Source/WebCore/html/canvas/CanvasCompositing.idl

    r267813 r279093  
    2626// https://html.spec.whatwg.org/multipage/canvas.html#canvascompositing
    2727interface mixin CanvasCompositing {
    28     // FIXME: All the unrestricted float attributes below should be unrestricted doubles.
    29 
    3028    // compositing
    31     attribute unrestricted float globalAlpha; // (default 1.0)
     29    attribute unrestricted double globalAlpha; // (default 1.0)
    3230    attribute DOMString globalCompositeOperation; // (default source-over)
    3331};
  • trunk/Source/WebCore/html/canvas/CanvasDrawImage.idl

    r274832 r279093  
    3939// https://html.spec.whatwg.org/multipage/canvas.html#canvasdrawimage
    4040interface mixin CanvasDrawImage {
    41     // FIXME: All the unrestricted float arguments below should be unrestricted doubles.
    42 
    4341    // drawing images
    4442    undefined drawImage(CanvasImageSource image, unrestricted double dx, unrestricted double dy);
  • trunk/Source/WebCore/html/canvas/CanvasDrawPath.idl

    r267813 r279093  
    3737    // undefined resetClip();
    3838
    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);
    4443};
  • trunk/Source/WebCore/html/canvas/CanvasGradient.cpp

    r277547 r279093  
    6969CanvasGradient::~CanvasGradient() = default;
    7070
    71 ExceptionOr<void> CanvasGradient::addColorStop(float value, const String& colorString)
     71ExceptionOr<void> CanvasGradient::addColorStop(double value, const String& colorString)
    7272{
    7373    if (!(value >= 0 && value <= 1))
     
    7979        return Exception { SyntaxError };
    8080
    81     m_gradient->addColorStop({ value, WTFMove(color) });
     81    m_gradient->addColorStop({ static_cast<float>(value), WTFMove(color) });
    8282    return { };
    8383}
  • trunk/Source/WebCore/html/canvas/CanvasGradient.h

    r277547 r279093  
    4545    const Gradient& gradient() const { return m_gradient; }
    4646
    47     ExceptionOr<void> addColorStop(float value, const String& color);
     47    ExceptionOr<void> addColorStop(double value, const String& color);
    4848
    4949private:
  • trunk/Source/WebCore/html/canvas/CanvasGradient.idl

    r274832 r279093  
    2929    ImplementationLacksVTable
    3030] interface CanvasGradient {
    31     // FIXME: The float parameters below should be a double.
    32 
    3331    // opaque object
    34     undefined addColorStop(float offset, DOMString color);
     32    undefined addColorStop(double offset, DOMString color);
    3533};
  • trunk/Source/WebCore/html/canvas/CanvasPathDrawingStyles.idl

    r267813 r279093  
    2626// https://html.spec.whatwg.org/multipage/canvas.html#canvaspathdrawingstyles
    2727interface mixin CanvasPathDrawingStyles {
    28     // FIXME: All the unrestricted float arguments / attributes below should be unrestricted doubles.
    29 
    3028    // line caps/joins
    31     attribute unrestricted float lineWidth; // (default 1)
     29    attribute unrestricted double lineWidth; // (default 1)
    3230    attribute CanvasLineCap lineCap; // (default "butt")
    3331    attribute CanvasLineJoin lineJoin; // (default "miter")
    34     attribute unrestricted float miterLimit; // (default 10)
     32    attribute unrestricted double miterLimit; // (default 10)
    3533
    3634    // dashed lines
    37     undefined setLineDash(sequence<unrestricted float> segments); // default empty
    38     sequence<unrestricted float> getLineDash();
    39     attribute unrestricted float lineDashOffset;
     35    undefined setLineDash(sequence<unrestricted double> segments); // default empty
     36    sequence<unrestricted double> getLineDash();
     37    attribute unrestricted double lineDashOffset;
    4038};
  • trunk/Source/WebCore/html/canvas/CanvasRect.idl

    r267813 r279093  
    2626// https://html.spec.whatwg.org/multipage/canvas.html#canvasrect
    2727interface mixin CanvasRect {
    28     // FIXME: All the unrestricted float parameters below should be unrestricted doubles.
    29 
    3028    // rects
    31     undefined clearRect(unrestricted float x, unrestricted float y, unrestricted float w, unrestricted float h);
    32     undefined fillRect(unrestricted float x, unrestricted float y, unrestricted float w, unrestricted float h);
    33     undefined strokeRect(unrestricted float x, unrestricted float y, unrestricted float w, unrestricted float h);
     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);
    3432};
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r278253 r279093  
    182182}
    183183
    184 void CanvasRenderingContext2D::fillText(const String& text, float x, float y, std::optional<float> maxWidth)
     184void CanvasRenderingContext2D::fillText(const String& text, double x, double y, std::optional<double> maxWidth)
    185185{
    186186    drawTextInternal(text, x, y, true, maxWidth);
    187187}
    188188
    189 void CanvasRenderingContext2D::strokeText(const String& text, float x, float y, std::optional<float> maxWidth)
     189void CanvasRenderingContext2D::strokeText(const String& text, double x, double y, std::optional<double> maxWidth)
    190190{
    191191    drawTextInternal(text, x, y, false, maxWidth);
     
    225225}
    226226
    227 void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, float y, bool fill, std::optional<float> maxWidth)
     227void CanvasRenderingContext2D::drawTextInternal(const String& text, double x, double y, bool fill, std::optional<double> maxWidth)
    228228{
    229229    downcast<HTMLCanvasElement>(canvasBase()).document().updateStyleIfNeeded();
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h

    r278253 r279093  
    5050    CanvasDirection direction() const;
    5151
    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);
    5454    Ref<TextMetrics> measureText(const String& text);
    5555
     
    6262    void setFontWithoutUpdatingStyle(const String&);
    6363
    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);
    6565
    6666    void drawFocusIfNeededInternal(const Path&, Element&);
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl

    r276777 r279093  
    6565    undefined setLineJoin(optional DOMString join);
    6666    undefined setMiterLimit(optional unrestricted float limit = NaN);
    67     attribute sequence<unrestricted float> webkitLineDash;
    68     [ImplementedAs=lineDashOffset] attribute unrestricted float webkitLineDashOffset;
     67    attribute sequence<unrestricted double> webkitLineDash;
     68    [ImplementedAs=lineDashOffset] attribute unrestricted double webkitLineDashOffset;
    6969
    7070    // Non-standard legacy aliases (CanvasShadowStyles).
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp

    r278863 r279093  
    516516}
    517517
    518 void CanvasRenderingContext2DBase::setLineWidth(float width)
     518void CanvasRenderingContext2DBase::setLineWidth(double width)
    519519{
    520520    if (!(std::isfinite(width) && width > 0))
     
    586586}
    587587
    588 void CanvasRenderingContext2DBase::setMiterLimit(float limit)
     588void CanvasRenderingContext2DBase::setMiterLimit(double limit)
    589589{
    590590    if (!(std::isfinite(limit) && limit > 0))
     
    645645}
    646646
    647 static bool lineDashSequenceIsValid(const Vector<float>& dash)
     647static bool lineDashSequenceIsValid(const Vector<double>& dash)
    648648{
    649649    for (size_t i = 0; i < dash.size(); i++) {
     
    654654}
    655655
    656 void CanvasRenderingContext2DBase::setLineDash(const Vector<float>& dash)
     656void CanvasRenderingContext2DBase::setLineDash(const Vector<double>& dash)
    657657{
    658658    if (!lineDashSequenceIsValid(dash))
     
    669669}
    670670
    671 void CanvasRenderingContext2DBase::setWebkitLineDash(const Vector<float>& dash)
     671void CanvasRenderingContext2DBase::setWebkitLineDash(const Vector<double>& dash)
    672672{
    673673    if (!lineDashSequenceIsValid(dash))
     
    680680}
    681681
    682 void CanvasRenderingContext2DBase::setLineDashOffset(float offset)
     682void CanvasRenderingContext2DBase::setLineDashOffset(double offset)
    683683{
    684684    if (!std::isfinite(offset) || state().lineDashOffset == offset)
     
    701701}
    702702
    703 void CanvasRenderingContext2DBase::setGlobalAlpha(float alpha)
     703void CanvasRenderingContext2DBase::setGlobalAlpha(double alpha)
    704704{
    705705    if (!(alpha >= 0 && alpha <= 1))
     
    732732}
    733733
    734 void CanvasRenderingContext2DBase::scale(float sx, float sy)
     734void CanvasRenderingContext2DBase::scale(double sx, double sy)
    735735{
    736736    GraphicsContext* c = drawingContext();
     
    760760}
    761761
    762 void CanvasRenderingContext2DBase::rotate(float angleInRadians)
     762void CanvasRenderingContext2DBase::rotate(double angleInRadians)
    763763{
    764764    GraphicsContext* c = drawingContext();
     
    783783}
    784784
    785 void CanvasRenderingContext2DBase::translate(float tx, float ty)
     785void CanvasRenderingContext2DBase::translate(double tx, double ty)
    786786{
    787787    GraphicsContext* c = drawingContext();
     
    806806}
    807807
    808 void CanvasRenderingContext2DBase::transform(float m11, float m12, float m21, float m22, float dx, float dy)
     808void CanvasRenderingContext2DBase::transform(double m11, double m12, double m21, double m22, double dx, double dy)
    809809{
    810810    GraphicsContext* c = drawingContext();
     
    838838}
    839839
    840 void CanvasRenderingContext2DBase::setTransform(float m11, float m12, float m21, float m22, float dx, float dy)
     840void CanvasRenderingContext2DBase::setTransform(double m11, double m12, double m21, double m22, double dx, double dy)
    841841{
    842842    GraphicsContext* c = drawingContext();
     
    966966}
    967967
    968 static bool validateRectForCanvas(float& x, float& y, float& width, float& height)
     968static bool validateRectForCanvas(double& x, double& y, double& width, double& height)
    969969{
    970970    if (!std::isfinite(x) | !std::isfinite(y) | !std::isfinite(width) | !std::isfinite(height))
     
    11381138}
    11391139
    1140 bool CanvasRenderingContext2DBase::isPointInPath(float x, float y, CanvasFillRule windingRule)
     1140bool CanvasRenderingContext2DBase::isPointInPath(double x, double y, CanvasFillRule windingRule)
    11411141{
    11421142    return isPointInPathInternal(m_path, x, y, windingRule);
    11431143}
    11441144
    1145 bool CanvasRenderingContext2DBase::isPointInStroke(float x, float y)
     1145bool CanvasRenderingContext2DBase::isPointInStroke(double x, double y)
    11461146{
    11471147    return isPointInStrokeInternal(m_path, x, y);
    11481148}
    11491149
    1150 bool CanvasRenderingContext2DBase::isPointInPath(Path2D& path, float x, float y, CanvasFillRule windingRule)
     1150bool CanvasRenderingContext2DBase::isPointInPath(Path2D& path, double x, double y, CanvasFillRule windingRule)
    11511151{
    11521152    return isPointInPathInternal(path.path(), x, y, windingRule);
    11531153}
    11541154
    1155 bool CanvasRenderingContext2DBase::isPointInStroke(Path2D& path, float x, float y)
     1155bool CanvasRenderingContext2DBase::isPointInStroke(Path2D& path, double x, double y)
    11561156{
    11571157    return isPointInStrokeInternal(path.path(), x, y);
    11581158}
    11591159
    1160 bool CanvasRenderingContext2DBase::isPointInPathInternal(const Path& path, float x, float y, CanvasFillRule windingRule)
     1160bool CanvasRenderingContext2DBase::isPointInPathInternal(const Path& path, double x, double y, CanvasFillRule windingRule)
    11611161{
    11621162    if (!drawingContext())
     
    11731173}
    11741174
    1175 bool CanvasRenderingContext2DBase::isPointInStrokeInternal(const Path& path, float x, float y)
     1175bool CanvasRenderingContext2DBase::isPointInStrokeInternal(const Path& path, double x, double y)
    11761176{
    11771177    if (!drawingContext())
     
    11981198}
    11991199
    1200 void CanvasRenderingContext2DBase::clearRect(float x, float y, float width, float height)
     1200void CanvasRenderingContext2DBase::clearRect(double x, double y, double width, double height)
    12011201{
    12021202    if (!validateRectForCanvas(x, y, width, height))
     
    12351235}
    12361236
    1237 void CanvasRenderingContext2DBase::fillRect(float x, float y, float width, float height)
     1237void CanvasRenderingContext2DBase::fillRect(double x, double y, double width, double height)
    12381238{
    12391239    if (!validateRectForCanvas(x, y, width, height))
     
    12791279}
    12801280
    1281 void CanvasRenderingContext2DBase::strokeRect(float x, float y, float width, float height)
     1281void CanvasRenderingContext2DBase::strokeRect(double x, double y, double width, double height)
    12821282{
    12831283    if (!validateRectForCanvas(x, y, width, height))
     
    23532353}
    23542354
    2355 bool CanvasRenderingContext2DBase::canDrawText(float x, float y, bool fill, std::optional<float> maxWidth)
     2355bool CanvasRenderingContext2DBase::canDrawText(double x, double y, bool fill, std::optional<double> maxWidth)
    23562356{
    23572357    if (!fontProxy()->realized())
     
    24102410}
    24112411
    2412 void CanvasRenderingContext2DBase::drawText(const String& text, float x, float y, bool fill, std::optional<float> maxWidth)
     2412void CanvasRenderingContext2DBase::drawText(const String& text, double x, double y, bool fill, std::optional<double> maxWidth)
    24132413{
    24142414    if (!canDrawText(x, y, fill, maxWidth))
     
    24212421}
    24222422
    2423 void CanvasRenderingContext2DBase::drawTextUnchecked(const TextRun& textRun, float x, float y, bool fill, std::optional<float> maxWidth)
     2423void CanvasRenderingContext2DBase::drawTextUnchecked(const TextRun& textRun, double x, double y, bool fill, std::optional<double> maxWidth)
    24242424{
    24252425    auto* c = drawingContext();
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h

    r278253 r279093  
    8888    const CanvasRenderingContext2DSettings& getContextAttributes() const { return m_settings; }
    8989
    90     float lineWidth() const { return state().lineWidth; }
    91     void setLineWidth(float);
     90    double lineWidth() const { return state().lineWidth; }
     91    void setLineWidth(double);
    9292
    9393    CanvasLineCap lineCap() const { return state().canvasLineCap(); }
     
    9999    void setLineJoin(const String&);
    100100
    101     float miterLimit() 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     float lineDashOffset() 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);
    112112
    113113    float shadowOffsetX() const { return state().shadowOffset.width(); }
     
    123123    void setShadowColor(const String&);
    124124
    125     float globalAlpha() const { return state().globalAlpha; }
    126     void setGlobalAlpha(float);
     125    double globalAlpha() const { return state().globalAlpha; }
     126    void setGlobalAlpha(double);
    127127
    128128    String globalCompositeOperation() const { return state().globalCompositeOperationString(); }
     
    132132    void restore();
    133133
    134     void scale(float sx, float sy);
    135     void rotate(float angleInRadians);
    136     void translate(float tx, float ty);
    137     void transform(float m11, float m12, float m21, float m22, float dx, float dy);
     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);
    138138
    139139    Ref<DOMMatrix> getTransform() const;
    140     void setTransform(float m11, float m12, float m21, float m22, float dx, float dy);
     140    void setTransform(double m11, double m12, double m21, double m22, double dx, double dy);
    141141    ExceptionOr<void> setTransform(DOMMatrix2DInit&&);
    142142    void resetTransform();
     
    160160    void clip(Path2D&, CanvasFillRule = CanvasFillRule::Nonzero);
    161161
    162     bool isPointInPath(float x, float y, CanvasFillRule = CanvasFillRule::Nonzero);
    163     bool isPointInStroke(float x, float y);
    164 
    165     bool isPointInPath(Path2D&, float x, float y, CanvasFillRule = CanvasFillRule::Nonzero);
    166     bool isPointInStroke(Path2D&, float x, float y);
    167 
    168     void clearRect(float x, float y, float width, float height);
    169     void fillRect(float x, float y, float width, float height);
    170     void strokeRect(float x, float y, float width, float height);
     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);
    171171
    172172    void setShadow(float width, float height, float blur, const String& color = String(), std::optional<float> alpha = std::nullopt);
     
    258258        CanvasStyle strokeStyle;
    259259        CanvasStyle fillStyle;
    260         float lineWidth;
     260        double lineWidth;
    261261        LineCap lineCap;
    262262        LineJoin lineJoin;
    263         float miterLimit;
     263        double miterLimit;
    264264        FloatSize shadowOffset;
    265265        float shadowBlur;
    266266        Color shadowColor;
    267         float globalAlpha;
     267        double globalAlpha;
    268268        CompositeOperator globalComposite;
    269269        BlendMode globalBlend;
    270270        AffineTransform transform;
    271271        bool hasInvertibleTransform;
    272         Vector<float> lineDash;
    273         float lineDashOffset;
     272        Vector<double> lineDash;
     273        double lineDashOffset;
    274274        bool imageSmoothingEnabled;
    275275        ImageSmoothingQuality imageSmoothingQuality;
     
    303303    static String normalizeSpaces(const String&);
    304304
    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);
    308308
    309309    Ref<TextMetrics> measureTextInternal(const TextRun&);
     
    372372    void clipInternal(const Path&, CanvasFillRule);
    373373
    374     bool isPointInPathInternal(const Path&, float x, float y, CanvasFillRule);
    375     bool isPointInStrokeInternal(const Path&, float x, float y);
     374    bool isPointInPathInternal(const Path&, double x, double y, CanvasFillRule);
     375    bool isPointInStrokeInternal(const Path&, double x, double y);
    376376
    377377    Path transformAreaToDevice(const Path&) const;
  • trunk/Source/WebCore/html/canvas/CanvasShadowStyles.idl

    r267813 r279093  
    2626// https://html.spec.whatwg.org/multipage/canvas.html#canvasshadowstyles
    2727interface mixin CanvasShadowStyles {
    28     // FIXME: All the unrestricted float attributes below should be unrestricted doubles.
    29 
    3028    // shadows
    3129    attribute unrestricted double shadowOffsetX; // (default 0)
  • trunk/Source/WebCore/html/canvas/CanvasText.idl

    r267813 r279093  
    2626// https://html.spec.whatwg.org/multipage/canvas.html#canvastext
    2727interface mixin CanvasText {
    28     // FIXME: All the unrestricted float parameters below should be unrestricted doubles.
    29 
    3028    // text (see also the CanvasPathDrawingStyles and CanvasTextDrawingStyles interfaces)
    31     undefined fillText(DOMString text, unrestricted float x, unrestricted float y, optional unrestricted float maxWidth);
    32     undefined strokeText(DOMString text, unrestricted float x, unrestricted float y, optional unrestricted float maxWidth);
     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);
    3331    TextMetrics measureText(DOMString text);
    3432};
  • trunk/Source/WebCore/html/canvas/CanvasTransform.idl

    r274832 r279093  
    2626// https://html.spec.whatwg.org/multipage/canvas.html#canvastransform
    2727interface mixin CanvasTransform {
    28     // FIXME: All the unrestricted float parameters below should be unrestricted doubles.
    29 
    3028    // transformations (default transform is the identity matrix)
    31     undefined scale(unrestricted float x, unrestricted float y);
    32     undefined rotate(unrestricted float angle);
    33     undefined translate(unrestricted float x, unrestricted float y);
    34     undefined transform(unrestricted float a, unrestricted float b, unrestricted float c, unrestricted float d, unrestricted float e, unrestricted float f);
     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);
    3533
    3634    [NewObject] DOMMatrix getTransform();
    37     undefined setTransform(unrestricted float a, unrestricted float b, unrestricted float c, unrestricted float d, unrestricted float e, unrestricted float f);
     35    undefined setTransform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
    3836    undefined setTransform(optional DOMMatrix2DInit transform);
    3937    undefined resetTransform();
  • trunk/Source/WebCore/html/canvas/OffscreenCanvasRenderingContext2D.cpp

    r278253 r279093  
    127127}
    128128
    129 void OffscreenCanvasRenderingContext2D::fillText(const String& text, float x, float y, std::optional<float> maxWidth)
     129void OffscreenCanvasRenderingContext2D::fillText(const String& text, double x, double y, std::optional<double> maxWidth)
    130130{
    131131    drawText(text, x, y, true, maxWidth);
    132132}
    133133
    134 void OffscreenCanvasRenderingContext2D::strokeText(const String& text, float x, float y, std::optional<float> maxWidth)
     134void OffscreenCanvasRenderingContext2D::strokeText(const String& text, double x, double y, std::optional<double> maxWidth)
    135135{
    136136    drawText(text, x, y, false, maxWidth);
  • trunk/Source/WebCore/html/canvas/OffscreenCanvasRenderingContext2D.h

    r278253 r279093  
    4848    void setFont(const String&);
    4949    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);
    5252    Ref<TextMetrics> measureText(const String& text);
    5353
  • trunk/Source/WebCore/inspector/InspectorCanvas.cpp

    r278340 r279093  
    439439}
    440440
     441std::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
    441448std::optional<InspectorCanvasCallTracer::ProcessedArgument> InspectorCanvas::processArgument(std::optional<float>& argument)
    442449{
     
    535542    });
    536543    return {{ buildArrayForVector(WTFMove(deduplicated)), RecordingSwizzleType::String }};
     544}
     545
     546std::optional<InspectorCanvasCallTracer::ProcessedArgument> InspectorCanvas::processArgument(Vector<double>& argument)
     547{
     548    return {{ buildArrayForVector(argument), RecordingSwizzleType::Array }};
    537549}
    538550
  • trunk/Source/WebCore/inspector/InspectorCanvasCallTracer.h

    r278340 r279093  
    154154    macro(ImageSmoothingQuality) \
    155155    macro(std::optional<float>&) \
     156    macro(std::optional<double>&) \
    156157    macro(Path2D*) \
    157158    macro(RefPtr<CanvasGradient>&) \
     
    169170    macro(Vector<String>&) \
    170171    macro(Vector<float>&) \
     172    macro(Vector<double>&) \
    171173    macro(Vector<uint32_t>&) \
    172174    macro(Vector<int32_t>&) \
Note: See TracChangeset for help on using the changeset viewer.