mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Upgrade to SM 39
This commit is contained in:
parent
a256f39796
commit
675267b782
205 changed files with 6546 additions and 5340 deletions
|
@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::HTMLBodyElementBinding::{self, HTMLBodyEle
|
|||
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
||||
use dom::bindings::codegen::InheritTypes::{EventTargetCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLBodyElementDerived, HTMLElementCast};
|
||||
use dom::bindings::js::{JSRef, Rootable, Temporary};
|
||||
use dom::bindings::js::Root;
|
||||
use dom::bindings::utils::Reflectable;
|
||||
use dom::document::{Document, DocumentHelpers};
|
||||
use dom::element::ElementTypeId;
|
||||
|
@ -25,6 +25,7 @@ use util::str::{self, DOMString};
|
|||
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::Cell;
|
||||
use std::rc::Rc;
|
||||
use time;
|
||||
|
||||
/// How long we should wait before performing the initial reflow after `<body>` is parsed, in
|
||||
|
@ -45,7 +46,7 @@ impl HTMLBodyElementDerived for EventTarget {
|
|||
}
|
||||
|
||||
impl HTMLBodyElement {
|
||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>)
|
||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document)
|
||||
-> HTMLBodyElement {
|
||||
HTMLBodyElement {
|
||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLBodyElement,
|
||||
|
@ -57,43 +58,43 @@ impl HTMLBodyElement {
|
|||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>)
|
||||
-> Temporary<HTMLBodyElement> {
|
||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: &Document)
|
||||
-> Root<HTMLBodyElement> {
|
||||
let element = HTMLBodyElement::new_inherited(localName, prefix, document);
|
||||
Node::reflect_node(box element, document, HTMLBodyElementBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> HTMLBodyElementMethods for JSRef<'a, HTMLBodyElement> {
|
||||
impl<'a> HTMLBodyElementMethods for &'a HTMLBodyElement {
|
||||
|
||||
// https://html.spec.whatwg.org/#dom-body-bgcolor
|
||||
make_getter!(BgColor, "bgcolor");
|
||||
make_setter!(SetBgColor, "bgcolor");
|
||||
|
||||
fn GetOnunload(self) -> Option<EventHandlerNonNull> {
|
||||
let win = window_from_node(self).root();
|
||||
fn GetOnunload(self) -> Option<Rc<EventHandlerNonNull>> {
|
||||
let win = window_from_node(self);
|
||||
win.r().GetOnunload()
|
||||
}
|
||||
|
||||
fn SetOnunload(self, listener: Option<EventHandlerNonNull>) {
|
||||
let win = window_from_node(self).root();
|
||||
fn SetOnunload(self, listener: Option<Rc<EventHandlerNonNull>>) {
|
||||
let win = window_from_node(self);
|
||||
win.r().SetOnunload(listener)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait HTMLBodyElementHelpers {
|
||||
fn get_background_color(&self) -> Option<RGBA>;
|
||||
fn get_background_color(self) -> Option<RGBA>;
|
||||
}
|
||||
|
||||
impl HTMLBodyElementHelpers for HTMLBodyElement {
|
||||
fn get_background_color(&self) -> Option<RGBA> {
|
||||
impl<'a> HTMLBodyElementHelpers for &'a HTMLBodyElement {
|
||||
fn get_background_color(self) -> Option<RGBA> {
|
||||
self.background_color.get()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, HTMLBodyElement> {
|
||||
impl<'a> VirtualMethods for &'a HTMLBodyElement {
|
||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||
let element: &JSRef<HTMLElement> = HTMLElementCast::from_borrowed_ref(self);
|
||||
let element: &&HTMLElement = HTMLElementCast::from_borrowed_ref(self);
|
||||
Some(element as &VirtualMethods)
|
||||
}
|
||||
|
||||
|
@ -106,15 +107,15 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLBodyElement> {
|
|||
return
|
||||
}
|
||||
|
||||
let window = window_from_node(*self).root();
|
||||
let document = window.r().Document().root();
|
||||
let window = window_from_node(*self);
|
||||
let document = window.r().Document();
|
||||
document.r().set_reflow_timeout(time::precise_time_ns() + INITIAL_REFLOW_DELAY);
|
||||
let ConstellationChan(ref chan) = window.r().constellation_chan();
|
||||
let event = ConstellationMsg::HeadParsed;
|
||||
chan.send(event).unwrap();
|
||||
}
|
||||
|
||||
fn after_set_attr(&self, attr: JSRef<Attr>) {
|
||||
fn after_set_attr(&self, attr: &Attr) {
|
||||
if let Some(ref s) = self.super_type() {
|
||||
s.after_set_attr(attr);
|
||||
}
|
||||
|
@ -126,11 +127,11 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLBodyElement> {
|
|||
"onbeforeunload", "onhashchange", "onlanguagechange", "onmessage",
|
||||
"onoffline", "ononline", "onpagehide", "onpageshow", "onpopstate",
|
||||
"onstorage", "onresize", "onunload", "onerror"];
|
||||
let window = window_from_node(*self).root();
|
||||
let window = window_from_node(*self);
|
||||
let (cx, url, reflector) = (window.r().get_cx(),
|
||||
window.r().get_url(),
|
||||
window.r().reflector().get_jsobject());
|
||||
let evtarget: JSRef<EventTarget> =
|
||||
let evtarget =
|
||||
if FORWARDED_EVENTS.iter().any(|&event| &**name == event) {
|
||||
EventTargetCast::from_ref(window.r())
|
||||
} else {
|
||||
|
@ -149,7 +150,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLBodyElement> {
|
|||
}
|
||||
}
|
||||
|
||||
fn before_remove_attr(&self, attr: JSRef<Attr>) {
|
||||
fn before_remove_attr(&self, attr: &Attr) {
|
||||
match self.super_type() {
|
||||
Some(ref s) => s.before_remove_attr(attr),
|
||||
_ => {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue