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

Conflicts resolved in conflicting files. OffscreenCanvas ready to be merged. #19067

Closed
wants to merge 11 commits into from

Specification links specified for offscreen-canvas and offscreen-canv…

…as2drendering
  • Loading branch information
gauraangkhurana committed Nov 22, 2017
commit 95bc7ae6e2e43f61071eb4e6c64d3f388a8f55d5
@@ -2,10 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */


use dom::bindings::cell::DomRefCell;
use dom::bindings::codegen::Bindings::OffscreenCanvasBinding;
use dom::bindings::codegen::Bindings::OffscreenCanvasBinding::OffscreenCanvasMethods;
use dom::bindings::cell::DomRefCell;
use dom::bindings::error::{Error, Fallible, report_pending_exception};
use dom::bindings::inheritance::Castable;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
@@ -58,14 +57,21 @@ impl OffscreenCanvas {
}

impl OffscreenCanvasMethods for OffscreenCanvas {
// https://html.spec.whatwg.org/multipage/#dom-img-width
fn Width(&self) -> u64 {
let width: u64 = 300;
width
}

// https://html.spec.whatwg.org/multipage/#dom-img-height
fn SetHeight(&self, height: u64) {
}

// https://html.spec.whatwg.org/multipage/#dom-img-width
fn SetWidth(&self, width: u64) {
}

// https://html.spec.whatwg.org/multipage/#dom-img-height
fn Height(&self) -> u64 {
let height: u64 = 300;
height
@@ -430,25 +430,21 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex
// so it's OK to panic if self.canvas is None.
DomRoot::from_ref(self.canvas.as_ref().expect("No canvas."))
}
fn Commit(&self) {
}

fn GlobalAlpha(&self) -> f64 {
let state = self.state.borrow();
state.global_alpha
}
fn SetGlobalAlpha(&self, value: f64) {
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-globalcompositeoperation
fn GlobalCompositeOperation(&self) -> DOMString {
let state = self.state.borrow();
match state.global_composition {
CompositionOrBlending::Composition(op) => DOMString::from(op.to_str()),
CompositionOrBlending::Blending(op) => DOMString::from(op.to_str()),
}
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-globalcompositeoperation
fn SetGlobalCompositeOperation(&self, op_str: DOMString) {
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
fn DrawImage(&self,
image: CanvasImageSource,
dx: f64,
@@ -460,6 +456,8 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex

self.draw_image(image, 0f64, 0f64, None, None, dx, dy, None, None)
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
fn DrawImage_(&self,
image: CanvasImageSource,
dx: f64,
@@ -473,6 +471,8 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex

self.draw_image(image, 0f64, 0f64, None, None, dx, dy, Some(dw), Some(dh))
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
fn DrawImage__(&self,
image: CanvasImageSource,
sx: f64,
@@ -499,15 +499,25 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex
Some(dw),
Some(dh))
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-beginpath
fn BeginPath(&self) {
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-fill
fn Fill(&self, _: CanvasFillRule) {
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-stroke
fn Stroke(&self) {
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-clip
fn Clip(&self, _: CanvasFillRule) {
// TODO: Process fill rule
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-strokestyle
fn StrokeStyle(&self) -> StringOrCanvasGradientOrCanvasPattern {
match self.state.borrow().stroke_style {
CanvasFillOrStrokeStyle::Color(ref rgba) => {
@@ -528,6 +538,8 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex
// https://html.spec.whatwg.org/multipage/#dom-context-2d-strokestyle
fn SetStrokeStyle(&self, value: StringOrCanvasGradientOrCanvasPattern) {
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-strokestyle
fn FillStyle(&self) -> StringOrCanvasGradientOrCanvasPattern {
match self.state.borrow().fill_style {
CanvasFillOrStrokeStyle::Color(ref rgba) => {
@@ -544,6 +556,7 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex
}
}

// https://html.spec.whatwg.org/multipage/#dom-context-2d-createlineargradient
fn CreateLinearGradient(&self,
x0: Finite<f64>,
y0: Finite<f64>,
@@ -711,7 +724,8 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex
// https://html.spec.whatwg.org/multipage/#dom-context-2d-beziercurveto
fn BezierCurveTo(&self, cp1x: f64, cp1y: f64, cp2x: f64, cp2y: f64, x: f64, y: f64) {
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-arc

// https://html.spec.whatwg.org/multipage/#dom-context-2d-arc
fn Arc(&self, x: f64, y: f64, r: f64, start: f64, end: f64, ccw: bool) -> ErrorResult {
if !([x, y, r, start, end].iter().all(|x| x.is_finite())) {
return Ok(());
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface
//[Pref="dom.offscreen_canvas.enabled"]

typedef (OffscreenCanvasRenderingContext2D or
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */


// https://html.spec.whatwg.org/multipage/canvas.html#the-offscreen-2d-rendering-context
//[Exposed=(Window,Worker)]
[Pref="dom.offscreen_canvas.enabled"]
interface OffscreenCanvasRenderingContext2D {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.