mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Add support for trait-based virtual methods on Nodes, and use it for before_remove_attr and after_set_attr.
This commit is contained in:
parent
ea2560ef20
commit
ca6cfb5bca
9 changed files with 173 additions and 65 deletions
|
@ -8,7 +8,7 @@ use dom::attr::Attr;
|
|||
use dom::bindings::codegen::InheritTypes::{CommentCast, DocumentCast, DocumentTypeCast};
|
||||
use dom::bindings::codegen::InheritTypes::{ElementCast, TextCast, NodeCast};
|
||||
use dom::bindings::codegen::InheritTypes::{CharacterDataCast, NodeBase, NodeDerived};
|
||||
use dom::bindings::codegen::InheritTypes::ProcessingInstructionCast;
|
||||
use dom::bindings::codegen::InheritTypes::{ProcessingInstructionCast, EventTargetCast};
|
||||
use dom::bindings::codegen::NodeBinding::NodeConstants;
|
||||
use dom::bindings::js::JS;
|
||||
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
|
||||
|
@ -22,8 +22,9 @@ use dom::documenttype::DocumentType;
|
|||
use dom::element::{Element, ElementTypeId, HTMLAnchorElementTypeId, IElement};
|
||||
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
||||
use dom::nodelist::{NodeList};
|
||||
use dom::text::Text;
|
||||
use dom::processinginstruction::ProcessingInstruction;
|
||||
use dom::text::Text;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom::window::Window;
|
||||
use html::hubbub_html_parser::build_element_from_tag;
|
||||
use layout_interface::{LayoutChan, ReapLayoutDataMsg, UntrustedNodeAddress};
|
||||
|
@ -1834,3 +1835,10 @@ pub fn window_from_node<T: NodeBase>(derived: &JS<T>) -> JS<Window> {
|
|||
let document: JS<Document> = document_from_node(derived);
|
||||
document.get().window.clone()
|
||||
}
|
||||
|
||||
impl VirtualMethods for JS<Node> {
|
||||
fn super_type(&self) -> Option<~VirtualMethods:> {
|
||||
let eventtarget: JS<EventTarget> = EventTargetCast::from(self);
|
||||
Some(~eventtarget as ~VirtualMethods:)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue