mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Remove RawLayoutHTMLInputElementHelpers.
This commit is contained in:
parent
50d51bab7f
commit
0dacd33102
2 changed files with 12 additions and 25 deletions
|
@ -42,7 +42,7 @@ use dom::htmlcollection::HTMLCollection;
|
||||||
use dom::htmlfieldsetelement::HTMLFieldSetElement;
|
use dom::htmlfieldsetelement::HTMLFieldSetElement;
|
||||||
use dom::htmlfontelement::HTMLFontElement;
|
use dom::htmlfontelement::HTMLFontElement;
|
||||||
use dom::htmliframeelement::HTMLIFrameElement;
|
use dom::htmliframeelement::HTMLIFrameElement;
|
||||||
use dom::htmlinputelement::{HTMLInputElement, RawLayoutHTMLInputElementHelpers};
|
use dom::htmlinputelement::{HTMLInputElement, LayoutHTMLInputElementHelpers};
|
||||||
use dom::htmllabelelement::HTMLLabelElement;
|
use dom::htmllabelelement::HTMLLabelElement;
|
||||||
use dom::htmllegendelement::HTMLLegendElement;
|
use dom::htmllegendelement::HTMLLegendElement;
|
||||||
use dom::htmloptgroupelement::HTMLOptGroupElement;
|
use dom::htmloptgroupelement::HTMLOptGroupElement;
|
||||||
|
@ -374,7 +374,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
||||||
// a text field
|
// a text field
|
||||||
match (*self.unsafe_get()).get_attr_val_for_layout(&ns!(""), &atom!("type")) {
|
match (*self.unsafe_get()).get_attr_val_for_layout(&ns!(""), &atom!("type")) {
|
||||||
Some("text") | Some("password") => {
|
Some("text") | Some("password") => {
|
||||||
match (*this.unsafe_get()).get_size_for_layout() {
|
match this.get_size_for_layout() {
|
||||||
0 => None,
|
0 => None,
|
||||||
s => Some(s as i32),
|
s => Some(s as i32),
|
||||||
}
|
}
|
||||||
|
@ -574,7 +574,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
||||||
// TODO option and menuitem can also have a checked state.
|
// TODO option and menuitem can also have a checked state.
|
||||||
match self.downcast::<HTMLInputElement>() {
|
match self.downcast::<HTMLInputElement>() {
|
||||||
Some(input) => unsafe {
|
Some(input) => unsafe {
|
||||||
(*input.unsafe_get()).get_checked_state_for_layout()
|
input.get_checked_state_for_layout()
|
||||||
},
|
},
|
||||||
None => false,
|
None => false,
|
||||||
}
|
}
|
||||||
|
@ -586,7 +586,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
||||||
// TODO progress elements can also be matched with :indeterminate
|
// TODO progress elements can also be matched with :indeterminate
|
||||||
match self.downcast::<HTMLInputElement>() {
|
match self.downcast::<HTMLInputElement>() {
|
||||||
Some(input) => unsafe {
|
Some(input) => unsafe {
|
||||||
(*input.unsafe_get()).get_indeterminate_state_for_layout()
|
input.get_indeterminate_state_for_layout()
|
||||||
},
|
},
|
||||||
None => false,
|
None => false,
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ use dom::bindings::conversions::Castable;
|
||||||
use dom::bindings::global::GlobalRef;
|
use dom::bindings::global::GlobalRef;
|
||||||
use dom::bindings::js::{JS, LayoutJS, Root, RootedReference};
|
use dom::bindings::js::{JS, LayoutJS, Root, RootedReference};
|
||||||
use dom::document::Document;
|
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::event::{Event, EventBubbles, EventCancelable};
|
||||||
use dom::eventtarget::EventTarget;
|
use dom::eventtarget::EventTarget;
|
||||||
use dom::htmlelement::HTMLElement;
|
use dom::htmlelement::HTMLElement;
|
||||||
|
@ -136,15 +136,10 @@ pub trait LayoutHTMLInputElementHelpers {
|
||||||
unsafe fn get_size_for_layout(self) -> u32;
|
unsafe fn get_size_for_layout(self) -> u32;
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn get_insertion_point_for_layout(self) -> Option<TextPoint>;
|
unsafe fn get_insertion_point_for_layout(self) -> Option<TextPoint>;
|
||||||
}
|
|
||||||
|
|
||||||
pub trait RawLayoutHTMLInputElementHelpers {
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn get_checked_state_for_layout(&self) -> bool;
|
unsafe fn get_checked_state_for_layout(self) -> bool;
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn get_indeterminate_state_for_layout(&self) -> bool;
|
unsafe fn get_indeterminate_state_for_layout(self) -> bool;
|
||||||
#[allow(unsafe_code)]
|
|
||||||
unsafe fn get_size_for_layout(&self) -> u32;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> {
|
impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> {
|
||||||
|
@ -184,7 +179,7 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> {
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn get_size_for_layout(self) -> u32 {
|
unsafe fn get_size_for_layout(self) -> u32 {
|
||||||
(*self.unsafe_get()).get_size_for_layout()
|
(*self.unsafe_get()).size.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
|
@ -196,25 +191,17 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> {
|
||||||
_ => None
|
_ => None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl RawLayoutHTMLInputElementHelpers for HTMLInputElement {
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn get_checked_state_for_layout(&self) -> bool {
|
unsafe fn get_checked_state_for_layout(self) -> bool {
|
||||||
self.Checked()
|
self.upcast::<Element>().get_state_for_layout().contains(IN_CHECKED_STATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn get_indeterminate_state_for_layout(&self) -> bool {
|
unsafe fn get_indeterminate_state_for_layout(self) -> bool {
|
||||||
self.Indeterminate()
|
self.upcast::<Element>().get_state_for_layout().contains(IN_INDETERMINATE_STATE)
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
unsafe fn get_size_for_layout(&self) -> u32 {
|
|
||||||
self.size.get()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue