mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Privatize InheritTypes
This commit is contained in:
parent
acd98a73a4
commit
9a52bb8310
80 changed files with 252 additions and 101 deletions
|
@ -116,8 +116,8 @@ pub trait TLayoutNode {
|
||||||
fail!("not an iframe element!")
|
fail!("not an iframe element!")
|
||||||
}
|
}
|
||||||
let iframe_element: JS<HTMLIFrameElement> = self.get_jsmanaged().transmute_copy();
|
let iframe_element: JS<HTMLIFrameElement> = self.get_jsmanaged().transmute_copy();
|
||||||
let size = (*iframe_element.unsafe_get()).size.get().unwrap();
|
let size = (*iframe_element.unsafe_get()).size().unwrap();
|
||||||
(size.pipeline_id, size.subpage_id)
|
(*size.pipeline_id(), *size.subpage_id())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ impl<'ln> TLayoutNode for LayoutNode<'ln> {
|
||||||
unsafe {
|
unsafe {
|
||||||
if self.get().is_text() {
|
if self.get().is_text() {
|
||||||
let text: JS<Text> = self.get_jsmanaged().transmute_copy();
|
let text: JS<Text> = self.get_jsmanaged().transmute_copy();
|
||||||
(*text.unsafe_get()).characterdata.data.borrow().clone()
|
(*text.unsafe_get()).characterdata().data().clone()
|
||||||
} else if self.get().is_htmlinputelement() {
|
} else if self.get().is_htmlinputelement() {
|
||||||
let input: JS<HTMLInputElement> = self.get_jsmanaged().transmute_copy();
|
let input: JS<HTMLInputElement> = self.get_jsmanaged().transmute_copy();
|
||||||
input.get_value_for_layout()
|
input.get_value_for_layout()
|
||||||
|
@ -765,7 +765,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
||||||
Some(TextNodeTypeId) => {
|
Some(TextNodeTypeId) => {
|
||||||
unsafe {
|
unsafe {
|
||||||
let text: JS<Text> = self.get_jsmanaged().transmute_copy();
|
let text: JS<Text> = self.get_jsmanaged().transmute_copy();
|
||||||
if !is_whitespace((*text.unsafe_get()).characterdata.data.borrow().as_slice()) {
|
if !is_whitespace((*text.unsafe_get()).characterdata().data().as_slice()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5452,7 +5452,7 @@ class GlobalGenRoots():
|
||||||
protoDescriptor = config.getDescriptor(protoName)
|
protoDescriptor = config.getDescriptor(protoName)
|
||||||
delegate = string.Template('''impl ${selfName} for ${baseName} {
|
delegate = string.Template('''impl ${selfName} for ${baseName} {
|
||||||
fn ${fname}(&self) -> bool {
|
fn ${fname}(&self) -> bool {
|
||||||
self.${parentName}.${fname}()
|
self.${parentName}().${fname}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
''').substitute({'fname': 'is_' + name.lower(),
|
''').substitute({'fname': 'is_' + name.lower(),
|
||||||
|
|
|
@ -14,13 +14,14 @@ use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
||||||
use dom::node::{CommentNodeTypeId, Node, NodeTypeId, TextNodeTypeId, ProcessingInstructionNodeTypeId, NodeHelpers};
|
use dom::node::{CommentNodeTypeId, Node, NodeTypeId, TextNodeTypeId, ProcessingInstructionNodeTypeId, NodeHelpers};
|
||||||
use servo_util::str::DOMString;
|
use servo_util::str::DOMString;
|
||||||
|
|
||||||
use std::cell::RefCell;
|
use std::cell::{Ref, RefCell};
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct CharacterData {
|
pub struct CharacterData {
|
||||||
pub node: Node,
|
node: Node,
|
||||||
pub data: RefCell<DOMString>,
|
data: RefCell<DOMString>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CharacterDataDerived for EventTarget {
|
impl CharacterDataDerived for EventTarget {
|
||||||
|
@ -41,6 +42,21 @@ impl CharacterData {
|
||||||
data: RefCell::new(data),
|
data: RefCell::new(data),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn node<'a>(&'a self) -> &'a Node {
|
||||||
|
&self.node
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn data(&self) -> Ref<DOMString> {
|
||||||
|
self.data.borrow()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn set_data(&self, data: DOMString) {
|
||||||
|
*self.data.borrow_mut() = data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
||||||
|
|
|
@ -641,7 +641,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
for child in title_elem.children() {
|
for child in title_elem.children() {
|
||||||
if child.is_text() {
|
if child.is_text() {
|
||||||
let text: JSRef<Text> = TextCast::to_ref(child).unwrap();
|
let text: JSRef<Text> = TextCast::to_ref(child).unwrap();
|
||||||
title.push_str(text.characterdata.data.borrow().as_slice());
|
title.push_str(text.characterdata().data().as_slice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -166,6 +166,11 @@ impl Element {
|
||||||
Node::reflect_node(box Element::new_inherited(ElementTypeId_, local_name, namespace, prefix, document),
|
Node::reflect_node(box Element::new_inherited(ElementTypeId_, local_name, namespace, prefix, document),
|
||||||
document, ElementBinding::Wrap)
|
document, ElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn node<'a>(&'a self) -> &'a Node {
|
||||||
|
&self.node
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait RawLayoutElementHelpers {
|
pub trait RawLayoutElementHelpers {
|
||||||
|
|
|
@ -23,8 +23,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLAnchorElement {
|
pub struct HTMLAnchorElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLAnchorElementDerived for EventTarget {
|
impl HTMLAnchorElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLAppletElement {
|
pub struct HTMLAppletElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLAppletElementDerived for EventTarget {
|
impl HTMLAppletElementDerived for EventTarget {
|
||||||
|
|
|
@ -16,8 +16,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLAreaElement {
|
pub struct HTMLAreaElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLAreaElementDerived for EventTarget {
|
impl HTMLAreaElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLAudioElement {
|
pub struct HTMLAudioElement {
|
||||||
pub htmlmediaelement: HTMLMediaElement
|
htmlmediaelement: HTMLMediaElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLAudioElementDerived for EventTarget {
|
impl HTMLAudioElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLBaseElement {
|
pub struct HTMLBaseElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLBaseElementDerived for EventTarget {
|
impl HTMLBaseElementDerived for EventTarget {
|
||||||
|
|
|
@ -22,8 +22,9 @@ use string_cache::Atom;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLBodyElement {
|
pub struct HTMLBodyElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLBodyElementDerived for EventTarget {
|
impl HTMLBodyElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLBRElement {
|
pub struct HTMLBRElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLBRElementDerived for EventTarget {
|
impl HTMLBRElementDerived for EventTarget {
|
||||||
|
|
|
@ -22,8 +22,9 @@ use string_cache::Atom;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLButtonElement {
|
pub struct HTMLButtonElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLButtonElementDerived for EventTarget {
|
impl HTMLButtonElementDerived for EventTarget {
|
||||||
|
|
|
@ -30,8 +30,9 @@ static DefaultHeight: u32 = 150;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLCanvasElement {
|
pub struct HTMLCanvasElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
context: MutNullableJS<CanvasRenderingContext2D>,
|
context: MutNullableJS<CanvasRenderingContext2D>,
|
||||||
width: Cell<u32>,
|
width: Cell<u32>,
|
||||||
height: Cell<u32>,
|
height: Cell<u32>,
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLDataElement {
|
pub struct HTMLDataElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLDataElementDerived for EventTarget {
|
impl HTMLDataElementDerived for EventTarget {
|
||||||
|
|
|
@ -18,8 +18,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLDataListElement {
|
pub struct HTMLDataListElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLDataListElementDerived for EventTarget {
|
impl HTMLDataListElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLDirectoryElement {
|
pub struct HTMLDirectoryElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLDirectoryElementDerived for EventTarget {
|
impl HTMLDirectoryElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLDivElement {
|
pub struct HTMLDivElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLDivElementDerived for EventTarget {
|
impl HTMLDivElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLDListElement {
|
pub struct HTMLDListElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLDListElementDerived for EventTarget {
|
impl HTMLDListElementDerived for EventTarget {
|
||||||
|
|
|
@ -22,8 +22,9 @@ use string_cache::Atom;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLElement {
|
pub struct HTMLElement {
|
||||||
pub element: Element
|
element: Element
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLElementDerived for EventTarget {
|
impl HTMLElementDerived for EventTarget {
|
||||||
|
@ -48,6 +49,11 @@ impl HTMLElement {
|
||||||
let element = HTMLElement::new_inherited(HTMLElementTypeId, localName, prefix, document);
|
let element = HTMLElement::new_inherited(HTMLElementTypeId, localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn element<'a>(&'a self) -> &'a Element {
|
||||||
|
&self.element
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait PrivateHTMLElementHelpers {
|
trait PrivateHTMLElementHelpers {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLEmbedElement {
|
pub struct HTMLEmbedElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLEmbedElementDerived for EventTarget {
|
impl HTMLEmbedElementDerived for EventTarget {
|
||||||
|
|
|
@ -23,8 +23,9 @@ use string_cache::Atom;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLFieldSetElement {
|
pub struct HTMLFieldSetElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLFieldSetElementDerived for EventTarget {
|
impl HTMLFieldSetElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLFontElement {
|
pub struct HTMLFontElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLFontElementDerived for EventTarget {
|
impl HTMLFontElementDerived for EventTarget {
|
||||||
|
|
|
@ -31,8 +31,9 @@ use url::form_urlencoded::serialize;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLFormElement {
|
pub struct HTMLFormElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLFormElementDerived for EventTarget {
|
impl HTMLFormElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLFrameElement {
|
pub struct HTMLFrameElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLFrameElementDerived for EventTarget {
|
impl HTMLFrameElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLFrameSetElement {
|
pub struct HTMLFrameSetElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLFrameSetElementDerived for EventTarget {
|
impl HTMLFrameSetElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLHeadElement {
|
pub struct HTMLHeadElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLHeadElementDerived for EventTarget {
|
impl HTMLHeadElementDerived for EventTarget {
|
||||||
|
|
|
@ -25,9 +25,10 @@ pub enum HeadingLevel {
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLHeadingElement {
|
pub struct HTMLHeadingElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
pub level: HeadingLevel,
|
level: HeadingLevel,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLHeadingElementDerived for EventTarget {
|
impl HTMLHeadingElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLHRElement {
|
pub struct HTMLHRElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLHRElementDerived for EventTarget {
|
impl HTMLHRElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLHtmlElement {
|
pub struct HTMLHtmlElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLHtmlElementDerived for EventTarget {
|
impl HTMLHtmlElementDerived for EventTarget {
|
||||||
|
|
|
@ -41,10 +41,11 @@ enum SandboxAllowance {
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLIFrameElement {
|
pub struct HTMLIFrameElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
pub size: Cell<Option<IFrameSize>>,
|
size: Cell<Option<IFrameSize>>,
|
||||||
pub sandbox: Cell<Option<u8>>,
|
sandbox: Cell<Option<u8>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLIFrameElementDerived for EventTarget {
|
impl HTMLIFrameElementDerived for EventTarget {
|
||||||
|
@ -54,9 +55,22 @@ impl HTMLIFrameElementDerived for EventTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
|
#[privatize]
|
||||||
pub struct IFrameSize {
|
pub struct IFrameSize {
|
||||||
pub pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
pub subpage_id: SubpageId,
|
subpage_id: SubpageId,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IFrameSize {
|
||||||
|
#[inline]
|
||||||
|
pub fn pipeline_id<'a>(&'a self) -> &'a PipelineId {
|
||||||
|
&self.pipeline_id
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn subpage_id<'a>(&'a self) -> &'a SubpageId {
|
||||||
|
&self.subpage_id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait HTMLIFrameElementHelpers {
|
pub trait HTMLIFrameElementHelpers {
|
||||||
|
@ -126,6 +140,11 @@ impl HTMLIFrameElement {
|
||||||
let element = HTMLIFrameElement::new_inherited(localName, prefix, document);
|
let element = HTMLIFrameElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLIFrameElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLIFrameElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn size(&self) -> Option<IFrameSize> {
|
||||||
|
self.size.get()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> {
|
impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> {
|
||||||
|
|
|
@ -26,8 +26,9 @@ use std::cell::RefCell;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLImageElement {
|
pub struct HTMLImageElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
image: RefCell<Option<Url>>,
|
image: RefCell<Option<Url>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,9 @@ enum InputType {
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLInputElement {
|
pub struct HTMLInputElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
input_type: Cell<InputType>,
|
input_type: Cell<InputType>,
|
||||||
checked: Cell<bool>,
|
checked: Cell<bool>,
|
||||||
uncommitted_value: RefCell<Option<String>>,
|
uncommitted_value: RefCell<Option<String>>,
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLLabelElement {
|
pub struct HTMLLabelElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLLabelElementDerived for EventTarget {
|
impl HTMLLabelElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLLegendElement {
|
pub struct HTMLLegendElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLLegendElementDerived for EventTarget {
|
impl HTMLLegendElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLLIElement {
|
pub struct HTMLLIElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLLIElementDerived for EventTarget {
|
impl HTMLLIElementDerived for EventTarget {
|
||||||
|
|
|
@ -23,8 +23,9 @@ use string_cache::Atom;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLLinkElement {
|
pub struct HTMLLinkElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLLinkElementDerived for EventTarget {
|
impl HTMLLinkElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLMapElement {
|
pub struct HTMLMapElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLMapElementDerived for EventTarget {
|
impl HTMLMapElementDerived for EventTarget {
|
||||||
|
|
|
@ -14,8 +14,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLMediaElement {
|
pub struct HTMLMediaElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLMediaElementDerived for EventTarget {
|
impl HTMLMediaElementDerived for EventTarget {
|
||||||
|
@ -34,6 +35,11 @@ impl HTMLMediaElement {
|
||||||
htmlelement: HTMLElement::new_inherited(type_id, tag_name, prefix, document)
|
htmlelement: HTMLElement::new_inherited(type_id, tag_name, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn htmlelement<'a>(&'a self) -> &'a HTMLElement {
|
||||||
|
&self.htmlelement
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Reflectable for HTMLMediaElement {
|
impl Reflectable for HTMLMediaElement {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLMetaElement {
|
pub struct HTMLMetaElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLMetaElementDerived for EventTarget {
|
impl HTMLMetaElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLMeterElement {
|
pub struct HTMLMeterElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLMeterElementDerived for EventTarget {
|
impl HTMLMeterElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLModElement {
|
pub struct HTMLModElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLModElementDerived for EventTarget {
|
impl HTMLModElementDerived for EventTarget {
|
||||||
|
|
|
@ -27,8 +27,9 @@ use url::Url;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLObjectElement {
|
pub struct HTMLObjectElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLObjectElementDerived for EventTarget {
|
impl HTMLObjectElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLOListElement {
|
pub struct HTMLOListElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLOListElementDerived for EventTarget {
|
impl HTMLOListElementDerived for EventTarget {
|
||||||
|
|
|
@ -20,8 +20,9 @@ use string_cache::Atom;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLOptGroupElement {
|
pub struct HTMLOptGroupElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLOptGroupElementDerived for EventTarget {
|
impl HTMLOptGroupElementDerived for EventTarget {
|
||||||
|
|
|
@ -24,8 +24,9 @@ use string_cache::Atom;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLOptionElement {
|
pub struct HTMLOptionElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLOptionElementDerived for EventTarget {
|
impl HTMLOptionElementDerived for EventTarget {
|
||||||
|
|
|
@ -17,8 +17,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLOutputElement {
|
pub struct HTMLOutputElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLOutputElementDerived for EventTarget {
|
impl HTMLOutputElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLParagraphElement {
|
pub struct HTMLParagraphElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLParagraphElementDerived for EventTarget {
|
impl HTMLParagraphElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLParamElement {
|
pub struct HTMLParamElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLParamElementDerived for EventTarget {
|
impl HTMLParamElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLPreElement {
|
pub struct HTMLPreElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLPreElementDerived for EventTarget {
|
impl HTMLPreElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLProgressElement {
|
pub struct HTMLProgressElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLProgressElementDerived for EventTarget {
|
impl HTMLProgressElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLQuoteElement {
|
pub struct HTMLQuoteElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLQuoteElementDerived for EventTarget {
|
impl HTMLQuoteElementDerived for EventTarget {
|
||||||
|
|
|
@ -20,8 +20,9 @@ use servo_util::str::{DOMString, HTML_SPACE_CHARACTERS, StaticStringVec};
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLScriptElement {
|
pub struct HTMLScriptElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLScriptElementDerived for EventTarget {
|
impl HTMLScriptElementDerived for EventTarget {
|
||||||
|
|
|
@ -23,8 +23,9 @@ use string_cache::Atom;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLSelectElement {
|
pub struct HTMLSelectElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLSelectElementDerived for EventTarget {
|
impl HTMLSelectElementDerived for EventTarget {
|
||||||
|
|
|
@ -69,7 +69,7 @@ pub fn serialize(iterator: &mut NodeIterator) -> String {
|
||||||
|
|
||||||
fn serialize_comment(comment: JSRef<Comment>, html: &mut String) {
|
fn serialize_comment(comment: JSRef<Comment>, html: &mut String) {
|
||||||
html.push_str("<!--");
|
html.push_str("<!--");
|
||||||
html.push_str(comment.characterdata.data.borrow().as_slice());
|
html.push_str(comment.characterdata.data().as_slice());
|
||||||
html.push_str("-->");
|
html.push_str("-->");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,11 +82,11 @@ fn serialize_text(text: JSRef<Text>, html: &mut String) {
|
||||||
"style" | "script" | "xmp" | "iframe" |
|
"style" | "script" | "xmp" | "iframe" |
|
||||||
"noembed" | "noframes" | "plaintext" |
|
"noembed" | "noframes" | "plaintext" |
|
||||||
"noscript" if elem.namespace == ns!(HTML)
|
"noscript" if elem.namespace == ns!(HTML)
|
||||||
=> html.push_str(text.characterdata.data.borrow().as_slice()),
|
=> html.push_str(text.characterdata().data().as_slice()),
|
||||||
_ => escape(text.characterdata.data.borrow().as_slice(), false, html)
|
_ => escape(text.characterdata().data().as_slice(), false, html)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => escape(text.characterdata.data.borrow().as_slice(), false, html)
|
_ => escape(text.characterdata().data().as_slice(), false, html)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ fn serialize_processing_instruction(processing_instruction: JSRef<ProcessingInst
|
||||||
html.push_str("<?");
|
html.push_str("<?");
|
||||||
html.push_str(processing_instruction.target.as_slice());
|
html.push_str(processing_instruction.target.as_slice());
|
||||||
html.push_char(' ');
|
html.push_char(' ');
|
||||||
html.push_str(processing_instruction.characterdata.data.borrow().as_slice());
|
html.push_str(processing_instruction.characterdata.data().as_slice());
|
||||||
html.push_str("?>");
|
html.push_str("?>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ fn serialize_elem(elem: JSRef<Element>, open_elements: &mut Vec<String>, html: &
|
||||||
match node.first_child().map(|child| child.root()) {
|
match node.first_child().map(|child| child.root()) {
|
||||||
Some(ref child) if child.is_text() => {
|
Some(ref child) if child.is_text() => {
|
||||||
let text: JSRef<CharacterData> = CharacterDataCast::to_ref(**child).unwrap();
|
let text: JSRef<CharacterData> = CharacterDataCast::to_ref(**child).unwrap();
|
||||||
if text.data.borrow().len() > 0 && text.data.borrow().as_slice().char_at(0) == '\n' {
|
if text.data().len() > 0 && text.data().as_slice().char_at(0) == '\n' {
|
||||||
html.push_char('\x0A');
|
html.push_char('\x0A');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLSourceElement {
|
pub struct HTMLSourceElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLSourceElementDerived for EventTarget {
|
impl HTMLSourceElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLSpanElement {
|
pub struct HTMLSpanElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLSpanElementDerived for EventTarget {
|
impl HTMLSpanElementDerived for EventTarget {
|
||||||
|
|
|
@ -19,8 +19,9 @@ use style::Stylesheet;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLStyleElement {
|
pub struct HTMLStyleElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLStyleElementDerived for EventTarget {
|
impl HTMLStyleElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLTableCaptionElement {
|
pub struct HTMLTableCaptionElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTableCaptionElementDerived for EventTarget {
|
impl HTMLTableCaptionElementDerived for EventTarget {
|
||||||
|
|
|
@ -14,8 +14,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLTableCellElement {
|
pub struct HTMLTableCellElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTableCellElementDerived for EventTarget {
|
impl HTMLTableCellElementDerived for EventTarget {
|
||||||
|
@ -34,6 +35,11 @@ impl HTMLTableCellElement {
|
||||||
htmlelement: HTMLElement::new_inherited(type_id, tag_name, prefix, document)
|
htmlelement: HTMLElement::new_inherited(type_id, tag_name, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn htmlelement<'a>(&'a self) -> &'a HTMLElement {
|
||||||
|
&self.htmlelement
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Reflectable for HTMLTableCellElement {
|
impl Reflectable for HTMLTableCellElement {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLTableColElement {
|
pub struct HTMLTableColElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTableColElementDerived for EventTarget {
|
impl HTMLTableColElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLTableDataCellElement {
|
pub struct HTMLTableDataCellElement {
|
||||||
pub htmltablecellelement: HTMLTableCellElement,
|
htmltablecellelement: HTMLTableCellElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTableDataCellElementDerived for EventTarget {
|
impl HTMLTableDataCellElementDerived for EventTarget {
|
||||||
|
|
|
@ -19,8 +19,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLTableElement {
|
pub struct HTMLTableElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTableElementDerived for EventTarget {
|
impl HTMLTableElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLTableHeaderCellElement {
|
pub struct HTMLTableHeaderCellElement {
|
||||||
pub htmltablecellelement: HTMLTableCellElement,
|
htmltablecellelement: HTMLTableCellElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTableHeaderCellElementDerived for EventTarget {
|
impl HTMLTableHeaderCellElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLTableRowElement {
|
pub struct HTMLTableRowElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTableRowElementDerived for EventTarget {
|
impl HTMLTableRowElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLTableSectionElement {
|
pub struct HTMLTableSectionElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTableSectionElementDerived for EventTarget {
|
impl HTMLTableSectionElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLTemplateElement {
|
pub struct HTMLTemplateElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTemplateElementDerived for EventTarget {
|
impl HTMLTemplateElementDerived for EventTarget {
|
||||||
|
|
|
@ -20,8 +20,9 @@ use string_cache::Atom;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLTextAreaElement {
|
pub struct HTMLTextAreaElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTextAreaElementDerived for EventTarget {
|
impl HTMLTextAreaElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLTimeElement {
|
pub struct HTMLTimeElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTimeElementDerived for EventTarget {
|
impl HTMLTimeElementDerived for EventTarget {
|
||||||
|
|
|
@ -18,8 +18,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLTitleElement {
|
pub struct HTMLTitleElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTitleElementDerived for EventTarget {
|
impl HTMLTitleElementDerived for EventTarget {
|
||||||
|
@ -50,7 +51,7 @@ impl<'a> HTMLTitleElementMethods for JSRef<'a, HTMLTitleElement> {
|
||||||
for child in node.children() {
|
for child in node.children() {
|
||||||
let text: Option<JSRef<Text>> = TextCast::to_ref(child);
|
let text: Option<JSRef<Text>> = TextCast::to_ref(child);
|
||||||
match text {
|
match text {
|
||||||
Some(text) => content.push_str(text.characterdata.data.borrow().as_slice()),
|
Some(text) => content.push_str(text.characterdata().data().as_slice()),
|
||||||
None => (),
|
None => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLTrackElement {
|
pub struct HTMLTrackElement {
|
||||||
pub htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTrackElementDerived for EventTarget {
|
impl HTMLTrackElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLUListElement {
|
pub struct HTMLUListElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLUListElementDerived for EventTarget {
|
impl HTMLUListElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLUnknownElement {
|
pub struct HTMLUnknownElement {
|
||||||
pub htmlelement: HTMLElement
|
htmlelement: HTMLElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLUnknownElementDerived for EventTarget {
|
impl HTMLUnknownElementDerived for EventTarget {
|
||||||
|
|
|
@ -15,8 +15,9 @@ use servo_util::str::DOMString;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct HTMLVideoElement {
|
pub struct HTMLVideoElement {
|
||||||
pub htmlmediaelement: HTMLMediaElement
|
htmlmediaelement: HTMLMediaElement
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLVideoElementDerived for EventTarget {
|
impl HTMLVideoElementDerived for EventTarget {
|
||||||
|
|
|
@ -1144,6 +1144,11 @@ impl Node {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn eventtarget<'a>(&'a self) -> &'a EventTarget {
|
||||||
|
&self.eventtarget
|
||||||
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#concept-node-adopt
|
// http://dom.spec.whatwg.org/#concept-node-adopt
|
||||||
pub fn adopt(node: JSRef<Node>, document: JSRef<Document>) {
|
pub fn adopt(node: JSRef<Node>, document: JSRef<Document>) {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
|
@ -1464,7 +1469,7 @@ impl Node {
|
||||||
},
|
},
|
||||||
CommentNodeTypeId => {
|
CommentNodeTypeId => {
|
||||||
let comment: JSRef<Comment> = CommentCast::to_ref(node).unwrap();
|
let comment: JSRef<Comment> = CommentCast::to_ref(node).unwrap();
|
||||||
let comment = Comment::new(comment.characterdata.data.borrow().clone(), *document);
|
let comment = Comment::new(comment.characterdata.data().clone(), *document);
|
||||||
NodeCast::from_temporary(comment)
|
NodeCast::from_temporary(comment)
|
||||||
},
|
},
|
||||||
DocumentNodeTypeId => {
|
DocumentNodeTypeId => {
|
||||||
|
@ -1486,13 +1491,13 @@ impl Node {
|
||||||
},
|
},
|
||||||
TextNodeTypeId => {
|
TextNodeTypeId => {
|
||||||
let text: JSRef<Text> = TextCast::to_ref(node).unwrap();
|
let text: JSRef<Text> = TextCast::to_ref(node).unwrap();
|
||||||
let text = Text::new(text.characterdata.data.borrow().clone(), *document);
|
let text = Text::new(text.characterdata().data().clone(), *document);
|
||||||
NodeCast::from_temporary(text)
|
NodeCast::from_temporary(text)
|
||||||
},
|
},
|
||||||
ProcessingInstructionNodeTypeId => {
|
ProcessingInstructionNodeTypeId => {
|
||||||
let pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap();
|
let pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap();
|
||||||
let pi = ProcessingInstruction::new(pi.target.clone(),
|
let pi = ProcessingInstruction::new(pi.target.clone(),
|
||||||
pi.characterdata.data.borrow().clone(), *document);
|
pi.characterdata.data().clone(), *document);
|
||||||
NodeCast::from_temporary(pi)
|
NodeCast::from_temporary(pi)
|
||||||
},
|
},
|
||||||
}.root();
|
}.root();
|
||||||
|
@ -1569,7 +1574,7 @@ impl Node {
|
||||||
for node in iterator {
|
for node in iterator {
|
||||||
let text: Option<JSRef<Text>> = TextCast::to_ref(node);
|
let text: Option<JSRef<Text>> = TextCast::to_ref(node);
|
||||||
match text {
|
match text {
|
||||||
Some(text) => content.push_str(text.characterdata.data.borrow().as_slice()),
|
Some(text) => content.push_str(text.characterdata().data().as_slice()),
|
||||||
None => (),
|
None => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1759,7 +1764,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
self.wait_until_safe_to_modify_dom();
|
self.wait_until_safe_to_modify_dom();
|
||||||
|
|
||||||
let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(self).unwrap();
|
let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(self).unwrap();
|
||||||
*characterdata.data.borrow_mut() = value;
|
characterdata.set_data(value);
|
||||||
|
|
||||||
// Notify the document that the content of this node is different
|
// Notify the document that the content of this node is different
|
||||||
let document = self.owner_doc().root();
|
let document = self.owner_doc().root();
|
||||||
|
@ -1970,12 +1975,12 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
let pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap();
|
let pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap();
|
||||||
let other_pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(other).unwrap();
|
let other_pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(other).unwrap();
|
||||||
(pi.target == other_pi.target) &&
|
(pi.target == other_pi.target) &&
|
||||||
(*pi.characterdata.data.borrow() == *other_pi.characterdata.data.borrow())
|
(*pi.characterdata.data() == *other_pi.characterdata.data())
|
||||||
}
|
}
|
||||||
fn is_equal_characterdata(node: JSRef<Node>, other: JSRef<Node>) -> bool {
|
fn is_equal_characterdata(node: JSRef<Node>, other: JSRef<Node>) -> bool {
|
||||||
let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(node).unwrap();
|
let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(node).unwrap();
|
||||||
let other_characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(other).unwrap();
|
let other_characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(other).unwrap();
|
||||||
*characterdata.data.borrow() == *other_characterdata.data.borrow()
|
*characterdata.data() == *other_characterdata.data()
|
||||||
}
|
}
|
||||||
fn is_equal_element_attrs(node: JSRef<Node>, other: JSRef<Node>) -> bool {
|
fn is_equal_element_attrs(node: JSRef<Node>, other: JSRef<Node>) -> bool {
|
||||||
let element: JSRef<Element> = ElementCast::to_ref(node).unwrap();
|
let element: JSRef<Element> = ElementCast::to_ref(node).unwrap();
|
||||||
|
|
|
@ -18,8 +18,9 @@ use servo_util::str::DOMString;
|
||||||
/// An HTML text node.
|
/// An HTML text node.
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct Text {
|
pub struct Text {
|
||||||
pub characterdata: CharacterData,
|
characterdata: CharacterData,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TextDerived for EventTarget {
|
impl TextDerived for EventTarget {
|
||||||
|
@ -44,6 +45,11 @@ impl Text {
|
||||||
let document = global.as_window().Document().root();
|
let document = global.as_window().Document().root();
|
||||||
Ok(Text::new(text, *document))
|
Ok(Text::new(text, *document))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn characterdata<'a>(&'a self) -> &'a CharacterData {
|
||||||
|
&self.characterdata
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Reflectable for Text {
|
impl Reflectable for Text {
|
||||||
|
|
|
@ -21,8 +21,9 @@ use std::default::Default;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct UIEvent {
|
pub struct UIEvent {
|
||||||
pub event: Event,
|
event: Event,
|
||||||
view: MutNullableJS<Window>,
|
view: MutNullableJS<Window>,
|
||||||
detail: Cell<i32>
|
detail: Cell<i32>
|
||||||
}
|
}
|
||||||
|
@ -67,6 +68,11 @@ impl UIEvent {
|
||||||
init.view.root_ref(), init.detail);
|
init.view.root_ref(), init.detail);
|
||||||
Ok(event)
|
Ok(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn event<'a>(&'a self) -> &'a Event {
|
||||||
|
&self.event
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> UIEventMethods for JSRef<'a, UIEvent> {
|
impl<'a> UIEventMethods for JSRef<'a, UIEvent> {
|
||||||
|
|
|
@ -32,8 +32,9 @@ pub enum WorkerGlobalScopeId {
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct WorkerGlobalScope {
|
pub struct WorkerGlobalScope {
|
||||||
pub eventtarget: EventTarget,
|
eventtarget: EventTarget,
|
||||||
worker_url: Url,
|
worker_url: Url,
|
||||||
js_context: Rc<Cx>,
|
js_context: Rc<Cx>,
|
||||||
resource_task: ResourceTask,
|
resource_task: ResourceTask,
|
||||||
|
@ -61,6 +62,11 @@ impl WorkerGlobalScope {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn eventtarget<'a>(&'a self) -> &'a EventTarget {
|
||||||
|
&self.eventtarget
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_cx(&self) -> *mut JSContext {
|
pub fn get_cx(&self) -> *mut JSContext {
|
||||||
self.js_context.ptr
|
self.js_context.ptr
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,9 @@ use dom::xmlhttprequest::XMLHttpRequestId;
|
||||||
|
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct XMLHttpRequestEventTarget {
|
pub struct XMLHttpRequestEventTarget {
|
||||||
pub eventtarget: EventTarget,
|
eventtarget: EventTarget,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl XMLHttpRequestEventTarget {
|
impl XMLHttpRequestEventTarget {
|
||||||
|
@ -23,6 +24,11 @@ impl XMLHttpRequestEventTarget {
|
||||||
eventtarget: EventTarget::new_inherited(XMLHttpRequestTargetTypeId(type_id))
|
eventtarget: EventTarget::new_inherited(XMLHttpRequestTargetTypeId(type_id))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn eventtarget<'a>(&'a self) -> &'a EventTarget {
|
||||||
|
&self.eventtarget
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl XMLHttpRequestEventTargetDerived for EventTarget {
|
impl XMLHttpRequestEventTargetDerived for EventTarget {
|
||||||
fn is_xmlhttprequesteventtarget(&self) -> bool {
|
fn is_xmlhttprequesteventtarget(&self) -> bool {
|
||||||
|
|
|
@ -503,7 +503,7 @@ pub fn parse_html(page: &Page,
|
||||||
for child in scriptnode.children() {
|
for child in scriptnode.children() {
|
||||||
debug!("child = {:?}", child);
|
debug!("child = {:?}", child);
|
||||||
let text: JSRef<Text> = TextCast::to_ref(child).unwrap();
|
let text: JSRef<Text> = TextCast::to_ref(child).unwrap();
|
||||||
data.push_str(text.characterdata.data.borrow().as_slice());
|
data.push_str(text.characterdata().data().as_slice());
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("script data = {:?}", data);
|
debug!("script data = {:?}", data);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue