Auto merge of #10805 - tylersouthwick:webglcontextevent, r=Ms2ger

implement webglcontextevent

fixes #10742

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10805)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-04-25 01:50:52 -07:00
commit 59205323da
3 changed files with 14 additions and 24 deletions

View file

@ -77,6 +77,7 @@ use dom::touchevent::TouchEvent;
use dom::touchlist::TouchList;
use dom::treewalker::TreeWalker;
use dom::uievent::UIEvent;
use dom::webglcontextevent::WebGLContextEvent;
use dom::window::{ReflowReason, Window};
use encoding::EncodingRef;
use encoding::all::UTF_8;
@ -2168,6 +2169,8 @@ impl DocumentMethods for Document {
&TouchList::new(&self.window, &[]),
)
)),
"webglcontextevent" =>
Ok(Root::upcast(WebGLContextEvent::new_uninitialized(GlobalRef::Window(&self.window)))),
_ =>
Err(Error::NotSupported),
}

View file

@ -41,6 +41,17 @@ impl WebGLContextEvent {
}
}
pub fn new_uninitialized(global_ref: GlobalRef) -> Root<WebGLContextEvent> {
// according to https://www.khronos.org/registry/webgl/specs/1.0/#5.15 this is
// additional information or the empty string if no additional information is
// available.
let status_message = DOMString::new();
reflect_dom_object(
box WebGLContextEvent::new_inherited(status_message),
global_ref,
WebGLContextEventBinding::Wrap)
}
pub fn new(global: GlobalRef,
type_: Atom,
bubbles: EventBubbles,