Remove not-yet-implemented APIs, and update MouseEvent to specification.

This commit is contained in:
Ms2ger 2014-06-02 12:32:09 +02:00
parent 59cef940e8
commit c1d2d700c5
15 changed files with 198 additions and 706 deletions

View file

@ -7,7 +7,6 @@ use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::codegen::BindingDeclarations::BlobBinding; use dom::bindings::codegen::BindingDeclarations::BlobBinding;
use dom::window::Window; use dom::window::Window;
use servo_util::str::DOMString;
#[deriving(Encodable)] #[deriving(Encodable)]
pub struct Blob { pub struct Blob {
@ -35,27 +34,6 @@ impl Blob {
} }
pub trait BlobMethods { pub trait BlobMethods {
fn Size(&self) -> u64;
fn Type(&self) -> DOMString;
fn Slice(&self, _start: Option<i64>, _end: Option<i64>, _contentType: Option<DOMString>) -> Temporary<Blob>;
fn Close(&self);
}
impl<'a> BlobMethods for JSRef<'a, Blob> {
fn Size(&self) -> u64 {
0
}
fn Type(&self) -> DOMString {
"".to_owned()
}
fn Slice(&self, _start: Option<i64>, _end: Option<i64>, _contentType: Option<DOMString>) -> Temporary<Blob> {
let window = self.window.root();
Blob::new(&window.root_ref())
}
fn Close(&self) {}
} }
impl Reflectable for Blob { impl Reflectable for Blob {

View file

@ -5,7 +5,6 @@
use dom::bindings::codegen::BindingDeclarations::LocationBinding; use dom::bindings::codegen::BindingDeclarations::LocationBinding;
use dom::bindings::js::{JSRef, Temporary}; use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::error::Fallible;
use dom::window::Window; use dom::window::Window;
use servo_util::str::DOMString; use servo_util::str::DOMString;
@ -37,128 +36,13 @@ impl Location {
} }
pub trait LocationMethods { pub trait LocationMethods {
fn Assign(&self, _url: DOMString);
fn Replace(&self, _url: DOMString);
fn Reload(&self);
fn Href(&self) -> DOMString; fn Href(&self) -> DOMString;
fn SetHref(&self, _href: DOMString) -> Fallible<()>;
fn Origin(&self) -> DOMString;
fn Protocol(&self) -> DOMString;
fn SetProtocol(&self, _protocol: DOMString);
fn Username(&self) -> DOMString;
fn SetUsername(&self, _username: DOMString);
fn Password(&self) -> DOMString;
fn SetPassword(&self, _password: DOMString);
fn Host(&self) -> DOMString;
fn SetHost(&self, _host: DOMString);
fn Hostname(&self) -> DOMString;
fn SetHostname(&self, _hostname: DOMString);
fn Port(&self) -> DOMString;
fn SetPort(&self, _port: DOMString);
fn Pathname(&self) -> DOMString;
fn SetPathname(&self, _pathname: DOMString);
fn Search(&self) -> DOMString;
fn SetSearch(&self, _search: DOMString);
fn Hash(&self) -> DOMString;
fn SetHash(&self, _hash: DOMString);
} }
impl<'a> LocationMethods for JSRef<'a, Location> { impl<'a> LocationMethods for JSRef<'a, Location> {
fn Assign(&self, _url: DOMString) {
}
fn Replace(&self, _url: DOMString) {
}
fn Reload(&self) {
}
fn Href(&self) -> DOMString { fn Href(&self) -> DOMString {
self.page.get_url().to_str() self.page.get_url().to_str()
} }
fn SetHref(&self, _href: DOMString) -> Fallible<()> {
Ok(())
}
fn Origin(&self) -> DOMString {
"".to_owned()
}
fn Protocol(&self) -> DOMString {
"".to_owned()
}
fn SetProtocol(&self, _protocol: DOMString) {
}
fn Username(&self) -> DOMString {
"".to_owned()
}
fn SetUsername(&self, _username: DOMString) {
}
fn Password(&self) -> DOMString {
"".to_owned()
}
fn SetPassword(&self, _password: DOMString) {
}
fn Host(&self) -> DOMString {
"".to_owned()
}
fn SetHost(&self, _host: DOMString) {
}
fn Hostname(&self) -> DOMString {
"".to_owned()
}
fn SetHostname(&self, _hostname: DOMString) {
}
fn Port(&self) -> DOMString {
"".to_owned()
}
fn SetPort(&self, _port: DOMString) {
}
fn Pathname(&self) -> DOMString {
"".to_owned()
}
fn SetPathname(&self, _pathname: DOMString) {
}
fn Search(&self) -> DOMString {
"".to_owned()
}
fn SetSearch(&self, _search: DOMString) {
}
fn Hash(&self) -> DOMString {
"".to_owned()
}
fn SetHash(&self, _hash: DOMString) {
}
} }
impl Reflectable for Location { impl Reflectable for Location {

View file

@ -25,7 +25,7 @@ pub struct MouseEvent {
pub shift_key: bool, pub shift_key: bool,
pub alt_key: bool, pub alt_key: bool,
pub meta_key: bool, pub meta_key: bool,
pub button: u16, pub button: i16,
pub related_target: Cell<Option<JS<EventTarget>>> pub related_target: Cell<Option<JS<EventTarget>>>
} }
@ -72,7 +72,7 @@ impl MouseEvent {
altKey: bool, altKey: bool,
shiftKey: bool, shiftKey: bool,
metaKey: bool, metaKey: bool,
button: u16, button: i16,
relatedTarget: Option<JSRef<EventTarget>>) -> Temporary<MouseEvent> { relatedTarget: Option<JSRef<EventTarget>>) -> Temporary<MouseEvent> {
let mut ev = MouseEvent::new_uninitialized(window).root(); let mut ev = MouseEvent::new_uninitialized(window).root();
ev.InitMouseEvent(type_, canBubble, cancelable, view, detail, ev.InitMouseEvent(type_, canBubble, cancelable, view, detail,
@ -85,9 +85,11 @@ impl MouseEvent {
pub fn Constructor(owner: &JSRef<Window>, pub fn Constructor(owner: &JSRef<Window>,
type_: DOMString, type_: DOMString,
init: &MouseEventBinding::MouseEventInit) -> Fallible<Temporary<MouseEvent>> { init: &MouseEventBinding::MouseEventInit) -> Fallible<Temporary<MouseEvent>> {
let event = MouseEvent::new(owner, type_, init.bubbles, init.cancelable, let event = MouseEvent::new(owner, type_, init.parent.parent.bubbles,
init.view.root_ref(), init.parent.parent.cancelable,
init.detail, init.screenX, init.screenY, init.parent.view.root_ref(),
init.parent.detail,
init.screenX, init.screenY,
init.clientX, init.clientY, init.ctrlKey, init.clientX, init.clientY, init.ctrlKey,
init.altKey, init.shiftKey, init.metaKey, init.altKey, init.shiftKey, init.metaKey,
init.button, init.relatedTarget.root_ref()); init.button, init.relatedTarget.root_ref());
@ -104,10 +106,8 @@ pub trait MouseEventMethods {
fn ShiftKey(&self) -> bool; fn ShiftKey(&self) -> bool;
fn AltKey(&self) -> bool; fn AltKey(&self) -> bool;
fn MetaKey(&self) -> bool; fn MetaKey(&self) -> bool;
fn Button(&self) -> u16; fn Button(&self) -> i16;
fn Buttons(&self)-> u16;
fn GetRelatedTarget(&self) -> Option<Temporary<EventTarget>>; fn GetRelatedTarget(&self) -> Option<Temporary<EventTarget>>;
fn GetModifierState(&self, _keyArg: DOMString) -> bool;
fn InitMouseEvent(&mut self, fn InitMouseEvent(&mut self,
typeArg: DOMString, typeArg: DOMString,
canBubbleArg: bool, canBubbleArg: bool,
@ -122,7 +122,7 @@ pub trait MouseEventMethods {
altKeyArg: bool, altKeyArg: bool,
shiftKeyArg: bool, shiftKeyArg: bool,
metaKeyArg: bool, metaKeyArg: bool,
buttonArg: u16, buttonArg: i16,
relatedTargetArg: Option<JSRef<EventTarget>>); relatedTargetArg: Option<JSRef<EventTarget>>);
} }
@ -159,24 +159,14 @@ impl<'a> MouseEventMethods for JSRef<'a, MouseEvent> {
self.meta_key self.meta_key
} }
fn Button(&self) -> u16 { fn Button(&self) -> i16 {
self.button self.button
} }
fn Buttons(&self)-> u16 {
//TODO
0
}
fn GetRelatedTarget(&self) -> Option<Temporary<EventTarget>> { fn GetRelatedTarget(&self) -> Option<Temporary<EventTarget>> {
self.related_target.get().clone().map(|target| Temporary::new(target)) self.related_target.get().clone().map(|target| Temporary::new(target))
} }
fn GetModifierState(&self, _keyArg: DOMString) -> bool {
//TODO
false
}
fn InitMouseEvent(&mut self, fn InitMouseEvent(&mut self,
typeArg: DOMString, typeArg: DOMString,
canBubbleArg: bool, canBubbleArg: bool,
@ -191,7 +181,7 @@ impl<'a> MouseEventMethods for JSRef<'a, MouseEvent> {
altKeyArg: bool, altKeyArg: bool,
shiftKeyArg: bool, shiftKeyArg: bool,
metaKeyArg: bool, metaKeyArg: bool,
buttonArg: u16, buttonArg: i16,
relatedTargetArg: Option<JSRef<EventTarget>>) { relatedTargetArg: Option<JSRef<EventTarget>>) {
{ {
let uievent: &mut JSRef<UIEvent> = UIEventCast::from_mut_ref(self); let uievent: &mut JSRef<UIEvent> = UIEventCast::from_mut_ref(self);

View file

@ -5,7 +5,6 @@
use dom::bindings::codegen::BindingDeclarations::NavigatorBinding; use dom::bindings::codegen::BindingDeclarations::NavigatorBinding;
use dom::bindings::js::{JSRef, Temporary}; use dom::bindings::js::{JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::bindings::error::Fallible;
use dom::window::Window; use dom::window::Window;
use servo_util::str::DOMString; use servo_util::str::DOMString;
@ -29,57 +28,18 @@ impl Navigator {
} }
pub trait NavigatorMethods { pub trait NavigatorMethods {
fn DoNotTrack(&self) -> DOMString;
fn Vendor(&self) -> DOMString;
fn VendorSub(&self) -> DOMString;
fn Product(&self) -> DOMString; fn Product(&self) -> DOMString;
fn ProductSub(&self) -> DOMString;
fn CookieEnabled(&self) -> bool;
fn GetBuildID(&self) -> Fallible<DOMString>;
fn JavaEnabled(&self) -> Fallible<bool>;
fn TaintEnabled(&self) -> bool; fn TaintEnabled(&self) -> bool;
fn AppName(&self) -> DOMString; fn AppName(&self) -> DOMString;
fn GetAppCodeName(&self) -> Fallible<DOMString>; fn AppCodeName(&self) -> DOMString;
fn GetAppVersion(&self) -> Fallible<DOMString>; fn Platform(&self) -> DOMString;
fn GetPlatform(&self) -> Fallible<DOMString>;
fn GetUserAgent(&self) -> Fallible<DOMString>;
fn GetLanguage(&self) -> Option<DOMString>;
fn OnLine(&self) -> bool;
} }
impl<'a> NavigatorMethods for JSRef<'a, Navigator> { impl<'a> NavigatorMethods for JSRef<'a, Navigator> {
fn DoNotTrack(&self) -> DOMString {
"unspecified".to_owned()
}
fn Vendor(&self) -> DOMString {
"".to_owned() // Like Gecko
}
fn VendorSub(&self) -> DOMString {
"".to_owned() // Like Gecko
}
fn Product(&self) -> DOMString { fn Product(&self) -> DOMString {
"Gecko".to_owned() "Gecko".to_owned()
} }
fn ProductSub(&self) -> DOMString {
"".to_owned()
}
fn CookieEnabled(&self) -> bool {
false
}
fn GetBuildID(&self) -> Fallible<DOMString> {
Ok("".to_owned())
}
fn JavaEnabled(&self) -> Fallible<bool> {
Ok(false)
}
fn TaintEnabled(&self) -> bool { fn TaintEnabled(&self) -> bool {
false false
} }
@ -88,28 +48,12 @@ impl<'a> NavigatorMethods for JSRef<'a, Navigator> {
"Netscape".to_owned() // Like Gecko/Webkit "Netscape".to_owned() // Like Gecko/Webkit
} }
fn GetAppCodeName(&self) -> Fallible<DOMString> { fn AppCodeName(&self) -> DOMString {
Ok("Mozilla".to_owned()) // Like Gecko/Webkit "Mozilla".to_owned()
} }
fn GetAppVersion(&self) -> Fallible<DOMString> { fn Platform(&self) -> DOMString {
Ok("".to_owned()) "".to_owned()
}
fn GetPlatform(&self) -> Fallible<DOMString> {
Ok("".to_owned())
}
fn GetUserAgent(&self) -> Fallible<DOMString> {
Ok("".to_owned())
}
fn GetLanguage(&self) -> Option<DOMString> {
None
}
fn OnLine(&self) -> bool {
true
} }
} }

View file

@ -8,7 +8,6 @@ use dom::bindings::js::{JS, JSRef, RootedReference, Temporary, OptionalSettable}
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::event::{Event, EventMethods, EventTypeId, UIEventTypeId}; use dom::event::{Event, EventMethods, EventTypeId, UIEventTypeId};
use dom::node::Node;
use dom::window::Window; use dom::window::Window;
use servo_util::str::DOMString; use servo_util::str::DOMString;
@ -67,16 +66,6 @@ impl UIEvent {
pub trait UIEventMethods { pub trait UIEventMethods {
fn GetView(&self) -> Option<Temporary<Window>>; fn GetView(&self) -> Option<Temporary<Window>>;
fn Detail(&self) -> i32; fn Detail(&self) -> i32;
fn LayerX(&self) -> i32;
fn LayerY(&self) -> i32;
fn PageX(&self) -> i32;
fn PageY(&self) -> i32;
fn Which(&self) -> u32;
fn GetRangeParent(&self) -> Option<Temporary<Node>>;
fn RangeOffset(&self) -> i32;
fn CancelBubble(&self) -> bool;
fn SetCancelBubble(&self, _val: bool);
fn IsChar(&self) -> bool;
fn InitUIEvent(&mut self, fn InitUIEvent(&mut self,
type_: DOMString, type_: DOMString,
can_bubble: bool, can_bubble: bool,
@ -107,55 +96,6 @@ impl<'a> UIEventMethods for JSRef<'a, UIEvent> {
self.view.assign(view); self.view.assign(view);
self.detail = detail; self.detail = detail;
} }
fn LayerX(&self) -> i32 {
//TODO
0
}
fn LayerY(&self) -> i32 {
//TODO
0
}
fn PageX(&self) -> i32 {
//TODO
0
}
fn PageY(&self) -> i32 {
//TODO
0
}
fn Which(&self) -> u32 {
//TODO
0
}
fn GetRangeParent(&self) -> Option<Temporary<Node>> {
//TODO
None
}
fn RangeOffset(&self) -> i32 {
//TODO
0
}
fn CancelBubble(&self) -> bool {
//TODO
false
}
fn SetCancelBubble(&self, _val: bool) {
//TODO
}
fn IsChar(&self) -> bool {
//TODO
false
}
} }
impl Reflectable for UIEvent { impl Reflectable for UIEvent {

View file

@ -32,53 +32,6 @@ impl ValidityState {
} }
pub trait ValidityStateMethods { pub trait ValidityStateMethods {
fn ValueMissing(&self) -> bool;
fn TypeMismatch(&self) -> bool;
fn PatternMismatch(&self) -> bool;
fn TooLong(&self) -> bool;
fn RangeUnderflow(&self) -> bool;
fn RangeOverflow(&self) -> bool;
fn StepMismatch(&self) -> bool;
fn CustomError(&self) -> bool;
fn Valid(&self) -> bool;
}
impl<'a> ValidityStateMethods for JSRef<'a, ValidityState> {
fn ValueMissing(&self) -> bool {
false
}
fn TypeMismatch(&self) -> bool {
false
}
fn PatternMismatch(&self) -> bool {
false
}
fn TooLong(&self) -> bool {
false
}
fn RangeUnderflow(&self) -> bool {
false
}
fn RangeOverflow(&self) -> bool {
false
}
fn StepMismatch(&self) -> bool {
false
}
fn CustomError(&self) -> bool {
false
}
fn Valid(&self) -> bool {
true
}
} }
impl Reflectable for ValidityState { impl Reflectable for ValidityState {

View file

@ -1,28 +1,29 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * License, v. 2.0. If a copy of the MPL was not distributed with this
* You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
*
* The origin of this IDL file is
* http://dev.w3.org/2006/webapi/FileAPI/#blob
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
[Constructor/*, // http://dev.w3.org/2006/webapi/FileAPI/#dfn-Blob
Constructor(sequence<(ArrayBuffer or ArrayBufferView or Blob or DOMString)> blobParts, optional BlobPropertyBag option)*/] //[Exposed=Window,Worker][Constructor,
// Constructor(sequence<(ArrayBuffer or ArrayBufferView or Blob or DOMString)> blobParts, optional BlobPropertyBag options)]
[Constructor]
interface Blob { interface Blob {
readonly attribute unsigned long long size;
readonly attribute DOMString type;
Blob slice(/*[Clamp]*/ optional long long start, //readonly attribute unsigned long long size;
/*[Clamp]*/ optional long long end, //readonly attribute DOMString type;
optional DOMString contentType); //readonly attribute boolean isClosed;
void close();
//slice Blob into byte-ranged chunks
//Blob slice([Clamp] optional long long start,
// [Clamp] optional long long end,
// optional DOMString contentType);
//void close();
}; };
dictionary BlobPropertyBag { dictionary BlobPropertyBag {
DOMString type = ""; DOMString type = "";
}; };

View file

@ -1,21 +1,12 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * License, v. 2.0. If a copy of the MPL was not distributed with this
* You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/#the-location-interface
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
// No support for [Unforgeable] on interfaces yet // http://www.whatwg.org/html/#location
//[Unforgeable] /*[Unforgeable]*/ interface Location {
interface Location { //void assign(DOMString url);
void assign(DOMString url); //void replace(DOMString url);
void replace(DOMString url); //void reload();
void reload();
}; };
Location implements URLUtils; Location implements URLUtils;

View file

@ -1,15 +1,10 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
*
* For more information on this interface please see
* http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-MouseEvent
[Constructor(DOMString typeArg, optional MouseEventInit mouseEventInitDict)]
interface MouseEvent : UIEvent { interface MouseEvent : UIEvent {
readonly attribute long screenX; readonly attribute long screenX;
readonly attribute long screenY; readonly attribute long screenY;
@ -19,47 +14,15 @@ interface MouseEvent : UIEvent {
readonly attribute boolean shiftKey; readonly attribute boolean shiftKey;
readonly attribute boolean altKey; readonly attribute boolean altKey;
readonly attribute boolean metaKey; readonly attribute boolean metaKey;
readonly attribute unsigned short button; readonly attribute short button;
readonly attribute unsigned short buttons;
readonly attribute EventTarget? relatedTarget; readonly attribute EventTarget? relatedTarget;
// Deprecated in DOM Level 3: // Introduced in DOM Level 3
void initMouseEvent(DOMString typeArg, //readonly attribute unsigned short buttons;
boolean canBubbleArg, //boolean getModifierState (DOMString keyArg);
boolean cancelableArg,
Window? viewArg,
long detailArg,
long screenXArg,
long screenYArg,
long clientXArg,
long clientYArg,
boolean ctrlKeyArg,
boolean altKeyArg,
boolean shiftKeyArg,
boolean metaKeyArg,
unsigned short buttonArg,
EventTarget? relatedTargetArg);
// Introduced in DOM Level 3:
boolean getModifierState(DOMString keyArg);
}; };
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-MouseEventInit
// Event Constructor Syntax: dictionary MouseEventInit : UIEventInit {
[Constructor(DOMString typeArg, optional MouseEventInit mouseEventInitDict)]
partial interface MouseEvent
{
};
// Suggested initMouseEvent replacement initializer:
dictionary MouseEventInit {
// Attributes from Event:
boolean bubbles = false;
boolean cancelable = false;
// Attributes from UIEvent:
Window? view = null;
long detail = 0;
// Attributes for MouseEvent:
long screenX = 0; long screenX = 0;
long screenY = 0; long screenY = 0;
long clientX = 0; long clientX = 0;
@ -68,8 +31,13 @@ dictionary MouseEventInit {
boolean shiftKey = false; boolean shiftKey = false;
boolean altKey = false; boolean altKey = false;
boolean metaKey = false; boolean metaKey = false;
unsigned short button = 0; short button = 0;
// Note: "buttons" was not previously initializable through initMouseEvent! //unsigned short buttons = 0;
unsigned short buttons = 0;
EventTarget? relatedTarget = null; EventTarget? relatedTarget = null;
}; };
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-MouseEvent-1
partial interface MouseEvent {
// Deprecated in DOM Level 3
void initMouseEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Window? viewArg, long detailArg, long screenXArg, long screenYArg, long clientXArg, long clientYArg, boolean ctrlKeyArg, boolean altKeyArg, boolean shiftKeyArg, boolean metaKeyArg, short buttonArg, EventTarget? relatedTargetArg);
};

View file

@ -1,80 +1,27 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * License, v. 2.0. If a copy of the MPL was not distributed with this
* You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/#the-navigator-object
* http://www.w3.org/TR/tracking-dnt/
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
// http://www.whatwg.org/specs/web-apps/current-work/#the-navigator-object // http://www.whatwg.org/html/#navigator
interface Navigator { interface Navigator {
// objects implementing this interface also implement the interfaces given below // objects implementing this interface also implement the interfaces given below
}; };
Navigator implements NavigatorID; Navigator implements NavigatorID;
Navigator implements NavigatorLanguage; //Navigator implements NavigatorLanguage;
Navigator implements NavigatorOnLine; //Navigator implements NavigatorOnLine;
//Navigator implements NavigatorContentUtils; //Navigator implements NavigatorContentUtils;
//Navigator implements NavigatorStorageUtils; //Navigator implements NavigatorStorageUtils;
//Navigator implements NavigatorPlugins;
[NoInterfaceObject] // http://www.whatwg.org/html/#navigatorid
[NoInterfaceObject, Exposed=Window,Worker]
interface NavigatorID { interface NavigatorID {
readonly attribute DOMString appCodeName; // constant "Mozilla"
readonly attribute DOMString appName; readonly attribute DOMString appName;
[Throws] //readonly attribute DOMString appVersion;
readonly attribute DOMString appVersion;
[Throws]
readonly attribute DOMString platform; readonly attribute DOMString platform;
[Throws] readonly attribute DOMString product; // constant "Gecko"
readonly attribute DOMString userAgent; boolean taintEnabled(); // constant false
//readonly attribute DOMString userAgent;
// Spec has this as a const, but that's wrong because it should not
// be on the interface object.
//const DOMString product = "Gecko"; // for historical reasons
readonly attribute DOMString product;
};
[NoInterfaceObject]
interface NavigatorLanguage {
readonly attribute DOMString? language;
};
[NoInterfaceObject]
interface NavigatorOnLine {
readonly attribute boolean onLine;
};
// http://www.w3.org/TR/tracking-dnt/ sort of
partial interface Navigator {
readonly attribute DOMString doNotTrack;
};
// Mozilla-specific extensions
// nsIDOMNavigator
partial interface Navigator {
// WebKit/Blink/Trident/Presto support this (hardcoded "Mozilla").
[Throws]
readonly attribute DOMString appCodeName;
//[Throws]
//readonly attribute DOMString oscpu;
// WebKit/Blink support this; Trident/Presto do not.
readonly attribute DOMString vendor;
// WebKit/Blink supports this (hardcoded ""); Trident/Presto do not.
readonly attribute DOMString vendorSub;
// WebKit/Blink supports this (hardcoded "20030107"); Trident/Presto don't
readonly attribute DOMString productSub;
// WebKit/Blink/Trident/Presto support this.
readonly attribute boolean cookieEnabled;
[Throws]
readonly attribute DOMString buildID;
// WebKit/Blink/Trident/Presto support this.
[Throws]
boolean javaEnabled();
// Everyone but WebKit/Blink supports this. See bug 679971.
boolean taintEnabled();
}; };

View file

@ -1,45 +1,25 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
*
* For more information on this interface please see
* http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-UIEvent
[Constructor(DOMString type, optional UIEventInit eventInitDict)] [Constructor(DOMString type, optional UIEventInit eventInitDict)]
interface UIEvent : Event interface UIEvent : Event {
{ // readonly attribute WindowProxy? view;
readonly attribute Window? view; readonly attribute Window? view;
readonly attribute long detail; readonly attribute long detail;
void initUIEvent(DOMString aType,
boolean aCanBubble,
boolean aCancelable,
Window? aView,
long aDetail);
}; };
// Additional DOM0 properties. // https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-UIEventInit
partial interface UIEvent { dictionary UIEventInit : EventInit {
const long SCROLL_PAGE_UP = -32768; // WindowProxy? view = null;
const long SCROLL_PAGE_DOWN = 32768;
readonly attribute long layerX;
readonly attribute long layerY;
readonly attribute long pageX;
readonly attribute long pageY;
readonly attribute unsigned long which;
readonly attribute Node? rangeParent;
readonly attribute long rangeOffset;
attribute boolean cancelBubble;
readonly attribute boolean isChar;
};
dictionary UIEventInit : EventInit
{
Window? view = null; Window? view = null;
long detail = 0; long detail = 0;
}; };
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-UIEvent-1
partial interface UIEvent {
// Deprecated in DOM Level 3
void initUIEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Window? viewArg, long detailArg);
};

View file

@ -1,32 +1,23 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * License, v. 2.0. If a copy of the MPL was not distributed with this
* You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
*
* The origin of this IDL file is
* http://url.spec.whatwg.org/#urlutils
*
* To the extent possible under law, the editors have waived all copyright
* and related or neighboring rights to this work. In addition, as of 17
* February 2013, the editors have made this specification available under
* the Open Web Foundation Agreement Version 1.0, which is available at
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
*/
// http://url.spec.whatwg.org/#urlutils
[NoInterfaceObject] [NoInterfaceObject]
interface URLUtils { interface URLUtils {
[SetterThrows] //stringifier attribute ScalarValueString href;
/* stringifier */ attribute DOMString href; readonly attribute DOMString href;
readonly attribute DOMString origin; //readonly attribute ScalarValueString origin;
attribute DOMString protocol; // attribute ScalarValueString protocol;
attribute DOMString username; // attribute ScalarValueString username;
attribute DOMString password; // attribute ScalarValueString password;
attribute DOMString host; // attribute ScalarValueString host;
attribute DOMString hostname; // attribute ScalarValueString hostname;
attribute DOMString port; // attribute ScalarValueString port;
attribute DOMString pathname; // attribute ScalarValueString pathname;
attribute DOMString search; // attribute ScalarValueString search;
// attribute URLQuery? query; // attribute URLSearchParams searchParams;
attribute DOMString hash; // attribute ScalarValueString hash;
}; };

View file

@ -1,25 +1,19 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * License, v. 2.0. If a copy of the MPL was not distributed with this
* You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/#validitystate
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
// http://www.whatwg.org/html/#validitystate
interface ValidityState { interface ValidityState {
readonly attribute boolean valueMissing; //readonly attribute boolean valueMissing;
readonly attribute boolean typeMismatch; //readonly attribute boolean typeMismatch;
readonly attribute boolean patternMismatch; //readonly attribute boolean patternMismatch;
readonly attribute boolean tooLong; //readonly attribute boolean tooLong;
readonly attribute boolean rangeUnderflow; //readonly attribute boolean tooShort;
readonly attribute boolean rangeOverflow; //readonly attribute boolean rangeUnderflow;
readonly attribute boolean stepMismatch; //readonly attribute boolean rangeOverflow;
//readonly attribute boolean stepMismatch;
//readonly attribute boolean badInput; //readonly attribute boolean badInput;
readonly attribute boolean customError; //readonly attribute boolean customError;
readonly attribute boolean valid; //readonly attribute boolean valid;
}; };

View file

@ -1,95 +1,86 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * License, v. 2.0. If a copy of the MPL was not distributed with this
* You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
*
* The origin of this IDL file is:
* http://www.w3.org/html/wg/drafts/html/master/browsers.html#the-window-object
*/
[NamedPropertiesObject] // http://www.whatwg.org/html/#window
[PrimaryGlobal]
/*sealed*/ interface Window : EventTarget { /*sealed*/ interface Window : EventTarget {
// the current browsing context // the current browsing context
[Unforgeable] readonly attribute Window window; //[Unforgeable] readonly attribute WindowProxy window;
[Replaceable] readonly attribute Window self; //[Replaceable] readonly attribute WindowProxy self;
[Unforgeable] readonly attribute Document document; readonly attribute Window window;
attribute DOMString name; readonly attribute Window self;
/*[Unforgeable]*/ readonly attribute Document document;
// attribute DOMString name;
/*[PutForwards=href, Unforgeable]*/ readonly attribute Location location; /*[PutForwards=href, Unforgeable]*/ readonly attribute Location location;
/* readonly attribute History history; //readonly attribute History history;
[Replaceable] readonly attribute BarProp locationbar; //[Replaceable] readonly attribute BarProp locationbar;
[Replaceable] readonly attribute BarProp menubar; //[Replaceable] readonly attribute BarProp menubar;
[Replaceable] readonly attribute BarProp personalbar; //[Replaceable] readonly attribute BarProp personalbar;
[Replaceable] readonly attribute BarProp scrollbars; //[Replaceable] readonly attribute BarProp scrollbars;
[Replaceable] readonly attribute BarProp statusbar; //[Replaceable] readonly attribute BarProp statusbar;
[Replaceable] readonly attribute BarProp toolbar;*/ //[Replaceable] readonly attribute BarProp toolbar;
attribute DOMString status; // attribute DOMString status;
void close(); void close();
readonly attribute boolean closed; //readonly attribute boolean closed;
void stop(); //void stop();
void focus(); //void focus();
void blur(); //void blur();
// other browsing contexts // other browsing contexts
/*[Replaceable] readonly attribute Window frames; //[Replaceable] readonly attribute WindowProxy frames;
[Replaceable] readonly attribute unsigned long length; //[Replaceable] readonly attribute unsigned long length;
[Unforgeable] readonly attribute Window top; //[Unforgeable] readonly attribute WindowProxy top;
attribute Window? opener; // attribute any opener;
readonly attribute Window parent;*/ //readonly attribute WindowProxy parent;
readonly attribute Element? frameElement; //readonly attribute Element? frameElement;
/*Window open(optional DOMString url = "about:blank", optional DOMString target = "_blank", optional DOMString features = "", optional boolean replace = false); //WindowProxy open(optional DOMString url = "about:blank", optional DOMString target = "_blank", optional DOMString features = "", optional boolean replace = false);
getter Window (unsigned long index);*/ //getter WindowProxy (unsigned long index);
//getter object (DOMString name); //getter object (DOMString name);
// the user agent // the user agent
readonly attribute Navigator navigator; readonly attribute Navigator navigator;
/* //[Replaceable] readonly attribute External external;
readonly attribute External external; //readonly attribute ApplicationCache applicationCache;
readonly attribute ApplicationCache applicationCache;*/
// user prompts // user prompts
void alert(optional DOMString message = ""); //void alert();
boolean confirm(optional DOMString message = ""); void alert(DOMString message);
DOMString? prompt(optional DOMString message = "", optional DOMString default = ""); //boolean confirm(optional DOMString message = "");
void print(); //DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
any showModalDialog(DOMString url, optional any argument); //void print();
//any showModalDialog(DOMString url, optional any argument);
//void postMessage(any message, DOMString targetOrigin, optional sequence<Transferable> transfer);
// also has obsolete members
}; };
// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HighResolutionTime/Overview.html
partial interface Window {
[Replaceable] readonly attribute Performance performance;
};
// Not part of any spec
partial interface Window {
// web developer niceties
readonly attribute Console console;
};
/*Window implements GlobalEventHandlers;
Window implements WindowEventHandlers;*/
[NoInterfaceObject]
interface WindowTimers {
//long setTimeout(Function handler, optional long timeout = 0, any... arguments);
//XXXjdm No support for Function or variadic arguments yet
long setTimeout(any handler, optional long timeout = 0/*, any... arguments*/);
void clearTimeout(optional long handle = 0);
long setInterval(any handler, optional long timeout = 0/*, any... arguments*/);
void clearInterval(optional long handler = 0);
/*long setTimeout(DOMString handler, optional long timeout = 0, any... arguments);
long setInterval(Function handler, optional long timeout = 0, any... arguments);
long setInterval(DOMString handler, optional long timeout = 0, any... arguments);
void clearInterval(optional long handle = 0);*/
};
Window implements WindowTimers;
Window implements GlobalEventHandlers; Window implements GlobalEventHandlers;
Window implements WindowEventHandlers; Window implements WindowEventHandlers;
Window implements OnErrorEventHandlerForWindow;
// http://www.whatwg.org/html/#windowtimers
interface WindowTimers {
//long setTimeout(Function handler, optional long timeout = 0, any... arguments);
//long setTimeout(DOMString handler, optional long timeout = 0, any... arguments);
long setTimeout(any handler, optional long timeout = 0);
void clearTimeout(optional long handle = 0);
//long setInterval(Function handler, optional long timeout = 0, any... arguments);
//long setInterval(DOMString handler, optional long timeout = 0, any... arguments);
long setInterval(any handler, optional long timeout = 0);
void clearInterval(optional long handle = 0);
};
Window implements WindowTimers;
// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html#sec-window.performance-attribute
partial interface Window {
/*[Replaceable]*/ readonly attribute Performance performance;
};
// Proprietary extensions. // Proprietary extensions.
partial interface Window { partial interface Window {
readonly attribute Console console;
void debug(DOMString arg); void debug(DOMString arg);
void gc(); void gc();
}; };
Window implements OnErrorEventHandlerForWindow;

View file

@ -11,7 +11,6 @@ use dom::bindings::utils::{Reflectable, Reflector};
use dom::browsercontext::BrowserContext; use dom::browsercontext::BrowserContext;
use dom::console::Console; use dom::console::Console;
use dom::document::Document; use dom::document::Document;
use dom::element::Element;
use dom::eventtarget::{EventTarget, WindowTypeId, EventTargetHelpers}; use dom::eventtarget::{EventTarget, WindowTypeId, EventTargetHelpers};
use dom::location::Location; use dom::location::Location;
use dom::navigator::Navigator; use dom::navigator::Navigator;
@ -27,7 +26,7 @@ use servo_util::url::parse_url;
use js::jsapi::JSContext; use js::jsapi::JSContext;
use js::jsapi::{JS_GC, JS_GetRuntime}; use js::jsapi::{JS_GC, JS_GetRuntime};
use js::jsval::{NullValue, JSVal}; use js::jsval::JSVal;
use collections::hashmap::HashMap; use collections::hashmap::HashMap;
use std::cell::Cell; use std::cell::Cell;
@ -120,22 +119,9 @@ pub trait WindowMethods {
fn Alert(&self, s: DOMString); fn Alert(&self, s: DOMString);
fn Close(&self); fn Close(&self);
fn Document(&self) -> Temporary<Document>; fn Document(&self) -> Temporary<Document>;
fn Name(&self) -> DOMString;
fn SetName(&self, _name: DOMString);
fn Status(&self) -> DOMString;
fn SetStatus(&self, _status: DOMString);
fn Closed(&self) -> bool;
fn Stop(&self);
fn Focus(&self);
fn Blur(&self);
fn GetFrameElement(&self) -> Option<Temporary<Element>>;
fn Location(&mut self) -> Temporary<Location>; fn Location(&mut self) -> Temporary<Location>;
fn Console(&mut self) -> Temporary<Console>; fn Console(&mut self) -> Temporary<Console>;
fn Navigator(&mut self) -> Temporary<Navigator>; fn Navigator(&mut self) -> Temporary<Navigator>;
fn Confirm(&self, _message: DOMString) -> bool;
fn Prompt(&self, _message: DOMString, _default: DOMString) -> Option<DOMString>;
fn Print(&self);
fn ShowModalDialog(&self, _cx: *mut JSContext, _url: DOMString, _argument: Option<JSVal>) -> JSVal;
fn SetTimeout(&mut self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32; fn SetTimeout(&mut self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32;
fn ClearTimeout(&mut self, handle: i32); fn ClearTimeout(&mut self, handle: i32);
fn SetInterval(&mut self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32; fn SetInterval(&mut self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32;
@ -169,37 +155,6 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
Temporary::new(frame.get_ref().document.clone()) Temporary::new(frame.get_ref().document.clone())
} }
fn Name(&self) -> DOMString {
"".to_owned()
}
fn SetName(&self, _name: DOMString) {
}
fn Status(&self) -> DOMString {
"".to_owned()
}
fn SetStatus(&self, _status: DOMString) {
}
fn Closed(&self) -> bool {
false
}
fn Stop(&self) {
}
fn Focus(&self) {
}
fn Blur(&self) {
}
fn GetFrameElement(&self) -> Option<Temporary<Element>> {
None
}
fn Location(&mut self) -> Temporary<Location> { fn Location(&mut self) -> Temporary<Location> {
if self.location.get().is_none() { if self.location.get().is_none() {
let page = self.deref().page.clone(); let page = self.deref().page.clone();
@ -225,21 +180,6 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
Temporary::new(self.navigator.get().get_ref().clone()) Temporary::new(self.navigator.get().get_ref().clone())
} }
fn Confirm(&self, _message: DOMString) -> bool {
false
}
fn Prompt(&self, _message: DOMString, _default: DOMString) -> Option<DOMString> {
None
}
fn Print(&self) {
}
fn ShowModalDialog(&self, _cx: *mut JSContext, _url: DOMString, _argument: Option<JSVal>) -> JSVal {
NullValue()
}
fn SetTimeout(&mut self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32 { fn SetTimeout(&mut self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32 {
self.set_timeout_or_interval(callback, timeout, false) self.set_timeout_or_interval(callback, timeout, false)
} }