Auto merge of #11610 - nox:dom3events, r=emilio

Fix all the links to the UI Events spec

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11610)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-06-04 20:25:36 -05:00
commit 573c0a7468
9 changed files with 24 additions and 25 deletions

View file

@ -577,7 +577,7 @@ impl Document {
}
/// Return the element that currently has focus.
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#events-focusevent-doc-focus
// https://w3c.github.io/uievents/#events-focusevent-doc-focus
pub fn get_focused_element(&self) -> Option<Root<Element>> {
self.focused.get()
}
@ -706,7 +706,7 @@ impl Document {
self.begin_focus_transaction();
}
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-click
// https://w3c.github.io/uievents/#event-type-click
let client_x = client_point.x as i32;
let client_y = client_point.y as i32;
let clickCount = 1;
@ -728,7 +728,7 @@ impl Document {
None);
let event = event.upcast::<Event>();
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#trusted-events
// https://w3c.github.io/uievents/#trusted-events
event.set_trusted(true);
// https://html.spec.whatwg.org/multipage/#run-authentic-click-activation-steps
match mouse_event_type {
@ -1093,9 +1093,9 @@ impl Document {
event.fire(target);
let mut prevented = event.DefaultPrevented();
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#keys-cancelable-keys
// https://w3c.github.io/uievents/#keys-cancelable-keys
if state != KeyState::Released && props.is_printable() && !prevented {
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#keypress-event-order
// https://w3c.github.io/uievents/#keypress-event-order
let event = KeyboardEvent::new(&self.window,
DOMString::from("keypress"),
true,

View file

@ -647,7 +647,7 @@ fn key_location(key: Key) -> u32 {
}
}
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#widl-KeyboardEvent-charCode
// https://w3c.github.io/uievents/#dom-keyboardevent-charcode
fn key_charcode(key: Key, mods: KeyModifiers) -> Option<u32> {
let key_string = key_value(key, mods);
if key_string.len() == 1 {
@ -657,10 +657,10 @@ fn key_charcode(key: Key, mods: KeyModifiers) -> Option<u32> {
}
}
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#legacy-key-models
// https://w3c.github.io/uievents/#legacy-key-models
fn key_keycode(key: Key) -> u32 {
match key {
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#legacy-key-models
// https://w3c.github.io/uievents/#legacy-key-models
Key::Backspace => 8,
Key::Tab => 9,
Key::Enter => 13,
@ -680,7 +680,7 @@ fn key_keycode(key: Key) -> u32 {
Key::Down => 40,
Key::Delete => 46,
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#optionally-fixed-virtual-key-codes
// https://w3c.github.io/uievents/#optionally-fixed-virtual-key-codes
Key::Semicolon => 186,
Key::Equal => 187,
Key::Comma => 188,
@ -820,7 +820,7 @@ impl KeyboardEventMethods for KeyboardEvent {
self.is_composing.get()
}
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#widl-KeyboardEvent-getModifierState
// https://w3c.github.io/uievents/#dom-keyboardevent-getmodifierstate
fn GetModifierState(&self, keyArg: DOMString) -> bool {
match &*keyArg {
"Ctrl" => self.CtrlKey(),

View file

@ -18,7 +18,7 @@ use std::cell::Cell;
use std::default::Default;
use string_cache::Atom;
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-UIEvent
// https://w3c.github.io/uievents/#interface-uievent
#[dom_struct]
pub struct UIEvent {
event: Event,

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-KeyboardEvent
* https://w3c.github.io/uievents/#interface-keyboardevent
*
*/
@ -26,7 +26,7 @@ interface KeyboardEvent : UIEvent {
boolean getModifierState (DOMString keyArg);
};
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-interface-KeyboardEvent-initializers
// https://w3c.github.io/uievents/#idl-interface-KeyboardEvent-initializers
partial interface KeyboardEvent {
// Originally introduced (and deprecated) in DOM Level 3
void initKeyboardEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Window? viewArg,
@ -34,7 +34,7 @@ partial interface KeyboardEvent {
boolean repeat, DOMString locale);
};
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#KeyboardEvent-supplemental-interface
// https://w3c.github.io/uievents/#legacy-interface-KeyboardEvent
partial interface KeyboardEvent {
// The following support legacy user agents
readonly attribute unsigned long charCode;
@ -42,7 +42,7 @@ partial interface KeyboardEvent {
readonly attribute unsigned long which;
};
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-KeyboardEvent
// https://w3c.github.io/uievents/#dictdef-keyboardeventinit
dictionary KeyboardEventInit : SharedKeyboardAndMouseEventInit {
DOMString key = "";
DOMString code = "";
@ -51,7 +51,7 @@ dictionary KeyboardEventInit : SharedKeyboardAndMouseEventInit {
boolean isComposing = false;
};
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#events-KeyboardEventInit-supplemental
// https://w3c.github.io/uievents/#legacy-dictionary-KeyboardEventInit
/*partial dictionary KeyboardEventInit {
unsigned long charCode = 0;
unsigned long keyCode = 0;

View file

@ -2,7 +2,7 @@
* 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/. */
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-MouseEvent
// https://w3c.github.io/uievents/#interface-mouseevent
[Constructor(DOMString typeArg, optional MouseEventInit mouseEventInitDict)]
interface MouseEvent : UIEvent {
readonly attribute long screenX;
@ -23,7 +23,7 @@ interface MouseEvent : UIEvent {
readonly attribute long which;
};
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-MouseEventInit
// https://w3c.github.io/uievents/#dictdef-eventmodifierinit
dictionary MouseEventInit : SharedKeyboardAndMouseEventInit {
long screenX = 0;
long screenY = 0;
@ -34,7 +34,7 @@ dictionary MouseEventInit : SharedKeyboardAndMouseEventInit {
EventTarget? relatedTarget = null;
};
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-MouseEvent-1
// https://w3c.github.io/uievents/#idl-interface-MouseEvent-initializers
partial interface MouseEvent {
// Deprecated in DOM Level 3
void initMouseEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg,

View file

@ -2,7 +2,7 @@
* 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/. */
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-SharedKeyboardAndMouseEventInit
// https://w3c.github.io/uievents/#dictdef-eventmodifierinit
dictionary SharedKeyboardAndMouseEventInit : UIEventInit {
boolean ctrlKey = false;
boolean shiftKey = false;

View file

@ -2,7 +2,7 @@
* 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/. */
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-UIEvent
// https://w3c.github.io/uievents/#interface-uievent
[Constructor(DOMString type, optional UIEventInit eventInitDict)]
interface UIEvent : Event {
// readonly attribute WindowProxy? view;
@ -10,14 +10,14 @@ interface UIEvent : Event {
readonly attribute long detail;
};
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-UIEventInit
// https://w3c.github.io/uievents/#dictdef-uieventinit-uieventinit
dictionary UIEventInit : EventInit {
// WindowProxy? view = null;
Window? view = null;
long detail = 0;
};
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#idl-def-UIEvent-1
// https://w3c.github.io/uievents/#idl-interface-UIEvent-initializers
partial interface UIEvent {
// Deprecated in DOM Level 3
void initUIEvent (DOMString typeArg, boolean bubblesArg, boolean cancelableArg, Window? viewArg, long detailArg);

View file

@ -1920,7 +1920,6 @@ impl ScriptThread {
}
// http://dev.w3.org/csswg/cssom-view/#resizing-viewports
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-resize
if size_type == WindowSizeType::Resize {
let uievent = UIEvent::new(window.r(),
DOMString::from("resize"), EventBubbles::DoesNotBubble,

View file

@ -6,7 +6,7 @@
<body>
<script>
window.addEventListener("resize", function (aEvent) {
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-resize
// http://dev.w3.org/csswg/cssom-view/#resizing-viewports
is_a(aEvent, UIEvent, "event should be UIEvent.");
is(aEvent.bubbles, false, "Bubbles should be No.");
is(aEvent.cancelable, false, "Cancelable should be No.");