Skip to content
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

Initial Steps OffscreenCanvas API #22379

Closed
wants to merge 3 commits into from
Closed

Conversation

@maharsh312
Copy link
Contributor

maharsh312 commented Dec 7, 2018

@Chiaggs @PrayaniSingh0106

Initial Steps for OffscreenCanvas API

r? @jdm

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #__ (github issue number if applicable).
  • There`are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive
Copy link

highfive commented Dec 7, 2018

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @jdm (or someone else) soon.

@highfive
Copy link

highfive commented Dec 7, 2018

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/webidls/OffscreenCanvasRenderingContext2D.webidl, components/script/dom/mod.rs, components/script/dom/webidls/OffscreenCanvas.webidl, components/script/dom/offscreencanvas.rs, components/script/dom/offscreencanvasrenderingcontext2d.rs
  • @jgraham: tests/wpt/include.ini
  • @KiChjang: components/script/dom/webidls/OffscreenCanvasRenderingContext2D.webidl, components/script/dom/mod.rs, components/script/dom/webidls/OffscreenCanvas.webidl, components/script/dom/offscreencanvas.rs, components/script/dom/offscreencanvasrenderingcontext2d.rs
@highfive
Copy link

highfive commented Dec 7, 2018

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
components/script/dom/mod.rs Outdated Show resolved Hide resolved
}
//let global = window_from_node(self);
let size = self.get_size();
let context = unsafe {OffscreenCanvasRenderingContext2D::new(&GlobalScope::from_context(cx), self, size)};

This comment has been minimized.

Copy link
@jdm

jdm Dec 8, 2018

Member

This can use let context = OffscreenCanvasRenderingContext2D::new(self.global(), self, size); instead.

This comment has been minimized.

Copy link
@maharsh312

maharsh312 Dec 15, 2018

Author Contributor

@jdm This statement give error as offscreencanvas does not have it's own global defined.
Error:"error[E0599]: no method named global found for type &dom::offscreencanvas::OffscreenCanvas in the current scope
"

This comment has been minimized.

Copy link
@maharsh312

maharsh312 Dec 15, 2018

Author Contributor

Any other alternatives?

components/script/dom/offscreencanvas.rs Outdated Show resolved Hide resolved
// ***************** For Mixin CanvasState ***********************************
// https://html.spec.whatwg.org/multipage/#dom-context-2d-save
fn Save(&self) {
self.saved_states

This comment has been minimized.

Copy link
@jdm

jdm Dec 8, 2018

Member

This doesn't compile, right? Rather than duplicating all of the canvas implementation code, I wanted to move the relevant implementation of CanvasRenderingContext2D methods to a structure that can be shared by both CanvasRenderingContext2D and OffscreenCanvasRenderingContext2D. For example:

struct CanvasState {
    saved_states: ...,
    ...
}
impl CanvasState {
    fn save(&self) {
        ....
    }
}

impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContext2D {
    fn Save(&self) {
        self.canvas_state.save()
    }
}

impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
    fn Save(&self) {
        self.canvas_state.save()
    }
}
components/script/dom/offscreencanvas.rs Outdated Show resolved Hide resolved
components/script/dom/offscreencanvas.rs Outdated Show resolved Hide resolved
@bors-servo
Copy link
Contributor

bors-servo commented Dec 11, 2018

The latest upstream changes (presumably #22392) made this pull request unmergeable. Please resolve the merge conflicts.

@maharsh312
Copy link
Contributor Author

maharsh312 commented Dec 15, 2018

Closed the pull resquest as I am updating my GitHub fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.