mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Generate bindings for HTMLHeadElement.
This commit is contained in:
parent
fd4efad70c
commit
9a545b13c3
13 changed files with 132 additions and 73 deletions
|
@ -2,11 +2,11 @@
|
|||
* 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::TextBinding;
|
||||
use dom::bindings::element;
|
||||
use dom::bindings::text;
|
||||
use dom::bindings::utils;
|
||||
use dom::bindings::utils::{CacheableWrapper, WrapperCache, DerivedWrapper};
|
||||
use dom::element::{HTMLHeadElementTypeId, HTMLHeadElement};
|
||||
use dom::node::{AbstractNode, Node, ElementNodeTypeId, TextNodeTypeId, CommentNodeTypeId};
|
||||
use dom::node::{DoctypeNodeTypeId, ScriptView, Text};
|
||||
|
||||
|
@ -65,13 +65,16 @@ pub fn init(compartment: @mut Compartment) {
|
|||
#[allow(non_implicitly_copyable_typarams)]
|
||||
pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject {
|
||||
match node.type_id() {
|
||||
ElementNodeTypeId(HTMLHeadElementTypeId) => {
|
||||
let node: @mut HTMLHeadElement = unsafe { cast::transmute(node.raw_object()) };
|
||||
node.wrap_object_shared(cx, ptr::null())
|
||||
}
|
||||
ElementNodeTypeId(_) => element::create(cx, node).ptr,
|
||||
CommentNodeTypeId |
|
||||
DoctypeNodeTypeId => text::create(cx, node).ptr,
|
||||
TextNodeTypeId => {
|
||||
let mut unused = false;
|
||||
let node: @mut Text = unsafe { cast::transmute(node.raw_object()) };
|
||||
TextBinding::Wrap(cx, ptr::null(), node, &mut unused)
|
||||
node.wrap_object_shared(cx, ptr::null())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue