mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement HTMLAppletElement.name
This commit is contained in:
parent
2176aab642
commit
b86672af0c
6 changed files with 45 additions and 137 deletions
|
@ -3,13 +3,20 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::codegen::Bindings::HTMLAppletElementBinding;
|
||||
use dom::bindings::codegen::Bindings::HTMLAppletElementBinding::HTMLAppletElementMethods;
|
||||
|
||||
use dom::attr::AttrValue;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLAppletElementDerived;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLElementCast;
|
||||
use dom::bindings::js::{JSRef, Temporary};
|
||||
use dom::document::Document;
|
||||
use dom::element::ElementTypeId;
|
||||
use dom::element::{AttributeHandlers, ElementTypeId};
|
||||
use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
||||
use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
|
||||
use dom::node::{Node, NodeTypeId};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
|
||||
use string_cache::Atom;
|
||||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -37,3 +44,21 @@ impl HTMLAppletElement {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> HTMLAppletElementMethods for JSRef<'a, HTMLAppletElement> {
|
||||
// https://html.spec.whatwg.org/#the-applet-element:dom-applet-name
|
||||
make_getter!(Name);
|
||||
make_atomic_setter!(SetName, "name");
|
||||
}
|
||||
|
||||
impl<'a> VirtualMethods for JSRef<'a, HTMLAppletElement> {
|
||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||
Some(HTMLElementCast::from_borrowed_ref(self) as &VirtualMethods)
|
||||
}
|
||||
|
||||
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
|
||||
match name {
|
||||
&atom!("name") => AttrValue::from_atomic(value),
|
||||
_ => self.super_type().unwrap().parse_plain_attribute(name, value),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,6 +199,20 @@ macro_rules! make_limited_uint_setter(
|
|||
};
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! make_atomic_setter(
|
||||
( $attr:ident, $htmlname:expr ) => (
|
||||
fn $attr(self, value: DOMString) {
|
||||
use dom::element::{Element, AttributeHandlers};
|
||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||
use string_cache::Atom;
|
||||
let element: JSRef<Element> = ElementCast::from_ref(self);
|
||||
// FIXME(pcwalton): Do this at compile time, not at runtime.
|
||||
element.set_atomic_attribute(&Atom::from_slice($htmlname), value)
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
/// For use on non-jsmanaged types
|
||||
/// Use #[jstraceable] on JS managed types
|
||||
macro_rules! no_jsmanaged_fields(
|
||||
|
|
|
@ -6,6 +6,7 @@ use dom::attr::{Attr, AttrValue};
|
|||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLAnchorElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLAreaElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLAppletElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLBodyElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLButtonElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLCanvasElementCast;
|
||||
|
@ -144,6 +145,9 @@ pub fn vtable_for<'a>(node: &'a JSRef<'a, Node>) -> &'a (VirtualMethods + 'a) {
|
|||
let element: &'a JSRef<'a, HTMLAnchorElement> = HTMLAnchorElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a (VirtualMethods + 'a)
|
||||
}
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAppletElement)) => {
|
||||
HTMLAppletElementCast::to_borrowed_ref(node).unwrap() as &'a (VirtualMethods + 'a)
|
||||
}
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) => {
|
||||
let element: &'a JSRef<'a, HTMLAreaElement> = HTMLAreaElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a (VirtualMethods + 'a)
|
||||
|
|
|
@ -12,7 +12,7 @@ interface HTMLAppletElement : HTMLElement {
|
|||
// attribute DOMString codeBase;
|
||||
// attribute DOMString height;
|
||||
// attribute unsigned long hspace;
|
||||
// attribute DOMString name;
|
||||
attribute DOMString name;
|
||||
// attribute DOMString _object; // the underscore is not part of the identifier
|
||||
// attribute unsigned long vspace;
|
||||
// attribute DOMString width;
|
||||
|
|
|
@ -8967,9 +8967,6 @@
|
|||
[HTMLAppletElement interface: attribute hspace]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLAppletElement interface: attribute name]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLAppletElement interface: attribute object]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -9000,9 +8997,6 @@
|
|||
[HTMLAppletElement interface: document.createElement("applet") must inherit property "hspace" with the proper type (6)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLAppletElement interface: document.createElement("applet") must inherit property "name" with the proper type (7)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLAppletElement interface: document.createElement("applet") must inherit property "object" with the proper type (8)]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1452,135 +1452,6 @@
|
|||
[applet.hspace: IDL set to "-0" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: typeof IDL attribute]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL get with DOM attribute unset]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to "" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to undefined followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to 7 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to 1.5 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to true followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to false followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to object "[object Object\]" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to NaN followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to -Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to "\\0" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to null followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to object "test-toString" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: setAttribute() to object "test-valueOf" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to "" followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to undefined followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to undefined followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to 7 followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to 7 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to 1.5 followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to 1.5 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to true followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to true followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to false followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to false followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to object "[object Object\]" followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to object "[object Object\]" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to NaN followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to NaN followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to Infinity followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to -Infinity followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to -Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to "\\0" followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to null followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to null followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to object "test-toString" followed by getAttribute()]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to object "test-toString" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.name: IDL set to object "test-valueOf" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[applet.object: typeof IDL attribute]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue