gecko-dev/servo/src/components/script/dom/htmlstyleelement.rs
Patrick Walton cf773ab0f2 servo: Merge #1424 - Harden layout (from pcwalton:harden-layout); r=pcwalton
This changeset gets rid of the `FooView` phantom type in favor of a more brute force approach that just whitelists methods that layout is allowed to call. The set is surprisingly small now that layout isn't going to the DOM for much.

If this approach turns out not to scale, we can do something fancier, but I'd rather just have it be safe and secure first and then refactor later for programmer happiness.

r? @kmcallister

Source-Repo: https://github.com/servo/servo
Source-Revision: 824c7ac613ebb80bb432ff6425c5e25c642b6afb
2013-12-17 18:16:05 -08:00

60 lines
1.6 KiB
Rust

/* 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::HTMLStyleElementBinding;
use dom::bindings::utils::{DOMString, ErrorResult};
use dom::document::AbstractDocument;
use dom::element::HTMLStyleElementTypeId;
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Node};
pub struct HTMLStyleElement {
htmlelement: HTMLElement,
}
impl HTMLStyleElement {
pub fn new_inherited(localName: ~str, document: AbstractDocument) -> HTMLStyleElement {
HTMLStyleElement {
htmlelement: HTMLElement::new_inherited(HTMLStyleElementTypeId, localName, document)
}
}
pub fn new(localName: ~str, document: AbstractDocument) -> AbstractNode {
let element = HTMLStyleElement::new_inherited(localName, document);
Node::reflect_node(@mut element, document, HTMLStyleElementBinding::Wrap)
}
}
impl HTMLStyleElement {
pub fn Disabled(&self) -> bool {
false
}
pub fn SetDisabled(&self, _disabled: bool) {
}
pub fn Media(&self) -> DOMString {
~""
}
pub fn SetMedia(&mut self, _media: DOMString) -> ErrorResult {
Ok(())
}
pub fn Type(&self) -> DOMString {
~""
}
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(())
}
pub fn Scoped(&self) -> bool {
false
}
pub fn SetScoped(&self, _scoped: bool) -> ErrorResult {
Ok(())
}
}