aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/layout/wrapper.rs3
-rw-r--r--components/script/dom/blob.rs8
-rw-r--r--components/script/dom/canvasgradient.rs2
-rw-r--r--components/script/dom/canvaspattern.rs1
-rw-r--r--components/script/dom/canvasrenderingcontext2d.rs54
-rw-r--r--components/script/dom/characterdata.rs1
-rw-r--r--components/script/dom/console.rs6
-rw-r--r--components/script/dom/cssstyledeclaration.rs2
-rw-r--r--components/script/dom/customevent.rs3
-rw-r--r--components/script/dom/dedicatedworkerglobalscope.rs2
-rw-r--r--components/script/dom/document.rs17
-rw-r--r--components/script/dom/documentfragment.rs1
-rw-r--r--components/script/dom/documenttype.rs4
-rw-r--r--components/script/dom/domimplementation.rs1
-rw-r--r--components/script/dom/element.rs17
-rw-r--r--components/script/dom/imagedata.rs3
-rw-r--r--components/script/dom/location.rs5
-rw-r--r--components/script/dom/urlhelper.rs7
-rw-r--r--components/util/str.rs10
19 files changed, 112 insertions, 35 deletions
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs
index 324ac12148f..e528553bbc2 100644
--- a/components/layout/wrapper.rs
+++ b/components/layout/wrapper.rs
@@ -560,8 +560,7 @@ impl<'le> TElement<'le> for LayoutElement<'le> {
// FIXME: This is HTML only.
let node: &Node = NodeCast::from_actual(self.element);
match node.type_id_for_layout() {
- // https://www.whatwg.org/specs/web-apps/current-work/multipage/selectors.html#
- // selector-link
+ // https://html.spec.whatwg.org/multipage/#selector-link
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)) => {
diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs
index 60763f7aa7e..bfecd088bbe 100644
--- a/components/script/dom/blob.rs
+++ b/components/script/dom/blob.rs
@@ -23,6 +23,7 @@ pub enum BlobTypeId {
File,
}
+// http://dev.w3.org/2006/webapi/FileAPI/#blob
#[dom_struct]
pub struct Blob {
reflector_: Reflector,
@@ -59,10 +60,12 @@ impl Blob {
BlobBinding::Wrap)
}
+ // http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
pub fn Constructor(global: GlobalRef) -> Fallible<Temporary<Blob>> {
Ok(Blob::new(global, None, ""))
}
+ // http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
pub fn Constructor_(global: GlobalRef, blobParts: DOMString, blobPropertyBag: &BlobBinding::BlobPropertyBag) -> Fallible<Temporary<Blob>> {
//TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView or Blob
let bytes: Option<Vec<u8>> = Some(blobParts.into_bytes());
@@ -77,6 +80,7 @@ impl Blob {
}
impl<'a> BlobMethods for JSRef<'a, Blob> {
+ // http://dev.w3.org/2006/webapi/FileAPI/#dfn-size
fn Size(self) -> u64{
match self.bytes {
None => 0,
@@ -84,10 +88,12 @@ impl<'a> BlobMethods for JSRef<'a, Blob> {
}
}
+ // http://dev.w3.org/2006/webapi/FileAPI/#dfn-type
fn Type(self) -> DOMString {
self.typeString.clone()
}
+ // http://dev.w3.org/2006/webapi/FileAPI/#slice-method-algo
fn Slice(self, start: Option<i64>, end: Option<i64>,
contentType: Option<DOMString>) -> Temporary<Blob> {
let size: i64 = self.Size().to_i64().unwrap();
@@ -135,10 +141,12 @@ impl<'a> BlobMethods for JSRef<'a, Blob> {
}
}
+ // http://dev.w3.org/2006/webapi/FileAPI/#dfn-isClosed
//fn IsClosed(self) -> bool {
// self.isClosed_.clone()
//}
+ // http://dev.w3.org/2006/webapi/FileAPI/#dfn-close
//fn Close(self) {
// TODO
//}
diff --git a/components/script/dom/canvasgradient.rs b/components/script/dom/canvasgradient.rs
index 2b193697124..e25dc88ef72 100644
--- a/components/script/dom/canvasgradient.rs
+++ b/components/script/dom/canvasgradient.rs
@@ -13,6 +13,7 @@ use dom::bindings::num::Finite;
use dom::bindings::utils::{Reflector, reflect_dom_object};
use dom::canvasrenderingcontext2d::parse_color;
+// https://html.spec.whatwg.org/multipage/#canvasgradient
#[dom_struct]
pub struct CanvasGradient {
reflector_: Reflector,
@@ -42,6 +43,7 @@ impl CanvasGradient {
}
impl<'a> CanvasGradientMethods for JSRef<'a, CanvasGradient> {
+ // https://html.spec.whatwg.org/multipage/#dom-canvasgradient-addcolorstop
fn AddColorStop(self, offset: Finite<f32>, color: String) {
let default_black = RGBA {
red: 0.0,
diff --git a/components/script/dom/canvaspattern.rs b/components/script/dom/canvaspattern.rs
index f1010bf6f53..b8b2808d3b9 100644
--- a/components/script/dom/canvaspattern.rs
+++ b/components/script/dom/canvaspattern.rs
@@ -4,6 +4,7 @@
use dom::bindings::utils::Reflector;
+// https://html.spec.whatwg.org/multipage/#canvaspattern
#[dom_struct]
pub struct CanvasPattern {
reflector_: Reflector,
diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs
index 891c2d49b87..7ac2fac20d3 100644
--- a/components/script/dom/canvasrenderingcontext2d.rs
+++ b/components/script/dom/canvasrenderingcontext2d.rs
@@ -45,6 +45,7 @@ use util::str::DOMString;
use url::Url;
use util::vec::byte_swap;
+// https://html.spec.whatwg.org/multipage/#canvasrenderingcontext2d
#[dom_struct]
pub struct CanvasRenderingContext2D {
reflector_: Reflector,
@@ -164,7 +165,7 @@ impl CanvasRenderingContext2D {
// The rectangle (sx, sy, sw, sh) from the source image
// is copied on the rectangle (dx, dy, dh, dw) of the destination canvas
//
- // https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-drawimage
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
fn draw_html_canvas_element(&self,
canvas: JSRef<HTMLCanvasElement>,
sx: f64, sy: f64, sw: f64, sh: f64,
@@ -312,10 +313,12 @@ impl LayoutCanvasRenderingContext2DHelpers for LayoutJS<CanvasRenderingContext2D
//
// FIXME: this behavior should might be generated by some annotattions to idl.
impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> {
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-canvas
fn Canvas(self) -> Temporary<HTMLCanvasElement> {
Temporary::new(self.canvas)
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-scale
fn Scale(self, x: f64, y: f64) {
if !(x.is_finite() && y.is_finite()) {
return;
@@ -325,6 +328,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
self.update_transform()
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-translate
fn Translate(self, x: f64, y: f64) {
if !(x.is_finite() && y.is_finite()) {
return;
@@ -334,6 +338,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
self.update_transform()
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-transform
fn Transform(self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) {
if !(a.is_finite() && b.is_finite() && c.is_finite() &&
d.is_finite() && e.is_finite() && f.is_finite()) {
@@ -349,6 +354,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
self.update_transform()
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-settransform
fn SetTransform(self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) {
if !(a.is_finite() && b.is_finite() && c.is_finite() &&
d.is_finite() && e.is_finite() && f.is_finite()) {
@@ -364,10 +370,12 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
self.update_transform()
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-globalalpha
fn GlobalAlpha(self) -> f64 {
self.global_alpha.get()
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-globalalpha
fn SetGlobalAlpha(self, alpha: f64) {
if !alpha.is_finite() || alpha > 1.0 || alpha < 0.0 {
return;
@@ -377,41 +385,48 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
self.renderer.send(CanvasMsg::SetGlobalAlpha(alpha as f32)).unwrap()
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-fillrect
fn FillRect(self, x: f64, y: f64, width: f64, height: f64) {
if let Some(rect) = self.create_drawable_rect(x, y, width, height) {
self.renderer.send(CanvasMsg::FillRect(rect)).unwrap();
}
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-clearrect
fn ClearRect(self, x: f64, y: f64, width: f64, height: f64) {
if let Some(rect) = self.create_drawable_rect(x, y, width, height) {
self.renderer.send(CanvasMsg::ClearRect(rect)).unwrap();
}
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-strokerect
fn StrokeRect(self, x: f64, y: f64, width: f64, height: f64) {
if let Some(rect) = self.create_drawable_rect(x, y, width, height) {
self.renderer.send(CanvasMsg::StrokeRect(rect)).unwrap();
}
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-beginpath
fn BeginPath(self) {
self.renderer.send(CanvasMsg::BeginPath).unwrap();
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-closepath
fn ClosePath(self) {
self.renderer.send(CanvasMsg::ClosePath).unwrap();
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-fill
fn Fill(self, _: CanvasWindingRule) {
self.renderer.send(CanvasMsg::Fill).unwrap();
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-stroke
fn Stroke(self) {
self.renderer.send(CanvasMsg::Stroke).unwrap();
}
- // https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-drawimage
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
fn DrawImage(self, image: HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D,
dx: f64, dy: f64) -> Fallible<()> {
if !(dx.is_finite() && dy.is_finite()) {
@@ -453,7 +468,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLImageElement(image) => {
let image = image.root();
let image_element = image.r();
- // https://html.spec.whatwg.org/multipage/embedded-content.html#img-error
+ // https://html.spec.whatwg.org/multipage/#img-error
// If the image argument is an HTMLImageElement object that is in the broken state,
// then throw an InvalidStateError exception
let (image_data, image_size) = match self.fetch_image_data(&image_element) {
@@ -473,7 +488,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
}
}
- // https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-drawimage
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
fn DrawImage_(self, image: HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D,
dx: f64, dy: f64, dw: f64, dh: f64) -> Fallible<()> {
if !(dx.is_finite() && dy.is_finite() &&
@@ -512,7 +527,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLImageElement(image) => {
let image = image.root();
let image_element = image.r();
- // https://html.spec.whatwg.org/multipage/embedded-content.html#img-error
+ // https://html.spec.whatwg.org/multipage/#img-error
// If the image argument is an HTMLImageElement object that is in the broken state,
// then throw an InvalidStateError exception
let (image_data, image_size) = match self.fetch_image_data(&image_element) {
@@ -529,7 +544,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
}
}
- // https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-drawimage
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
fn DrawImage__(self, image: HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D,
sx: f64, sy: f64, sw: f64, sh: f64,
dx: f64, dy: f64, dw: f64, dh: f64) -> Fallible<()> {
@@ -556,7 +571,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2D::eHTMLImageElement(image) => {
let image = image.root();
let image_element = image.r();
- // https://html.spec.whatwg.org/multipage/embedded-content.html#img-error
+ // https://html.spec.whatwg.org/multipage/#img-error
// If the image argument is an HTMLImageElement object that is in the broken state,
// then throw an InvalidStateError exception
let (image_data, image_size) = match self.fetch_image_data(&image_element) {
@@ -571,6 +586,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
}
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-moveto
fn MoveTo(self, x: f64, y: f64) {
if !(x.is_finite() && y.is_finite()) {
return;
@@ -579,6 +595,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
self.renderer.send(CanvasMsg::MoveTo(Point2D(x as f32, y as f32))).unwrap();
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-lineto
fn LineTo(self, x: f64, y: f64) {
if !(x.is_finite() && y.is_finite()) {
return;
@@ -587,6 +604,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
self.renderer.send(CanvasMsg::LineTo(Point2D(x as f32, y as f32))).unwrap();
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-quadraticcurveto
fn QuadraticCurveTo(self, cpx: f64, cpy: f64, x: f64, y: f64) {
if !(cpx.is_finite() && cpy.is_finite() &&
x.is_finite() && y.is_finite()) {
@@ -597,6 +615,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
Point2D(x as f32, y as f32))).unwrap();
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-beziercurveto
fn BezierCurveTo(self, cp1x: f64, cp1y: f64, cp2x: f64, cp2y: f64, x: f64, y: f64) {
if !(cp1x.is_finite() && cp1y.is_finite() && cp2x.is_finite() && cp2y.is_finite() &&
x.is_finite() && y.is_finite()) {
@@ -608,6 +627,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
Point2D(x as f32, y as f32))).unwrap();
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-arc
fn Arc(self, x: Finite<f64>, y: Finite<f64>, r: Finite<f64>,
start: Finite<f64>, end: Finite<f64>, ccw: bool) -> Fallible<()> {
let x = *x;
@@ -625,6 +645,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
Ok(())
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-arcto
fn ArcTo(self, cp1x: f64, cp1y: f64, cp2x: f64, cp2y: f64, r: f64) -> Fallible<()> {
if !([cp1x, cp1y, cp2x, cp2y, r].iter().all(|x| x.is_finite())) {
return Ok(());
@@ -648,15 +669,17 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
self.image_smoothing_enabled.set(value);
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-strokestyle
fn StrokeStyle(self) -> StringOrCanvasGradientOrCanvasPattern {
// FIXME(pcwalton, #4761): This is not spec-compliant. See:
//
- // https://html.spec.whatwg.org/multipage/scripting.html#serialisation-of-a-colour
+ // https://html.spec.whatwg.org/multipage/#serialisation-of-a-colour
let mut result = String::new();
self.stroke_color.get().to_css(&mut result).unwrap();
StringOrCanvasGradientOrCanvasPattern::eString(result)
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-strokestyle
fn SetStrokeStyle(self, value: StringOrCanvasGradientOrCanvasPattern) {
match value {
StringOrCanvasGradientOrCanvasPattern::eString(string) => {
@@ -676,15 +699,17 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
}
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-strokestyle
fn FillStyle(self) -> StringOrCanvasGradientOrCanvasPattern {
// FIXME(pcwalton, #4761): This is not spec-compliant. See:
//
- // https://html.spec.whatwg.org/multipage/scripting.html#serialisation-of-a-colour
+ // https://html.spec.whatwg.org/multipage/#serialisation-of-a-colour
let mut result = String::new();
self.stroke_color.get().to_css(&mut result).unwrap();
StringOrCanvasGradientOrCanvasPattern::eString(result)
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-strokestyle
fn SetFillStyle(self, value: StringOrCanvasGradientOrCanvasPattern) {
match value {
StringOrCanvasGradientOrCanvasPattern::eString(string) => {
@@ -705,6 +730,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
}
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-createimagedata
fn CreateImageData(self, sw: f64, sh: f64) -> Fallible<Temporary<ImageData>> {
if !(sw.is_finite() && sh.is_finite()) {
return Err(NotSupported);
@@ -717,10 +743,12 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
Ok(ImageData::new(self.global.root().r(), sw.abs().to_u32().unwrap(), sh.abs().to_u32().unwrap(), None))
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-createimagedata
fn CreateImageData_(self, imagedata: JSRef<ImageData>) -> Fallible<Temporary<ImageData>> {
Ok(ImageData::new(self.global.root().r(), imagedata.Width(), imagedata.Height(), None))
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-getimagedata
fn GetImageData(self, sx: Finite<f64>, sy: Finite<f64>, sw: Finite<f64>, sh: Finite<f64>) -> Fallible<Temporary<ImageData>> {
let sx = *sx;
let sy = *sy;
@@ -740,6 +768,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
Ok(ImageData::new(self.global.root().r(), sw.abs().to_u32().unwrap(), sh.abs().to_u32().unwrap(), Some(data)))
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
fn PutImageData(self, imagedata: JSRef<ImageData>, dx: Finite<f64>, dy: Finite<f64>) {
let dx = *dx;
let dy = *dy;
@@ -758,6 +787,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
self.renderer.send(CanvasMsg::PutImageData(data, image_data_rect, dirty_rect)).unwrap()
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
fn PutImageData_(self, imagedata: JSRef<ImageData>, dx: Finite<f64>, dy: Finite<f64>,
dirtyX: Finite<f64>, dirtyY: Finite<f64>, dirtyWidth: Finite<f64>, dirtyHeight: Finite<f64>) {
let dx = *dx;
@@ -782,6 +812,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
self.renderer.send(CanvasMsg::PutImageData(data, image_data_rect, dirty_rect)).unwrap()
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-createlineargradient
fn CreateLinearGradient(self, x0: Finite<f64>, y0: Finite<f64>,
x1: Finite<f64>, y1: Finite<f64>) -> Fallible<Temporary<CanvasGradient>> {
let x0 = *x0;
@@ -796,6 +827,7 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
CanvasGradientStyle::Linear(LinearGradientStyle::new(x0, y0, x1, y1, Vec::new()))))
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-createradialgradient
fn CreateRadialGradient(self, x0: Finite<f64>, y0: Finite<f64>, r0: Finite<f64>,
x1: Finite<f64>, y1: Finite<f64>, r1: Finite<f64>) -> Fallible<Temporary<CanvasGradient>> {
let x0 = *x0;
@@ -812,10 +844,12 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
CanvasGradientStyle::Radial(RadialGradientStyle::new(x0, y0, r0, x1, y1, r1, Vec::new()))))
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-linewidth
fn LineWidth(self) -> f64 {
self.line_width.get()
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-linewidth
fn SetLineWidth(self, width: f64) {
if !width.is_finite() || width <= 0.0 {
return;
@@ -855,10 +889,12 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
}
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-miterlimit
fn MiterLimit(self) -> f64 {
self.miter_limit.get()
}
+ // https://html.spec.whatwg.org/multipage/#dom-context-2d-miterlimit
fn SetMiterLimit(self, limit: f64) {
if !limit.is_finite() || limit <= 0.0 {
return;
diff --git a/components/script/dom/characterdata.rs b/components/script/dom/characterdata.rs
index a638683c0ea..bc1106f94cc 100644
--- a/components/script/dom/characterdata.rs
+++ b/components/script/dom/characterdata.rs
@@ -22,6 +22,7 @@ use std::borrow::ToOwned;
use std::cell::Ref;
use std::cmp;
+// https://dom.spec.whatwg.org/#characterdata
#[dom_struct]
pub struct CharacterData {
node: Node,
diff --git a/components/script/dom/console.rs b/components/script/dom/console.rs
index 60377018b76..726a59e3c0d 100644
--- a/components/script/dom/console.rs
+++ b/components/script/dom/console.rs
@@ -11,6 +11,7 @@ use dom::window::WindowHelpers;
use devtools_traits::{DevtoolsControlMsg, ConsoleMessage};
use util::str::DOMString;
+// https://developer.mozilla.org/en-US/docs/Web/API/Console
#[dom_struct]
pub struct Console {
reflector_: Reflector,
@@ -31,6 +32,7 @@ impl Console {
}
impl<'a> ConsoleMethods for JSRef<'a, Console> {
+ // https://developer.mozilla.org/en-US/docs/Web/API/Console/log
fn Log(self, messages: Vec<DOMString>) {
for message in messages {
println!("{}", message);
@@ -45,24 +47,28 @@ impl<'a> ConsoleMethods for JSRef<'a, Console> {
}
}
+ // https://developer.mozilla.org/en-US/docs/Web/API/Console/info
fn Info(self, messages: Vec<DOMString>) {
for message in messages {
println!("{}", message);
}
}
+ // https://developer.mozilla.org/en-US/docs/Web/API/Console/warn
fn Warn(self, messages: Vec<DOMString>) {
for message in messages {
println!("{}", message);
}
}
+ // https://developer.mozilla.org/en-US/docs/Web/API/Console/error
fn Error(self, messages: Vec<DOMString>) {
for message in messages {
println!("{}", message);
}
}
+ // https://developer.mozilla.org/en-US/docs/Web/API/Console/assert
fn Assert(self, condition: bool, message: Option<DOMString>) {
if !condition {
let message = match message {
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs
index 2f907feb3f9..654bafcca75 100644
--- a/components/script/dom/cssstyledeclaration.rs
+++ b/components/script/dom/cssstyledeclaration.rs
@@ -21,6 +21,7 @@ use style::properties::PropertyDeclaration;
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
+// http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface
#[dom_struct]
pub struct CSSStyleDeclaration {
reflector_: Reflector,
@@ -335,6 +336,7 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
self.SetPropertyValue("float".to_owned(), value)
}
+ // http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface
fn IndexedGetter(self, index: u32, found: &mut bool) -> DOMString {
let rval = self.Item(index);
*found = index < self.Length();
diff --git a/components/script/dom/customevent.rs b/components/script/dom/customevent.rs
index ab8d53e5309..bb64e3075f8 100644
--- a/components/script/dom/customevent.rs
+++ b/components/script/dom/customevent.rs
@@ -15,6 +15,7 @@ use js::jsapi::JSContext;
use js::jsval::{JSVal, NullValue};
use util::str::DOMString;
+// https://dom.spec.whatwg.org/#interface-customevent
#[dom_struct]
pub struct CustomEvent {
event: Event,
@@ -53,10 +54,12 @@ impl CustomEvent {
}
impl<'a> CustomEventMethods for JSRef<'a, CustomEvent> {
+ // https://dom.spec.whatwg.org/#dom-customevent-detail
fn Detail(self, _cx: *mut JSContext) -> JSVal {
self.detail.get()
}
+ // https://dom.spec.whatwg.org/#dom-customevent-initcustomevent
fn InitCustomEvent(self,
_cx: *mut JSContext,
type_: DOMString,
diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs
index 0d5170f8f83..83168d44e2d 100644
--- a/components/script/dom/dedicatedworkerglobalscope.rs
+++ b/components/script/dom/dedicatedworkerglobalscope.rs
@@ -91,6 +91,7 @@ impl<'a> Drop for AutoWorkerReset<'a> {
}
}
+// https://html.spec.whatwg.org/multipage/#dedicatedworkerglobalscope
#[dom_struct]
pub struct DedicatedWorkerGlobalScope {
workerglobalscope: WorkerGlobalScope,
@@ -255,6 +256,7 @@ impl<'a> PrivateDedicatedWorkerGlobalScopeHelpers for JSRef<'a, DedicatedWorkerG
}
impl<'a> DedicatedWorkerGlobalScopeMethods for JSRef<'a, DedicatedWorkerGlobalScope> {
+ // https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage
fn PostMessage(self, cx: *mut JSContext, message: JSVal) -> ErrorResult {
let data = try!(StructuredCloneData::write(cx, message));
let worker = self.worker.borrow().as_ref().unwrap().clone();
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 5a6aab11ba3..bff8ea0cdba 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -97,6 +97,7 @@ pub enum IsHTMLDocument {
NonHTMLDocument,
}
+// https://dom.spec.whatwg.org/#document
#[dom_struct]
pub struct Document {
node: Node,
@@ -1098,7 +1099,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
}
}
- // https://www.whatwg.org/html/#dom-document-lastmodified
+ // https://html.spec.whatwg.org/#dom-document-lastmodified
fn LastModified(self) -> DOMString {
match self.last_modified {
Some(ref t) => t.clone(),
@@ -1118,7 +1119,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
}
// TODO: Support root SVG namespace: https://github.com/servo/servo/issues/5315
- // https://www.whatwg.org/specs/web-apps/current-work/#document.title
+ // https://html.spec.whatwg.org/#document.title
fn Title(self) -> DOMString {
let title_element = self.GetDocumentElement().root().and_then(|root| {
NodeCast::from_ref(root.r()).traverse_preorder().find(|node| {
@@ -1140,7 +1141,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
}
// TODO: Support root SVG namespace: https://github.com/servo/servo/issues/5315
- // https://www.whatwg.org/specs/web-apps/current-work/#document.title
+ // https://html.spec.whatwg.org/#document.title
fn SetTitle(self, title: DOMString) -> ErrorResult {
self.GetDocumentElement().root().map(|root| {
let root: JSRef<Node> = NodeCast::from_ref(root.r());
@@ -1179,7 +1180,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
Ok(())
}
- // https://www.whatwg.org/specs/web-apps/current-work/#dom-document-head
+ // https://html.spec.whatwg.org/#dom-document-head
fn GetHead(self) -> Option<Temporary<HTMLHeadElement>> {
self.get_html_element().and_then(|root| {
let root = root.root();
@@ -1191,12 +1192,12 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
})
}
- // https://www.whatwg.org/specs/web-apps/current-work/#dom-document-currentscript
+ // https://html.spec.whatwg.org/#dom-document-currentscript
fn GetCurrentScript(self) -> Option<Temporary<HTMLScriptElement>> {
self.current_script.get()
}
- // https://www.whatwg.org/specs/web-apps/current-work/#dom-document-body
+ // https://html.spec.whatwg.org/#dom-document-body
fn GetBody(self) -> Option<Temporary<HTMLElement>> {
self.get_html_element().and_then(|root| {
let root = root.root();
@@ -1213,7 +1214,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
})
}
- // https://www.whatwg.org/specs/web-apps/current-work/#dom-document-body
+ // https://html.spec.whatwg.org/#dom-document-body
fn SetBody(self, new_body: Option<JSRef<HTMLElement>>) -> ErrorResult {
// Step 1.
let new_body = match new_body {
@@ -1256,7 +1257,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
Ok(())
}
- // https://www.whatwg.org/specs/web-apps/current-work/#dom-document-getelementsbyname
+ // https://html.spec.whatwg.org/#dom-document-getelementsbyname
fn GetElementsByName(self, name: DOMString) -> Temporary<NodeList> {
self.create_node_list(|node| {
let element: JSRef<Element> = match ElementCast::to_ref(node) {
diff --git a/components/script/dom/documentfragment.rs b/components/script/dom/documentfragment.rs
index 606a2066bca..43af033a0fb 100644
--- a/components/script/dom/documentfragment.rs
+++ b/components/script/dom/documentfragment.rs
@@ -18,6 +18,7 @@ use dom::node::{Node, NodeHelpers, NodeTypeId, window_from_node};
use dom::nodelist::NodeList;
use util::str::DOMString;
+// https://dom.spec.whatwg.org/#documentfragment
#[dom_struct]
pub struct DocumentFragment {
node: Node,
diff --git a/components/script/dom/documenttype.rs b/components/script/dom/documenttype.rs
index 0f2f675d4d5..c8e3dfaa40e 100644
--- a/components/script/dom/documenttype.rs
+++ b/components/script/dom/documenttype.rs
@@ -13,6 +13,7 @@ use util::str::DOMString;
use std::borrow::ToOwned;
+// https://dom.spec.whatwg.org/#documenttype
/// The `DOCTYPE` tag.
#[dom_struct]
pub struct DocumentType {
@@ -71,14 +72,17 @@ impl DocumentType {
}
impl<'a> DocumentTypeMethods for JSRef<'a, DocumentType> {
+ // https://dom.spec.whatwg.org/#dom-documenttype-name
fn Name(self) -> DOMString {
self.name.clone()
}
+ // https://dom.spec.whatwg.org/#dom-documenttype-publicid
fn PublicId(self) -> DOMString {
self.public_id.clone()
}
+ // https://dom.spec.whatwg.org/#dom-documenttype-systemid
fn SystemId(self) -> DOMString {
self.system_id.clone()
}
diff --git a/components/script/dom/domimplementation.rs b/components/script/dom/domimplementation.rs
index 22f853bd2ab..07eb80561bf 100644
--- a/components/script/dom/domimplementation.rs
+++ b/components/script/dom/domimplementation.rs
@@ -25,6 +25,7 @@ use util::str::DOMString;
use std::borrow::ToOwned;
+// https://dom.spec.whatwg.org/#domimplementation
#[dom_struct]
pub struct DOMImplementation {
reflector_: Reflector,
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index 16cfe151bb3..e3abbc5ee1a 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -497,7 +497,7 @@ impl<'a> ElementHelpers<'a> for JSRef<'a, Element> {
}
match self.local_name.as_slice() {
/* List of void elements from
- https://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#html-fragment-serialization-algorithm */
+ https://html.spec.whatwg.org/multipage/#html-fragment-serialisation-algorithm */
"area" | "base" | "basefont" | "bgsound" | "br" | "col" | "embed" |
"frame" | "hr" | "img" | "input" | "keygen" | "link" | "menuitem" |
"meta" | "param" | "source" | "track" | "wbr" => true,
@@ -602,10 +602,10 @@ impl<'a> ElementHelpers<'a> for JSRef<'a, Element> {
}
pub trait FocusElementHelpers {
- /// https://html.spec.whatwg.org/multipage/interaction.html#focusable-area
+ /// https://html.spec.whatwg.org/multipage/#focusable-area
fn is_focusable_area(self) -> bool;
- /// https://html.spec.whatwg.org/multipage/scripting.html#concept-element-disabled
+ /// https://html.spec.whatwg.org/multipage/#concept-element-disabled
fn is_actually_disabled(self) -> bool;
}
@@ -616,7 +616,7 @@ impl<'a> FocusElementHelpers for JSRef<'a, Element> {
}
// TODO: Check whether the element is being rendered (i.e. not hidden).
// TODO: Check the tabindex focus flag.
- // https://html.spec.whatwg.org/multipage/interaction.html#specially-focusable
+ // https://html.spec.whatwg.org/multipage/#specially-focusable
let node: JSRef<Node> = NodeCast::from_ref(self);
match node.type_id() {
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) |
@@ -1481,8 +1481,7 @@ impl<'a> style::node::TElement<'a> for JSRef<'a, Element> {
// FIXME: This is HTML only.
let node: JSRef<Node> = NodeCast::from_ref(self);
match node.type_id() {
- // https://www.whatwg.org/specs/web-apps/current-work/multipage/selectors.html#
- // selector-link
+ // https://html.spec.whatwg.org/multipage/#selector-link
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)) => self.get_attr(&ns!(""), &atom!("href")),
@@ -1514,7 +1513,7 @@ impl<'a> style::node::TElement<'a> for JSRef<'a, Element> {
fn get_focus_state(self) -> bool {
// TODO: Also check whether the top-level browsing context has the system focus,
// and whether this element is a browsing context container.
- // https://html.spec.whatwg.org/multipage/scripting.html#selector-focus
+ // https://html.spec.whatwg.org/multipage/#selector-focus
let node: JSRef<Node> = NodeCast::from_ref(self);
node.get_focus_state()
}
@@ -1629,7 +1628,7 @@ impl<'a> ActivationElementHelpers<'a> for JSRef<'a, Element> {
node.set_flag(CLICK_IN_PROGRESS, click)
}
- // https://html.spec.whatwg.org/multipage/interaction.html#nearest-activatable-element
+ // https://html.spec.whatwg.org/multipage/#nearest-activatable-element
fn nearest_activable_element(self) -> Option<Temporary<Element>> {
match self.as_maybe_activatable() {
Some(el) => Some(Temporary::from_rooted(el.as_element().root().r())),
@@ -1650,7 +1649,7 @@ impl<'a> ActivationElementHelpers<'a> for JSRef<'a, Element> {
/// Please call this method *only* for real click events
///
- /// https://html.spec.whatwg.org/multipage/interaction.html#run-authentic-click-activation-steps
+ /// https://html.spec.whatwg.org/multipage/#run-authentic-click-activation-steps
///
/// Use an element's synthetic click activation (or handle_event) for any script-triggered clicks.
/// If the spec says otherwise, check with Manishearth first
diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs
index 4b1bccab86c..34bebafb082 100644
--- a/components/script/dom/imagedata.rs
+++ b/components/script/dom/imagedata.rs
@@ -73,14 +73,17 @@ impl<'a> ImageDataHelpers for JSRef<'a, ImageData> {
}
impl<'a> ImageDataMethods for JSRef<'a, ImageData> {
+ // https://html.spec.whatwg.org/multipage/#dom-imagedata-width
fn Width(self) -> u32 {
self.width
}
+ // https://html.spec.whatwg.org/multipage/#dom-imagedata-height
fn Height(self) -> u32 {
self.height
}
+ // https://html.spec.whatwg.org/multipage/#dom-imagedata-data
fn Data(self, _: *mut JSContext) -> *mut JSObject {
self.data
}
diff --git a/components/script/dom/location.rs b/components/script/dom/location.rs
index 40efc0c7eec..7e937baef18 100644
--- a/components/script/dom/location.rs
+++ b/components/script/dom/location.rs
@@ -42,22 +42,27 @@ impl<'a> LocationMethods for JSRef<'a, Location> {
self.window.root().r().load_url(url);
}
+ // https://url.spec.whatwg.org/#dom-urlutils-href
fn Href(self) -> USVString {
UrlHelper::Href(&self.get_url())
}
+ // https://url.spec.whatwg.org/#dom-urlutils-pathname
fn Pathname(self) -> USVString {
UrlHelper::Pathname(&self.get_url())
}
+ // https://url.spec.whatwg.org/#URLUtils-stringification-behavior
fn Stringify(self) -> DOMString {
self.Href().0
}
+ // https://url.spec.whatwg.org/#dom-urlutils-search
fn Search(self) -> USVString {
UrlHelper::Search(&self.get_url())
}
+ // https://url.spec.whatwg.org/#dom-urlutils-hash
fn Hash(self) -> USVString {
UrlHelper::Hash(&self.get_url())
}
diff --git a/components/script/dom/urlhelper.rs b/components/script/dom/urlhelper.rs
index a9d29521579..4a86c75a722 100644
--- a/components/script/dom/urlhelper.rs
+++ b/components/script/dom/urlhelper.rs
@@ -11,10 +11,12 @@ use std::borrow::ToOwned;
pub struct UrlHelper;
impl UrlHelper {
+ // https://url.spec.whatwg.org/#dom-urlutils-href
pub fn Href(url: &Url) -> USVString {
USVString(url.serialize())
}
+ // https://url.spec.whatwg.org/#dom-urlutils-search
pub fn Search(url: &Url) -> USVString {
USVString(match url.query {
None => "".to_owned(),
@@ -23,6 +25,7 @@ impl UrlHelper {
})
}
+ // https://url.spec.whatwg.org/#dom-urlutils-hash
pub fn Hash(url: &Url) -> USVString {
USVString(match url.fragment {
None => "".to_owned(),
@@ -31,8 +34,8 @@ impl UrlHelper {
})
}
+ // https://url.spec.whatwg.org/#dom-urlutils-pathname
pub fn Pathname(url: &Url) -> USVString {
- // https://url.spec.whatwg.org/#dom-urlutils-pathname
// FIXME: Url null check is skipped for now
USVString(match url.scheme_data {
SchemeData::NonRelative(ref scheme_data) => scheme_data.clone(),
@@ -40,7 +43,7 @@ impl UrlHelper {
})
}
- /// https://html.spec.whatwg.org/multipage/#same-origin
+ // https://html.spec.whatwg.org/multipage/#same-origin
pub fn SameOrigin(urlA: &Url, urlB: &Url) -> bool {
if urlA.host() != urlB.host() {
return false
diff --git a/components/util/str.rs b/components/util/str.rs
index 9d1d65294d4..8f3ee5cb541 100644
--- a/components/util/str.rs
+++ b/components/util/str.rs
@@ -49,7 +49,7 @@ pub fn char_is_whitespace(c: char) -> bool {
/// A "space character" according to:
///
-/// https://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#space-character
+/// https://html.spec.whatwg.org/multipage/#space-character
pub static HTML_SPACE_CHARACTERS: StaticCharVec = &[
'\u{0020}',
'\u{0009}',
@@ -65,8 +65,8 @@ pub fn split_html_space_chars<'a>(s: &'a str) ->
}
/// Shared implementation to parse an integer according to
-/// <https://www.whatwg.org/html/#rules-for-parsing-integers> or
-/// <https://www.whatwg.org/html/#rules-for-parsing-non-negative-integers>.
+/// <https://html.spec.whatwg.org/#rules-for-parsing-integers> or
+/// <https://html.spec.whatwg.org/#rules-for-parsing-non-negative-integers>
fn do_parse_integer<T: Iterator<Item=char>>(input: T) -> Option<i64> {
fn is_ascii_digit(c: &char) -> bool {
match *c {
@@ -111,7 +111,7 @@ fn do_parse_integer<T: Iterator<Item=char>>(input: T) -> Option<i64> {
}
/// Parse an integer according to
-/// <https://www.whatwg.org/html/#rules-for-parsing-integers>.
+/// <https://html.spec.whatwg.org/#rules-for-parsing-integers>.
pub fn parse_integer<T: Iterator<Item=char>>(input: T) -> Option<i32> {
do_parse_integer(input).and_then(|result| {
result.to_i32()
@@ -119,7 +119,7 @@ pub fn parse_integer<T: Iterator<Item=char>>(input: T) -> Option<i32> {
}
/// Parse an integer according to
-/// <https://www.whatwg.org/html/#rules-for-parsing-non-negative-integers>.
+/// <https://html.spec.whatwg.org/#rules-for-parsing-non-negative-integers>
pub fn parse_unsigned_integer<T: Iterator<Item=char>>(input: T) -> Option<u32> {
do_parse_integer(input).and_then(|result| {
result.to_u32()