servo: Merge #5525 - Add basic HTMLDialogElement interface (from dhodder:master); r=jdm

An empty DOM interface for HTMLDialogElement

r?

Source-Repo: https://github.com/servo/servo
Source-Revision: 1fd609d198e99c87dee1a8a79e908cd1604040af
This commit is contained in:
Dave Hodder 2015-04-07 02:50:04 -05:00
Родитель 363eb1983b
Коммит b05e81d72a
7 изменённых файлов: 59 добавлений и 0 удалений

Просмотреть файл

@ -18,6 +18,7 @@ use dom::htmlbuttonelement::HTMLButtonElement;
use dom::htmlcanvaselement::HTMLCanvasElement;
use dom::htmldataelement::HTMLDataElement;
use dom::htmldatalistelement::HTMLDataListElement;
use dom::htmldialogelement::HTMLDialogElement;
use dom::htmldirectoryelement::HTMLDirectoryElement;
use dom::htmldivelement::HTMLDivElement;
use dom::htmldlistelement::HTMLDListElement;
@ -134,6 +135,7 @@ pub fn create_element(name: QualName, prefix: Option<DOMString>,
atom!("del") => make!(HTMLModElement),
atom!("details") => make!(HTMLElement),
atom!("dfn") => make!(HTMLElement),
atom!("dialog") => make!(HTMLDialogElement),
atom!("dir") => make!(HTMLDirectoryElement),
atom!("div") => make!(HTMLDivElement),
atom!("dl") => make!(HTMLDListElement),

Просмотреть файл

@ -0,0 +1,39 @@
/* 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, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLDialogElementBinding;
use dom::bindings::codegen::InheritTypes::HTMLDialogElementDerived;
use dom::bindings::js::{JSRef, Temporary};
use dom::document::Document;
use dom::element::ElementTypeId;
use dom::eventtarget::{EventTarget, EventTargetTypeId};
use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
use dom::node::{Node, NodeTypeId};
use util::str::DOMString;
#[dom_struct]
pub struct HTMLDialogElement {
htmlelement: HTMLElement,
}
impl HTMLDialogElementDerived for EventTarget {
fn is_htmldialogelement(&self) -> bool {
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDialogElement)))
}
}
impl HTMLDialogElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDialogElement {
HTMLDialogElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDialogElement, localName, prefix, document)
}
}
#[allow(unrooted_must_root)]
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLDialogElement> {
let element = HTMLDialogElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLDialogElementBinding::Wrap)
}
}

Просмотреть файл

@ -253,6 +253,7 @@ pub enum HTMLElementTypeId {
HTMLCanvasElement,
HTMLDataElement,
HTMLDataListElement,
HTMLDialogElement,
HTMLDirectoryElement,
HTMLDListElement,
HTMLDivElement,

Просмотреть файл

@ -236,6 +236,7 @@ pub mod htmlcanvaselement;
pub mod htmlcollection;
pub mod htmldataelement;
pub mod htmldatalistelement;
pub mod htmldialogelement;
pub mod htmldirectoryelement;
pub mod htmldivelement;
pub mod htmldlistelement;

Просмотреть файл

@ -0,0 +1,13 @@
/* -*- 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
* 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/. */
// http://www.whatwg.org/html/#htmldialogelement
interface HTMLDialogElement : HTMLElement {
//attribute boolean open;
//attribute DOMString returnValue;
//void show(optional (MouseEvent or Element) anchor);
//void showModal(optional (MouseEvent or Element) anchor);
//void close(optional DOMString returnValue);
};

Просмотреть файл

@ -51,6 +51,7 @@
<time datetime="2014-02-14">Valentines day</time>
<area></area>
<data></data>
<dialog></dialog>
<template></template>
<pre>pre</pre>
<audio>
@ -111,6 +112,7 @@ check_tag("body", 1, [HTMLBodyElement]);
check_tag("area", 1, [HTMLAreaElement]);
check_tag("base", 1, [HTMLBaseElement]);
check_tag("data", 1, [HTMLDataElement]);
check_tag("dialog", 1, [HTMLDialogElement]);
check_tag("ol", 1, [HTMLOListElement]);
check_tag("canvas", 1, [HTMLCanvasElement]);
check_tag("source", 2, [HTMLSourceElement]);

Просмотреть файл

@ -45,6 +45,7 @@
create_element_and_check("colgroup", HTMLTableColElement);
create_element_and_check("data", HTMLDataElement);
create_element_and_check("datalist", HTMLDataListElement);
create_element_and_check("dialog", HTMLDialogElement);
create_element_and_check("dd", HTMLElement);
create_element_and_check("del", HTMLModElement);
create_element_and_check("details", HTMLElement);