Remove the HTMLTable{Header,Data}CellElement interfaces

Fixes #17222.
This commit is contained in:
Simon Pieters 2018-10-02 19:13:53 +02:00
parent 57053e03bb
commit 9b74f0af24
16 changed files with 42 additions and 149 deletions

View file

@ -55,10 +55,9 @@ use dom::bindings::codegen::Bindings::HTMLSourceElementBinding;
use dom::bindings::codegen::Bindings::HTMLSpanElementBinding; use dom::bindings::codegen::Bindings::HTMLSpanElementBinding;
use dom::bindings::codegen::Bindings::HTMLStyleElementBinding; use dom::bindings::codegen::Bindings::HTMLStyleElementBinding;
use dom::bindings::codegen::Bindings::HTMLTableCaptionElementBinding; use dom::bindings::codegen::Bindings::HTMLTableCaptionElementBinding;
use dom::bindings::codegen::Bindings::HTMLTableCellElementBinding;
use dom::bindings::codegen::Bindings::HTMLTableColElementBinding; use dom::bindings::codegen::Bindings::HTMLTableColElementBinding;
use dom::bindings::codegen::Bindings::HTMLTableDataCellElementBinding;
use dom::bindings::codegen::Bindings::HTMLTableElementBinding; use dom::bindings::codegen::Bindings::HTMLTableElementBinding;
use dom::bindings::codegen::Bindings::HTMLTableHeaderCellElementBinding;
use dom::bindings::codegen::Bindings::HTMLTableRowElementBinding; use dom::bindings::codegen::Bindings::HTMLTableRowElementBinding;
use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding; use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding;
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding; use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding;
@ -310,11 +309,11 @@ pub fn get_constructor_object_from_local_name(
local_name!("sup") => get_constructor!(HTMLElementBinding), local_name!("sup") => get_constructor!(HTMLElementBinding),
local_name!("table") => get_constructor!(HTMLTableElementBinding), local_name!("table") => get_constructor!(HTMLTableElementBinding),
local_name!("tbody") => get_constructor!(HTMLTableSectionElementBinding), local_name!("tbody") => get_constructor!(HTMLTableSectionElementBinding),
local_name!("td") => get_constructor!(HTMLTableDataCellElementBinding), local_name!("td") => get_constructor!(HTMLTableCellElementBinding),
local_name!("template") => get_constructor!(HTMLTemplateElementBinding), local_name!("template") => get_constructor!(HTMLTemplateElementBinding),
local_name!("textarea") => get_constructor!(HTMLTextAreaElementBinding), local_name!("textarea") => get_constructor!(HTMLTextAreaElementBinding),
local_name!("tfoot") => get_constructor!(HTMLTableSectionElementBinding), local_name!("tfoot") => get_constructor!(HTMLTableSectionElementBinding),
local_name!("th") => get_constructor!(HTMLTableHeaderCellElementBinding), local_name!("th") => get_constructor!(HTMLTableCellElementBinding),
local_name!("thead") => get_constructor!(HTMLTableSectionElementBinding), local_name!("thead") => get_constructor!(HTMLTableSectionElementBinding),
local_name!("time") => get_constructor!(HTMLTimeElementBinding), local_name!("time") => get_constructor!(HTMLTimeElementBinding),
local_name!("title") => get_constructor!(HTMLTitleElementBinding), local_name!("title") => get_constructor!(HTMLTitleElementBinding),

View file

@ -64,10 +64,9 @@ use dom::htmlsourceelement::HTMLSourceElement;
use dom::htmlspanelement::HTMLSpanElement; use dom::htmlspanelement::HTMLSpanElement;
use dom::htmlstyleelement::HTMLStyleElement; use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltablecaptionelement::HTMLTableCaptionElement; use dom::htmltablecaptionelement::HTMLTableCaptionElement;
use dom::htmltablecellelement::HTMLTableCellElement;
use dom::htmltablecolelement::HTMLTableColElement; use dom::htmltablecolelement::HTMLTableColElement;
use dom::htmltabledatacellelement::HTMLTableDataCellElement;
use dom::htmltableelement::HTMLTableElement; use dom::htmltableelement::HTMLTableElement;
use dom::htmltableheadercellelement::HTMLTableHeaderCellElement;
use dom::htmltablerowelement::HTMLTableRowElement; use dom::htmltablerowelement::HTMLTableRowElement;
use dom::htmltablesectionelement::HTMLTableSectionElement; use dom::htmltablesectionelement::HTMLTableSectionElement;
use dom::htmltemplateelement::HTMLTemplateElement; use dom::htmltemplateelement::HTMLTemplateElement;
@ -346,12 +345,12 @@ pub fn create_native_html_element(
local_name!("sup") => make!(HTMLElement), local_name!("sup") => make!(HTMLElement),
local_name!("table") => make!(HTMLTableElement), local_name!("table") => make!(HTMLTableElement),
local_name!("tbody") => make!(HTMLTableSectionElement), local_name!("tbody") => make!(HTMLTableSectionElement),
local_name!("td") => make!(HTMLTableDataCellElement), local_name!("td") => make!(HTMLTableCellElement),
local_name!("template") => make!(HTMLTemplateElement), local_name!("template") => make!(HTMLTemplateElement),
local_name!("textarea") => make!(HTMLTextAreaElement), local_name!("textarea") => make!(HTMLTextAreaElement),
// https://html.spec.whatwg.org/multipage/#the-tfoot-element:concept-element-dom // https://html.spec.whatwg.org/multipage/#the-tfoot-element:concept-element-dom
local_name!("tfoot") => make!(HTMLTableSectionElement), local_name!("tfoot") => make!(HTMLTableSectionElement),
local_name!("th") => make!(HTMLTableHeaderCellElement), local_name!("th") => make!(HTMLTableCellElement),
// https://html.spec.whatwg.org/multipage/#the-thead-element:concept-element-dom // https://html.spec.whatwg.org/multipage/#the-thead-element:concept-element-dom
local_name!("thead") => make!(HTMLTableSectionElement), local_name!("thead") => make!(HTMLTableSectionElement),
local_name!("time") => make!(HTMLTimeElement), local_name!("time") => make!(HTMLTimeElement),

View file

@ -3,9 +3,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::RGBA; use cssparser::RGBA;
use dom::bindings::codegen::Bindings::HTMLTableCellElementBinding;
use dom::bindings::codegen::Bindings::HTMLTableCellElementBinding::HTMLTableCellElementMethods; use dom::bindings::codegen::Bindings::HTMLTableCellElementBinding::HTMLTableCellElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::bindings::root::DomRoot;
use dom::bindings::root::LayoutDom; use dom::bindings::root::LayoutDom;
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::document::Document; use dom::document::Document;
@ -28,15 +30,30 @@ pub struct HTMLTableCellElement {
} }
impl HTMLTableCellElement { impl HTMLTableCellElement {
pub fn new_inherited( fn new_inherited(
tag_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,
document: &Document, document: &Document,
) -> HTMLTableCellElement { ) -> HTMLTableCellElement {
HTMLTableCellElement { HTMLTableCellElement {
htmlelement: HTMLElement::new_inherited(tag_name, prefix, document), htmlelement: HTMLElement::new_inherited(local_name, prefix, document),
} }
} }
#[allow(unrooted_must_root)]
pub fn new(
local_name: LocalName,
prefix: Option<Prefix>,
document: &Document,
) -> DomRoot<HTMLTableCellElement> {
Node::reflect_node(
Box::new(HTMLTableCellElement::new_inherited(
local_name, prefix, document,
)),
document,
HTMLTableCellElementBinding::Wrap,
)
}
} }
impl HTMLTableCellElementMethods for HTMLTableCellElement { impl HTMLTableCellElementMethods for HTMLTableCellElement {

View file

@ -1,43 +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::HTMLTableDataCellElementBinding;
use dom::bindings::root::DomRoot;
use dom::document::Document;
use dom::htmltablecellelement::HTMLTableCellElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLTableDataCellElement {
htmltablecellelement: HTMLTableCellElement,
}
impl HTMLTableDataCellElement {
fn new_inherited(
local_name: LocalName,
prefix: Option<Prefix>,
document: &Document,
) -> HTMLTableDataCellElement {
HTMLTableDataCellElement {
htmltablecellelement: HTMLTableCellElement::new_inherited(local_name, prefix, document),
}
}
#[allow(unrooted_must_root)]
pub fn new(
local_name: LocalName,
prefix: Option<Prefix>,
document: &Document,
) -> DomRoot<HTMLTableDataCellElement> {
Node::reflect_node(
Box::new(HTMLTableDataCellElement::new_inherited(
local_name, prefix, document,
)),
document,
HTMLTableDataCellElementBinding::Wrap,
)
}
}

View file

@ -1,43 +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::HTMLTableHeaderCellElementBinding;
use dom::bindings::root::DomRoot;
use dom::document::Document;
use dom::htmltablecellelement::HTMLTableCellElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLTableHeaderCellElement {
htmltablecellelement: HTMLTableCellElement,
}
impl HTMLTableHeaderCellElement {
fn new_inherited(
local_name: LocalName,
prefix: Option<Prefix>,
document: &Document,
) -> HTMLTableHeaderCellElement {
HTMLTableHeaderCellElement {
htmltablecellelement: HTMLTableCellElement::new_inherited(local_name, prefix, document),
}
}
#[allow(unrooted_must_root)]
pub fn new(
local_name: LocalName,
prefix: Option<Prefix>,
document: &Document,
) -> DomRoot<HTMLTableHeaderCellElement> {
Node::reflect_node(
Box::new(HTMLTableHeaderCellElement::new_inherited(
local_name, prefix, document,
)),
document,
HTMLTableHeaderCellElementBinding::Wrap,
)
}
}

View file

@ -15,9 +15,8 @@ use dom::document::Document;
use dom::element::{Element, RawLayoutElementHelpers}; use dom::element::{Element, RawLayoutElementHelpers};
use dom::htmlcollection::{CollectionFilter, HTMLCollection}; use dom::htmlcollection::{CollectionFilter, HTMLCollection};
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use dom::htmltabledatacellelement::HTMLTableDataCellElement; use dom::htmltablecellelement::HTMLTableCellElement;
use dom::htmltableelement::HTMLTableElement; use dom::htmltableelement::HTMLTableElement;
use dom::htmltableheadercellelement::HTMLTableHeaderCellElement;
use dom::htmltablesectionelement::HTMLTableSectionElement; use dom::htmltablesectionelement::HTMLTableSectionElement;
use dom::node::{Node, window_from_node}; use dom::node::{Node, window_from_node};
use dom::virtualmethods::VirtualMethods; use dom::virtualmethods::VirtualMethods;
@ -29,7 +28,7 @@ use style::attr::AttrValue;
struct CellsFilter; struct CellsFilter;
impl CollectionFilter for CellsFilter { impl CollectionFilter for CellsFilter {
fn filter(&self, elem: &Element, root: &Node) -> bool { fn filter(&self, elem: &Element, root: &Node) -> bool {
(elem.is::<HTMLTableHeaderCellElement>() || elem.is::<HTMLTableDataCellElement>()) && (elem.is::<HTMLTableCellElement>()) &&
elem.upcast::<Node>().GetParentNode().r() == Some(root) elem.upcast::<Node>().GetParentNode().r() == Some(root)
} }
} }
@ -99,7 +98,7 @@ impl HTMLTableRowElementMethods for HTMLTableRowElement {
node.insert_cell_or_row( node.insert_cell_or_row(
index, index,
|| self.Cells(), || self.Cells(),
|| HTMLTableDataCellElement::new(local_name!("td"), None, &node.owner_doc()), || HTMLTableCellElement::new(local_name!("td"), None, &node.owner_doc()),
) )
} }
@ -109,7 +108,7 @@ impl HTMLTableRowElementMethods for HTMLTableRowElement {
node.delete_cell_or_row( node.delete_cell_or_row(
index, index,
|| self.Cells(), || self.Cells(),
|n| n.is::<HTMLTableDataCellElement>(), |n| n.is::<HTMLTableCellElement>(),
) )
} }

View file

@ -372,9 +372,7 @@ pub mod htmlstyleelement;
pub mod htmltablecaptionelement; pub mod htmltablecaptionelement;
pub mod htmltablecellelement; pub mod htmltablecellelement;
pub mod htmltablecolelement; pub mod htmltablecolelement;
pub mod htmltabledatacellelement;
pub mod htmltableelement; pub mod htmltableelement;
pub mod htmltableheadercellelement;
pub mod htmltablerowelement; pub mod htmltablerowelement;
pub mod htmltablesectionelement; pub mod htmltablesectionelement;
pub mod htmltemplateelement; pub mod htmltemplateelement;

View file

@ -2920,7 +2920,7 @@ impl Into<LayoutElementType> for ElementTypeId {
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLParagraphElement) => { ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLParagraphElement) => {
LayoutElementType::HTMLParagraphElement LayoutElementType::HTMLParagraphElement
}, },
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement(_)) => { ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement) => {
LayoutElementType::HTMLTableCellElement LayoutElementType::HTMLTableCellElement
}, },
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableColElement) => { ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableColElement) => {

View file

@ -242,7 +242,7 @@ pub fn vtable_for(node: &Node) -> &VirtualMethods {
node.downcast::<HTMLTableElement>().unwrap() as &VirtualMethods node.downcast::<HTMLTableElement>().unwrap() as &VirtualMethods
}, },
NodeTypeId::Element(ElementTypeId::HTMLElement( NodeTypeId::Element(ElementTypeId::HTMLElement(
HTMLElementTypeId::HTMLTableCellElement(_), HTMLElementTypeId::HTMLTableCellElement,
)) => node.downcast::<HTMLTableCellElement>().unwrap() as &VirtualMethods, )) => node.downcast::<HTMLTableCellElement>().unwrap() as &VirtualMethods,
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableRowElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableRowElement)) => {
node.downcast::<HTMLTableRowElement>().unwrap() as &VirtualMethods node.downcast::<HTMLTableRowElement>().unwrap() as &VirtualMethods

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#htmltablecellelement // https://html.spec.whatwg.org/multipage/#htmltablecellelement
[HTMLConstructor, Abstract] [HTMLConstructor]
interface HTMLTableCellElement : HTMLElement { interface HTMLTableCellElement : HTMLElement {
[CEReactions] [CEReactions]
attribute unsigned long colSpan; attribute unsigned long colSpan;
@ -13,6 +13,11 @@ interface HTMLTableCellElement : HTMLElement {
// attribute DOMString headers; // attribute DOMString headers;
readonly attribute long cellIndex; readonly attribute long cellIndex;
// [CEReactions]
// attribute DOMString scope; // only conforming for th elements
// [CEReactions]
// attribute DOMString abbr; // only conforming for th elements
// also has obsolete members // also has obsolete members
}; };

View file

@ -1,15 +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/#htmltabledatacellelement
[HTMLConstructor]
interface HTMLTableDataCellElement : HTMLTableCellElement {
// also has obsolete members
};
// https://html.spec.whatwg.org/multipage/#HTMLTableDataCellElement-partial
partial interface HTMLTableDataCellElement {
// [CEReactions]
// attribute DOMString abbr;
};

View file

@ -1,15 +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/#htmltableheadercellelement
[HTMLConstructor]
interface HTMLTableHeaderCellElement : HTMLTableCellElement {
// [CEReactions]
// attribute DOMString scope;
// [CEReactions]
// attribute DOMString abbr;
// [CEReactions]
// attribute DOMString sorted;
// void sort();
};

View file

@ -3,9 +3,3 @@
[document.all cannot find applet] [document.all cannot find applet]
expected: FAIL expected: FAIL
[HTMLTableHeaderCellElement interface is removed]
expected: FAIL
[HTMLTableDataCellElement interface is removed]
expected: FAIL

View file

@ -26638,7 +26638,7 @@
"testharness" "testharness"
], ],
"mozilla/collections.html": [ "mozilla/collections.html": [
"4011ee6bf322eaacafafd98238c4261084397fde", "8e06ffcc0933719b4b79ea6656d6635cc121d900",
"testharness" "testharness"
], ],
"mozilla/createEvent-storageevent.html": [ "mozilla/createEvent-storageevent.html": [
@ -27038,7 +27038,7 @@
"testharness" "testharness"
], ],
"mozilla/interfaces.html": [ "mozilla/interfaces.html": [
"4863f4d1036e945cfaae1f112981fac3367b2e49", "8bbde3b46a8e9d5ead6f9a2bf372d9647ad059be",
"testharness" "testharness"
], ],
"mozilla/interfaces.js": [ "mozilla/interfaces.js": [

View file

@ -123,8 +123,8 @@ test(function() {
check_tag("caption", 1, [HTMLTableCaptionElement]); check_tag("caption", 1, [HTMLTableCaptionElement]);
check_tag("textarea", 1, [HTMLTextAreaElement]); check_tag("textarea", 1, [HTMLTextAreaElement]);
check_tag("q", 1, [HTMLQuoteElement]); check_tag("q", 1, [HTMLQuoteElement]);
check_tag("th", 1, [HTMLTableCellElement, HTMLTableHeaderCellElement]); check_tag("th", 1, [HTMLTableCellElement]);
check_tag("td", 1, [HTMLTableCellElement, HTMLTableDataCellElement]); check_tag("td", 1, [HTMLTableCellElement]);
check_tag("col", 1, [HTMLTableColElement]); check_tag("col", 1, [HTMLTableColElement]);
check_tag("colgroup", 1, [HTMLTableColElement]); check_tag("colgroup", 1, [HTMLTableColElement]);
check_tag("input", 2, [HTMLInputElement]); check_tag("input", 2, [HTMLInputElement]);

View file

@ -139,9 +139,7 @@ test_interfaces([
"HTMLTableCaptionElement", "HTMLTableCaptionElement",
"HTMLTableCellElement", "HTMLTableCellElement",
"HTMLTableColElement", "HTMLTableColElement",
"HTMLTableDataCellElement",
"HTMLTableElement", "HTMLTableElement",
"HTMLTableHeaderCellElement",
"HTMLTableRowElement", "HTMLTableRowElement",
"HTMLTableSectionElement", "HTMLTableSectionElement",
"HTMLTemplateElement", "HTMLTemplateElement",