servo: Merge #18657 - script: Remove HTMLAppletElement (from emilio:bye-applet); r=KiChjang

It was removed from the spec, there's no reason to keep it in tree.

Source-Repo: https://github.com/servo/servo
Source-Revision: a509ebf90ccd24ef80b27737faefa340a5af8916

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 06e4fac5600155e9337e1cca39318ae77c77f8f6
This commit is contained in:
Emilio Cobos Álvarez 2017-11-06 10:46:44 -06:00
Родитель b8a8802972
Коммит a4faa8b65a
9 изменённых файлов: 33 добавлений и 128 удалений

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

@ -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;
};

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

@ -139,31 +139,31 @@ hr[color], hr[noshade] { border-style: solid; }
iframe[frameborder="0"], iframe[frameborder=no i] { border: none; }
applet[align=left i], embed[align=left i], iframe[align=left i], img[type=image i][align=left i], object[align=left i] {
embed[align=left i], iframe[align=left i], img[type=image i][align=left i], object[align=left i] {
float: left;
}
applet[align=right i], embed[align=right i], iframe[align=right i], img[type=image i][align=right i], object[align=right i] {
embed[align=right i], iframe[align=right i], img[type=image i][align=right i], object[align=right i] {
float: right;
}
applet[align=top i], embed[align=top i], iframe[align=top i], img[type=image i][align=top i], object[align=top i] {
embed[align=top i], iframe[align=top i], img[type=image i][align=top i], object[align=top i] {
vertical-align: top;
}
applet[align=baseline i], embed[align=baseline i], iframe[align=baseline i], img[type=image i][align=baseline i], object[align=baseline i] {
embed[align=baseline i], iframe[align=baseline i], img[type=image i][align=baseline i], object[align=baseline i] {
vertical-align: baseline;
}
applet[align=texttop i], embed[align=texttop i], iframe[align=texttop i], img[type=image i][align=texttop i], object[align=texttop i] {
embed[align=texttop i], iframe[align=texttop i], img[type=image i][align=texttop i], object[align=texttop i] {
vertical-align: text-top;
}
applet[align=absmiddle i], embed[align=absmiddle i], iframe[align=absmiddle i], img[type=image i][align=absmiddle i], object[align=absmiddle i],
applet[align=abscenter i], embed[align=abscenter i], iframe[align=abscenter i], img[type=image i][align=abscenter i], object[align=abscenter i] {
embed[align=absmiddle i], iframe[align=absmiddle i], img[type=image i][align=absmiddle i], object[align=absmiddle i],
embed[align=abscenter i], iframe[align=abscenter i], img[type=image i][align=abscenter i], object[align=abscenter i] {
vertical-align: middle;
}
applet[align=bottom i], embed[align=bottom i], iframe[align=bottom i], img[type=image i][align=bottom i], object[align=bottom i] {
embed[align=bottom i], iframe[align=bottom i], img[type=image i][align=bottom i], object[align=bottom i] {
vertical-align: bottom;
}
/*
FIXME:
:matches(applet, embed, iframe, img, input[type=image i], object):matches([align=center i], [align=middle i]) {
:matches(embed, iframe, img, input[type=image i], object):matches([align=center i], [align=middle i]) {
vertical-align: "aligns the vertical middle of the element with the parent element's baseline."
}
*/
@ -235,14 +235,14 @@ hr
legend
align
applet, embed, iframe, img, input[type=image i], object
embed, iframe, img, input[type=image i], object
hspace
vspace
img, input[type=image i], object
border
applet, embed, iframe, img, input[type=image i], object, video
embed, iframe, img, input[type=image i], object, video
width
height