Add onresize handler to GlobalEventHandlers

Refs: https://github.com/servo/servo/issues/7996
Rebased: https://github.com/servo/servo/pull/8006
This commit is contained in:
Jeff Harrison 2016-01-28 20:12:17 -05:00 committed by Greg Guthe
parent 5e1f0495a9
commit d4fe40089b
7 changed files with 64 additions and 15 deletions

View file

@ -162,6 +162,24 @@ impl HTMLElementMethods for HTMLElement {
}
}
// https://html.spec.whatwg.org/multipage/#handler-onresize
fn GetOnresize(&self) -> Option<Rc<EventHandlerNonNull>> {
if self.is_body_or_frameset() {
window_from_node(self).GetOnload()
} else {
self.upcast::<EventTarget>().get_event_handler_common("resize")
}
}
// https://html.spec.whatwg.org/multipage/#handler-onresize
fn SetOnresize(&self, listener: Option<Rc<EventHandlerNonNull>>) {
if self.is_body_or_frameset() {
window_from_node(self).SetOnresize(listener);
} else {
self.upcast::<EventTarget>().set_event_handler_common("resize", listener)
}
}
// https://html.spec.whatwg.org/multipage/#dom-click
fn Click(&self) {
if let Some(i) = self.downcast::<HTMLInputElement>() {