mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement the form owner concept
This commit is contained in:
parent
f90e19f705
commit
38a61712e4
25 changed files with 1004 additions and 165 deletions
|
@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::MouseEventBinding::MouseEventMethods;
|
|||
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
||||
use dom::bindings::error::Fallible;
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::bindings::js::{LayoutJS, Root};
|
||||
use dom::bindings::js::{LayoutJS, MutNullableJS, Root};
|
||||
use dom::bindings::refcounted::Trusted;
|
||||
use dom::bindings::reflector::DomObject;
|
||||
use dom::bindings::str::DOMString;
|
||||
|
@ -26,6 +26,7 @@ use dom::event::Event;
|
|||
use dom::eventtarget::EventTarget;
|
||||
use dom::htmlareaelement::HTMLAreaElement;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::htmlformelement::{FormControl, HTMLFormElement};
|
||||
use dom::htmlmapelement::HTMLMapElement;
|
||||
use dom::mouseevent::MouseEvent;
|
||||
use dom::node::{Node, NodeDamage, document_from_node, window_from_node};
|
||||
|
@ -78,6 +79,7 @@ pub struct HTMLImageElement {
|
|||
htmlelement: HTMLElement,
|
||||
current_request: DOMRefCell<ImageRequest>,
|
||||
pending_request: DOMRefCell<ImageRequest>,
|
||||
form_owner: MutNullableJS<HTMLFormElement>,
|
||||
generation: Cell<u32>,
|
||||
}
|
||||
|
||||
|
@ -384,6 +386,7 @@ impl HTMLImageElement {
|
|||
metadata: None,
|
||||
blocker: None,
|
||||
}),
|
||||
form_owner: Default::default(),
|
||||
generation: Default::default(),
|
||||
}
|
||||
}
|
||||
|
@ -689,6 +692,24 @@ impl VirtualMethods for HTMLImageElement {
|
|||
}
|
||||
}
|
||||
|
||||
impl FormControl for HTMLImageElement {
|
||||
fn form_owner(&self) -> Option<Root<HTMLFormElement>> {
|
||||
self.form_owner.get()
|
||||
}
|
||||
|
||||
fn set_form_owner(&self, form: Option<&HTMLFormElement>) {
|
||||
self.form_owner.set(form);
|
||||
}
|
||||
|
||||
fn to_element<'a>(&'a self) -> &'a Element {
|
||||
self.upcast::<Element>()
|
||||
}
|
||||
|
||||
fn is_listed(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fn image_dimension_setter(element: &Element, attr: LocalName, value: u32) {
|
||||
// This setter is a bit weird: the IDL type is unsigned long, but it's parsed as
|
||||
// a dimension for rendering.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue