aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlelement.rs
diff options
context:
space:
mode:
authorJeff Harrison <jeffrharrison@gmail.com>2016-01-28 20:12:17 -0500
committerGreg Guthe <greg.guthe@gmail.com>2016-01-29 18:22:52 -0500
commitd4fe40089b69866420b71b7e148eb4d9053221f3 (patch)
tree7547c367d7dd2a99d1a4baafd346898606f6dd4f /components/script/dom/htmlelement.rs
parent5e1f0495a922c5dddbc120f17ba5c933973537ed (diff)
downloadservo-d4fe40089b69866420b71b7e148eb4d9053221f3.tar.gz
servo-d4fe40089b69866420b71b7e148eb4d9053221f3.zip
Add onresize handler to GlobalEventHandlers
Refs: https://github.com/servo/servo/issues/7996 Rebased: https://github.com/servo/servo/pull/8006
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r--components/script/dom/htmlelement.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs
index 8c718c5ab29..f0348c27b76 100644
--- a/components/script/dom/htmlelement.rs
+++ b/components/script/dom/htmlelement.rs
@@ -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>() {