From c5a5db6324c3ef1c1d25b2a87edcebcd408a4c8b Mon Sep 17 00:00:00 2001 From: yodalee Date: Tue, 6 Jan 2015 01:50:37 +0800 Subject: [PATCH] add button type into HTMLButtonElement --- components/script/dom/htmlbuttonelement.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index 04c827056b7..c84d964e13f 100644 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -21,11 +21,23 @@ use dom::virtualmethods::VirtualMethods; use std::ascii::OwnedAsciiExt; use std::borrow::ToOwned; use util::str::DOMString; +use std::cell::Cell; use string_cache::Atom; +#[jstraceable] +#[derive(PartialEq, Copy)] +#[allow(dead_code)] +enum ButtonType { + ButtonSubmit, + ButtonReset, + ButtonButton, + ButtonMenu +} + #[dom_struct] pub struct HTMLButtonElement { - htmlelement: HTMLElement + htmlelement: HTMLElement, + button_type: Cell } impl HTMLButtonElementDerived for EventTarget { @@ -37,7 +49,8 @@ impl HTMLButtonElementDerived for EventTarget { impl HTMLButtonElement { fn new_inherited(localName: DOMString, prefix: Option, document: JSRef) -> HTMLButtonElement { HTMLButtonElement { - htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLButtonElement, localName, prefix, document) + htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLButtonElement, localName, prefix, document), + button_type: Cell::new(ButtonType::ButtonSubmit) } }