mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #18657 - emilio:bye-applet, r=KiChjang
script: Remove HTMLAppletElement. It was removed from the spec, there's no reason to keep it in tree. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18657) <!-- Reviewable:end -->
This commit is contained in:
commit
a509ebf90c
17 changed files with 132 additions and 156 deletions
|
@ -10,7 +10,6 @@ use dom::document::Document;
|
|||
use dom::element::{CustomElementCreationMode, CustomElementState, Element, ElementCreator};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::htmlanchorelement::HTMLAnchorElement;
|
||||
use dom::htmlappletelement::HTMLAppletElement;
|
||||
use dom::htmlareaelement::HTMLAreaElement;
|
||||
use dom::htmlaudioelement::HTMLAudioElement;
|
||||
use dom::htmlbaseelement::HTMLBaseElement;
|
||||
|
@ -191,12 +190,13 @@ fn create_html_element(name: QualName,
|
|||
result
|
||||
}
|
||||
|
||||
pub fn create_native_html_element(name: QualName,
|
||||
prefix: Option<Prefix>,
|
||||
document: &Document,
|
||||
creator: ElementCreator)
|
||||
-> DomRoot<Element> {
|
||||
assert!(name.ns == ns!(html));
|
||||
pub fn create_native_html_element(
|
||||
name: QualName,
|
||||
prefix: Option<Prefix>,
|
||||
document: &Document,
|
||||
creator: ElementCreator,
|
||||
) -> DomRoot<Element> {
|
||||
assert_eq!(name.ns, ns!(html));
|
||||
|
||||
macro_rules! make(
|
||||
($ctor:ident) => ({
|
||||
|
@ -217,7 +217,6 @@ pub fn create_native_html_element(name: QualName,
|
|||
local_name!("abbr") => make!(HTMLElement),
|
||||
local_name!("acronym") => make!(HTMLElement),
|
||||
local_name!("address") => make!(HTMLElement),
|
||||
local_name!("applet") => make!(HTMLAppletElement),
|
||||
local_name!("area") => make!(HTMLAreaElement),
|
||||
local_name!("article") => make!(HTMLElement),
|
||||
local_name!("aside") => make!(HTMLElement),
|
||||
|
|
|
@ -47,7 +47,6 @@ use dom::forcetouchevent::ForceTouchEvent;
|
|||
use dom::globalscope::GlobalScope;
|
||||
use dom::hashchangeevent::HashChangeEvent;
|
||||
use dom::htmlanchorelement::HTMLAnchorElement;
|
||||
use dom::htmlappletelement::HTMLAppletElement;
|
||||
use dom::htmlareaelement::HTMLAreaElement;
|
||||
use dom::htmlbaseelement::HTMLBaseElement;
|
||||
use dom::htmlbodyelement::HTMLBodyElement;
|
||||
|
@ -413,14 +412,6 @@ impl CollectionFilter for AnchorsFilter {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
struct AppletsFilter;
|
||||
impl CollectionFilter for AppletsFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
elem.is::<HTMLAppletElement>()
|
||||
}
|
||||
}
|
||||
|
||||
impl Document {
|
||||
#[inline]
|
||||
pub fn loader(&self) -> Ref<DocumentLoader> {
|
||||
|
@ -3373,10 +3364,8 @@ impl DocumentMethods for Document {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-document-applets
|
||||
fn Applets(&self) -> DomRoot<HTMLCollection> {
|
||||
// FIXME: This should be return OBJECT elements containing applets.
|
||||
self.applets.or_init(|| {
|
||||
let filter = Box::new(AppletsFilter);
|
||||
HTMLCollection::create(&self.window, self.upcast(), filter)
|
||||
HTMLCollection::always_empty(&self.window, self.upcast())
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -3530,17 +3519,6 @@ impl DocumentMethods for Document {
|
|||
None => return false,
|
||||
};
|
||||
match html_elem_type {
|
||||
HTMLElementTypeId::HTMLAppletElement => {
|
||||
match elem.get_attribute(&ns!(), &local_name!("name")) {
|
||||
Some(ref attr) if attr.value().as_atom() == name => true,
|
||||
_ => {
|
||||
match elem.get_attribute(&ns!(), &local_name!("id")) {
|
||||
Some(ref attr) => attr.value().as_atom() == name,
|
||||
None => false,
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
HTMLElementTypeId::HTMLFormElement => {
|
||||
match elem.get_attribute(&ns!(), &local_name!("name")) {
|
||||
Some(ref attr) => attr.value().as_atom() == name,
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
/* 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::HTMLAppletElementBinding;
|
||||
use dom::bindings::codegen::Bindings::HTMLAppletElementBinding::HTMLAppletElementMethods;
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::bindings::root::DomRoot;
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::document::Document;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::Node;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{LocalName, Prefix};
|
||||
use style::attr::AttrValue;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLAppletElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
||||
impl HTMLAppletElement {
|
||||
fn new_inherited(local_name: LocalName,
|
||||
prefix: Option<Prefix>,
|
||||
document: &Document) -> HTMLAppletElement {
|
||||
HTMLAppletElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited(local_name, prefix, document)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new(local_name: LocalName,
|
||||
prefix: Option<Prefix>,
|
||||
document: &Document) -> DomRoot<HTMLAppletElement> {
|
||||
Node::reflect_node(Box::new(HTMLAppletElement::new_inherited(local_name, prefix, document)),
|
||||
document,
|
||||
HTMLAppletElementBinding::Wrap)
|
||||
}
|
||||
}
|
||||
|
||||
impl HTMLAppletElementMethods for HTMLAppletElement {
|
||||
// https://html.spec.whatwg.org/multipage/#the-applet-element:dom-applet-name
|
||||
make_getter!(Name, "name");
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#the-applet-element:dom-applet-name
|
||||
make_atomic_setter!(SetName, "name");
|
||||
}
|
||||
|
||||
impl VirtualMethods for HTMLAppletElement {
|
||||
fn super_type(&self) -> Option<&VirtualMethods> {
|
||||
Some(self.upcast::<HTMLElement>() as &VirtualMethods)
|
||||
}
|
||||
|
||||
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue {
|
||||
match name {
|
||||
&local_name!("name") => AttrValue::from_atomic(value.into()),
|
||||
_ => self.super_type().unwrap().parse_plain_attribute(name, value),
|
||||
}
|
||||
}
|
||||
}
|
|
@ -80,6 +80,19 @@ impl HTMLCollection {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns a collection which is always empty.
|
||||
pub fn always_empty(window: &Window, root: &Node) -> DomRoot<Self> {
|
||||
#[derive(JSTraceable)]
|
||||
struct NoFilter;
|
||||
impl CollectionFilter for NoFilter {
|
||||
fn filter<'a>(&self, _: &'a Element, _: &'a Node) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
Self::new(window, root, Box::new(NoFilter))
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new(window: &Window, root: &Node, filter: Box<CollectionFilter + 'static>) -> DomRoot<HTMLCollection> {
|
||||
reflect_dom_object(Box::new(HTMLCollection::new_inherited(root, filter)),
|
||||
|
|
|
@ -301,7 +301,6 @@ pub mod hashchangeevent;
|
|||
pub mod headers;
|
||||
pub mod history;
|
||||
pub mod htmlanchorelement;
|
||||
pub mod htmlappletelement;
|
||||
pub mod htmlareaelement;
|
||||
pub mod htmlaudioelement;
|
||||
pub mod htmlbaseelement;
|
||||
|
|
|
@ -14,7 +14,6 @@ use dom::document::Document;
|
|||
use dom::element::{AttributeMutation, Element};
|
||||
use dom::event::Event;
|
||||
use dom::htmlanchorelement::HTMLAnchorElement;
|
||||
use dom::htmlappletelement::HTMLAppletElement;
|
||||
use dom::htmlareaelement::HTMLAreaElement;
|
||||
use dom::htmlbaseelement::HTMLBaseElement;
|
||||
use dom::htmlbodyelement::HTMLBodyElement;
|
||||
|
@ -154,9 +153,6 @@ pub fn vtable_for(node: &Node) -> &VirtualMethods {
|
|||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)) => {
|
||||
node.downcast::<HTMLAnchorElement>().unwrap() as &VirtualMethods
|
||||
}
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAppletElement)) => {
|
||||
node.downcast::<HTMLAppletElement>().unwrap() as &VirtualMethods
|
||||
}
|
||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) => {
|
||||
node.downcast::<HTMLAreaElement>().unwrap() as &VirtualMethods
|
||||
}
|
||||
|
|
|
@ -171,6 +171,7 @@ partial interface Document {
|
|||
|
||||
[SameObject]
|
||||
readonly attribute HTMLCollection anchors;
|
||||
|
||||
[SameObject]
|
||||
readonly attribute HTMLCollection applets;
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/* 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/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#htmlappletelement
|
||||
// Note: intentionally not [HTMLConstructor]
|
||||
interface HTMLAppletElement : HTMLElement {
|
||||
// attribute DOMString align;
|
||||
// attribute DOMString alt;
|
||||
// attribute DOMString archive;
|
||||
// attribute DOMString code;
|
||||
// attribute DOMString codeBase;
|
||||
// attribute DOMString height;
|
||||
// attribute unsigned long hspace;
|
||||
attribute DOMString name;
|
||||
// attribute DOMString _object; // the underscore is not part of the identifier
|
||||
// attribute unsigned long vspace;
|
||||
// attribute DOMString width;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue