mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
auto merge of #4133 : mttr/servo/form_resetting, r=jdm
We can reset `<input type=text>` fields! I wish I could've done something with checkboxes, but unfortunately, that's it for now. In addition to that, this PR implements `HTMLInputAttribute.defaultValue`, updates wpt-test to expect passing tests as a result of that implementation, and fixes an index error crash with text inputs. edit: also includes an html example where one may lazily watch form resets in action: ` tests/html/form_reset_handsfree.html`
This commit is contained in:
commit
5951056973
22 changed files with 376 additions and 446 deletions
|
@ -35,7 +35,7 @@ use dom::event::Event;
|
|||
use dom::eventtarget::{EventTarget, NodeTargetTypeId, EventTargetHelpers};
|
||||
use dom::htmlbodyelement::{HTMLBodyElement, HTMLBodyElementHelpers};
|
||||
use dom::htmlcollection::HTMLCollection;
|
||||
use dom::htmlinputelement::{HTMLInputElement, RawLayoutHTMLInputElementHelpers};
|
||||
use dom::htmlinputelement::{HTMLInputElement, RawLayoutHTMLInputElementHelpers, HTMLInputElementHelpers};
|
||||
use dom::htmlserializer::serialize;
|
||||
use dom::htmltableelement::{HTMLTableElement, HTMLTableElementHelpers};
|
||||
use dom::htmltablecellelement::{HTMLTableCellElement, HTMLTableCellElementHelpers};
|
||||
|
@ -212,6 +212,7 @@ pub trait RawLayoutElementHelpers {
|
|||
unsafe fn get_integer_attribute_for_layout(&self, integer_attribute: IntegerAttribute)
|
||||
-> Option<i32>;
|
||||
unsafe fn get_checked_state_for_layout(&self) -> bool;
|
||||
unsafe fn get_indeterminate_state_for_layout(&self) -> bool;
|
||||
unsafe fn get_unsigned_integer_attribute_for_layout(&self, attribute: UnsignedIntegerAttribute)
|
||||
-> Option<u32>;
|
||||
unsafe fn get_simple_color_attribute_for_layout(&self, attribute: SimpleColorAttribute)
|
||||
|
@ -352,6 +353,18 @@ impl RawLayoutElementHelpers for Element {
|
|||
this.get_checked_state_for_layout()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unrooted_must_root)]
|
||||
unsafe fn get_indeterminate_state_for_layout(&self) -> bool {
|
||||
// TODO progress elements can also be matched with :indeterminate
|
||||
if !self.is_htmlinputelement() {
|
||||
return false
|
||||
}
|
||||
let this: &HTMLInputElement = mem::transmute(self);
|
||||
this.get_indeterminate_state_for_layout()
|
||||
}
|
||||
|
||||
|
||||
unsafe fn get_unsigned_integer_attribute_for_layout(&self,
|
||||
attribute: UnsignedIntegerAttribute)
|
||||
-> Option<u32> {
|
||||
|
@ -1289,6 +1302,12 @@ impl<'a> style::TElement<'a> for JSRef<'a, Element> {
|
|||
None => false,
|
||||
}
|
||||
}
|
||||
fn get_indeterminate_state(self) -> bool {
|
||||
match HTMLInputElementCast::to_ref(self) {
|
||||
Some(input) => input.get_indeterminate_state(),
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
fn has_class(self, name: &Atom) -> bool {
|
||||
// FIXME(zwarich): Remove this when UFCS lands and there is a better way
|
||||
// of disambiguating methods.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue