Bug 156995

Summary: [Web IDL] Specify default values for optional parameters of type 'float' / 'unrestricted float'
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: BindingsAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, commit-queue, darin, esprehn+autocc, gyuyoung.kim, kondapallykalyan, sam, youennf
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

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.