Remove and allow some dead code.

This commit is contained in:
Ms2ger 2016-06-08 14:48:49 +02:00
parent 8f2d624cbf
commit 1bc0862214
28 changed files with 20 additions and 152 deletions

View file

@ -31,7 +31,7 @@ impl<T: DomObject> SimpleWorkerErrorHandler<T> {
#[derive(Copy, Clone)]
pub struct SharedRt {
pub rt: *mut JSRuntime
rt: *mut JSRuntime
}
impl SharedRt {
@ -47,10 +47,6 @@ impl SharedRt {
JS_RequestInterruptCallback(self.rt);
}
}
pub fn rt(&self) -> *mut JSRuntime {
self.rt
}
}
#[allow(unsafe_code)]
unsafe impl Send for SharedRt {}

View file

@ -2,6 +2,8 @@
* 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/. */
#![allow(dead_code)]
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::BeforeUnloadEventBinding;
use dom::bindings::codegen::Bindings::BeforeUnloadEventBinding::BeforeUnloadEventMethods;

View file

@ -20,6 +20,7 @@ pub struct ConstantSpec {
/// Representation of an IDL constant value.
#[derive(Clone)]
#[allow(dead_code)]
pub enum ConstantVal {
/// `long` constant.
IntVal(i32),

View file

@ -157,7 +157,7 @@ pub mod weakref;
pub mod xmlname;
/// Generated JS-Rust bindings.
#[allow(missing_docs, non_snake_case)]
#[allow(dead_code, missing_docs, non_snake_case)]
pub mod codegen {
#[allow(unrooted_must_root)]
pub mod Bindings {

View file

@ -2,17 +2,15 @@
* 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::CSSGroupingRuleBinding;
use dom::bindings::codegen::Bindings::CSSGroupingRuleBinding::CSSGroupingRuleMethods;
use dom::bindings::error::{ErrorResult, Fallible};
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{MutNullableJS, Root};
use dom::bindings::reflector::{DomObject, reflect_dom_object};
use dom::bindings::reflector::DomObject;
use dom::bindings::str::DOMString;
use dom::cssrule::CSSRule;
use dom::cssrulelist::{CSSRuleList, RulesSource};
use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window;
use parking_lot::RwLock;
use std::sync::Arc;
use style::stylesheets::CssRules as StyleCssRules;
@ -35,14 +33,6 @@ impl CSSGroupingRule {
}
}
#[allow(unrooted_must_root)]
pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet,
rules: Arc<RwLock<StyleCssRules>>) -> Root<CSSGroupingRule> {
reflect_dom_object(box CSSGroupingRule::new_inherited(parent_stylesheet, rules),
window,
CSSGroupingRuleBinding::Wrap)
}
fn rulelist(&self) -> Root<CSSRuleList> {
let parent_stylesheet = self.upcast::<CSSRule>().parent_stylesheet();
self.rulelist.or_init(|| CSSRuleList::new(self.global().as_window(),

View file

@ -2,11 +2,10 @@
* 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::CSSRuleBinding;
use dom::bindings::codegen::Bindings::CSSRuleBinding::CSSRuleMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::reflector::Reflector;
use dom::bindings::str::DOMString;
use dom::cssfontfacerule::CSSFontFaceRule;
use dom::cssimportrule::CSSImportRule;
@ -43,13 +42,6 @@ impl CSSRule {
}
}
#[allow(unrooted_must_root)]
pub fn new(window: &Window, parent_stylesheet: &CSSStyleSheet) -> Root<CSSRule> {
reflect_dom_object(box CSSRule::new_inherited(parent_stylesheet),
window,
CSSRuleBinding::Wrap)
}
pub fn as_specific(&self) -> &SpecificCSSRule {
if let Some(rule) = self.downcast::<CSSStyleRule>() {
rule as &SpecificCSSRule

View file

@ -40,10 +40,6 @@ impl CSSStyleRule {
window,
CSSStyleRuleBinding::Wrap)
}
pub fn style_rule(&self) -> Arc<RwLock<StyleRule>> {
self.stylerule.clone()
}
}
impl SpecificCSSRule for CSSStyleRule {

View file

@ -29,13 +29,11 @@ pub enum DOMErrorName {
SecurityError = DOMExceptionConstants::SECURITY_ERR,
NetworkError = DOMExceptionConstants::NETWORK_ERR,
AbortError = DOMExceptionConstants::ABORT_ERR,
URLMismatchError = DOMExceptionConstants::URL_MISMATCH_ERR,
TypeMismatchError = DOMExceptionConstants::TYPE_MISMATCH_ERR,
QuotaExceededError = DOMExceptionConstants::QUOTA_EXCEEDED_ERR,
TimeoutError = DOMExceptionConstants::TIMEOUT_ERR,
InvalidNodeTypeError = DOMExceptionConstants::INVALID_NODE_TYPE_ERR,
DataCloneError = DOMExceptionConstants::DATA_CLONE_ERR,
EncodingError,
}
#[dom_struct]
@ -62,11 +60,7 @@ impl DOMException {
impl DOMExceptionMethods for DOMException {
// https://heycam.github.io/webidl/#dfn-DOMException
fn Code(&self) -> u16 {
match self.code {
// https://heycam.github.io/webidl/#dfn-throw
DOMErrorName::EncodingError => 0,
code => code as u16,
}
self.code as u16
}
// https://heycam.github.io/webidl/#idl-DOMException-error-names
@ -93,14 +87,12 @@ impl DOMExceptionMethods for DOMException {
DOMErrorName::SecurityError => "The operation is insecure.",
DOMErrorName::NetworkError => "A network error occurred.",
DOMErrorName::AbortError => "The operation was aborted.",
DOMErrorName::URLMismatchError => "The given URL does not match another URL.",
DOMErrorName::TypeMismatchError => "The given type does not match any expected type.",
DOMErrorName::QuotaExceededError => "The quota has been exceeded.",
DOMErrorName::TimeoutError => "The operation timed out.",
DOMErrorName::InvalidNodeTypeError =>
"The supplied node is incorrect or has an incorrect ancestor for this operation.",
DOMErrorName::DataCloneError => "The object can not be cloned.",
DOMErrorName::EncodingError => "The encoding operation (either encoded or decoding) failed."
};
DOMString::from(message)

View file

@ -85,10 +85,6 @@ impl HTMLFormElement {
document,
HTMLFormElementBinding::Wrap)
}
pub fn generation_id(&self) -> GenerationId {
self.generation_id.get()
}
}
impl HTMLFormElementMethods for HTMLFormElement {
@ -662,6 +658,7 @@ impl HTMLFormElement {
#[derive(JSTraceable, HeapSizeOf, Clone)]
pub enum FormDatumValue {
#[allow(dead_code)]
File(Root<File>),
String(DOMString)
}
@ -701,6 +698,7 @@ pub enum FormMethod {
}
#[derive(HeapSizeOf)]
#[allow(dead_code)]
pub enum FormSubmittableElement {
ButtonElement(Root<HTMLButtonElement>),
InputElement(Root<HTMLInputElement>),

View file

@ -77,10 +77,6 @@ impl HTMLLinkElement {
HTMLLinkElementBinding::Wrap)
}
pub fn parser_inserted(&self) -> bool {
self.parser_inserted.get()
}
pub fn set_stylesheet(&self, s: Arc<Stylesheet>) {
assert!(self.stylesheet.borrow().is_none());
*self.stylesheet.borrow_mut() = Some(s);

View file

@ -243,11 +243,6 @@ impl HTMLMediaElement {
}
}
#[inline]
pub fn htmlelement(&self) -> &HTMLElement {
&self.htmlelement
}
// https://html.spec.whatwg.org/multipage/#internal-pause-steps
fn internal_pause_steps(&self) {
// Step 1

View file

@ -33,11 +33,6 @@ impl HTMLTableCellElement {
htmlelement: HTMLElement::new_inherited(tag_name, prefix, document),
}
}
#[inline]
pub fn htmlelement(&self) -> &HTMLElement {
&self.htmlelement
}
}
impl HTMLTableCellElementMethods for HTMLTableCellElement {

View file

@ -285,11 +285,6 @@ impl HTMLTextAreaElementMethods for HTMLTextAreaElement {
impl HTMLTextAreaElement {
// https://html.spec.whatwg.org/multipage/#concept-fe-mutable
pub fn mutable(&self) -> bool {
// https://html.spec.whatwg.org/multipage/#the-textarea-element:concept-fe-mutable
!(self.Disabled() || self.ReadOnly())
}
pub fn reset(&self) {
// https://html.spec.whatwg.org/multipage/#the-textarea-element:concept-form-reset-control
self.SetValue(self.DefaultValue());

View file

@ -26,12 +26,6 @@ pub struct MediaQueryListEvent {
}
impl MediaQueryListEvent {
pub fn new_uninitialized(global: &GlobalScope) -> Root<MediaQueryListEvent> {
MediaQueryListEvent::new_initialized(global,
DOMString::new(),
false)
}
pub fn new_initialized(global: &GlobalScope,
media: DOMString,
matches: bool) -> Root<MediaQueryListEvent> {

View file

@ -79,7 +79,6 @@ impl NodeIteratorMethods for NodeIterator {
match self.filter {
Filter::None => None,
Filter::Callback(ref nf) => Some((*nf).clone()),
Filter::Native(_) => panic!("Cannot convert native node filter to DOM NodeFilter")
}
}
@ -200,7 +199,6 @@ impl NodeIterator {
// Step 3-5.
match self.filter {
Filter::None => Ok(NodeFilterConstants::FILTER_ACCEPT),
Filter::Native(f) => Ok((f)(node)),
Filter::Callback(ref callback) => callback.AcceptNode_(self, node, Rethrow)
}
}
@ -210,6 +208,5 @@ impl NodeIterator {
#[derive(JSTraceable)]
pub enum Filter {
None,
Native(fn (node: &Node) -> u16),
Callback(Rc<NodeFilter>)
}

View file

@ -40,10 +40,6 @@ impl RadioNodeList {
RadioNodeList::new(window, NodeListType::Simple(iter.map(|r| JS::from_ref(&*r)).collect()))
}
pub fn empty(window: &Window) -> Root<RadioNodeList> {
RadioNodeList::new(window, NodeListType::Simple(vec![]))
}
// FIXME: This shouldn't need to be implemented here since NodeList (the parent of
// RadioNodeList) implements Length
// https://github.com/servo/servo/issues/5875

View file

@ -2,13 +2,10 @@
* 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::SVGElementBinding;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root;
use dom::bindings::str::DOMString;
use dom::document::Document;
use dom::element::Element;
use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use html5ever_atoms::LocalName;
use style::element_state::ElementState;
@ -19,11 +16,6 @@ pub struct SVGElement {
}
impl SVGElement {
pub fn new_inherited(tag_name: LocalName, prefix: Option<DOMString>,
document: &Document) -> SVGElement {
SVGElement::new_inherited_with_state(ElementState::empty(), tag_name, prefix, document)
}
pub fn new_inherited_with_state(state: ElementState, tag_name: LocalName,
prefix: Option<DOMString>, document: &Document)
-> SVGElement {
@ -32,13 +24,6 @@ impl SVGElement {
Element::new_inherited_with_state(state, tag_name, ns!(svg), prefix, document),
}
}
#[allow(unrooted_must_root)]
pub fn new(local_name: LocalName, prefix: Option<DOMString>, document: &Document) -> Root<SVGElement> {
Node::reflect_node(box SVGElement::new_inherited(local_name, prefix, document),
document,
SVGElementBinding::Wrap)
}
}
impl VirtualMethods for SVGElement {

View file

@ -2,12 +2,9 @@
* 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::SVGGraphicsElementBinding;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root;
use dom::bindings::str::DOMString;
use dom::document::Document;
use dom::node::Node;
use dom::svgelement::SVGElement;
use dom::virtualmethods::VirtualMethods;
use html5ever_atoms::LocalName;
@ -32,13 +29,6 @@ impl SVGGraphicsElement {
SVGElement::new_inherited_with_state(state, tag_name, prefix, document),
}
}
#[allow(unrooted_must_root)]
pub fn new(local_name: LocalName, prefix: Option<DOMString>, document: &Document) -> Root<SVGGraphicsElement> {
Node::reflect_node(box SVGGraphicsElement::new_inherited(local_name, prefix, document),
document,
SVGGraphicsElementBinding::Wrap)
}
}
impl VirtualMethods for SVGGraphicsElement {

View file

@ -10,8 +10,8 @@ use dom::element::Element;
use dom::window::Window;
// https://html.spec.whatwg.org/multipage/#validity-states
#[derive(JSTraceable)]
#[derive(HeapSizeOf)]
#[derive(JSTraceable, HeapSizeOf)]
#[allow(dead_code)]
pub enum ValidityStatus {
ValueMissing,
TypeMismatch,

View file

@ -3,10 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use dom::bindings::codegen::Bindings::WebGLObjectBinding;
use dom::bindings::js::Root;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::window::Window;
use dom::bindings::reflector::Reflector;
#[dom_struct]
pub struct WebGLObject {
@ -19,8 +16,4 @@ impl WebGLObject {
reflector_: Reflector::new(),
}
}
pub fn new(window: &Window) -> Root<WebGLObject> {
reflect_dom_object(box WebGLObject::new_inherited(), window, WebGLObjectBinding::Wrap)
}
}

View file

@ -2829,39 +2829,4 @@ impl UniformSetterType {
UniformSetterType::FloatMat4 => 16,
}
}
pub fn is_compatible_with(&self, gl_type: u32) -> bool {
gl_type == self.as_gl_constant() || match *self {
// Sampler uniform variables have an index value (the index of the
// texture), and as such they have to be set as ints
UniformSetterType::Int => gl_type == constants::SAMPLER_2D ||
gl_type == constants::SAMPLER_CUBE,
// Don't ask me why, but it seems we must allow setting bool
// uniforms with uniform1f.
//
// See the WebGL conformance test
// conformance/uniforms/gl-uniform-bool.html
UniformSetterType::Float => gl_type == constants::BOOL,
UniformSetterType::FloatVec2 => gl_type == constants::BOOL_VEC2,
UniformSetterType::FloatVec3 => gl_type == constants::BOOL_VEC3,
UniformSetterType::FloatVec4 => gl_type == constants::BOOL_VEC4,
_ => false,
}
}
fn as_gl_constant(&self) -> u32 {
match *self {
UniformSetterType::Int => constants::INT,
UniformSetterType::IntVec2 => constants::INT_VEC2,
UniformSetterType::IntVec3 => constants::INT_VEC3,
UniformSetterType::IntVec4 => constants::INT_VEC4,
UniformSetterType::Float => constants::FLOAT,
UniformSetterType::FloatVec2 => constants::FLOAT_VEC2,
UniformSetterType::FloatVec3 => constants::FLOAT_VEC3,
UniformSetterType::FloatVec4 => constants::FLOAT_VEC4,
UniformSetterType::FloatMat2 => constants::FLOAT_MAT2,
UniformSetterType::FloatMat3 => constants::FLOAT_MAT3,
UniformSetterType::FloatMat4 => constants::FLOAT_MAT4,
}
}
}

View file

@ -2,6 +2,8 @@
* 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/. */
#![allow(dead_code)]
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding;
use dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding::WebGLShaderPrecisionFormatMethods;

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/cssom/#the-cssgroupingrule-interface
[Exposed=Window]
[Abstract, Exposed=Window]
interface CSSGroupingRule : CSSRule {
[SameObject] readonly attribute CSSRuleList cssRules;
[Throws] unsigned long insertRule(DOMString rule, unsigned long index);

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/cssom/#the-cssrule-interface
[Exposed=Window]
[Abstract, Exposed=Window]
interface CSSRule {
const unsigned short STYLE_RULE = 1;
const unsigned short CHARSET_RULE = 2; // historical

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://svgwg.org/svg2-draft/types.html#InterfaceSVGElement
[Pref="dom.svg.enabled"]
[Abstract, Pref="dom.svg.enabled"]
interface SVGElement : Element {
//[SameObject] readonly attribute SVGAnimatedString className;

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://svgwg.org/svg2-draft/types.html#InterfaceSVGGraphicsElement
[Pref="dom.svg.enabled"]
//dictionary SVGBoundingBoxOptions {
// boolean fill = true;
// boolean stroke = false;
@ -11,6 +10,7 @@
// boolean clipped = false;
//};
[Abstract, Pref="dom.svg.enabled"]
interface SVGGraphicsElement : SVGElement {
//[SameObject] readonly attribute SVGAnimatedTransformList transform;

View file

@ -6,6 +6,6 @@
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.3
//
[Exposed=Window]
[Abstract, Exposed=Window]
interface WebGLObject {
};

View file

@ -142,8 +142,6 @@ pub enum ReflowReason {
ElementStateChanged,
}
pub type ScrollPoint = Point2D<Au>;
#[dom_struct]
pub struct Window {
globalscope: GlobalScope,