Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd WebGLContextAttributes support #6183
Conversation
hoppipolla-critic-bot
commented
May 25, 2015
|
Critic review: https://critic.hoppipolla.co.uk/r/5098 This is an external review system which you may optionally use for the code review of your pull request. In order to help critic track your changes, please do not make in-place history rewrites (e.g. via |
eda4b63
to
1a375ad
|
I added to codegen the posibility to return a dictionary value. I think my changes are correct (converting to a plain JS dictionary should suffice since it does not need to be rootable), and it definitely works (see the I kept commits split, just in case :P |
|
Review status: all files reviewed, 16 unresolved discussions, all commit checks successful.
components/script/dom/bindings/codegen/CodegenRust.py, line 4591 [r3] (raw file): components/script/dom/htmlcanvaselement.rs, line 139 [r3] (raw file): components/script/dom/htmlcanvaselement.rs, line 143 [r3] (raw file): components/script/dom/htmlcanvaselement.rs, line 148 [r3] (raw file): components/script/dom/htmlcanvaselement.rs, line 152 [r3] (raw file): components/script/dom/htmlcanvaselement.rs, line 221 [r3] (raw file): @jdm? components/script/dom/htmlcanvaselement.rs, line 242 [r3] (raw file): If this is required, I would just make it a bare function in this module instead of a trait. @jdm? components/script/dom/htmlcanvaselement.rs, line 283 [r3] (raw file): components/script/dom/webidls/HTMLCanvasElement.webidl, line 15 [r3] (raw file): components/servo/Cargo.lock, line 537 [r3] (raw file): components/servo/Cargo.lock, line 552 [r3] (raw file): ports/cef/Cargo.lock, line 539 [r3] (raw file): ports/cef/Cargo.lock, line 554 [r3] (raw file): ports/gonk/Cargo.lock, line 447 [r3] (raw file): ports/gonk/Cargo.lock, line 462 [r3] (raw file): Comments from the review on Reviewable.io |
|
Review status: 9 of 15 files reviewed, 7 unresolved discussions, all commit checks successful. components/script/dom/bindings/codegen/CodegenRust.py, line 4591 [r3] (raw file): components/script/dom/htmlcanvaselement.rs, line 139 [r3] (raw file): components/script/dom/htmlcanvaselement.rs, line 221 [r3] (raw file): We can either return components/script/dom/htmlcanvaselement.rs, line 242 [r3] (raw file): var gl = document.createElement('canvas').getContext('webgl', { alpha: '' });
gl.getContextAttributes().alpha === falseBut apart from that the behaviour is inconsistent. In Firefox: canvas.getContext('webgl', 'literal string'); // null
canvas.getContext('webgl', function() {}); // WebGLRenderingContext with default attributesWhile in Chromium both return a rendering context with default parameters. I couldn't test in more browsers. That being said, it seems to me (after reading components/script/dom/htmlcanvaselement.rs, line 283 [r3] (raw file): You're right tough, so I released an update which prevents creating contexts with preserve_drawing_buffer. components/script/dom/webidls/HTMLCanvasElement.webidl, line 15 [r3] (raw file): components/servo/Cargo.lock, line 537 [r3] (raw file): Comments from the review on Reviewable.io |
|
Review status: all files reviewed, 3 unresolved discussions, all commit checks successful.
components/script/dom/htmlcanvaselement.rs, line 242 [r3] (raw file): components/script/dom/htmlcanvaselement.rs, line 286 [r5] (raw file): components/script/dom/webidls/HTMLCanvasElement.webidl, line 15 [r3] (raw file): Pinging @jdm. Comments from the review on Reviewable.io |
|
Review status: all files reviewed, 4 unresolved discussions, all commit checks successful. components/script/dom/htmlcanvaselement.rs, line 139 [r3] (raw file): components/script/dom/htmlcanvaselement.rs, line 286 [r5] (raw file): components/script/dom/webidls/HTMLCanvasElement.webidl, line 15 [r3] (raw file): Anyways I think as of right now this is way cleaner. Comments from the review on Reviewable.io |
|
Review status: all files reviewed, 4 unresolved discussions, some commit checks failed. components/script/dom/htmlcanvaselement.rs, line 233 [r3] (raw file): components/script/dom/webidls/HTMLCanvasElement.webidl, line 15 [r3] (raw file): Comments from the review on Reviewable.io |
|
|
|
Review status: all files reviewed, 3 unresolved discussions, some commit checks failed. components/script/dom/htmlcanvaselement.rs, line 233 [r3] (raw file): components/script/dom/htmlcanvaselement.rs, line 286 [r5] (raw file): Comments from the review on Reviewable.io |
33c833a
to
b27a672
|
Review status: 6 of 15 files reviewed, 4 unresolved discussions, all commit checks successful. components/script/dom/htmlcanvaselement.rs, line 286 [r5] (raw file): components/script/dom/webidls/HTMLCanvasElement.webidl, line 15 [r3] (raw file): Comments from the review on Reviewable.io |
|
Review status: all files reviewed, 3 unresolved discussions, all commit checks successful.
components/script/dom/htmlcanvaselement.rs, line 287 [r7] (raw file): Otherwise, reference*. Comments from the review on Reviewable.io |
|
Review status: 14 of 15 files reviewed, 4 unresolved discussions, some commit checks pending. components/script/dom/htmlcanvaselement.rs, line 287 [r7] (raw file): The comment was just to justify not using: impl From<WebGLContextAttributes> for ...Anyways, removed :P Comments from the review on Reviewable.io |
|
Review status: all files reviewed, 2 unresolved discussions, all commit checks successful.
Comments from the review on Reviewable.io |
|
@ecoal95 Squash everything and it can be merged. |
|
Done :) |
|
@bors-servo: r+ |
|
|
r? @jdm I couldn't add the `getContextAttributes` method since `CodegenRust` doesn't know how to return a dictionary value, I'll take a look at it ASAP. I think the helper functions can return directly the renderer, since they're used just for that, but I wanted to hear your opinions about this. By the way I'm interested in adding more serious tests for WebGL, and I think the [khronos conformance suit](https://github.com/KhronosGroup/WebGL/tree/master/conformance-suites/1.0.3) should be the best option. Should I try to integrate it in wpt, or making a `tests/webgl` directory (or similar) inside the servo tree? (Maybe this question should be for @Ms2ger) <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6183) <!-- Reviewable:end -->
|
|
|
|
Review status: all files reviewed, 3 unresolved discussions, some commit checks failed. components/script/dom/htmlcanvaselement.rs, line 140 [r9] (raw file): Comments from the review on Reviewable.io |
|
Review status: 14 of 16 files reviewed, 4 unresolved discussions, some commit checks pending. components/script/dom/htmlcanvaselement.rs, line 140 [r9] (raw file): #[jstraceable]
pub enum CanvasContext {
Context2d(MutHeap<JS<CanvasRenderingContext2D>>),
WebGL(MutHeap<JS<WebGLRenderingContext>>),
None,
}I can't do that since we need interior mutability. I can't wrap it in a I've been able to do it, passing the web platform tests without errors, manually implementing #[jstraceable]
#[must_root]
#[derive(Clone, Copy)]
pub enum CanvasContext {
Context2d(JS<CanvasRenderingContext2D>),
WebGL(JS<WebGLRenderingContext>),
}
impl HeapGCValue for CanvasContext {}
#[dom_struct]
pub struct HTMLCanvasElement {
// ...
context: MutNullableHeap<CanvasContext>,
// ...
}I've pushed, but if we want to roll back it's easy. Comments from the review on Reviewable.io |
|
Review status: all files reviewed, 2 unresolved discussions, all commit checks successful.
components/script/dom/htmlcanvaselement.rs, line 140 [r9] (raw file): Comments from the review on Reviewable.io |
|
Review status: all files reviewed, 3 unresolved discussions, all commit checks successful. components/script/dom/htmlcanvaselement.rs, line 151 [r9] (raw file): Comments from the review on Reviewable.io |
|
Is there something left to do about this one? |
This commit also: * Allows to return non-rootable dictionaries from Codegen. * Merges the two context types in an enum type.
|
I don't think so. |
|
@bors-servo: r+ |
|
Was squashing right now |
|
Ok, squash it then. The bot doesn't know I'm a reviewer yet. :) |
|
Done :P @jdm must be happy about having a bit more help ;) |
|
@bors-servo: r+ |
|
|
r? @jdm I couldn't add the `getContextAttributes` method since `CodegenRust` doesn't know how to return a dictionary value, I'll take a look at it ASAP. I think the helper functions can return directly the renderer, since they're used just for that, but I wanted to hear your opinions about this. By the way I'm interested in adding more serious tests for WebGL, and I think the [khronos conformance suit](https://github.com/KhronosGroup/WebGL/tree/master/conformance-suites/1.0.3) should be the best option. Should I try to integrate it in wpt, or making a `tests/webgl` directory (or similar) inside the servo tree? (Maybe this question should be for @Ms2ger) <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6183) <!-- Reviewable:end -->
emilio commentedMay 25, 2015
r? @jdm
I couldn't add the
getContextAttributesmethod sinceCodegenRustdoesn't know how to return a dictionary value, I'll take a look at it ASAP.
I think the helper functions can return directly the renderer, since they're used just for that, but I wanted to hear your opinions about this.
By the way I'm interested in adding more serious tests for WebGL, and I think the khronos conformance suit should be the best option.
Should I try to integrate it in wpt, or making a
tests/webgldirectory (or similar) inside the servo tree? (Maybe this question should be for @Ms2ger)