mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Link to the HTML multipage spec, not the single-page one.
This commit is contained in:
parent
8cb3c5f628
commit
fa606bf1c8
12 changed files with 47 additions and 47 deletions
|
@ -744,13 +744,13 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-context-2d-imagesmoothingenabled
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-imagesmoothingenabled
|
||||||
fn ImageSmoothingEnabled(&self) -> bool {
|
fn ImageSmoothingEnabled(&self) -> bool {
|
||||||
let state = self.state.borrow();
|
let state = self.state.borrow();
|
||||||
state.image_smoothing_enabled
|
state.image_smoothing_enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-context-2d-imagesmoothingenabled
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-imagesmoothingenabled
|
||||||
fn SetImageSmoothingEnabled(&self, value: bool) -> () {
|
fn SetImageSmoothingEnabled(&self, value: bool) -> () {
|
||||||
self.state.borrow_mut().image_smoothing_enabled = value;
|
self.state.borrow_mut().image_smoothing_enabled = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1170,7 +1170,7 @@ impl DocumentMethods for Document {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-hasfocus
|
// https://html.spec.whatwg.org/multipage/#dom-document-hasfocus
|
||||||
fn HasFocus(&self) -> bool {
|
fn HasFocus(&self) -> bool {
|
||||||
let target = self; // Step 1.
|
let target = self; // Step 1.
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
|
@ -1394,7 +1394,7 @@ impl DocumentMethods for Document {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-lastmodified
|
// https://html.spec.whatwg.org/multipage/#dom-document-lastmodified
|
||||||
fn LastModified(&self) -> DOMString {
|
fn LastModified(&self) -> DOMString {
|
||||||
match self.last_modified {
|
match self.last_modified {
|
||||||
Some(ref t) => t.clone(),
|
Some(ref t) => t.clone(),
|
||||||
|
@ -1419,7 +1419,7 @@ impl DocumentMethods for Document {
|
||||||
TreeWalker::new(self, root, whatToShow, filter)
|
TreeWalker::new(self, root, whatToShow, filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#document.title
|
// https://html.spec.whatwg.org/multipage/#document.title
|
||||||
fn Title(&self) -> DOMString {
|
fn Title(&self) -> DOMString {
|
||||||
let title = self.GetDocumentElement().and_then(|root| {
|
let title = self.GetDocumentElement().and_then(|root| {
|
||||||
if root.r().namespace() == &ns!(SVG) && root.r().local_name() == &atom!("svg") {
|
if root.r().namespace() == &ns!(SVG) && root.r().local_name() == &atom!("svg") {
|
||||||
|
@ -1446,7 +1446,7 @@ impl DocumentMethods for Document {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#document.title
|
// https://html.spec.whatwg.org/multipage/#document.title
|
||||||
fn SetTitle(&self, title: DOMString) {
|
fn SetTitle(&self, title: DOMString) {
|
||||||
let root = match self.GetDocumentElement() {
|
let root = match self.GetDocumentElement() {
|
||||||
Some(root) => root,
|
Some(root) => root,
|
||||||
|
@ -1497,7 +1497,7 @@ impl DocumentMethods for Document {
|
||||||
elem.r().SetTextContent(Some(title));
|
elem.r().SetTextContent(Some(title));
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-head
|
// https://html.spec.whatwg.org/multipage/#dom-document-head
|
||||||
fn GetHead(&self) -> Option<Root<HTMLHeadElement>> {
|
fn GetHead(&self) -> Option<Root<HTMLHeadElement>> {
|
||||||
self.get_html_element().and_then(|root| {
|
self.get_html_element().and_then(|root| {
|
||||||
let node = NodeCast::from_ref(root.r());
|
let node = NodeCast::from_ref(root.r());
|
||||||
|
@ -1507,12 +1507,12 @@ impl DocumentMethods for Document {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-currentscript
|
// https://html.spec.whatwg.org/multipage/#dom-document-currentscript
|
||||||
fn GetCurrentScript(&self) -> Option<Root<HTMLScriptElement>> {
|
fn GetCurrentScript(&self) -> Option<Root<HTMLScriptElement>> {
|
||||||
self.current_script.get_rooted()
|
self.current_script.get_rooted()
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-body
|
// https://html.spec.whatwg.org/multipage/#dom-document-body
|
||||||
fn GetBody(&self) -> Option<Root<HTMLElement>> {
|
fn GetBody(&self) -> Option<Root<HTMLElement>> {
|
||||||
self.get_html_element().and_then(|root| {
|
self.get_html_element().and_then(|root| {
|
||||||
let node = NodeCast::from_ref(root.r());
|
let node = NodeCast::from_ref(root.r());
|
||||||
|
@ -1528,7 +1528,7 @@ impl DocumentMethods for Document {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-body
|
// https://html.spec.whatwg.org/multipage/#dom-document-body
|
||||||
fn SetBody(&self, new_body: Option<&HTMLElement>) -> ErrorResult {
|
fn SetBody(&self, new_body: Option<&HTMLElement>) -> ErrorResult {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
let new_body = match new_body {
|
let new_body = match new_body {
|
||||||
|
@ -1571,7 +1571,7 @@ impl DocumentMethods for Document {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-getelementsbyname
|
// https://html.spec.whatwg.org/multipage/#dom-document-getelementsbyname
|
||||||
fn GetElementsByName(&self, name: DOMString) -> Root<NodeList> {
|
fn GetElementsByName(&self, name: DOMString) -> Root<NodeList> {
|
||||||
self.create_node_list(|node| {
|
self.create_node_list(|node| {
|
||||||
let element = match ElementCast::to_ref(node) {
|
let element = match ElementCast::to_ref(node) {
|
||||||
|
@ -1587,7 +1587,7 @@ impl DocumentMethods for Document {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-images
|
// https://html.spec.whatwg.org/multipage/#dom-document-images
|
||||||
fn Images(&self) -> Root<HTMLCollection> {
|
fn Images(&self) -> Root<HTMLCollection> {
|
||||||
self.images.or_init(|| {
|
self.images.or_init(|| {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
|
@ -1597,7 +1597,7 @@ impl DocumentMethods for Document {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-embeds
|
// https://html.spec.whatwg.org/multipage/#dom-document-embeds
|
||||||
fn Embeds(&self) -> Root<HTMLCollection> {
|
fn Embeds(&self) -> Root<HTMLCollection> {
|
||||||
self.embeds.or_init(|| {
|
self.embeds.or_init(|| {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
|
@ -1607,12 +1607,12 @@ impl DocumentMethods for Document {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-plugins
|
// https://html.spec.whatwg.org/multipage/#dom-document-plugins
|
||||||
fn Plugins(&self) -> Root<HTMLCollection> {
|
fn Plugins(&self) -> Root<HTMLCollection> {
|
||||||
self.Embeds()
|
self.Embeds()
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-links
|
// https://html.spec.whatwg.org/multipage/#dom-document-links
|
||||||
fn Links(&self) -> Root<HTMLCollection> {
|
fn Links(&self) -> Root<HTMLCollection> {
|
||||||
self.links.or_init(|| {
|
self.links.or_init(|| {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
|
@ -1622,7 +1622,7 @@ impl DocumentMethods for Document {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-forms
|
// https://html.spec.whatwg.org/multipage/#dom-document-forms
|
||||||
fn Forms(&self) -> Root<HTMLCollection> {
|
fn Forms(&self) -> Root<HTMLCollection> {
|
||||||
self.forms.or_init(|| {
|
self.forms.or_init(|| {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
|
@ -1632,7 +1632,7 @@ impl DocumentMethods for Document {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-scripts
|
// https://html.spec.whatwg.org/multipage/#dom-document-scripts
|
||||||
fn Scripts(&self) -> Root<HTMLCollection> {
|
fn Scripts(&self) -> Root<HTMLCollection> {
|
||||||
self.scripts.or_init(|| {
|
self.scripts.or_init(|| {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
|
@ -1642,7 +1642,7 @@ impl DocumentMethods for Document {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-anchors
|
// https://html.spec.whatwg.org/multipage/#dom-document-anchors
|
||||||
fn Anchors(&self) -> Root<HTMLCollection> {
|
fn Anchors(&self) -> Root<HTMLCollection> {
|
||||||
self.anchors.or_init(|| {
|
self.anchors.or_init(|| {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
|
@ -1652,7 +1652,7 @@ impl DocumentMethods for Document {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-applets
|
// https://html.spec.whatwg.org/multipage/#dom-document-applets
|
||||||
fn Applets(&self) -> Root<HTMLCollection> {
|
fn Applets(&self) -> Root<HTMLCollection> {
|
||||||
// FIXME: This should be return OBJECT elements containing applets.
|
// FIXME: This should be return OBJECT elements containing applets.
|
||||||
self.applets.or_init(|| {
|
self.applets.or_init(|| {
|
||||||
|
@ -1663,7 +1663,7 @@ impl DocumentMethods for Document {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-location
|
// https://html.spec.whatwg.org/multipage/#dom-document-location
|
||||||
fn Location(&self) -> Root<Location> {
|
fn Location(&self) -> Root<Location> {
|
||||||
let window = self.window.root();
|
let window = self.window.root();
|
||||||
let window = window.r();
|
let window = window.r();
|
||||||
|
@ -1771,7 +1771,7 @@ impl DocumentMethods for Document {
|
||||||
filter_by_name(&self.name, NodeCast::from_ref(elem))
|
filter_by_name(&self.name, NodeCast::from_ref(elem))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// https://html.spec.whatwg.org/#dom-document-nameditem-filter
|
// https://html.spec.whatwg.org/multipage/#dom-document-nameditem-filter
|
||||||
fn filter_by_name(name: &Atom, node: &Node) -> bool {
|
fn filter_by_name(name: &Atom, node: &Node) -> bool {
|
||||||
let html_elem_type = match node.type_id() {
|
let html_elem_type = match node.type_id() {
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(type_)) => type_,
|
NodeTypeId::Element(ElementTypeId::HTMLElement(type_)) => type_,
|
||||||
|
@ -1861,7 +1861,7 @@ impl DocumentMethods for Document {
|
||||||
// This method intentionally does nothing
|
// This method intentionally does nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-document-releaseevents
|
// https://html.spec.whatwg.org/multipage/#dom-document-releaseevents
|
||||||
fn ReleaseEvents(&self) {
|
fn ReleaseEvents(&self) {
|
||||||
// This method intentionally does nothing
|
// This method intentionally does nothing
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl DOMStringMap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#domstringmap
|
// https://html.spec.whatwg.org/multipage/#domstringmap
|
||||||
impl DOMStringMapMethods for DOMStringMap {
|
impl DOMStringMapMethods for DOMStringMap {
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-domstringmap-removeitem
|
// https://html.spec.whatwg.org/multipage/#dom-domstringmap-removeitem
|
||||||
fn NamedDeleter(&self, name: DOMString) {
|
fn NamedDeleter(&self, name: DOMString) {
|
||||||
|
|
|
@ -50,10 +50,10 @@ impl HTMLAppletElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLAppletElementMethods for HTMLAppletElement {
|
impl HTMLAppletElementMethods for HTMLAppletElement {
|
||||||
// https://html.spec.whatwg.org/#the-applet-element:dom-applet-name
|
// https://html.spec.whatwg.org/multipage/#the-applet-element:dom-applet-name
|
||||||
make_getter!(Name);
|
make_getter!(Name);
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#the-applet-element:dom-applet-name
|
// https://html.spec.whatwg.org/multipage/#the-applet-element:dom-applet-name
|
||||||
make_atomic_setter!(SetName, "name");
|
make_atomic_setter!(SetName, "name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -268,7 +268,7 @@ impl HTMLElementMethods for HTMLElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#attr-data-*
|
// https://html.spec.whatwg.org/multipage/#attr-data-*
|
||||||
|
|
||||||
fn to_snake_case(name: DOMString) -> DOMString {
|
fn to_snake_case(name: DOMString) -> DOMString {
|
||||||
let mut attr_name = "data-".to_owned();
|
let mut attr_name = "data-".to_owned();
|
||||||
|
|
|
@ -8,7 +8,7 @@ use dom::bindings::js::Root;
|
||||||
use dom::bindings::utils::{Reflector, reflect_dom_object};
|
use dom::bindings::utils::{Reflector, reflect_dom_object};
|
||||||
use dom::window::Window;
|
use dom::window::Window;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#validitystate
|
// https://html.spec.whatwg.org/multipage/#validitystate
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct ValidityState {
|
pub struct ValidityState {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#canvasgradient
|
// https://html.spec.whatwg.org/multipage/#canvasgradient
|
||||||
// [Exposed=(Window,Worker)]
|
// [Exposed=(Window,Worker)]
|
||||||
interface CanvasGradient {
|
interface CanvasGradient {
|
||||||
// opaque object
|
// opaque object
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#the-domstringmap-interface
|
// https://html.spec.whatwg.org/multipage/#the-domstringmap-interface
|
||||||
[OverrideBuiltins]
|
[OverrideBuiltins]
|
||||||
interface DOMStringMap {
|
interface DOMStringMap {
|
||||||
getter DOMString (DOMString name);
|
getter DOMString (DOMString name);
|
||||||
|
|
|
@ -139,7 +139,7 @@ partial /*sealed*/ interface Document {
|
||||||
};
|
};
|
||||||
Document implements GlobalEventHandlers;
|
Document implements GlobalEventHandlers;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#Document-partial
|
// https://html.spec.whatwg.org/multipage/#Document-partial
|
||||||
partial interface Document {
|
partial interface Document {
|
||||||
// [TreatNullAs=EmptyString] attribute DOMString fgColor;
|
// [TreatNullAs=EmptyString] attribute DOMString fgColor;
|
||||||
// [TreatNullAs=EmptyString] attribute DOMString linkColor;
|
// [TreatNullAs=EmptyString] attribute DOMString linkColor;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#the-body-element
|
// https://html.spec.whatwg.org/multipage/#the-body-element
|
||||||
interface HTMLBodyElement : HTMLElement {
|
interface HTMLBodyElement : HTMLElement {
|
||||||
// also has obsolete members
|
// also has obsolete members
|
||||||
};
|
};
|
||||||
|
|
|
@ -360,7 +360,7 @@ pub fn base64_atob(input: DOMString) -> Fallible<DOMString> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WindowMethods for Window {
|
impl WindowMethods for Window {
|
||||||
// https://html.spec.whatwg.org/#dom-alert
|
// https://html.spec.whatwg.org/multipage/#dom-alert
|
||||||
fn Alert(&self, s: DOMString) {
|
fn Alert(&self, s: DOMString) {
|
||||||
// Right now, just print to the console
|
// Right now, just print to the console
|
||||||
// Ensure that stderr doesn't trample through the alert() we use to
|
// Ensure that stderr doesn't trample through the alert() we use to
|
||||||
|
@ -384,17 +384,17 @@ impl WindowMethods for Window {
|
||||||
self.browsing_context().as_ref().unwrap().active_document()
|
self.browsing_context().as_ref().unwrap().active_document()
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-location
|
// https://html.spec.whatwg.org/multipage/#dom-location
|
||||||
fn Location(&self) -> Root<Location> {
|
fn Location(&self) -> Root<Location> {
|
||||||
self.Document().r().Location()
|
self.Document().r().Location()
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-sessionstorage
|
// https://html.spec.whatwg.org/multipage/#dom-sessionstorage
|
||||||
fn SessionStorage(&self) -> Root<Storage> {
|
fn SessionStorage(&self) -> Root<Storage> {
|
||||||
self.session_storage.or_init(|| Storage::new(&GlobalRef::Window(self), StorageType::Session))
|
self.session_storage.or_init(|| Storage::new(&GlobalRef::Window(self), StorageType::Session))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-localstorage
|
// https://html.spec.whatwg.org/multipage/#dom-localstorage
|
||||||
fn LocalStorage(&self) -> Root<Storage> {
|
fn LocalStorage(&self) -> Root<Storage> {
|
||||||
self.local_storage.or_init(|| Storage::new(&GlobalRef::Window(self), StorageType::Local))
|
self.local_storage.or_init(|| Storage::new(&GlobalRef::Window(self), StorageType::Local))
|
||||||
}
|
}
|
||||||
|
@ -409,17 +409,17 @@ impl WindowMethods for Window {
|
||||||
self.crypto.or_init(|| Crypto::new(GlobalRef::Window(self)))
|
self.crypto.or_init(|| Crypto::new(GlobalRef::Window(self)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-frameelement
|
// https://html.spec.whatwg.org/multipage/#dom-frameelement
|
||||||
fn GetFrameElement(&self) -> Option<Root<Element>> {
|
fn GetFrameElement(&self) -> Option<Root<Element>> {
|
||||||
self.browsing_context().as_ref().unwrap().frame_element()
|
self.browsing_context().as_ref().unwrap().frame_element()
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-navigator
|
// https://html.spec.whatwg.org/multipage/#dom-navigator
|
||||||
fn Navigator(&self) -> Root<Navigator> {
|
fn Navigator(&self) -> Root<Navigator> {
|
||||||
self.navigator.or_init(|| Navigator::new(self))
|
self.navigator.or_init(|| Navigator::new(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-windowtimers-settimeout
|
// https://html.spec.whatwg.org/multipage/#dom-windowtimers-settimeout
|
||||||
fn SetTimeout(&self, _cx: *mut JSContext, callback: Rc<Function>, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
fn SetTimeout(&self, _cx: *mut JSContext, callback: Rc<Function>, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
||||||
self.timers.set_timeout_or_interval(TimerCallback::FunctionTimerCallback(callback),
|
self.timers.set_timeout_or_interval(TimerCallback::FunctionTimerCallback(callback),
|
||||||
args,
|
args,
|
||||||
|
@ -429,7 +429,7 @@ impl WindowMethods for Window {
|
||||||
self.script_chan.clone())
|
self.script_chan.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-windowtimers-settimeout
|
// https://html.spec.whatwg.org/multipage/#dom-windowtimers-settimeout
|
||||||
fn SetTimeout_(&self, _cx: *mut JSContext, callback: DOMString, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
fn SetTimeout_(&self, _cx: *mut JSContext, callback: DOMString, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
||||||
self.timers.set_timeout_or_interval(TimerCallback::StringTimerCallback(callback),
|
self.timers.set_timeout_or_interval(TimerCallback::StringTimerCallback(callback),
|
||||||
args,
|
args,
|
||||||
|
@ -439,12 +439,12 @@ impl WindowMethods for Window {
|
||||||
self.script_chan.clone())
|
self.script_chan.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-windowtimers-cleartimeout
|
// https://html.spec.whatwg.org/multipage/#dom-windowtimers-cleartimeout
|
||||||
fn ClearTimeout(&self, handle: i32) {
|
fn ClearTimeout(&self, handle: i32) {
|
||||||
self.timers.clear_timeout_or_interval(handle);
|
self.timers.clear_timeout_or_interval(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-windowtimers-setinterval
|
// https://html.spec.whatwg.org/multipage/#dom-windowtimers-setinterval
|
||||||
fn SetInterval(&self, _cx: *mut JSContext, callback: Rc<Function>, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
fn SetInterval(&self, _cx: *mut JSContext, callback: Rc<Function>, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
||||||
self.timers.set_timeout_or_interval(TimerCallback::FunctionTimerCallback(callback),
|
self.timers.set_timeout_or_interval(TimerCallback::FunctionTimerCallback(callback),
|
||||||
args,
|
args,
|
||||||
|
@ -454,7 +454,7 @@ impl WindowMethods for Window {
|
||||||
self.script_chan.clone())
|
self.script_chan.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-windowtimers-setinterval
|
// https://html.spec.whatwg.org/multipage/#dom-windowtimers-setinterval
|
||||||
fn SetInterval_(&self, _cx: *mut JSContext, callback: DOMString, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
fn SetInterval_(&self, _cx: *mut JSContext, callback: DOMString, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
||||||
self.timers.set_timeout_or_interval(TimerCallback::StringTimerCallback(callback),
|
self.timers.set_timeout_or_interval(TimerCallback::StringTimerCallback(callback),
|
||||||
args,
|
args,
|
||||||
|
@ -464,7 +464,7 @@ impl WindowMethods for Window {
|
||||||
self.script_chan.clone())
|
self.script_chan.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-windowtimers-clearinterval
|
// https://html.spec.whatwg.org/multipage/#dom-windowtimers-clearinterval
|
||||||
fn ClearInterval(&self, handle: i32) {
|
fn ClearInterval(&self, handle: i32) {
|
||||||
self.ClearTimeout(handle);
|
self.ClearTimeout(handle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,8 +75,8 @@ fn read_numbers<I: Iterator<Item=char>>(mut iter: Peekable<I>) -> Option<i64> {
|
||||||
|
|
||||||
|
|
||||||
/// Shared implementation to parse an integer according to
|
/// Shared implementation to parse an integer according to
|
||||||
/// <https://html.spec.whatwg.org/#rules-for-parsing-integers> or
|
/// <https://html.spec.whatwg.org/multipage/#rules-for-parsing-integers> or
|
||||||
/// <https://html.spec.whatwg.org/#rules-for-parsing-non-negative-integers>
|
/// <https://html.spec.whatwg.org/multipage/#rules-for-parsing-non-negative-integers>
|
||||||
fn do_parse_integer<T: Iterator<Item=char>>(input: T) -> Option<i64> {
|
fn do_parse_integer<T: Iterator<Item=char>>(input: T) -> Option<i64> {
|
||||||
let mut input = input.skip_while(|c| {
|
let mut input = input.skip_while(|c| {
|
||||||
HTML_SPACE_CHARACTERS.iter().any(|s| s == c)
|
HTML_SPACE_CHARACTERS.iter().any(|s| s == c)
|
||||||
|
@ -101,7 +101,7 @@ fn do_parse_integer<T: Iterator<Item=char>>(input: T) -> Option<i64> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse an integer according to
|
/// Parse an integer according to
|
||||||
/// <https://html.spec.whatwg.org/#rules-for-parsing-integers>.
|
/// <https://html.spec.whatwg.org/multipage/#rules-for-parsing-integers>.
|
||||||
pub fn parse_integer<T: Iterator<Item=char>>(input: T) -> Option<i32> {
|
pub fn parse_integer<T: Iterator<Item=char>>(input: T) -> Option<i32> {
|
||||||
do_parse_integer(input).and_then(|result| {
|
do_parse_integer(input).and_then(|result| {
|
||||||
result.to_i32()
|
result.to_i32()
|
||||||
|
@ -109,7 +109,7 @@ pub fn parse_integer<T: Iterator<Item=char>>(input: T) -> Option<i32> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse an integer according to
|
/// Parse an integer according to
|
||||||
/// <https://html.spec.whatwg.org/#rules-for-parsing-non-negative-integers>
|
/// <https://html.spec.whatwg.org/multipage/#rules-for-parsing-non-negative-integers>
|
||||||
pub fn parse_unsigned_integer<T: Iterator<Item=char>>(input: T) -> Option<u32> {
|
pub fn parse_unsigned_integer<T: Iterator<Item=char>>(input: T) -> Option<u32> {
|
||||||
do_parse_integer(input).and_then(|result| {
|
do_parse_integer(input).and_then(|result| {
|
||||||
result.to_u32()
|
result.to_u32()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue