Bug 156995 - [Web IDL] Specify default values for optional parameters of type 'float' / 'unrestricted float'
Summary: [Web IDL] Specify default values for optional parameters of type 'float' / 'u...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-25 14:20 PDT by Chris Dumez
Modified: 2016-04-25 16:38 PDT (History)
8 users (show)

See Also:


Attachments
Patch (17.74 KB, patch)
2016-04-25 15:20 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (18.75 KB, patch)
2016-04-25 16:37 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-04-25 14:20:21 PDT
Specify default values for optional parameters of type 'float' / 'unrestricted float' and let the bindings generator use WTF::Optional<> for the ones that do not have a default value.
Comment 1 Chris Dumez 2016-04-25 15:20:55 PDT
Created attachment 277283 [details]
Patch
Comment 2 Darin Adler 2016-04-25 16:02:22 PDT
Comment on attachment 277283 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=277283&action=review

> Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:1267
> +    setShadow(FloatSize(width, height), blur, alpha ? colorWithOverrideAlpha(rgba, alpha.value()) : rgba);

Seems like we it would be elegant to add an overload of colorWithOverrideAlpha that takes an Optional. It can be inlined, but it would be nice to have it there, rather than writing it out here.

> Source/WebCore/html/canvas/CanvasRenderingContext2D.idl:131
> +    void setStrokeColor(unrestricted float grayLevel, optional float alpha = 1.0);

I think just "= 1" would be nicer.

> Source/WebCore/html/canvas/CanvasRenderingContext2D.idl:136
> +    void setFillColor(unrestricted float grayLevel, optional unrestricted float alpha = 1.0);

Ditto.

> Source/WebCore/html/canvas/CanvasRenderingContext2D.idl:166
> +        optional unrestricted float alpha = 1.0);

Ditto.
Comment 3 Chris Dumez 2016-04-25 16:37:51 PDT
Created attachment 277293 [details]
Patch
Comment 4 Chris Dumez 2016-04-25 16:38:35 PDT
Comment on attachment 277293 [details]
Patch

Clearing flags on attachment: 277293

Committed r200058: <http://trac.webkit.org/changeset/200058>
Comment 5 Chris Dumez 2016-04-25 16:38:43 PDT
All reviewed patches have been landed.  Closing bug.