-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Use enum for lineCap/lineJoin/textAlign/textBaseline/direction #680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60026,12 +60026,18 @@ interface <dfn>CanvasImageData</dfn> { | |
| void <span data-x="dom-context-2d-putImageData">putImageData</span>(<span>ImageData</span> imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight); | ||
| }; | ||
|
|
||
| enum <dfn>CanvasLineCap</dfn> { "butt", "round", "square" }; | ||
| enum <dfn>CanvasLineJoin</dfn> { "round", "bevel", "miter"}; | ||
| enum <dfn>CanvasTextAlign</dfn> { "<span data-x="dom-context-2d-textalign-start">start</span>", "<span data-x="dom-context-2d-textalign-end">end</span>", "<span data-x="dom-context-2d-textalign-left">left</span>", "<span data-x="dom-context-2d-textalign-right">right</span>", "<span data-x="dom-context-2d-textalign-center">center</span>" }; | ||
|
||
| enum <dfn>CanvasTextBaseline</dfn> { "<span data-x="dom-context-2d-textbaseline-top">top</span>", "<span data-x="dom-context-2d-textbaseline-hanging">hanging</span>", "<span data-x="dom-context-2d-textbaseline-middle">middle</span>", "<span data-x="dom-context-2d-textbaseline-alphabetic">alphabetic</span>", "<span data-x="dom-context-2d-textbaseline-ideographic">ideographic</span>", "<span data-x="dom-context-2d-textbaseline-bottom">bottom</span>" }; | ||
| enum <dfn>CanvasDirection</dfn> { "<span data-x="dom-context-2d-direction-ltr">ltr</span>", "<span data-x="dom-context-2d-direction-rtl">rtl</span>", "<span data-x="dom-context-2d-direction-inherit">inherit</span>" }; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't remove this, just change
|
||
|
|
||
| [NoInterfaceObject, Exposed=(Window,Worker)] | ||
| interface <dfn>CanvasPathDrawingStyles</dfn> { | ||
| // line caps/joins | ||
| attribute unrestricted double <span data-x="dom-context-2d-lineWidth">lineWidth</span>; // (default 1) | ||
| attribute DOMString <span data-x="dom-context-2d-lineCap">lineCap</span>; // "butt", "round", "square" (default "butt") | ||
| attribute DOMString <span data-x="dom-context-2d-lineJoin">lineJoin</span>; // "round", "bevel", "miter" (default "miter") | ||
| attribute <dfn>CanvasLineCap</dfn> <span data-x="dom-context-2d-lineCap">lineCap</span>; // (default "butt") | ||
| attribute <dfn>CanvasLineJoin</dfn> <span data-x="dom-context-2d-lineJoin">lineJoin</span>; // (default "miter") | ||
| attribute unrestricted double <span data-x="dom-context-2d-miterLimit">miterLimit</span>; // (default 10) | ||
|
|
||
| // dashed lines | ||
|
|
@@ -60044,9 +60050,9 @@ interface <dfn>CanvasPathDrawingStyles</dfn> { | |
| interface <dfn>CanvasTextDrawingStyles</dfn> { | ||
|
||
| // text | ||
|
||
| attribute DOMString <span data-x="dom-context-2d-font">font</span>; // (default 10px sans-serif) | ||
| attribute DOMString <span data-x="dom-context-2d-textAlign">textAlign</span>; // "start", "end", "left", "right", "center" (default: "start") | ||
| attribute DOMString <span data-x="dom-context-2d-textBaseline">textBaseline</span>; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic") | ||
| attribute DOMString <span data-x="dom-context-2d-direction">direction</span>; // "ltr", "rtl"<!--, "auto"-->, "inherit" (default: "inherit") | ||
| attribute <dfn>CanvasTextAlign</dfn> <span data-x="dom-context-2d-textAlign">textAlign</span>; // (default: "start") | ||
| attribute <dfn>CanvasTextBaseline</dfn> <span data-x="dom-context-2d-textBaseline">textBaseline</span>; // (default: "alphabetic") | ||
| attribute <dfn>CanvasDirection</dfn> <span data-x="dom-context-2d-direction">direction</span>; // (default: "inherit") | ||
| }; | ||
|
|
||
| [NoInterfaceObject, Exposed=(Window,Worker)] | ||
|
|
@@ -60923,10 +60929,8 @@ idea from Mihai: | |
| data-x="">butt</code>", "<code data-x="">round</code>", and "<code | ||
| data-x="">square</code>".</p> | ||
|
|
||
| <p>On getting, it must return the current value. On setting, if the new value is one of the | ||
| literal strings "<code data-x="">butt</code>", "<code data-x="">round</code>", and "<code | ||
| data-x="">square</code>", then the current value must be changed to the new value; other values | ||
| must ignored, leaving the value unchanged.</p> | ||
| <p>On getting, it must return the current value. On setting, the current value must be changed | ||
| to the new value.</p> | ||
|
|
||
| <p>When the object implementing the <code>CanvasPathDrawingStyles</code> interface is created, the | ||
| <code data-x="dom-context-2d-lineCap">lineCap</code> attribute must initially have the value | ||
|
|
@@ -60938,10 +60942,8 @@ idea from Mihai: | |
| of corners that UAs will place where two lines meet. The three valid values are | ||
| "<code data-x="">bevel</code>", "<code data-x="">round</code>", and "<code data-x="">miter</code>".</p> | ||
|
|
||
|
||
| <p>On getting, it must return the current value. On setting, if the new value is one of the | ||
| literal strings "<code data-x="">bevel</code>", "<code data-x="">round</code>", and "<code | ||
| data-x="">miter</code>", then the current value must be changed to the new value; other values | ||
| must be ignored, leaving the value unchanged.</p> | ||
| <p>On getting, it must return the current value. On setting, the current value must be changed | ||
| to the new value.</p> | ||
|
|
||
| <p>When the object implementing the <code>CanvasPathDrawingStyles</code> interface is created, the | ||
| <code data-x="dom-context-2d-lineJoin">lineJoin</code> attribute must initially have the value | ||
|
|
@@ -61384,40 +61386,22 @@ transform. ack Shaun Morris. --> | |
| interpreted relative to the normal-weight 10px sans-serif default.</p> | ||
|
|
||
| <p>The <dfn><code data-x="dom-context-2d-textAlign">textAlign</code></dfn> IDL attribute, on | ||
| getting, must return the current value. On setting, if the value is one of <code | ||
| data-x="dom-context-2d-textAlign-start">start</code>, <code | ||
| data-x="dom-context-2d-textAlign-end">end</code>, <code | ||
| data-x="dom-context-2d-textAlign-left">left</code>, <code | ||
| data-x="dom-context-2d-textAlign-right">right</code>, or <code | ||
| data-x="dom-context-2d-textAlign-center">center</code>, then the value must be changed to the new | ||
| value. Otherwise, the new value must be ignored. When the object implementing the | ||
| <code>CanvasTextDrawingStyles</code> interface is created, the <code | ||
| data-x="dom-context-2d-textAlign">textAlign</code> attribute must initially have the value <code | ||
| data-x="dom-context-2d-textAlign-start">start</code>.</p> | ||
| getting, must return the current value. On setting, the current value must be changed to the new | ||
| value. When the object implementing the <code>CanvasTextDrawingStyles</code> interface is | ||
| created, the <code data-x="dom-context-2d-textAlign">textAlign</code> attribute must initially | ||
| have the value <code data-x="dom-context-2d-textAlign-start">start</code>.</p> | ||
|
|
||
| <p>The <dfn><code data-x="dom-context-2d-textBaseline">textBaseline</code></dfn> IDL attribute, on | ||
| getting, must return the current value. On setting, if the value is one of <code | ||
| data-x="dom-context-2d-textBaseline-top">top</code>, <code | ||
| data-x="dom-context-2d-textBaseline-hanging">hanging</code>, <code | ||
| data-x="dom-context-2d-textBaseline-middle">middle</code>, <code | ||
| data-x="dom-context-2d-textBaseline-alphabetic">alphabetic</code>, <code | ||
| data-x="dom-context-2d-textBaseline-ideographic">ideographic</code>, or <code | ||
| data-x="dom-context-2d-textBaseline-bottom">bottom</code>, then the value must be changed to the | ||
| new value. Otherwise, the new value must be ignored. When the object implementing the | ||
| <code>CanvasTextDrawingStyles</code> interface is created, the <code | ||
| data-x="dom-context-2d-textBaseline">textBaseline</code> attribute must initially have the value | ||
| <code data-x="dom-context-2d-textBaseline-alphabetic">alphabetic</code>.</p> | ||
| getting, must return the current value. On setting, the current value must be changed to the new | ||
| value. When the object implementing the <code>CanvasTextDrawingStyles</code> interface is | ||
| created, the <code data-x="dom-context-2d-textBaseline">textBaseline</code> attribute must | ||
| initially have the value <code data-x="dom-context-2d-textBaseline-alphabetic">alphabetic</code>.</p> | ||
|
|
||
| <p>The <dfn><code data-x="dom-context-2d-direction">direction</code></dfn> IDL attribute, on | ||
| getting, must return the current value. On setting, if the value is one of "<code | ||
| data-x="dom-context-2d-direction-ltr">ltr</code>", "<code | ||
| data-x="dom-context-2d-direction-rtl">rtl</code>", <!--"<code | ||
| data-x="dom-context-2d-direction-auto">auto</code>",--> or "<code | ||
| data-x="dom-context-2d-direction-inherit">inherit</code>", then the value must be changed to the | ||
| new value. Otherwise, the new value must be ignored. When the object implementing the | ||
| <code>CanvasTextDrawingStyles</code> interface is created, the <code | ||
| data-x="dom-context-2d-direction">direction</code> attribute must initially have the value "<code | ||
| data-x="dom-context-2d-direction-inherit">inherit</code>".</p> | ||
| getting, must return the current value. On setting, the current value must be changed to the new | ||
| value. When the object implementing the <code>CanvasTextDrawingStyles</code> interface is | ||
|
||
| created, the <code data-x="dom-context-2d-direction">direction</code> attribute must initially | ||
| have the value "<code data-x="dom-context-2d-direction-inherit">inherit</code>".</p> | ||
|
|
||
| </div> | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think enums shouldn't say what the default is, since in principle different features could reuse the same enum but have different defaults. So remove the comments from
enumlines.