diff options
author | Ms2ger <Ms2ger@gmail.com> | 2015-11-02 11:42:39 +0100 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2015-11-02 11:42:39 +0100 |
commit | 0dacd331020dfb17ef6da9352cfea1f01842a8f2 (patch) | |
tree | 141b0a4e4c1d207173fe26033a0f7107a355fc23 | |
parent | 50d51bab7faa5ce52e9f345eee3d49886433289f (diff) | |
download | servo-0dacd331020dfb17ef6da9352cfea1f01842a8f2.tar.gz servo-0dacd331020dfb17ef6da9352cfea1f01842a8f2.zip |
Remove RawLayoutHTMLInputElementHelpers.
-rw-r--r-- | components/script/dom/element.rs | 8 | ||||
-rw-r--r-- | components/script/dom/htmlinputelement.rs | 29 |
2 files changed, 12 insertions, 25 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index d07d2566371..a78ba89b485 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -42,7 +42,7 @@ use dom::htmlcollection::HTMLCollection; use dom::htmlfieldsetelement::HTMLFieldSetElement; use dom::htmlfontelement::HTMLFontElement; use dom::htmliframeelement::HTMLIFrameElement; -use dom::htmlinputelement::{HTMLInputElement, RawLayoutHTMLInputElementHelpers}; +use dom::htmlinputelement::{HTMLInputElement, LayoutHTMLInputElementHelpers}; use dom::htmllabelelement::HTMLLabelElement; use dom::htmllegendelement::HTMLLegendElement; use dom::htmloptgroupelement::HTMLOptGroupElement; @@ -374,7 +374,7 @@ impl LayoutElementHelpers for LayoutJS<Element> { // a text field match (*self.unsafe_get()).get_attr_val_for_layout(&ns!(""), &atom!("type")) { Some("text") | Some("password") => { - match (*this.unsafe_get()).get_size_for_layout() { + match this.get_size_for_layout() { 0 => None, s => Some(s as i32), } @@ -574,7 +574,7 @@ impl LayoutElementHelpers for LayoutJS<Element> { // TODO option and menuitem can also have a checked state. match self.downcast::<HTMLInputElement>() { Some(input) => unsafe { - (*input.unsafe_get()).get_checked_state_for_layout() + input.get_checked_state_for_layout() }, None => false, } @@ -586,7 +586,7 @@ impl LayoutElementHelpers for LayoutJS<Element> { // TODO progress elements can also be matched with :indeterminate match self.downcast::<HTMLInputElement>() { Some(input) => unsafe { - (*input.unsafe_get()).get_indeterminate_state_for_layout() + input.get_indeterminate_state_for_layout() }, None => false, } diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index b2f9069c1ec..f1a5bc8a818 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -15,7 +15,7 @@ use dom::bindings::conversions::Castable; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, LayoutJS, Root, RootedReference}; use dom::document::Document; -use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers}; +use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers, LayoutElementHelpers}; use dom::event::{Event, EventBubbles, EventCancelable}; use dom::eventtarget::EventTarget; use dom::htmlelement::HTMLElement; @@ -136,15 +136,10 @@ pub trait LayoutHTMLInputElementHelpers { unsafe fn get_size_for_layout(self) -> u32; #[allow(unsafe_code)] unsafe fn get_insertion_point_for_layout(self) -> Option<TextPoint>; -} - -pub trait RawLayoutHTMLInputElementHelpers { - #[allow(unsafe_code)] - unsafe fn get_checked_state_for_layout(&self) -> bool; #[allow(unsafe_code)] - unsafe fn get_indeterminate_state_for_layout(&self) -> bool; + unsafe fn get_checked_state_for_layout(self) -> bool; #[allow(unsafe_code)] - unsafe fn get_size_for_layout(&self) -> u32; + unsafe fn get_indeterminate_state_for_layout(self) -> bool; } impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> { @@ -184,7 +179,7 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> { #[allow(unrooted_must_root)] #[allow(unsafe_code)] unsafe fn get_size_for_layout(self) -> u32 { - (*self.unsafe_get()).get_size_for_layout() + (*self.unsafe_get()).size.get() } #[allow(unrooted_must_root)] @@ -196,25 +191,17 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> { _ => None } } -} -impl RawLayoutHTMLInputElementHelpers for HTMLInputElement { #[allow(unrooted_must_root)] #[allow(unsafe_code)] - unsafe fn get_checked_state_for_layout(&self) -> bool { - self.Checked() - } - - #[allow(unrooted_must_root)] - #[allow(unsafe_code)] - unsafe fn get_indeterminate_state_for_layout(&self) -> bool { - self.Indeterminate() + unsafe fn get_checked_state_for_layout(self) -> bool { + self.upcast::<Element>().get_state_for_layout().contains(IN_CHECKED_STATE) } #[allow(unrooted_must_root)] #[allow(unsafe_code)] - unsafe fn get_size_for_layout(&self) -> u32 { - self.size.get() + unsafe fn get_indeterminate_state_for_layout(self) -> bool { + self.upcast::<Element>().get_state_for_layout().contains(IN_INDETERMINATE_STATE) } } |