Skip to content

Replace alpha flag with a PaintRenderingContext2DSettings object#448

Merged
bfgeek merged 7 commits into
w3c:masterfrom
xidachen:ContextAttributes
Sep 8, 2017
Merged

Replace alpha flag with a PaintRenderingContext2DSettings object#448
bfgeek merged 7 commits into
w3c:masterfrom
xidachen:ContextAttributes

Conversation

@xidachen
Copy link
Copy Markdown
Contributor

@bfgeek @flackr: Please review.

@xidachen xidachen changed the title Replace alpha flag with a contextAttributes object Replace alpha flag with a ContextAttributes object Aug 18, 2017
Comment thread css-paint-api/Overview.bs Outdated
static get inputProperties() { return ['--foo']; }
static get inputArguments() { return ['<color>']; }
static get alpha() { return true; }
static get ContextAttributes() { return {alpha: true}; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think should be lowerCamelCase, "contextAttributes"

Comment thread css-paint-api/Overview.bs Outdated
2. <a for=list>Append</a> |parsedSyntax| to |inputArgumentSyntaxes|.

12. Let |alphaValue| be the result of <a>Get</a>(|paintCtor|, "alpha").
12. Let |alphaValue| be the result of <a>Get</a>(|paintCtor|, "ContextAttributes.alpha").
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be...

  1. Let |contextAttributesValue| be the result of Get(|paintCtor|, "contextAttributes").

  2. Let |contextAttributes| be the result of converting |contextAttributesValue| to a {{PaintContextAttributes}}, .... etc etc etc

Comment thread css-paint-api/Overview.bs Outdated
- <a for="paint definition">input properties</a> being |inputProperties|.

- <a for="paint definition">context alpha flag</a> being |alpha|.
- <a for="paint definition">ContextAttributes object</a> being {alpha: |alpha|}.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... being |contextAttributes|.

Comment thread css-paint-api/Overview.bs Outdated
|inputArgumentSyntaxes|.

- <a for="document paint definition">context alpha flag</a> being |alpha|.
- <a for="document paint definition">ContextAttributes object</a> being {alpha: |alpha|}.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above.

Comment thread css-paint-api/Overview.bs Outdated
with the paint canvas. Right now, the {{ContextAttributes}} has a boolean flag
indicating if the paint canvas contains an alpha channel.
<pre class='idl'>
dictionary ContextAttributes {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be nice to namespace this for the spec e.g. {{PaintContextAttributes}}, but doesn't really matter as not user visible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not very certain about this. I notice that there is a proposal for CanvasRenderingContext2DSettings in here: https://github.com/WICG/canvas-color-space/blob/master/CanvasColorSpaceProposal.md

Currently there is only one alpha, but the proposal make it including color space attributes. Maybe in the future we should make ContextAttributes inherit from it? Or maybe just directly using it for PaintRenderingContext2D?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flackr thoughts?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense that we might eventually want to support settings like color space. However, in the event that we do this I think we might still only want to support a subset of CanvasRenderingContext2DSettings just like PaintRenderingContext2D implements a subset of CanvasRenderingContext2D. How about PaintRenderingContext2DSettings for consistency?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'd support that. PaintRenderingContext2DSettings is a better name, because it is more clear that it is used for PaintRenderingContext2D.
Question: do we need to start a discussion somewhere and bring other people onboard, like CSS discussion group?

@xidachen
Copy link
Copy Markdown
Contributor Author

@bfgeek I have addressed almost all comments in the new commit. Please review.

Comment thread css-paint-api/Overview.bs Outdated
2. <a for=list>Append</a> |parsedSyntax| to |inputArgumentSyntaxes|.

12. Let |alphaValue| be the result of <a>Get</a>(|paintCtor|, "alpha").
12. Let |contextAttributesValue| be the result of <a>Get</a>(|paintCtor|, "ContextAttributes").
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"contextAttributes"

Comment thread css-paint-api/Overview.bs Outdated
with the paint canvas. Right now, the {{ContextAttributes}} has a boolean flag
indicating if the paint canvas contains an alpha channel.
<pre class='idl'>
dictionary ContextAttributes {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PaintContextAttributes to match below.

Comment thread css-paint-api/Overview.bs
@@ -605,7 +614,7 @@ When the user agent wants to <dfn>invoke a paint callback</dfn> given |name|, |i
8. Let |renderingContext| be the result of <a>create a PaintRenderingContext2D object</a> given:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has the "create a PaintRenderingContext2D object" algorithm been updated to receive a contextAttributes object?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I have updated that section.

Comment thread css-paint-api/Overview.bs Outdated
with the paint canvas. Right now, the {{ContextAttributes}} has a boolean flag
indicating if the paint canvas contains an alpha channel.
<pre class='idl'>
dictionary ContextAttributes {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flackr thoughts?

@xidachen
Copy link
Copy Markdown
Contributor Author

@bfgeek @flackr The name of the dictionary is now "PaintRenderingContext2DSettings".

@xidachen xidachen changed the title Replace alpha flag with a ContextAttributes object Replace alpha flag with a PaintRenderingContext2DSettings object Sep 6, 2017
@xidachen
Copy link
Copy Markdown
Contributor Author

xidachen commented Sep 6, 2017

@bfgeek @flackr Gentle ping.

Comment thread css-paint-api/Overview.bs Outdated
};
</pre>

The {{PaintRenderingContext2DSettings}} allows the settings for the rendering context associated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is confusing, what do you mean "allows the settings"? Maybe contains or provides?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread css-paint-api/Overview.bs Outdated
</pre>

The {{PaintRenderingContext2DSettings}} allows the settings for the rendering context associated
with the paint canvas. Right now, the {{PaintRenderingContext2DSettings}} has a boolean flag
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be more clear to have a bulleted list of what each value means. Also, perhaps instead of implying that we may add more settings we should say this provides a supported subset of the canvas context 2d settings (ideally with a link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed, please review the new commit.

@xidachen
Copy link
Copy Markdown
Contributor Author

xidachen commented Sep 8, 2017

Yay, thanks for reviewing it :)

@xidachen
Copy link
Copy Markdown
Contributor Author

xidachen commented Sep 8, 2017

I have changed the function name to contextOptions, please review.

@bfgeek bfgeek merged commit 869c59a into w3c:master Sep 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants