mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Reduce max line length from 150 to 120 characters
Part of https://github.com/servo/servo/issues/6041
This commit is contained in:
parent
7561f7b83f
commit
8e3f4bba85
141 changed files with 1161 additions and 497 deletions
|
@ -213,7 +213,8 @@ impl<'a> CanvasPaintTask<'a> {
|
||||||
Canvas2dMsg::Fill => painter.fill(),
|
Canvas2dMsg::Fill => painter.fill(),
|
||||||
Canvas2dMsg::Stroke => painter.stroke(),
|
Canvas2dMsg::Stroke => painter.stroke(),
|
||||||
Canvas2dMsg::Clip => painter.clip(),
|
Canvas2dMsg::Clip => painter.clip(),
|
||||||
Canvas2dMsg::DrawImage(imagedata, image_size, dest_rect, source_rect, smoothing_enabled) => {
|
Canvas2dMsg::DrawImage(imagedata, image_size, dest_rect, source_rect,
|
||||||
|
smoothing_enabled) => {
|
||||||
painter.draw_image(imagedata, image_size, dest_rect, source_rect, smoothing_enabled)
|
painter.draw_image(imagedata, image_size, dest_rect, source_rect, smoothing_enabled)
|
||||||
}
|
}
|
||||||
Canvas2dMsg::DrawImageSelf(image_size, dest_rect, source_rect, smoothing_enabled) => {
|
Canvas2dMsg::DrawImageSelf(image_size, dest_rect, source_rect, smoothing_enabled) => {
|
||||||
|
@ -245,7 +246,8 @@ impl<'a> CanvasPaintTask<'a> {
|
||||||
Canvas2dMsg::SetTransform(ref matrix) => painter.set_transform(matrix),
|
Canvas2dMsg::SetTransform(ref matrix) => painter.set_transform(matrix),
|
||||||
Canvas2dMsg::SetGlobalAlpha(alpha) => painter.set_global_alpha(alpha),
|
Canvas2dMsg::SetGlobalAlpha(alpha) => painter.set_global_alpha(alpha),
|
||||||
Canvas2dMsg::SetGlobalComposition(op) => painter.set_global_composition(op),
|
Canvas2dMsg::SetGlobalComposition(op) => painter.set_global_composition(op),
|
||||||
Canvas2dMsg::GetImageData(dest_rect, canvas_size, chan) => painter.get_image_data(dest_rect, canvas_size, chan),
|
Canvas2dMsg::GetImageData(dest_rect, canvas_size, chan)
|
||||||
|
=> painter.get_image_data(dest_rect, canvas_size, chan),
|
||||||
Canvas2dMsg::PutImageData(imagedata, image_data_rect, dirty_rect)
|
Canvas2dMsg::PutImageData(imagedata, image_data_rect, dirty_rect)
|
||||||
=> painter.put_image_data(imagedata, image_data_rect, dirty_rect),
|
=> painter.put_image_data(imagedata, image_data_rect, dirty_rect),
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,9 @@ unsafe impl Send for WebGLPaintTask {}
|
||||||
impl WebGLPaintTask {
|
impl WebGLPaintTask {
|
||||||
fn new(size: Size2D<i32>) -> Result<WebGLPaintTask, &'static str> {
|
fn new(size: Size2D<i32>) -> Result<WebGLPaintTask, &'static str> {
|
||||||
// TODO(ecoal95): Get the GLContextAttributes from the `GetContext` call
|
// TODO(ecoal95): Get the GLContextAttributes from the `GetContext` call
|
||||||
let context = try!(GLContext::create_offscreen_with_color_attachment(size,
|
let context = try!(
|
||||||
GLContextAttributes::default(),
|
GLContext::create_offscreen_with_color_attachment(
|
||||||
ColorAttachmentType::TextureWithSurface));
|
size, GLContextAttributes::default(), ColorAttachmentType::TextureWithSurface));
|
||||||
Ok(WebGLPaintTask {
|
Ok(WebGLPaintTask {
|
||||||
size: size,
|
size: size,
|
||||||
original_context_size: size,
|
original_context_size: size,
|
||||||
|
@ -50,10 +50,13 @@ impl WebGLPaintTask {
|
||||||
CanvasWebGLMsg::CreateBuffer(chan) => self.create_buffer(chan),
|
CanvasWebGLMsg::CreateBuffer(chan) => self.create_buffer(chan),
|
||||||
CanvasWebGLMsg::DrawArrays(mode, first, count) => self.draw_arrays(mode, first, count),
|
CanvasWebGLMsg::DrawArrays(mode, first, count) => self.draw_arrays(mode, first, count),
|
||||||
CanvasWebGLMsg::EnableVertexAttribArray(attrib_id) => self.enable_vertex_attrib_array(attrib_id),
|
CanvasWebGLMsg::EnableVertexAttribArray(attrib_id) => self.enable_vertex_attrib_array(attrib_id),
|
||||||
CanvasWebGLMsg::GetAttribLocation(program_id, name, chan) => self.get_attrib_location(program_id, name, chan),
|
CanvasWebGLMsg::GetAttribLocation(program_id, name, chan) =>
|
||||||
|
self.get_attrib_location(program_id, name, chan),
|
||||||
CanvasWebGLMsg::GetShaderInfoLog(shader_id, chan) => self.get_shader_info_log(shader_id, chan),
|
CanvasWebGLMsg::GetShaderInfoLog(shader_id, chan) => self.get_shader_info_log(shader_id, chan),
|
||||||
CanvasWebGLMsg::GetShaderParameter(shader_id, param_id, chan) => self.get_shader_parameter(shader_id, param_id, chan),
|
CanvasWebGLMsg::GetShaderParameter(shader_id, param_id, chan) =>
|
||||||
CanvasWebGLMsg::GetUniformLocation(program_id, name, chan) => self.get_uniform_location(program_id, name, chan),
|
self.get_shader_parameter(shader_id, param_id, chan),
|
||||||
|
CanvasWebGLMsg::GetUniformLocation(program_id, name, chan) =>
|
||||||
|
self.get_uniform_location(program_id, name, chan),
|
||||||
CanvasWebGLMsg::CompileShader(shader_id) => self.compile_shader(shader_id),
|
CanvasWebGLMsg::CompileShader(shader_id) => self.compile_shader(shader_id),
|
||||||
CanvasWebGLMsg::CreateProgram(chan) => self.create_program(chan),
|
CanvasWebGLMsg::CreateProgram(chan) => self.create_program(chan),
|
||||||
CanvasWebGLMsg::CreateShader(shader_type, chan) => self.create_shader(shader_type, chan),
|
CanvasWebGLMsg::CreateShader(shader_type, chan) => self.create_shader(shader_type, chan),
|
||||||
|
|
|
@ -151,7 +151,9 @@ impl Actor for ConsoleActor {
|
||||||
timeStamp: 0,
|
timeStamp: 0,
|
||||||
errorMessage: "page error test".to_string(),
|
errorMessage: "page error test".to_string(),
|
||||||
};
|
};
|
||||||
messages.push(json::from_str(json::encode(&message).as_slice()).unwrap().as_object().unwrap().clone());*/
|
messages.push(
|
||||||
|
json::from_str(
|
||||||
|
json::encode(&message).as_slice()).unwrap().as_object().unwrap().clone());*/
|
||||||
}
|
}
|
||||||
|
|
||||||
"LogMessage" => {
|
"LogMessage" => {
|
||||||
|
@ -161,7 +163,9 @@ impl Actor for ConsoleActor {
|
||||||
timeStamp: 0,
|
timeStamp: 0,
|
||||||
message: "log message test".to_string(),
|
message: "log message test".to_string(),
|
||||||
};
|
};
|
||||||
messages.push(json::from_str(json::encode(&message).as_slice()).unwrap().as_object().unwrap().clone());*/
|
messages.push(
|
||||||
|
json::from_str(
|
||||||
|
json::encode(&message).as_slice()).unwrap().as_object().unwrap().clone());*/
|
||||||
}
|
}
|
||||||
|
|
||||||
s => println!("unrecognized message type requested: \"{}\"", s),
|
s => println!("unrecognized message type requested: \"{}\"", s),
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
/// Liberally derived from the [Firefox JS implementation](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/root.js).
|
/// Liberally derived from the [Firefox JS implementation]
|
||||||
|
/// (http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/root.js).
|
||||||
/// Connection point for all new remote devtools interactions, providing lists of know actors
|
/// Connection point for all new remote devtools interactions, providing lists of know actors
|
||||||
/// that perform more specific actions (tabs, addons, browser chrome, etc.)
|
/// that perform more specific actions (tabs, addons, browser chrome, etc.)
|
||||||
|
|
||||||
|
|
|
@ -914,15 +914,17 @@ impl<'a> PaintContext<'a> {
|
||||||
if accum_blur > Au(0) {
|
if accum_blur > Au(0) {
|
||||||
// Set the correct size.
|
// Set the correct size.
|
||||||
let side_inflation = accum_blur * BLUR_INFLATION_FACTOR;
|
let side_inflation = accum_blur * BLUR_INFLATION_FACTOR;
|
||||||
size = Size2D(size.width + (side_inflation.to_nearest_px() * 2) as i32, size.height + (side_inflation.to_nearest_px() * 2) as i32);
|
size = Size2D(size.width + (side_inflation.to_nearest_px() * 2) as i32,
|
||||||
|
size.height + (side_inflation.to_nearest_px() * 2) as i32);
|
||||||
|
|
||||||
// Calculate the transform matrix.
|
// Calculate the transform matrix.
|
||||||
let old_transform = self.draw_target.get_transform();
|
let old_transform = self.draw_target.get_transform();
|
||||||
let inflated_size = Rect(Point2D(0.0, 0.0), Size2D(size.width as AzFloat,
|
let inflated_size = Rect(Point2D(0.0, 0.0), Size2D(size.width as AzFloat,
|
||||||
size.height as AzFloat));
|
size.height as AzFloat));
|
||||||
let temporary_draw_target_bounds = old_transform.transform_rect(&inflated_size);
|
let temporary_draw_target_bounds = old_transform.transform_rect(&inflated_size);
|
||||||
matrix = Matrix2D::identity().translate(-temporary_draw_target_bounds.origin.x as AzFloat,
|
matrix = Matrix2D::identity().translate(
|
||||||
-temporary_draw_target_bounds.origin.y as AzFloat).mul(&old_transform);
|
-temporary_draw_target_bounds.origin.x as AzFloat,
|
||||||
|
-temporary_draw_target_bounds.origin.y as AzFloat).mul(&old_transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
let temporary_draw_target =
|
let temporary_draw_target =
|
||||||
|
|
|
@ -481,7 +481,8 @@ impl WorkerThreadProxy {
|
||||||
layer_buffer: Option<Box<LayerBuffer>>,
|
layer_buffer: Option<Box<LayerBuffer>>,
|
||||||
stacking_context: Arc<StackingContext>,
|
stacking_context: Arc<StackingContext>,
|
||||||
scale: f32) {
|
scale: f32) {
|
||||||
self.sender.send(MsgToWorkerThread::PaintTile(thread_id, tile, layer_buffer, stacking_context, scale)).unwrap()
|
let msg = MsgToWorkerThread::PaintTile(thread_id, tile, layer_buffer, stacking_context, scale);
|
||||||
|
self.sender.send(msg).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_painted_tile_buffer(&mut self) -> Box<LayerBuffer> {
|
fn get_painted_tile_buffer(&mut self) -> Box<LayerBuffer> {
|
||||||
|
|
|
@ -91,13 +91,15 @@ pub fn get_variations_for_family<F>(family_name: &str, mut callback: F)
|
||||||
for i in 0..((*matches).nfont as isize) {
|
for i in 0..((*matches).nfont as isize) {
|
||||||
let font = (*matches).fonts.offset(i);
|
let font = (*matches).fonts.offset(i);
|
||||||
let mut file: *mut FcChar8 = ptr::null_mut();
|
let mut file: *mut FcChar8 = ptr::null_mut();
|
||||||
let file = if FcPatternGetString(*font, FC_FILE.as_ptr() as *mut c_char, 0, &mut file) == FcResultMatch {
|
let result = FcPatternGetString(*font, FC_FILE.as_ptr() as *mut c_char, 0, &mut file);
|
||||||
|
let file = if result == FcResultMatch {
|
||||||
c_str_to_string(file as *const c_char)
|
c_str_to_string(file as *const c_char)
|
||||||
} else {
|
} else {
|
||||||
panic!();
|
panic!();
|
||||||
};
|
};
|
||||||
let mut index: libc::c_int = 0;
|
let mut index: libc::c_int = 0;
|
||||||
let index = if FcPatternGetInteger(*font, FC_INDEX.as_ptr() as *mut c_char, 0, &mut index) == FcResultMatch {
|
let result = FcPatternGetInteger(*font, FC_INDEX.as_ptr() as *mut c_char, 0, &mut index);
|
||||||
|
let index = if result == FcResultMatch {
|
||||||
index
|
index
|
||||||
} else {
|
} else {
|
||||||
panic!();
|
panic!();
|
||||||
|
|
|
@ -198,7 +198,8 @@ impl Shaper {
|
||||||
let hb_funcs: *mut hb_font_funcs_t = RUST_hb_font_funcs_create();
|
let hb_funcs: *mut hb_font_funcs_t = RUST_hb_font_funcs_create();
|
||||||
RUST_hb_font_funcs_set_glyph_func(hb_funcs, glyph_func, ptr::null_mut(), None);
|
RUST_hb_font_funcs_set_glyph_func(hb_funcs, glyph_func, ptr::null_mut(), None);
|
||||||
RUST_hb_font_funcs_set_glyph_h_advance_func(hb_funcs, glyph_h_advance_func, ptr::null_mut(), None);
|
RUST_hb_font_funcs_set_glyph_h_advance_func(hb_funcs, glyph_h_advance_func, ptr::null_mut(), None);
|
||||||
RUST_hb_font_funcs_set_glyph_h_kerning_func(hb_funcs, glyph_h_kerning_func, ptr::null_mut(), ptr::null_mut());
|
RUST_hb_font_funcs_set_glyph_h_kerning_func(
|
||||||
|
hb_funcs, glyph_h_kerning_func, ptr::null_mut(), ptr::null_mut());
|
||||||
RUST_hb_font_set_funcs(hb_font, hb_funcs, font as *mut Font as *mut c_void, None);
|
RUST_hb_font_set_funcs(hb_font, hb_funcs, font as *mut Font as *mut c_void, None);
|
||||||
|
|
||||||
Shaper {
|
Shaper {
|
||||||
|
|
|
@ -1344,7 +1344,8 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> {
|
||||||
};
|
};
|
||||||
(munged_display, style.get_box().float, style.get_box().position)
|
(munged_display, style.get_box().float, style.get_box().position)
|
||||||
}
|
}
|
||||||
Some(NodeTypeId::CharacterData(CharacterDataTypeId::Text)) => (display::T::inline, float::T::none, position::T::static_),
|
Some(NodeTypeId::CharacterData(CharacterDataTypeId::Text)) =>
|
||||||
|
(display::T::inline, float::T::none, position::T::static_),
|
||||||
Some(NodeTypeId::CharacterData(CharacterDataTypeId::Comment)) |
|
Some(NodeTypeId::CharacterData(CharacterDataTypeId::Comment)) |
|
||||||
Some(NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction)) |
|
Some(NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction)) |
|
||||||
Some(NodeTypeId::DocumentType) |
|
Some(NodeTypeId::DocumentType) |
|
||||||
|
|
|
@ -42,7 +42,8 @@ use std::iter::repeat;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use style::computed_values::filter::Filter;
|
use style::computed_values::filter::Filter;
|
||||||
use style::computed_values::transform::ComputedMatrix;
|
use style::computed_values::transform::ComputedMatrix;
|
||||||
use style::computed_values::{background_attachment, background_clip, background_origin, background_repeat, background_size};
|
use style::computed_values::{background_attachment, background_clip, background_origin,
|
||||||
|
background_repeat, background_size};
|
||||||
use style::computed_values::{border_style, image_rendering, overflow_x, position, visibility};
|
use style::computed_values::{border_style, image_rendering, overflow_x, position, visibility};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::properties::style_structs::Border;
|
use style::properties::style_structs::Border;
|
||||||
|
@ -477,7 +478,8 @@ impl FragmentDisplayListBuilding for Fragment {
|
||||||
(absolute_bounds.origin.x, absolute_bounds.origin.y)
|
(absolute_bounds.origin.x, absolute_bounds.origin.y)
|
||||||
}
|
}
|
||||||
background_attachment::T::fixed => {
|
background_attachment::T::fixed => {
|
||||||
// If the ‘background-attachment’ value for this image is ‘fixed’, then 'background-origin' has no effect.
|
// If the ‘background-attachment’ value for this image is ‘fixed’, then
|
||||||
|
// 'background-origin' has no effect.
|
||||||
origin_x = Au(0);
|
origin_x = Au(0);
|
||||||
origin_y = Au(0);
|
origin_y = Au(0);
|
||||||
(Au(0), Au(0))
|
(Au(0), Au(0))
|
||||||
|
|
|
@ -131,7 +131,8 @@ impl MarginCollapseInfo {
|
||||||
let state = match self.state {
|
let state = match self.state {
|
||||||
MarginCollapseState::AccumulatingCollapsibleTopMargin => {
|
MarginCollapseState::AccumulatingCollapsibleTopMargin => {
|
||||||
match fragment.style().content_block_size() {
|
match fragment.style().content_block_size() {
|
||||||
LengthOrPercentageOrAuto::Auto | LengthOrPercentageOrAuto::Length(Au(0)) | LengthOrPercentageOrAuto::Percentage(0.) => {
|
LengthOrPercentageOrAuto::Auto | LengthOrPercentageOrAuto::Length(Au(0)) |
|
||||||
|
LengthOrPercentageOrAuto::Percentage(0.) => {
|
||||||
match fragment.style().min_block_size() {
|
match fragment.style().min_block_size() {
|
||||||
LengthOrPercentage::Length(Au(0)) | LengthOrPercentage::Percentage(0.) => {
|
LengthOrPercentage::Length(Au(0)) | LengthOrPercentage::Percentage(0.) => {
|
||||||
FinalMarginState::MarginsCollapseThrough
|
FinalMarginState::MarginsCollapseThrough
|
||||||
|
|
|
@ -50,7 +50,8 @@ type Generation = u32;
|
||||||
/// Since a work-stealing queue is used for styling, sometimes, the bloom filter
|
/// Since a work-stealing queue is used for styling, sometimes, the bloom filter
|
||||||
/// will no longer be the for the parent of the node we're currently on. When
|
/// will no longer be the for the parent of the node we're currently on. When
|
||||||
/// this happens, the task local bloom filter will be thrown away and rebuilt.
|
/// this happens, the task local bloom filter will be thrown away and rebuilt.
|
||||||
thread_local!(static STYLE_BLOOM: RefCell<Option<(Box<BloomFilter>, UnsafeLayoutNode, Generation)>> = RefCell::new(None));
|
thread_local!(
|
||||||
|
static STYLE_BLOOM: RefCell<Option<(Box<BloomFilter>, UnsafeLayoutNode, Generation)>> = RefCell::new(None));
|
||||||
|
|
||||||
/// Returns the task local bloom filter.
|
/// Returns the task local bloom filter.
|
||||||
///
|
///
|
||||||
|
|
|
@ -125,21 +125,24 @@ pub trait TLayoutNode {
|
||||||
|
|
||||||
fn get_renderer(&self) -> Option<Sender<CanvasMsg>> {
|
fn get_renderer(&self) -> Option<Sender<CanvasMsg>> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> = HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
|
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> =
|
||||||
|
HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
|
||||||
canvas_element.and_then(|elem| elem.get_renderer())
|
canvas_element.and_then(|elem| elem.get_renderer())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_canvas_width(&self) -> u32 {
|
fn get_canvas_width(&self) -> u32 {
|
||||||
unsafe {
|
unsafe {
|
||||||
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> = HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
|
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> =
|
||||||
|
HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
|
||||||
canvas_element.unwrap().get_canvas_width()
|
canvas_element.unwrap().get_canvas_width()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_canvas_height(&self) -> u32 {
|
fn get_canvas_height(&self) -> u32 {
|
||||||
unsafe {
|
unsafe {
|
||||||
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> = HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
|
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> =
|
||||||
|
HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
|
||||||
canvas_element.unwrap().get_canvas_height()
|
canvas_element.unwrap().get_canvas_height()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -311,7 +311,8 @@ impl MozBrowserEvent {
|
||||||
MozBrowserEvent::AsyncScroll | MozBrowserEvent::Close | MozBrowserEvent::ContextMenu |
|
MozBrowserEvent::AsyncScroll | MozBrowserEvent::Close | MozBrowserEvent::ContextMenu |
|
||||||
MozBrowserEvent::Error | MozBrowserEvent::IconChange | MozBrowserEvent::LoadEnd |
|
MozBrowserEvent::Error | MozBrowserEvent::IconChange | MozBrowserEvent::LoadEnd |
|
||||||
MozBrowserEvent::LoadStart | MozBrowserEvent::OpenWindow | MozBrowserEvent::SecurityChange |
|
MozBrowserEvent::LoadStart | MozBrowserEvent::OpenWindow | MozBrowserEvent::SecurityChange |
|
||||||
MozBrowserEvent::ShowModalPrompt | MozBrowserEvent::UsernameAndPasswordRequired | MozBrowserEvent::OpenSearch => None,
|
MozBrowserEvent::ShowModalPrompt | MozBrowserEvent::UsernameAndPasswordRequired |
|
||||||
|
MozBrowserEvent::OpenSearch => None,
|
||||||
MozBrowserEvent::LocationChange(ref new_location) => Some(new_location.clone()),
|
MozBrowserEvent::LocationChange(ref new_location) => Some(new_location.clone()),
|
||||||
MozBrowserEvent::TitleChange(ref new_title) => Some(new_title.clone()),
|
MozBrowserEvent::TitleChange(ref new_title) => Some(new_title.clone()),
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,8 @@ impl CookieStorage {
|
||||||
// http://tools.ietf.org/html/rfc6265#section-5.4
|
// http://tools.ietf.org/html/rfc6265#section-5.4
|
||||||
pub fn cookies_for_url(&mut self, url: &Url, source: CookieSource) -> Option<String> {
|
pub fn cookies_for_url(&mut self, url: &Url, source: CookieSource) -> Option<String> {
|
||||||
let filterer = |c: &&mut Cookie| -> bool {
|
let filterer = |c: &&mut Cookie| -> bool {
|
||||||
info!(" === SENT COOKIE : {} {} {:?} {:?}", c.cookie.name, c.cookie.value, c.cookie.domain, c.cookie.path);
|
info!(" === SENT COOKIE : {} {} {:?} {:?}",
|
||||||
|
c.cookie.name, c.cookie.value, c.cookie.domain, c.cookie.path);
|
||||||
info!(" === SENT COOKIE RESULT {}", c.appropriate_for_url(url, source));
|
info!(" === SENT COOKIE RESULT {}", c.appropriate_for_url(url, source));
|
||||||
// Step 1
|
// Step 1
|
||||||
c.appropriate_for_url(url, source)
|
c.appropriate_for_url(url, source)
|
||||||
|
|
|
@ -53,7 +53,8 @@ pub struct CORSCacheEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CORSCacheEntry {
|
impl CORSCacheEntry {
|
||||||
fn new (origin:Url, url: Url, max_age: u32, credentials: bool, header_or_method: HeaderOrMethod) -> CORSCacheEntry {
|
fn new(origin:Url, url: Url, max_age: u32, credentials: bool,
|
||||||
|
header_or_method: HeaderOrMethod) -> CORSCacheEntry {
|
||||||
CORSCacheEntry {
|
CORSCacheEntry {
|
||||||
origin: origin,
|
origin: origin,
|
||||||
url: url,
|
url: url,
|
||||||
|
@ -80,18 +81,22 @@ pub trait CORSCache {
|
||||||
/// Remove old entries
|
/// Remove old entries
|
||||||
fn cleanup(&mut self);
|
fn cleanup(&mut self);
|
||||||
|
|
||||||
/// Returns true if an entry with a [matching header](https://fetch.spec.whatwg.org/#concept-cache-match-header) is found
|
/// Returns true if an entry with a
|
||||||
|
/// [matching header](https://fetch.spec.whatwg.org/#concept-cache-match-header) is found
|
||||||
fn match_header(&mut self, request: CacheRequestDetails, header_name: &str) -> bool;
|
fn match_header(&mut self, request: CacheRequestDetails, header_name: &str) -> bool;
|
||||||
|
|
||||||
/// Updates max age if an entry for a [matching header](https://fetch.spec.whatwg.org/#concept-cache-match-header) is found.
|
/// Updates max age if an entry for a
|
||||||
|
/// [matching header](https://fetch.spec.whatwg.org/#concept-cache-match-header) is found.
|
||||||
///
|
///
|
||||||
/// If not, it will insert an equivalent entry
|
/// If not, it will insert an equivalent entry
|
||||||
fn match_header_and_update(&mut self, request: CacheRequestDetails, header_name: &str, new_max_age: u32) -> bool;
|
fn match_header_and_update(&mut self, request: CacheRequestDetails, header_name: &str, new_max_age: u32) -> bool;
|
||||||
|
|
||||||
/// Returns true if an entry with a [matching method](https://fetch.spec.whatwg.org/#concept-cache-match-method) is found
|
/// Returns true if an entry with a
|
||||||
|
/// [matching method](https://fetch.spec.whatwg.org/#concept-cache-match-method) is found
|
||||||
fn match_method(&mut self, request: CacheRequestDetails, method: Method) -> bool;
|
fn match_method(&mut self, request: CacheRequestDetails, method: Method) -> bool;
|
||||||
|
|
||||||
/// Updates max age if an entry for [a matching method](https://fetch.spec.whatwg.org/#concept-cache-match-method) is found.
|
/// Updates max age if an entry for
|
||||||
|
/// [a matching method](https://fetch.spec.whatwg.org/#concept-cache-match-method) is found.
|
||||||
///
|
///
|
||||||
/// If not, it will insert an equivalent entry
|
/// If not, it will insert an equivalent entry
|
||||||
fn match_method_and_update(&mut self, request: CacheRequestDetails, method: Method, new_max_age: u32) -> bool;
|
fn match_method_and_update(&mut self, request: CacheRequestDetails, method: Method, new_max_age: u32) -> bool;
|
||||||
|
@ -104,7 +109,8 @@ pub trait CORSCache {
|
||||||
pub struct BasicCORSCache(Vec<CORSCacheEntry>);
|
pub struct BasicCORSCache(Vec<CORSCacheEntry>);
|
||||||
|
|
||||||
impl BasicCORSCache {
|
impl BasicCORSCache {
|
||||||
fn find_entry_by_header<'a>(&'a mut self, request: &CacheRequestDetails, header_name: &str) -> Option<&'a mut CORSCacheEntry> {
|
fn find_entry_by_header<'a>(&'a mut self, request: &CacheRequestDetails,
|
||||||
|
header_name: &str) -> Option<&'a mut CORSCacheEntry> {
|
||||||
self.cleanup();
|
self.cleanup();
|
||||||
let BasicCORSCache(ref mut buf) = *self;
|
let BasicCORSCache(ref mut buf) = *self;
|
||||||
let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme &&
|
let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme &&
|
||||||
|
@ -116,7 +122,8 @@ impl BasicCORSCache {
|
||||||
entry
|
entry
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_entry_by_method<'a>(&'a mut self, request: &CacheRequestDetails, method: Method) -> Option<&'a mut CORSCacheEntry> {
|
fn find_entry_by_method<'a>(&'a mut self, request: &CacheRequestDetails,
|
||||||
|
method: Method) -> Option<&'a mut CORSCacheEntry> {
|
||||||
// we can take the method from CORSRequest itself
|
// we can take the method from CORSRequest itself
|
||||||
self.cleanup();
|
self.cleanup();
|
||||||
let BasicCORSCache(ref mut buf) = *self;
|
let BasicCORSCache(ref mut buf) = *self;
|
||||||
|
@ -135,7 +142,8 @@ impl CORSCache for BasicCORSCache {
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn clear (&mut self, request: CacheRequestDetails) {
|
fn clear (&mut self, request: CacheRequestDetails) {
|
||||||
let BasicCORSCache(buf) = self.clone();
|
let BasicCORSCache(buf) = self.clone();
|
||||||
let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect();
|
let new_buf: Vec<CORSCacheEntry> =
|
||||||
|
buf.into_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect();
|
||||||
*self = BasicCORSCache(new_buf);
|
*self = BasicCORSCache(new_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +151,9 @@ impl CORSCache for BasicCORSCache {
|
||||||
fn cleanup(&mut self) {
|
fn cleanup(&mut self) {
|
||||||
let BasicCORSCache(buf) = self.clone();
|
let BasicCORSCache(buf) = self.clone();
|
||||||
let now = time::now().to_timespec();
|
let now = time::now().to_timespec();
|
||||||
let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect();
|
let new_buf: Vec<CORSCacheEntry> = buf.into_iter()
|
||||||
|
.filter(|e| now.sec > e.created.sec + e.max_age as i64)
|
||||||
|
.collect();
|
||||||
*self = BasicCORSCache(new_buf);
|
*self = BasicCORSCache(new_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +166,8 @@ impl CORSCache for BasicCORSCache {
|
||||||
Some(_) => true,
|
Some(_) => true,
|
||||||
None => {
|
None => {
|
||||||
self.insert(CORSCacheEntry::new(request.origin, request.destination, new_max_age,
|
self.insert(CORSCacheEntry::new(request.origin, request.destination, new_max_age,
|
||||||
request.credentials, HeaderOrMethod::HeaderData(header_name.to_string())));
|
request.credentials,
|
||||||
|
HeaderOrMethod::HeaderData(header_name.to_string())));
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,8 @@ impl Request {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [HTTP fetch](https://fetch.spec.whatwg.org#http-fetch)
|
/// [HTTP fetch](https://fetch.spec.whatwg.org#http-fetch)
|
||||||
pub fn http_fetch(&mut self, cors_flag: bool, cors_preflight_flag: bool, authentication_fetch_flag: bool) -> Response {
|
pub fn http_fetch(&mut self, cors_flag: bool, cors_preflight_flag: bool,
|
||||||
|
authentication_fetch_flag: bool) -> Response {
|
||||||
// Step 1
|
// Step 1
|
||||||
let mut response: Option<Response> = None;
|
let mut response: Option<Response> = None;
|
||||||
// Step 2
|
// Step 2
|
||||||
|
@ -333,7 +334,9 @@ impl Request {
|
||||||
self.same_origin_data = false;
|
self.same_origin_data = false;
|
||||||
// Step 10
|
// Step 10
|
||||||
if self.redirect_mode == RedirectMode::Follow {
|
if self.redirect_mode == RedirectMode::Follow {
|
||||||
// FIXME: Origin method of the Url crate hasn't been implemented (https://github.com/servo/rust-url/issues/54)
|
// FIXME: Origin method of the Url crate hasn't been implemented
|
||||||
|
// https://github.com/servo/rust-url/issues/54
|
||||||
|
|
||||||
// Substep 1
|
// Substep 1
|
||||||
// if cors_flag && location_url.origin() != self.url.origin() { self.origin = None; }
|
// if cors_flag && location_url.origin() != self.url.origin() { self.origin = None; }
|
||||||
// Substep 2
|
// Substep 2
|
||||||
|
@ -387,7 +390,9 @@ impl Request {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// [HTTP network or cache fetch](https://fetch.spec.whatwg.org#http-network-or-cache-fetch)
|
/// [HTTP network or cache fetch](https://fetch.spec.whatwg.org#http-network-or-cache-fetch)
|
||||||
pub fn http_network_or_cache_fetch(&mut self, _credentials_flag: bool, _authentication_fetch_flag: bool) -> Response {
|
pub fn http_network_or_cache_fetch(&mut self,
|
||||||
|
_credentials_flag: bool,
|
||||||
|
_authentication_fetch_flag: bool) -> Response {
|
||||||
// TODO: Implement HTTP network or cache fetch spec
|
// TODO: Implement HTTP network or cache fetch spec
|
||||||
Response::network_error()
|
Response::network_error()
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,8 @@ pub struct Response {
|
||||||
pub status: Option<StatusCode>,
|
pub status: Option<StatusCode>,
|
||||||
pub headers: Headers,
|
pub headers: Headers,
|
||||||
pub body: ResponseBody,
|
pub body: ResponseBody,
|
||||||
/// [Internal response](https://fetch.spec.whatwg.org/#concept-internal-response), only used if the Response is a filtered response
|
/// [Internal response](https://fetch.spec.whatwg.org/#concept-internal-response), only used if the Response
|
||||||
|
/// is a filtered response
|
||||||
pub internal_response: Option<Box<Response>>,
|
pub internal_response: Option<Box<Response>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,8 @@ use std::boxed::FnBox;
|
||||||
pub fn factory(cookies_chan: Sender<ControlMsg>, devtools_chan: Option<Sender<DevtoolsControlMsg>>)
|
pub fn factory(cookies_chan: Sender<ControlMsg>, devtools_chan: Option<Sender<DevtoolsControlMsg>>)
|
||||||
-> Box<FnBox(LoadData, LoadConsumer, Arc<MIMEClassifier>) + Send> {
|
-> Box<FnBox(LoadData, LoadConsumer, Arc<MIMEClassifier>) + Send> {
|
||||||
box move |load_data, senders, classifier| {
|
box move |load_data, senders, classifier| {
|
||||||
spawn_named("http_loader".to_owned(), move || load(load_data, senders, classifier, cookies_chan, devtools_chan))
|
spawn_named("http_loader".to_owned(),
|
||||||
|
move || load(load_data, senders, classifier, cookies_chan, devtools_chan))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +281,9 @@ reason: \"certificate verify failed\" }]))";
|
||||||
Some(ref c) => {
|
Some(ref c) => {
|
||||||
if c.preflight {
|
if c.preflight {
|
||||||
// The preflight lied
|
// The preflight lied
|
||||||
send_error(url, "Preflight fetch inconsistent with main fetch".to_string(), start_chan);
|
send_error(url,
|
||||||
|
"Preflight fetch inconsistent with main fetch".to_string(),
|
||||||
|
start_chan);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// XXXManishearth There are some CORS-related steps here,
|
// XXXManishearth There are some CORS-related steps here,
|
||||||
|
@ -347,7 +350,8 @@ reason: \"certificate verify failed\" }]))";
|
||||||
// Send an HttpResponse message to devtools with the corresponding request_id
|
// Send an HttpResponse message to devtools with the corresponding request_id
|
||||||
// TODO: Send this message only if load_data has a pipeline_id that is not None
|
// TODO: Send this message only if load_data has a pipeline_id that is not None
|
||||||
if let Some(ref chan) = devtools_chan {
|
if let Some(ref chan) = devtools_chan {
|
||||||
let net_event_response = NetworkEvent::HttpResponse(metadata.headers.clone(), metadata.status.clone(), None);
|
let net_event_response = NetworkEvent::HttpResponse(
|
||||||
|
metadata.headers.clone(), metadata.status.clone(), None);
|
||||||
chan.send(DevtoolsControlMsg::NetworkEventMessage(request_id, net_event_response)).unwrap();
|
chan.send(DevtoolsControlMsg::NetworkEventMessage(request_id, net_event_response)).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -332,7 +332,8 @@ impl ImageCache {
|
||||||
url: url,
|
url: url,
|
||||||
sender: self.progress_sender.clone(),
|
sender: self.progress_sender.clone(),
|
||||||
};
|
};
|
||||||
self.resource_task.send(ControlMsg::Load(load_data, LoadConsumer::Listener(listener))).unwrap();
|
let msg = ControlMsg::Load(load_data, LoadConsumer::Listener(listener));
|
||||||
|
self.resource_task.send(msg).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,8 @@ pub fn start_sending_sniffed_opt(start_chan: LoadConsumer, mut metadata: Metadat
|
||||||
let supplied_type = metadata.content_type.map(|ContentType(Mime(toplevel, sublevel, _))| {
|
let supplied_type = metadata.content_type.map(|ContentType(Mime(toplevel, sublevel, _))| {
|
||||||
(format!("{}", toplevel), format!("{}", sublevel))
|
(format!("{}", toplevel), format!("{}", sublevel))
|
||||||
});
|
});
|
||||||
metadata.content_type = classifier.classify(nosniff, check_for_apache_bug, &supplied_type, &partial_body).map(|(toplevel, sublevel)| {
|
metadata.content_type = classifier.classify(nosniff, check_for_apache_bug, &supplied_type,
|
||||||
|
&partial_body).map(|(toplevel, sublevel)| {
|
||||||
let mime_tp: TopLevel = FromStr::from_str(&toplevel).unwrap();
|
let mime_tp: TopLevel = FromStr::from_str(&toplevel).unwrap();
|
||||||
let mime_sb: SubLevel = FromStr::from_str(&sublevel).unwrap();
|
let mime_sb: SubLevel = FromStr::from_str(&sublevel).unwrap();
|
||||||
ContentType(Mime(mime_tp, mime_sb, vec!()))
|
ContentType(Mime(mime_tp, mime_sb, vec!()))
|
||||||
|
@ -138,7 +139,8 @@ pub fn start_sending_opt(start_chan: LoadConsumer, metadata: Metadata) -> Result
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a ResourceTask
|
/// Create a ResourceTask
|
||||||
pub fn new_resource_task(user_agent: Option<String>, devtools_chan: Option<Sender<DevtoolsControlMsg>>) -> ResourceTask {
|
pub fn new_resource_task(user_agent: Option<String>,
|
||||||
|
devtools_chan: Option<Sender<DevtoolsControlMsg>>) -> ResourceTask {
|
||||||
let (setup_chan, setup_port) = channel();
|
let (setup_chan, setup_port) = channel();
|
||||||
let setup_chan_clone = setup_chan.clone();
|
let setup_chan_clone = setup_chan.clone();
|
||||||
spawn_named("ResourceManager".to_owned(), move || {
|
spawn_named("ResourceManager".to_owned(), move || {
|
||||||
|
@ -148,7 +150,8 @@ pub fn new_resource_task(user_agent: Option<String>, devtools_chan: Option<Sende
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_hostsfile(hostsfile_content: &str) -> Box<HashMap<String, String>> {
|
pub fn parse_hostsfile(hostsfile_content: &str) -> Box<HashMap<String, String>> {
|
||||||
let ipv4_regex = regex!(r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$");
|
let ipv4_regex = regex!(
|
||||||
|
r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$");
|
||||||
let ipv6_regex = regex!(r"^([a-fA-F0-9]{0,4}[:]?){1,8}(/\d{1,3})?$");
|
let ipv6_regex = regex!(r"^([a-fA-F0-9]{0,4}[:]?){1,8}(/\d{1,3})?$");
|
||||||
let mut host_table = HashMap::new();
|
let mut host_table = HashMap::new();
|
||||||
let lines: Vec<&str> = hostsfile_content.split('\n').collect();
|
let lines: Vec<&str> = hostsfile_content.split('\n').collect();
|
||||||
|
@ -191,8 +194,10 @@ struct ResourceManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ResourceManager {
|
impl ResourceManager {
|
||||||
fn new(from_client: Receiver<ControlMsg>, user_agent: Option<String>,
|
fn new(from_client: Receiver<ControlMsg>,
|
||||||
resource_task: Sender<ControlMsg>, devtools_channel: Option<Sender<DevtoolsControlMsg>>) -> ResourceManager {
|
user_agent: Option<String>,
|
||||||
|
resource_task: Sender<ControlMsg>,
|
||||||
|
devtools_channel: Option<Sender<DevtoolsControlMsg>>) -> ResourceManager {
|
||||||
ResourceManager {
|
ResourceManager {
|
||||||
from_client: from_client,
|
from_client: from_client,
|
||||||
user_agent: user_agent,
|
user_agent: user_agent,
|
||||||
|
@ -250,7 +255,8 @@ impl ResourceManager {
|
||||||
|
|
||||||
let loader = match &*load_data.url.scheme {
|
let loader = match &*load_data.url.scheme {
|
||||||
"file" => from_factory(file_loader::factory),
|
"file" => from_factory(file_loader::factory),
|
||||||
"http" | "https" | "view-source" => http_loader::factory(self.resource_task.clone(), self.devtools_chan.clone()),
|
"http" | "https" | "view-source" =>
|
||||||
|
http_loader::factory(self.resource_task.clone(), self.devtools_chan.clone()),
|
||||||
"data" => from_factory(data_loader::factory),
|
"data" => from_factory(data_loader::factory),
|
||||||
"about" => from_factory(about_loader::factory),
|
"about" => from_factory(about_loader::factory),
|
||||||
_ => {
|
_ => {
|
||||||
|
|
|
@ -102,7 +102,8 @@ impl StorageManager {
|
||||||
|
|
||||||
/// Sends Some(old_value) in case there was a previous value with the same key name but with different
|
/// Sends Some(old_value) in case there was a previous value with the same key name but with different
|
||||||
/// value name, otherwise sends None
|
/// value name, otherwise sends None
|
||||||
fn set_item(&mut self, sender: Sender<(bool, Option<DOMString>)>, url: Url, storage_type: StorageType, name: DOMString, value: DOMString) {
|
fn set_item(&mut self, sender: Sender<(bool, Option<DOMString>)>, url: Url, storage_type: StorageType,
|
||||||
|
name: DOMString, value: DOMString) {
|
||||||
let origin = self.get_origin_as_string(url);
|
let origin = self.get_origin_as_string(url);
|
||||||
let data = self.select_data_mut(storage_type);
|
let data = self.select_data_mut(storage_type);
|
||||||
if !data.contains_key(&origin) {
|
if !data.contains_key(&origin) {
|
||||||
|
@ -130,7 +131,8 @@ impl StorageManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sends Some(old_value) in case there was a previous value with the key name, otherwise sends None
|
/// Sends Some(old_value) in case there was a previous value with the key name, otherwise sends None
|
||||||
fn remove_item(&mut self, sender: Sender<Option<DOMString>>, url: Url, storage_type: StorageType, name: DOMString) {
|
fn remove_item(&mut self, sender: Sender<Option<DOMString>>, url: Url, storage_type: StorageType,
|
||||||
|
name: DOMString) {
|
||||||
let origin = self.get_origin_as_string(url);
|
let origin = self.get_origin_as_string(url);
|
||||||
let data = self.select_data_mut(storage_type);
|
let data = self.select_data_mut(storage_type);
|
||||||
let old_value = data.get_mut(&origin).and_then(|entry| {
|
let old_value = data.get_mut(&origin).and_then(|entry| {
|
||||||
|
|
|
@ -8,7 +8,8 @@ use syntax::ptr::P;
|
||||||
use syntax::ast::{MetaItem, Expr};
|
use syntax::ast::{MetaItem, Expr};
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::ext::build::AstBuilder;
|
use syntax::ext::build::AstBuilder;
|
||||||
use syntax::ext::deriving::generic::{combine_substructure, EnumMatching, FieldInfo, MethodDef, Struct, Substructure, TraitDef, ty};
|
use syntax::ext::deriving::generic::{combine_substructure, EnumMatching, FieldInfo, MethodDef, Struct,
|
||||||
|
Substructure, TraitDef, ty};
|
||||||
|
|
||||||
pub fn expand_dom_struct(cx: &mut ExtCtxt, sp: Span, _: &MetaItem, anno: Annotatable) -> Annotatable {
|
pub fn expand_dom_struct(cx: &mut ExtCtxt, sp: Span, _: &MetaItem, anno: Annotatable) -> Annotatable {
|
||||||
if let Annotatable::Item(item) = anno {
|
if let Annotatable::Item(item) = anno {
|
||||||
|
@ -31,8 +32,10 @@ pub fn expand_dom_struct(cx: &mut ExtCtxt, sp: Span, _: &MetaItem, anno: Annotat
|
||||||
|
|
||||||
/// Provides the hook to expand `#[jstraceable]` into an implementation of `JSTraceable`
|
/// Provides the hook to expand `#[jstraceable]` into an implementation of `JSTraceable`
|
||||||
///
|
///
|
||||||
/// The expansion basically calls `trace()` on all of the fields of the struct/enum, erroring if they do not implement the method.
|
/// The expansion basically calls `trace()` on all of the fields of the struct/enum, erroring if they do not
|
||||||
pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: Annotatable, push: &mut FnMut(Annotatable)) {
|
/// implement the method.
|
||||||
|
pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: Annotatable,
|
||||||
|
push: &mut FnMut(Annotatable)) {
|
||||||
let trait_def = TraitDef {
|
let trait_def = TraitDef {
|
||||||
span: span,
|
span: span,
|
||||||
attributes: Vec::new(),
|
attributes: Vec::new(),
|
||||||
|
@ -44,7 +47,8 @@ pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item:
|
||||||
name: "trace",
|
name: "trace",
|
||||||
generics: ty::LifetimeBounds::empty(),
|
generics: ty::LifetimeBounds::empty(),
|
||||||
explicit_self: ty::borrowed_explicit_self(),
|
explicit_self: ty::borrowed_explicit_self(),
|
||||||
args: vec!(ty::Ptr(box ty::Literal(ty::Path::new(vec!("js","jsapi","JSTracer"))), ty::Raw(ast::MutMutable))),
|
args: vec!(ty::Ptr(box ty::Literal(ty::Path::new(vec!("js","jsapi","JSTracer"))),
|
||||||
|
ty::Raw(ast::MutMutable))),
|
||||||
ret_ty: ty::nil_ty(),
|
ret_ty: ty::nil_ty(),
|
||||||
attributes: vec![quote_attr!(cx, #[inline(always)])],
|
attributes: vec![quote_attr!(cx, #[inline(always)])],
|
||||||
is_unsafe: false,
|
is_unsafe: false,
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
//!
|
//!
|
||||||
//! - `#[privatize]` : Forces all fields in a struct/enum to be private
|
//! - `#[privatize]` : Forces all fields in a struct/enum to be private
|
||||||
//! - `#[jstraceable]` : Auto-derives an implementation of `JSTraceable` for a struct in the script crate
|
//! - `#[jstraceable]` : Auto-derives an implementation of `JSTraceable` for a struct in the script crate
|
||||||
//! - `#[must_root]` : Prevents data of the marked type from being used on the stack. See the lints module for more details
|
//! - `#[must_root]` : Prevents data of the marked type from being used on the stack. See the lints module for more
|
||||||
|
//! details
|
||||||
//! - `#[dom_struct]` : Implies `#[privatize]`,`#[jstraceable]`, and `#[must_root]`.
|
//! - `#[dom_struct]` : Implies `#[privatize]`,`#[jstraceable]`, and `#[must_root]`.
|
||||||
//! Use this for structs that correspond to a DOM type
|
//! Use this for structs that correspond to a DOM type
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@ impl LintPass for InheritancePass {
|
||||||
lint_array!(INHERITANCE_INTEGRITY)
|
lint_array!(INHERITANCE_INTEGRITY)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_struct_def(&mut self, cx: &Context, def: &ast::StructDef, _i: ast::Ident, _gen: &ast::Generics, id: ast::NodeId) {
|
fn check_struct_def(&mut self, cx: &Context, def: &ast::StructDef, _i: ast::Ident,
|
||||||
|
_gen: &ast::Generics, id: ast::NodeId) {
|
||||||
// Lints are run post expansion, so it's fine to use
|
// Lints are run post expansion, so it's fine to use
|
||||||
// #[_dom_struct_marker] here without also checking for #[dom_struct]
|
// #[_dom_struct_marker] here without also checking for #[dom_struct]
|
||||||
if ty::has_attr(cx.tcx, ast_util::local_def(id), "_dom_struct_marker") {
|
if ty::has_attr(cx.tcx, ast_util::local_def(id), "_dom_struct_marker") {
|
||||||
|
@ -32,7 +33,8 @@ impl LintPass for InheritancePass {
|
||||||
if match_lang_ty(cx, &*f.node.ty, "reflector") {
|
if match_lang_ty(cx, &*f.node.ty, "reflector") {
|
||||||
if ctr > 0 {
|
if ctr > 0 {
|
||||||
cx.span_lint(INHERITANCE_INTEGRITY, f.span,
|
cx.span_lint(INHERITANCE_INTEGRITY, f.span,
|
||||||
"The Reflector should be the first field of the DOM struct");
|
"The Reflector should be the first field of the DOM \
|
||||||
|
struct");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ declare_lint!(PRIVATIZE, Deny,
|
||||||
|
|
||||||
/// Lint for keeping DOM fields private
|
/// Lint for keeping DOM fields private
|
||||||
///
|
///
|
||||||
/// This lint (disable with `-A privatize`/`#[allow(privatize)]`) ensures all types marked with `#[privatize]` have no private fields
|
/// This lint (disable with `-A privatize`/`#[allow(privatize)]`) ensures all types marked with `#[privatize]`
|
||||||
|
/// have no private fields
|
||||||
pub struct PrivatizePass;
|
pub struct PrivatizePass;
|
||||||
|
|
||||||
impl LintPass for PrivatizePass {
|
impl LintPass for PrivatizePass {
|
||||||
|
@ -21,13 +22,19 @@ impl LintPass for PrivatizePass {
|
||||||
lint_array!(PRIVATIZE)
|
lint_array!(PRIVATIZE)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_struct_def(&mut self, cx: &Context, def: &ast::StructDef, _i: ast::Ident, _gen: &ast::Generics, id: ast::NodeId) {
|
fn check_struct_def(&mut self,
|
||||||
|
cx: &Context,
|
||||||
|
def: &ast::StructDef,
|
||||||
|
_i: ast::Ident,
|
||||||
|
_gen: &ast::Generics,
|
||||||
|
id: ast::NodeId) {
|
||||||
if ty::has_attr(cx.tcx, ast_util::local_def(id), "privatize") {
|
if ty::has_attr(cx.tcx, ast_util::local_def(id), "privatize") {
|
||||||
for field in def.fields.iter() {
|
for field in def.fields.iter() {
|
||||||
match field.node {
|
match field.node {
|
||||||
ast::StructField_ { kind: ast::NamedField(ident, visibility), .. } if visibility == Public => {
|
ast::StructField_ { kind: ast::NamedField(ident, visibility), .. } if visibility == Public => {
|
||||||
cx.span_lint(PRIVATIZE, field.span,
|
cx.span_lint(PRIVATIZE, field.span,
|
||||||
&format!("Field {} is public where only private fields are allowed", ident.name));
|
&format!("Field {} is public where only private fields are allowed",
|
||||||
|
ident.name));
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,14 +15,17 @@ declare_lint!(UNROOTED_MUST_ROOT, Deny,
|
||||||
|
|
||||||
/// Lint for ensuring safe usage of unrooted pointers
|
/// Lint for ensuring safe usage of unrooted pointers
|
||||||
///
|
///
|
||||||
/// This lint (disable with `-A unrooted-must-root`/`#[allow(unrooted_must_root)]`) ensures that `#[must_root]` values are used correctly.
|
/// This lint (disable with `-A unrooted-must-root`/`#[allow(unrooted_must_root)]`) ensures that `#[must_root]`
|
||||||
|
/// values are used correctly.
|
||||||
|
///
|
||||||
/// "Incorrect" usage includes:
|
/// "Incorrect" usage includes:
|
||||||
///
|
///
|
||||||
/// - Not being used in a struct/enum field which is not `#[must_root]` itself
|
/// - Not being used in a struct/enum field which is not `#[must_root]` itself
|
||||||
/// - Not being used as an argument to a function (Except onces named `new` and `new_inherited`)
|
/// - Not being used as an argument to a function (Except onces named `new` and `new_inherited`)
|
||||||
/// - Not being bound locally in a `let` statement, assignment, `for` loop, or `match` statement.
|
/// - Not being bound locally in a `let` statement, assignment, `for` loop, or `match` statement.
|
||||||
///
|
///
|
||||||
/// This helps catch most situations where pointers like `JS<T>` are used in a way that they can be invalidated by a GC pass.
|
/// This helps catch most situations where pointers like `JS<T>` are used in a way that they can be invalidated by a
|
||||||
|
/// GC pass.
|
||||||
pub struct UnrootedPass;
|
pub struct UnrootedPass;
|
||||||
|
|
||||||
// Checks if a type has the #[must_root] annotation.
|
// Checks if a type has the #[must_root] annotation.
|
||||||
|
@ -31,7 +34,8 @@ pub struct UnrootedPass;
|
||||||
fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) {
|
fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) {
|
||||||
match ty.node {
|
match ty.node {
|
||||||
ast::TyVec(ref t) | ast::TyFixedLengthVec(ref t, _) |
|
ast::TyVec(ref t) | ast::TyFixedLengthVec(ref t, _) |
|
||||||
ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) => lint_unrooted_ty(cx, &**t, warning),
|
ast::TyPtr(ast::MutTy { ty: ref t, ..}) | ast::TyRptr(_, ast::MutTy { ty: ref t, ..}) =>
|
||||||
|
lint_unrooted_ty(cx, &**t, warning),
|
||||||
ast::TyPath(..) => {
|
ast::TyPath(..) => {
|
||||||
match cx.tcx.def_map.borrow()[&ty.id] {
|
match cx.tcx.def_map.borrow()[&ty.id] {
|
||||||
def::PathResolution{ base_def: def::DefTy(def_id, _), .. } => {
|
def::PathResolution{ base_def: def::DefTy(def_id, _), .. } => {
|
||||||
|
@ -51,7 +55,12 @@ impl LintPass for UnrootedPass {
|
||||||
lint_array!(UNROOTED_MUST_ROOT)
|
lint_array!(UNROOTED_MUST_ROOT)
|
||||||
}
|
}
|
||||||
/// All structs containing #[must_root] types must be #[must_root] themselves
|
/// All structs containing #[must_root] types must be #[must_root] themselves
|
||||||
fn check_struct_def(&mut self, cx: &Context, def: &ast::StructDef, _i: ast::Ident, _gen: &ast::Generics, id: ast::NodeId) {
|
fn check_struct_def(&mut self,
|
||||||
|
cx: &Context,
|
||||||
|
def: &ast::StructDef,
|
||||||
|
_i: ast::Ident,
|
||||||
|
_gen: &ast::Generics,
|
||||||
|
id: ast::NodeId) {
|
||||||
let item = match cx.tcx.map.get(id) {
|
let item = match cx.tcx.map.get(id) {
|
||||||
ast_map::Node::NodeItem(item) => item,
|
ast_map::Node::NodeItem(item) => item,
|
||||||
_ => cx.tcx.map.expect_item(cx.tcx.map.get_parent(id)),
|
_ => cx.tcx.map.expect_item(cx.tcx.map.get_parent(id)),
|
||||||
|
|
|
@ -9,12 +9,14 @@ use syntax::ast;
|
||||||
use utils::match_ty_unwrap;
|
use utils::match_ty_unwrap;
|
||||||
|
|
||||||
|
|
||||||
pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable: Annotatable, push: &mut FnMut(Annotatable)) {
|
pub fn expand_reflector(cx: &mut ExtCtxt, span: Span, _: &MetaItem, annotatable: Annotatable,
|
||||||
|
push: &mut FnMut(Annotatable)) {
|
||||||
if let Annotatable::Item(item) = annotatable {
|
if let Annotatable::Item(item) = annotatable {
|
||||||
if let ast::ItemStruct(ref def, _) = item.node {
|
if let ast::ItemStruct(ref def, _) = item.node {
|
||||||
let struct_name = item.ident;
|
let struct_name = item.ident;
|
||||||
// This path has to be hardcoded, unfortunately, since we can't resolve paths at expansion time
|
// This path has to be hardcoded, unfortunately, since we can't resolve paths at expansion time
|
||||||
match def.fields.iter().find(|f| match_ty_unwrap(&*f.node.ty, &["dom", "bindings", "utils", "Reflector"]).is_some()) {
|
match def.fields.iter().find(
|
||||||
|
|f| match_ty_unwrap(&*f.node.ty, &["dom", "bindings", "utils", "Reflector"]).is_some()) {
|
||||||
// If it has a field that is a Reflector, use that
|
// If it has a field that is a Reflector, use that
|
||||||
Some(f) => {
|
Some(f) => {
|
||||||
let field_name = f.node.ident();
|
let field_name = f.node.ident();
|
||||||
|
|
|
@ -83,6 +83,7 @@ pub fn unsafe_context(map: &ast_map::Map, id: ast::NodeId) -> bool {
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => false // There are probably a couple of other unsafe cases we don't care to lint, those will need to be added.
|
_ => false // There are probably a couple of other unsafe cases we don't care to lint, those will need
|
||||||
|
// to be added.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,7 +339,11 @@ pub struct CORSCacheEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CORSCacheEntry {
|
impl CORSCacheEntry {
|
||||||
fn new (origin:Url, url: Url, max_age: u32, credentials: bool, header_or_method: HeaderOrMethod) -> CORSCacheEntry {
|
fn new(origin:Url,
|
||||||
|
url: Url,
|
||||||
|
max_age: u32,
|
||||||
|
credentials: bool,
|
||||||
|
header_or_method: HeaderOrMethod) -> CORSCacheEntry {
|
||||||
CORSCacheEntry {
|
CORSCacheEntry {
|
||||||
origin: origin,
|
origin: origin,
|
||||||
url: url,
|
url: url,
|
||||||
|
@ -354,9 +358,12 @@ impl CORSCacheEntry {
|
||||||
impl CORSCache {
|
impl CORSCache {
|
||||||
/// https://fetch.spec.whatwg.org/#concept-cache-clear
|
/// https://fetch.spec.whatwg.org/#concept-cache-clear
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn clear (&mut self, request: &CORSRequest) {
|
fn clear(&mut self, request: &CORSRequest) {
|
||||||
let CORSCache(buf) = self.clone();
|
let CORSCache(buf) = self.clone();
|
||||||
let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect();
|
let new_buf: Vec<CORSCacheEntry> =
|
||||||
|
buf.into_iter()
|
||||||
|
.filter(|e| e.origin == request.origin && request.destination == e.url)
|
||||||
|
.collect();
|
||||||
*self = CORSCache(new_buf);
|
*self = CORSCache(new_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,12 +371,16 @@ impl CORSCache {
|
||||||
fn cleanup(&mut self) {
|
fn cleanup(&mut self) {
|
||||||
let CORSCache(buf) = self.clone();
|
let CORSCache(buf) = self.clone();
|
||||||
let now = time::now().to_timespec();
|
let now = time::now().to_timespec();
|
||||||
let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect();
|
let new_buf: Vec<CORSCacheEntry> = buf.into_iter()
|
||||||
|
.filter(|e| now.sec > e.created.sec + e.max_age as i64)
|
||||||
|
.collect();
|
||||||
*self = CORSCache(new_buf);
|
*self = CORSCache(new_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#concept-cache-match-header
|
/// https://fetch.spec.whatwg.org/#concept-cache-match-header
|
||||||
fn find_entry_by_header<'a>(&'a mut self, request: &CORSRequest, header_name: &str) -> Option<&'a mut CORSCacheEntry> {
|
fn find_entry_by_header<'a>(&'a mut self,
|
||||||
|
request: &CORSRequest,
|
||||||
|
header_name: &str) -> Option<&'a mut CORSCacheEntry> {
|
||||||
self.cleanup();
|
self.cleanup();
|
||||||
let CORSCache(ref mut buf) = *self;
|
let CORSCache(ref mut buf) = *self;
|
||||||
// Credentials are not yet implemented here
|
// Credentials are not yet implemented here
|
||||||
|
@ -389,7 +400,9 @@ impl CORSCache {
|
||||||
self.find_entry_by_header(request, header_name).map(|e| e.max_age = new_max_age).is_some()
|
self.find_entry_by_header(request, header_name).map(|e| e.max_age = new_max_age).is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_entry_by_method<'a>(&'a mut self, request: &CORSRequest, method: &Method) -> Option<&'a mut CORSCacheEntry> {
|
fn find_entry_by_method<'a>(&'a mut self,
|
||||||
|
request: &CORSRequest,
|
||||||
|
method: &Method) -> Option<&'a mut CORSCacheEntry> {
|
||||||
// we can take the method from CORSRequest itself
|
// we can take the method from CORSRequest itself
|
||||||
self.cleanup();
|
self.cleanup();
|
||||||
let CORSCache(ref mut buf) = *self;
|
let CORSCache(ref mut buf) = *self;
|
||||||
|
|
|
@ -36,7 +36,8 @@ pub fn handle_evaluate_js(page: &Rc<Page>, pipeline: PipelineId, eval: String, r
|
||||||
EvaluateJSReply::NumberValue(FromJSValConvertible::from_jsval(cx, rval, ()).unwrap())
|
EvaluateJSReply::NumberValue(FromJSValConvertible::from_jsval(cx, rval, ()).unwrap())
|
||||||
} else if rval.is_string() {
|
} else if rval.is_string() {
|
||||||
//FIXME: use jsstring_to_str when jsval grows to_jsstring
|
//FIXME: use jsstring_to_str when jsval grows to_jsstring
|
||||||
EvaluateJSReply::StringValue(FromJSValConvertible::from_jsval(cx, rval, StringificationBehavior::Default).unwrap())
|
EvaluateJSReply::StringValue(
|
||||||
|
FromJSValConvertible::from_jsval(cx, rval, StringificationBehavior::Default).unwrap())
|
||||||
} else if rval.is_null() {
|
} else if rval.is_null() {
|
||||||
EvaluateJSReply::NullValue
|
EvaluateJSReply::NullValue
|
||||||
} else {
|
} else {
|
||||||
|
@ -95,7 +96,10 @@ pub fn handle_get_layout(page: &Rc<Page>, pipeline: PipelineId, node_id: String,
|
||||||
reply.send((width, height)).unwrap();
|
reply.send((width, height)).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_modify_attribute(page: &Rc<Page>, pipeline: PipelineId, node_id: String, modifications: Vec<Modification>) {
|
pub fn handle_modify_attribute(page: &Rc<Page>,
|
||||||
|
pipeline: PipelineId,
|
||||||
|
node_id: String,
|
||||||
|
modifications: Vec<Modification>) {
|
||||||
let node = find_node_by_unique_id(&*page, pipeline, node_id).root();
|
let node = find_node_by_unique_id(&*page, pipeline, node_id).root();
|
||||||
let elem: JSRef<Element> = ElementCast::to_ref(node.r()).expect("should be getting layout of element");
|
let elem: JSRef<Element> = ElementCast::to_ref(node.r()).expect("should be getting layout of element");
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,8 @@ impl RootedCollectionSet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let dom_collections = &self.set[CollectionType::DOMObjects as usize] as *const _ as *const HashSet<*const RootedVec<JS<Void>>>;
|
let dom_collections =
|
||||||
|
&self.set[CollectionType::DOMObjects as usize] as *const _ as *const HashSet<*const RootedVec<JS<Void>>>;
|
||||||
for dom_collection in (*dom_collections).iter() {
|
for dom_collection in (*dom_collections).iter() {
|
||||||
for reflector in (**dom_collection).iter() {
|
for reflector in (**dom_collection).iter() {
|
||||||
trace_reflector(tracer, "", reflector.reflector());
|
trace_reflector(tracer, "", reflector.reflector());
|
||||||
|
|
|
@ -66,7 +66,8 @@ impl Blob {
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
|
// http://dev.w3.org/2006/webapi/FileAPI/#constructorBlob
|
||||||
pub fn Constructor_(global: GlobalRef, blobParts: DOMString, blobPropertyBag: &BlobBinding::BlobPropertyBag) -> Fallible<Temporary<Blob>> {
|
pub fn Constructor_(global: GlobalRef, blobParts: DOMString,
|
||||||
|
blobPropertyBag: &BlobBinding::BlobPropertyBag) -> Fallible<Temporary<Blob>> {
|
||||||
//TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView or Blob
|
//TODO: accept other blobParts types - ArrayBuffer or ArrayBufferView or Blob
|
||||||
let bytes: Option<Vec<u8>> = Some(blobParts.into_bytes());
|
let bytes: Option<Vec<u8>> = Some(blobParts.into_bytes());
|
||||||
let typeString = if is_ascii_printable(&blobPropertyBag.type_) {
|
let typeString = if is_ascii_printable(&blobPropertyBag.type_) {
|
||||||
|
|
|
@ -118,7 +118,8 @@ unsafe fn GetSubframeWindow(cx: *mut JSContext, proxy: *mut JSObject, id: jsid)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe extern fn getOwnPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, set: bool, desc: *mut JSPropertyDescriptor) -> bool {
|
unsafe extern fn getOwnPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
||||||
|
set: bool, desc: *mut JSPropertyDescriptor) -> bool {
|
||||||
let window = GetSubframeWindow(cx, proxy, id);
|
let window = GetSubframeWindow(cx, proxy, id);
|
||||||
if let Some(window) = window {
|
if let Some(window) = window {
|
||||||
let window = window.root();
|
let window = window.root();
|
||||||
|
@ -145,7 +146,8 @@ unsafe extern fn getOwnPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObje
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe extern fn defineProperty(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, desc: *mut JSPropertyDescriptor) -> bool {
|
unsafe extern fn defineProperty(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
||||||
|
desc: *mut JSPropertyDescriptor) -> bool {
|
||||||
if get_array_index_from_id(cx, id).is_some() {
|
if get_array_index_from_id(cx, id).is_some() {
|
||||||
// Spec says to Reject whether this is a supported index or not,
|
// Spec says to Reject whether this is a supported index or not,
|
||||||
// since we have no indexed setter or indexed creator. That means
|
// since we have no indexed setter or indexed creator. That means
|
||||||
|
@ -178,7 +180,8 @@ unsafe extern fn hasOwn(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, bp:
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe extern fn get(cx: *mut JSContext, proxy: *mut JSObject, receiver: *mut JSObject, id: jsid, vp: *mut JSVal) -> bool {
|
unsafe extern fn get(cx: *mut JSContext, proxy: *mut JSObject, receiver: *mut JSObject, id: jsid,
|
||||||
|
vp: *mut JSVal) -> bool {
|
||||||
let window = GetSubframeWindow(cx, proxy, id);
|
let window = GetSubframeWindow(cx, proxy, id);
|
||||||
if let Some(window) = window {
|
if let Some(window) = window {
|
||||||
let window = window.root();
|
let window = window.root();
|
||||||
|
@ -191,7 +194,8 @@ unsafe extern fn get(cx: *mut JSContext, proxy: *mut JSObject, receiver: *mut JS
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe extern fn set(cx: *mut JSContext, proxy: *mut JSObject, _receiver: *mut JSObject, id: jsid, _strict: bool, vp: *mut JSVal) -> bool {
|
unsafe extern fn set(cx: *mut JSContext, proxy: *mut JSObject, _receiver: *mut JSObject,
|
||||||
|
id: jsid, _strict: bool, vp: *mut JSVal) -> bool {
|
||||||
if get_array_index_from_id(cx, id).is_some() {
|
if get_array_index_from_id(cx, id).is_some() {
|
||||||
// Reject (which means throw if and only if strict) the set.
|
// Reject (which means throw if and only if strict) the set.
|
||||||
// FIXME: Throw
|
// FIXME: Throw
|
||||||
|
@ -205,12 +209,14 @@ unsafe extern fn set(cx: *mut JSContext, proxy: *mut JSObject, _receiver: *mut J
|
||||||
|
|
||||||
static PROXY_HANDLER: ProxyTraps = ProxyTraps {
|
static PROXY_HANDLER: ProxyTraps = ProxyTraps {
|
||||||
getPropertyDescriptor: Some(get_property_descriptor
|
getPropertyDescriptor: Some(get_property_descriptor
|
||||||
as unsafe extern "C" fn(*mut JSContext, *mut JSObject, jsid, bool, *mut JSPropertyDescriptor) -> bool),
|
as unsafe extern "C" fn(*mut JSContext, *mut JSObject, jsid, bool,
|
||||||
|
*mut JSPropertyDescriptor) -> bool),
|
||||||
getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor
|
getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor
|
||||||
as unsafe extern "C" fn(*mut JSContext, *mut JSObject,
|
as unsafe extern "C" fn(*mut JSContext, *mut JSObject,
|
||||||
jsid, bool, *mut JSPropertyDescriptor)
|
jsid, bool, *mut JSPropertyDescriptor)
|
||||||
-> bool),
|
-> bool),
|
||||||
defineProperty: Some(defineProperty as unsafe extern "C" fn(*mut JSContext, *mut JSObject, jsid, *mut JSPropertyDescriptor) -> bool),
|
defineProperty: Some(defineProperty as unsafe extern "C" fn(*mut JSContext, *mut JSObject, jsid,
|
||||||
|
*mut JSPropertyDescriptor) -> bool),
|
||||||
getOwnPropertyNames: None,
|
getOwnPropertyNames: None,
|
||||||
delete_: None,
|
delete_: None,
|
||||||
enumerate: None,
|
enumerate: None,
|
||||||
|
@ -218,7 +224,8 @@ static PROXY_HANDLER: ProxyTraps = ProxyTraps {
|
||||||
has: None,
|
has: None,
|
||||||
hasOwn: Some(hasOwn as unsafe extern "C" fn(*mut JSContext, *mut JSObject, jsid, *mut bool) -> bool),
|
hasOwn: Some(hasOwn as unsafe extern "C" fn(*mut JSContext, *mut JSObject, jsid, *mut bool) -> bool),
|
||||||
get: Some(get as unsafe extern "C" fn(*mut JSContext, *mut JSObject, *mut JSObject, jsid, *mut JSVal) -> bool),
|
get: Some(get as unsafe extern "C" fn(*mut JSContext, *mut JSObject, *mut JSObject, jsid, *mut JSVal) -> bool),
|
||||||
set: Some(set as unsafe extern "C" fn(*mut JSContext, *mut JSObject, *mut JSObject, jsid, bool, *mut JSVal) -> bool),
|
set: Some(set as unsafe extern "C" fn(*mut JSContext, *mut JSObject, *mut JSObject,
|
||||||
|
jsid, bool, *mut JSVal) -> bool),
|
||||||
keys: None,
|
keys: None,
|
||||||
iterate: None,
|
iterate: None,
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,8 @@ impl CanvasRenderingContext2D {
|
||||||
renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::GetImageData(source_rect, image_size, sender))).unwrap();
|
renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::GetImageData(source_rect, image_size, sender))).unwrap();
|
||||||
let imagedata = receiver.recv().unwrap();
|
let imagedata = receiver.recv().unwrap();
|
||||||
// Writes pixels to destination canvas
|
// Writes pixels to destination canvas
|
||||||
CanvasMsg::Canvas2d(Canvas2dMsg::DrawImage(imagedata, source_rect.size, dest_rect, source_rect, smoothing_enabled))
|
CanvasMsg::Canvas2d(
|
||||||
|
Canvas2dMsg::DrawImage(imagedata, source_rect.size, dest_rect, source_rect, smoothing_enabled))
|
||||||
};
|
};
|
||||||
|
|
||||||
self.renderer.send(msg).unwrap();
|
self.renderer.send(msg).unwrap();
|
||||||
|
@ -820,7 +821,9 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StringOrCanvasGradientOrCanvasPattern::eCanvasGradient(gradient) => {
|
StringOrCanvasGradientOrCanvasPattern::eCanvasGradient(gradient) => {
|
||||||
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::SetFillStyle(gradient.root().r().to_fill_or_stroke_style()))).unwrap();
|
let msg = CanvasMsg::Canvas2d(
|
||||||
|
Canvas2dMsg::SetFillStyle(gradient.root().r().to_fill_or_stroke_style()));
|
||||||
|
self.renderer.send(msg).unwrap();
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
@ -845,7 +848,11 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-getimagedata
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-getimagedata
|
||||||
fn GetImageData(self, sx: Finite<f64>, sy: Finite<f64>, sw: Finite<f64>, sh: Finite<f64>) -> Fallible<Temporary<ImageData>> {
|
fn GetImageData(self,
|
||||||
|
sx: Finite<f64>,
|
||||||
|
sy: Finite<f64>,
|
||||||
|
sw: Finite<f64>,
|
||||||
|
sh: Finite<f64>) -> Fallible<Temporary<ImageData>> {
|
||||||
let sx = *sx;
|
let sx = *sx;
|
||||||
let sy = *sy;
|
let sy = *sy;
|
||||||
let sw = *sw;
|
let sw = *sw;
|
||||||
|
@ -871,7 +878,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
|
||||||
|
|
||||||
// XXX:
|
// XXX:
|
||||||
// By the spec: http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#dom-context-2d-putimagedata
|
// By the spec: http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#dom-context-2d-putimagedata
|
||||||
// "If any of the arguments to the method are infinite or NaN, the method must throw a NotSupportedError exception"
|
// "If any of the arguments to the method are infinite or NaN, the method must throw a NotSupportedError
|
||||||
|
// exception"
|
||||||
// But this arguments are stricted value, so if they are not finite values,
|
// But this arguments are stricted value, so if they are not finite values,
|
||||||
// they will be TypeError by WebIDL spec before call this methods.
|
// they will be TypeError by WebIDL spec before call this methods.
|
||||||
|
|
||||||
|
@ -880,7 +888,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
|
||||||
let image_data_size = Size2D(image_data_size.width as f64, image_data_size.height as f64);
|
let image_data_size = Size2D(image_data_size.width as f64, image_data_size.height as f64);
|
||||||
let image_data_rect = Rect(Point2D(dx, dy), image_data_size);
|
let image_data_rect = Rect(Point2D(dx, dy), image_data_size);
|
||||||
let dirty_rect = None;
|
let dirty_rect = None;
|
||||||
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, image_data_rect, dirty_rect))).unwrap();
|
let msg = CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, image_data_rect, dirty_rect));
|
||||||
|
self.renderer.send(msg).unwrap();
|
||||||
self.mark_as_dirty();
|
self.mark_as_dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -896,7 +905,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
|
||||||
|
|
||||||
// XXX:
|
// XXX:
|
||||||
// By the spec: http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#dom-context-2d-putimagedata
|
// By the spec: http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#dom-context-2d-putimagedata
|
||||||
// "If any of the arguments to the method are infinite or NaN, the method must throw a NotSupportedError exception"
|
// "If any of the arguments to the method are infinite or NaN, the method must throw a NotSupportedError
|
||||||
|
// exception"
|
||||||
// But this arguments are stricted value, so if they are not finite values,
|
// But this arguments are stricted value, so if they are not finite values,
|
||||||
// they will be TypeError by WebIDL spec before call this methods.
|
// they will be TypeError by WebIDL spec before call this methods.
|
||||||
|
|
||||||
|
@ -906,7 +916,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
|
||||||
imagedata.Height() as f64));
|
imagedata.Height() as f64));
|
||||||
let dirty_rect = Some(Rect(Point2D(dirtyX, dirtyY),
|
let dirty_rect = Some(Rect(Point2D(dirtyX, dirtyY),
|
||||||
Size2D(dirtyWidth, dirtyHeight)));
|
Size2D(dirtyWidth, dirtyHeight)));
|
||||||
self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, image_data_rect, dirty_rect))).unwrap();
|
let msg = CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, image_data_rect, dirty_rect));
|
||||||
|
self.renderer.send(msg).unwrap();
|
||||||
self.mark_as_dirty();
|
self.mark_as_dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -919,7 +930,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
|
||||||
let y1 = *y1;
|
let y1 = *y1;
|
||||||
|
|
||||||
if [x0, y0, x1, y1].iter().any(|x| x.is_nan() || x.is_infinite()) {
|
if [x0, y0, x1, y1].iter().any(|x| x.is_nan() || x.is_infinite()) {
|
||||||
return Err(Type("One of the arguments of createLinearGradient() is not a finite floating-point value.".to_owned()));
|
return Err(Type("One of the arguments of createLinearGradient() is not a finite \
|
||||||
|
floating-point value.".to_owned()));
|
||||||
}
|
}
|
||||||
Ok(CanvasGradient::new(self.global.root().r(),
|
Ok(CanvasGradient::new(self.global.root().r(),
|
||||||
CanvasGradientStyle::Linear(LinearGradientStyle::new(x0, y0, x1, y1, Vec::new()))))
|
CanvasGradientStyle::Linear(LinearGradientStyle::new(x0, y0, x1, y1, Vec::new()))))
|
||||||
|
@ -927,7 +939,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-createradialgradient
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-createradialgradient
|
||||||
fn CreateRadialGradient(self, x0: Finite<f64>, y0: Finite<f64>, r0: Finite<f64>,
|
fn CreateRadialGradient(self, x0: Finite<f64>, y0: Finite<f64>, r0: Finite<f64>,
|
||||||
x1: Finite<f64>, y1: Finite<f64>, r1: Finite<f64>) -> Fallible<Temporary<CanvasGradient>> {
|
x1: Finite<f64>, y1: Finite<f64>, r1: Finite<f64>)
|
||||||
|
-> Fallible<Temporary<CanvasGradient>> {
|
||||||
let x0 = *x0;
|
let x0 = *x0;
|
||||||
let y0 = *y0;
|
let y0 = *y0;
|
||||||
let r0 = *r0;
|
let r0 = *r0;
|
||||||
|
@ -936,10 +949,12 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
|
||||||
let r1 = *r1;
|
let r1 = *r1;
|
||||||
|
|
||||||
if [x0, y0, r0, x1, y1, r1].iter().any(|x| x.is_nan() || x.is_infinite()) {
|
if [x0, y0, r0, x1, y1, r1].iter().any(|x| x.is_nan() || x.is_infinite()) {
|
||||||
return Err(Type("One of the arguments of createRadialGradient() is not a finite floating-point value.".to_owned()));
|
return Err(Type("One of the arguments of createRadialGradient() is not a \
|
||||||
|
finite floating-point value.".to_owned()));
|
||||||
}
|
}
|
||||||
Ok(CanvasGradient::new(self.global.root().r(),
|
Ok(CanvasGradient::new(self.global.root().r(),
|
||||||
CanvasGradientStyle::Radial(RadialGradientStyle::new(x0, y0, r0, x1, y1, r1, Vec::new()))))
|
CanvasGradientStyle::Radial(
|
||||||
|
RadialGradientStyle::new(x0, y0, r0, x1, y1, r1, Vec::new()))))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-linewidth
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-linewidth
|
||||||
|
|
|
@ -56,7 +56,11 @@ impl CloseEvent {
|
||||||
init: &CloseEventBinding::CloseEventInit)
|
init: &CloseEventBinding::CloseEventInit)
|
||||||
-> Fallible<Temporary<CloseEvent>> {
|
-> Fallible<Temporary<CloseEvent>> {
|
||||||
let bubbles = if init.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble };
|
let bubbles = if init.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble };
|
||||||
let cancelable = if init.parent.cancelable { EventCancelable::Cancelable } else { EventCancelable::NotCancelable };
|
let cancelable = if init.parent.cancelable {
|
||||||
|
EventCancelable::Cancelable
|
||||||
|
} else {
|
||||||
|
EventCancelable::NotCancelable
|
||||||
|
};
|
||||||
Ok(CloseEvent::new(global, type_, bubbles, cancelable, init.wasClean,
|
Ok(CloseEvent::new(global, type_, bubbles, cancelable, init.wasClean,
|
||||||
init.code, init.reason.clone()))
|
init.code, init.reason.clone()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,11 @@ impl CustomEvent {
|
||||||
global,
|
global,
|
||||||
CustomEventBinding::Wrap)
|
CustomEventBinding::Wrap)
|
||||||
}
|
}
|
||||||
pub fn new(global: GlobalRef, type_: DOMString, bubbles: bool, cancelable: bool, detail: JSVal) -> Temporary<CustomEvent> {
|
pub fn new(global: GlobalRef,
|
||||||
|
type_: DOMString,
|
||||||
|
bubbles: bool,
|
||||||
|
cancelable: bool,
|
||||||
|
detail: JSVal) -> Temporary<CustomEvent> {
|
||||||
let ev = CustomEvent::new_uninitialized(global).root();
|
let ev = CustomEvent::new_uninitialized(global).root();
|
||||||
ev.r().InitCustomEvent(global.get_cx(), type_, bubbles, cancelable, detail);
|
ev.r().InitCustomEvent(global.get_cx(), type_, bubbles, cancelable, detail);
|
||||||
Temporary::from_rooted(ev.r())
|
Temporary::from_rooted(ev.r())
|
||||||
|
|
|
@ -381,7 +381,8 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
|
||||||
|
|
||||||
let mut idmap = self.idmap.borrow_mut();
|
let mut idmap = self.idmap.borrow_mut();
|
||||||
|
|
||||||
let root = self.GetDocumentElement().expect("The element is in the document, so there must be a document element.").root();
|
let root = self.GetDocumentElement().expect(
|
||||||
|
"The element is in the document, so there must be a document element.").root();
|
||||||
|
|
||||||
match idmap.entry(id) {
|
match idmap.entry(id) {
|
||||||
Vacant(entry) => {
|
Vacant(entry) => {
|
||||||
|
@ -764,7 +765,8 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
|
||||||
match key {
|
match key {
|
||||||
Key::Space if !prevented && state == KeyState::Released => {
|
Key::Space if !prevented && state == KeyState::Released => {
|
||||||
let maybe_elem: Option<JSRef<Element>> = ElementCast::to_ref(target);
|
let maybe_elem: Option<JSRef<Element>> = ElementCast::to_ref(target);
|
||||||
maybe_elem.map(|el| el.as_maybe_activatable().map(|a| a.synthetic_click_activation(ctrl, alt, shift, meta)));
|
maybe_elem.map(
|
||||||
|
|el| el.as_maybe_activatable().map(|a| a.synthetic_click_activation(ctrl, alt, shift, meta)));
|
||||||
}
|
}
|
||||||
Key::Enter if !prevented && state == KeyState::Released => {
|
Key::Enter if !prevented && state == KeyState::Released => {
|
||||||
let maybe_elem: Option<JSRef<Element>> = ElementCast::to_ref(target);
|
let maybe_elem: Option<JSRef<Element>> = ElementCast::to_ref(target);
|
||||||
|
@ -1077,7 +1079,8 @@ impl<'a> PrivateClickEventHelpers for JSRef<'a, Node> {
|
||||||
// NodeTypeId::Element(ElementTypeId::HTMLKeygenElement) |
|
// NodeTypeId::Element(ElementTypeId::HTMLKeygenElement) |
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)) |
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)) |
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) |
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) |
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) if self.get_disabled_state() => true,
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement))
|
||||||
|
if self.get_disabled_state() => true,
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,8 @@ impl<'a> DOMExceptionMethods for JSRef<'a, DOMException> {
|
||||||
DOMErrorName::URLMismatchError => "The given URL does not match another URL.",
|
DOMErrorName::URLMismatchError => "The given URL does not match another URL.",
|
||||||
DOMErrorName::QuotaExceededError => "The quota has been exceeded.",
|
DOMErrorName::QuotaExceededError => "The quota has been exceeded.",
|
||||||
DOMErrorName::TimeoutError => "The operation timed out.",
|
DOMErrorName::TimeoutError => "The operation timed out.",
|
||||||
DOMErrorName::InvalidNodeTypeError => "The supplied node is incorrect or has an incorrect ancestor for this operation.",
|
DOMErrorName::InvalidNodeTypeError =>
|
||||||
|
"The supplied node is incorrect or has an incorrect ancestor for this operation.",
|
||||||
DOMErrorName::DataCloneError => "The object can not be cloned.",
|
DOMErrorName::DataCloneError => "The object can not be cloned.",
|
||||||
DOMErrorName::EncodingError => "The encoding operation (either encoded or decoding) failed."
|
DOMErrorName::EncodingError => "The encoding operation (either encoded or decoding) failed."
|
||||||
};
|
};
|
||||||
|
|
|
@ -129,12 +129,14 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
|
||||||
|
|
||||||
{
|
{
|
||||||
// Step 4.
|
// Step 4.
|
||||||
let doc_html: Root<Node> = NodeCast::from_temporary(HTMLHtmlElement::new("html".to_owned(), None, doc.r())).root();
|
let doc_html: Root<Node> = NodeCast::from_temporary(
|
||||||
|
HTMLHtmlElement::new("html".to_owned(), None, doc.r())).root();
|
||||||
assert!(doc_node.AppendChild(doc_html.r()).is_ok());
|
assert!(doc_node.AppendChild(doc_html.r()).is_ok());
|
||||||
|
|
||||||
{
|
{
|
||||||
// Step 5.
|
// Step 5.
|
||||||
let doc_head: Root<Node> = NodeCast::from_temporary(HTMLHeadElement::new("head".to_owned(), None, doc.r())).root();
|
let doc_head: Root<Node> = NodeCast::from_temporary(
|
||||||
|
HTMLHeadElement::new("head".to_owned(), None, doc.r())).root();
|
||||||
assert!(doc_html.r().AppendChild(doc_head.r()).is_ok());
|
assert!(doc_html.r().AppendChild(doc_head.r()).is_ok());
|
||||||
|
|
||||||
// Step 6.
|
// Step 6.
|
||||||
|
@ -142,7 +144,8 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
|
||||||
None => (),
|
None => (),
|
||||||
Some(title_str) => {
|
Some(title_str) => {
|
||||||
// Step 6.1.
|
// Step 6.1.
|
||||||
let doc_title: Root<Node> = NodeCast::from_temporary(HTMLTitleElement::new("title".to_owned(), None, doc.r())).root();
|
let doc_title: Root<Node> = NodeCast::from_temporary(
|
||||||
|
HTMLTitleElement::new("title".to_owned(), None, doc.r())).root();
|
||||||
assert!(doc_head.r().AppendChild(doc_title.r()).is_ok());
|
assert!(doc_head.r().AppendChild(doc_title.r()).is_ok());
|
||||||
|
|
||||||
// Step 6.2.
|
// Step 6.2.
|
||||||
|
|
|
@ -151,9 +151,14 @@ impl Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(local_name: DOMString, namespace: Namespace, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<Element> {
|
pub fn new(local_name: DOMString,
|
||||||
Node::reflect_node(box Element::new_inherited(ElementTypeId::Element, local_name, namespace, prefix, document),
|
namespace: Namespace,
|
||||||
document, ElementBinding::Wrap)
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<Element> {
|
||||||
|
Node::reflect_node(
|
||||||
|
box Element::new_inherited(ElementTypeId::Element, local_name, namespace, prefix, document),
|
||||||
|
document,
|
||||||
|
ElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -846,7 +851,10 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> {
|
||||||
fn get_attribute(self, namespace: &Namespace, local_name: &Atom) -> Option<Temporary<Attr>> {
|
fn get_attribute(self, namespace: &Namespace, local_name: &Atom) -> Option<Temporary<Attr>> {
|
||||||
let mut attributes = RootedVec::new();
|
let mut attributes = RootedVec::new();
|
||||||
self.get_attributes(local_name, &mut attributes);
|
self.get_attributes(local_name, &mut attributes);
|
||||||
attributes.iter().map(|attr| attr.root()).find(|attr| attr.r().namespace() == namespace).map(|x| Temporary::from_rooted(x.r()))
|
attributes.iter()
|
||||||
|
.map(|attr| attr.root())
|
||||||
|
.find(|attr| attr.r().namespace() == namespace)
|
||||||
|
.map(|x| Temporary::from_rooted(x.r()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name
|
// https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name
|
||||||
|
|
|
@ -97,7 +97,11 @@ impl ErrorEvent {
|
||||||
|
|
||||||
let bubbles = if init.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble };
|
let bubbles = if init.parent.bubbles { EventBubbles::Bubbles } else { EventBubbles::DoesNotBubble };
|
||||||
|
|
||||||
let cancelable = if init.parent.cancelable { EventCancelable::Cancelable } else { EventCancelable::NotCancelable };
|
let cancelable = if init.parent.cancelable {
|
||||||
|
EventCancelable::Cancelable
|
||||||
|
} else {
|
||||||
|
EventCancelable::NotCancelable
|
||||||
|
};
|
||||||
|
|
||||||
let event = ErrorEvent::new(global, type_,
|
let event = ErrorEvent::new(global, type_,
|
||||||
bubbles, cancelable,
|
bubbles, cancelable,
|
||||||
|
|
|
@ -38,20 +38,27 @@ pub struct HTMLAnchorElement {
|
||||||
|
|
||||||
impl HTMLAnchorElementDerived for EventTarget {
|
impl HTMLAnchorElementDerived for EventTarget {
|
||||||
fn is_htmlanchorelement(&self) -> bool {
|
fn is_htmlanchorelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAnchorElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLAnchorElement {
|
impl HTMLAnchorElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLAnchorElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLAnchorElement {
|
||||||
HTMLAnchorElement {
|
HTMLAnchorElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLAnchorElement, localName, prefix, document),
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLAnchorElement, localName, prefix, document),
|
||||||
rel_list: Default::default(),
|
rel_list: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLAnchorElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLAnchorElement> {
|
||||||
let element = HTMLAnchorElement::new_inherited(localName, prefix, document);
|
let element = HTMLAnchorElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLAnchorElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLAnchorElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
@ -133,7 +140,8 @@ impl<'a> Activatable for JSRef<'a, HTMLAnchorElement> {
|
||||||
if target.is_htmlimageelement() && element.has_attribute(&atom!("ismap")) {
|
if target.is_htmlimageelement() && element.has_attribute(&atom!("ismap")) {
|
||||||
|
|
||||||
let target_node = NodeCast::to_ref(target).unwrap();
|
let target_node = NodeCast::to_ref(target).unwrap();
|
||||||
let rect = window_from_node(target_node).root().r().content_box_query(target_node.to_trusted_node_address());
|
let rect = window_from_node(target_node).root().r().content_box_query(
|
||||||
|
target_node.to_trusted_node_address());
|
||||||
ismap_suffix = Some(
|
ismap_suffix = Some(
|
||||||
format!("?{},{}", mouse_event.ClientX().to_f32().unwrap() - rect.origin.x.to_f32_px(),
|
format!("?{},{}", mouse_event.ClientX().to_f32().unwrap() - rect.origin.x.to_f32_px(),
|
||||||
mouse_event.ClientY().to_f32().unwrap() - rect.origin.y.to_f32_px())
|
mouse_event.ClientY().to_f32().unwrap() - rect.origin.y.to_f32_px())
|
||||||
|
|
|
@ -26,19 +26,26 @@ pub struct HTMLAppletElement {
|
||||||
|
|
||||||
impl HTMLAppletElementDerived for EventTarget {
|
impl HTMLAppletElementDerived for EventTarget {
|
||||||
fn is_htmlappletelement(&self) -> bool {
|
fn is_htmlappletelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAppletElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAppletElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLAppletElement {
|
impl HTMLAppletElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLAppletElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLAppletElement {
|
||||||
HTMLAppletElement {
|
HTMLAppletElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLAppletElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLAppletElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLAppletElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLAppletElement> {
|
||||||
let element = HTMLAppletElement::new_inherited(localName, prefix, document);
|
let element = HTMLAppletElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLAppletElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLAppletElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,9 @@ pub struct HTMLAreaElement {
|
||||||
|
|
||||||
impl HTMLAreaElementDerived for EventTarget {
|
impl HTMLAreaElementDerived for EventTarget {
|
||||||
fn is_htmlareaelement(&self) -> bool {
|
fn is_htmlareaelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +44,9 @@ impl HTMLAreaElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLAreaElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLAreaElement> {
|
||||||
let element = HTMLAreaElement::new_inherited(localName, prefix, document);
|
let element = HTMLAreaElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLAreaElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLAreaElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,14 +28,19 @@ impl HTMLAudioElementDerived for EventTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLAudioElement {
|
impl HTMLAudioElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLAudioElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLAudioElement {
|
||||||
HTMLAudioElement {
|
HTMLAudioElement {
|
||||||
htmlmediaelement: HTMLMediaElement::new_inherited(HTMLMediaElementTypeId::HTMLAudioElement, localName, prefix, document)
|
htmlmediaelement:
|
||||||
|
HTMLMediaElement::new_inherited(HTMLMediaElementTypeId::HTMLAudioElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLAudioElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLAudioElement> {
|
||||||
let element = HTMLAudioElement::new_inherited(localName, prefix, document);
|
let element = HTMLAudioElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLAudioElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLAudioElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,9 @@ pub struct HTMLBaseElement {
|
||||||
|
|
||||||
impl HTMLBaseElementDerived for EventTarget {
|
impl HTMLBaseElementDerived for EventTarget {
|
||||||
fn is_htmlbaseelement(&self) -> bool {
|
fn is_htmlbaseelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBaseElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBaseElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +33,9 @@ impl HTMLBaseElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLBaseElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLBaseElement> {
|
||||||
let element = HTMLBaseElement::new_inherited(localName, prefix, document);
|
let element = HTMLBaseElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLBaseElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLBaseElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,9 @@ pub struct HTMLBodyElement {
|
||||||
|
|
||||||
impl HTMLBodyElementDerived for EventTarget {
|
impl HTMLBodyElementDerived for EventTarget {
|
||||||
fn is_htmlbodyelement(&self) -> bool {
|
fn is_htmlbodyelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,9 @@ pub struct HTMLBRElement {
|
||||||
|
|
||||||
impl HTMLBRElementDerived for EventTarget {
|
impl HTMLBRElementDerived for EventTarget {
|
||||||
fn is_htmlbrelement(&self) -> bool {
|
fn is_htmlbrelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBRElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBRElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +33,9 @@ impl HTMLBRElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLBRElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLBRElement> {
|
||||||
let element = HTMLBRElement::new_inherited(localName, prefix, document);
|
let element = HTMLBRElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLBRElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLBRElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,21 +45,28 @@ pub struct HTMLButtonElement {
|
||||||
|
|
||||||
impl HTMLButtonElementDerived for EventTarget {
|
impl HTMLButtonElementDerived for EventTarget {
|
||||||
fn is_htmlbuttonelement(&self) -> bool {
|
fn is_htmlbuttonelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLButtonElement {
|
impl HTMLButtonElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLButtonElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLButtonElement {
|
||||||
HTMLButtonElement {
|
HTMLButtonElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLButtonElement, localName, prefix, document),
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLButtonElement, localName, prefix, document),
|
||||||
//TODO: implement button_type in after_set_attr
|
//TODO: implement button_type in after_set_attr
|
||||||
button_type: Cell::new(ButtonType::ButtonSubmit)
|
button_type: Cell::new(ButtonType::ButtonSubmit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLButtonElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLButtonElement> {
|
||||||
let element = HTMLButtonElement::new_inherited(localName, prefix, document);
|
let element = HTMLButtonElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLButtonElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLButtonElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
@ -96,7 +103,8 @@ impl<'a> HTMLButtonElementMethods for JSRef<'a, HTMLButtonElement> {
|
||||||
|
|
||||||
make_setter!(SetFormAction, "formaction");
|
make_setter!(SetFormAction, "formaction");
|
||||||
|
|
||||||
make_enumerated_getter!(FormEnctype, "application/x-www-form-urlencoded", ("text/plain") | ("multipart/form-data"));
|
make_enumerated_getter!(
|
||||||
|
FormEnctype, "application/x-www-form-urlencoded", ("text/plain") | ("multipart/form-data"));
|
||||||
|
|
||||||
make_setter!(SetFormEnctype, "formenctype");
|
make_setter!(SetFormEnctype, "formenctype");
|
||||||
|
|
||||||
|
|
|
@ -47,14 +47,19 @@ pub struct HTMLCanvasElement {
|
||||||
|
|
||||||
impl HTMLCanvasElementDerived for EventTarget {
|
impl HTMLCanvasElementDerived for EventTarget {
|
||||||
fn is_htmlcanvaselement(&self) -> bool {
|
fn is_htmlcanvaselement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLCanvasElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLCanvasElement {
|
impl HTMLCanvasElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLCanvasElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLCanvasElement {
|
||||||
HTMLCanvasElement {
|
HTMLCanvasElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLCanvasElement, localName, prefix, document),
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLCanvasElement, localName, prefix, document),
|
||||||
context_2d: Default::default(),
|
context_2d: Default::default(),
|
||||||
context_webgl: Default::default(),
|
context_webgl: Default::default(),
|
||||||
width: Cell::new(DEFAULT_WIDTH),
|
width: Cell::new(DEFAULT_WIDTH),
|
||||||
|
@ -63,7 +68,9 @@ impl HTMLCanvasElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLCanvasElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLCanvasElement> {
|
||||||
let element = HTMLCanvasElement::new_inherited(localName, prefix, document);
|
let element = HTMLCanvasElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLCanvasElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLCanvasElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
@ -182,7 +189,9 @@ impl<'a> HTMLCanvasElementMethods for JSRef<'a, HTMLCanvasElement> {
|
||||||
let size = self.get_size();
|
let size = self.get_size();
|
||||||
CanvasRenderingContext2D::new(GlobalRef::Window(window.r()), self, size)
|
CanvasRenderingContext2D::new(GlobalRef::Window(window.r()), self, size)
|
||||||
});
|
});
|
||||||
Some(CanvasRenderingContext2DOrWebGLRenderingContext::eCanvasRenderingContext2D(Unrooted::from_temporary(context_2d)))
|
Some(
|
||||||
|
CanvasRenderingContext2DOrWebGLRenderingContext::eCanvasRenderingContext2D(
|
||||||
|
Unrooted::from_temporary(context_2d)))
|
||||||
}
|
}
|
||||||
"webgl" | "experimental-webgl" => {
|
"webgl" | "experimental-webgl" => {
|
||||||
if self.context_2d.get().is_some() {
|
if self.context_2d.get().is_some() {
|
||||||
|
|
|
@ -19,19 +19,25 @@ pub struct HTMLDataElement {
|
||||||
|
|
||||||
impl HTMLDataElementDerived for EventTarget {
|
impl HTMLDataElementDerived for EventTarget {
|
||||||
fn is_htmldataelement(&self) -> bool {
|
fn is_htmldataelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDataElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDataElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLDataElement {
|
impl HTMLDataElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDataElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLDataElement {
|
||||||
HTMLDataElement {
|
HTMLDataElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDataElement, localName, prefix, document)
|
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDataElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLDataElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLDataElement> {
|
||||||
let element = HTMLDataElement::new_inherited(localName, prefix, document);
|
let element = HTMLDataElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLDataElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLDataElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,19 +23,26 @@ pub struct HTMLDataListElement {
|
||||||
|
|
||||||
impl HTMLDataListElementDerived for EventTarget {
|
impl HTMLDataListElementDerived for EventTarget {
|
||||||
fn is_htmldatalistelement(&self) -> bool {
|
fn is_htmldatalistelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDataListElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDataListElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLDataListElement {
|
impl HTMLDataListElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDataListElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLDataListElement {
|
||||||
HTMLDataListElement {
|
HTMLDataListElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDataListElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLDataListElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLDataListElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLDataListElement> {
|
||||||
let element = HTMLDataListElement::new_inherited(localName, prefix, document);
|
let element = HTMLDataListElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLDataListElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLDataListElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,20 +25,27 @@ pub struct HTMLDialogElement {
|
||||||
|
|
||||||
impl HTMLDialogElementDerived for EventTarget {
|
impl HTMLDialogElementDerived for EventTarget {
|
||||||
fn is_htmldialogelement(&self) -> bool {
|
fn is_htmldialogelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDialogElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDialogElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLDialogElement {
|
impl HTMLDialogElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDialogElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLDialogElement {
|
||||||
HTMLDialogElement {
|
HTMLDialogElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDialogElement, localName, prefix, document),
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLDialogElement, localName, prefix, document),
|
||||||
return_value: DOMRefCell::new("".to_owned()),
|
return_value: DOMRefCell::new("".to_owned()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLDialogElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLDialogElement> {
|
||||||
let element = HTMLDialogElement::new_inherited(localName, prefix, document);
|
let element = HTMLDialogElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLDialogElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLDialogElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,26 @@ pub struct HTMLDirectoryElement {
|
||||||
|
|
||||||
impl HTMLDirectoryElementDerived for EventTarget {
|
impl HTMLDirectoryElementDerived for EventTarget {
|
||||||
fn is_htmldirectoryelement(&self) -> bool {
|
fn is_htmldirectoryelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDirectoryElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDirectoryElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLDirectoryElement {
|
impl HTMLDirectoryElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDirectoryElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLDirectoryElement {
|
||||||
HTMLDirectoryElement {
|
HTMLDirectoryElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDirectoryElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLDirectoryElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLDirectoryElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLDirectoryElement> {
|
||||||
let element = HTMLDirectoryElement::new_inherited(localName, prefix, document);
|
let element = HTMLDirectoryElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLDirectoryElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLDirectoryElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,25 @@ pub struct HTMLDivElement {
|
||||||
|
|
||||||
impl HTMLDivElementDerived for EventTarget {
|
impl HTMLDivElementDerived for EventTarget {
|
||||||
fn is_htmldivelement(&self) -> bool {
|
fn is_htmldivelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDivElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDivElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLDivElement {
|
impl HTMLDivElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDivElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLDivElement {
|
||||||
HTMLDivElement {
|
HTMLDivElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDivElement, localName, prefix, document)
|
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDivElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLDivElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLDivElement> {
|
||||||
let element = HTMLDivElement::new_inherited(localName, prefix, document);
|
let element = HTMLDivElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLDivElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLDivElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,24 @@ pub struct HTMLDListElement {
|
||||||
|
|
||||||
impl HTMLDListElementDerived for EventTarget {
|
impl HTMLDListElementDerived for EventTarget {
|
||||||
fn is_htmldlistelement(&self) -> bool {
|
fn is_htmldlistelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDListElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLDListElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLDListElement {
|
impl HTMLDListElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDListElement {
|
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDListElement {
|
||||||
HTMLDListElement {
|
HTMLDListElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDListElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLDListElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLDListElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLDListElement> {
|
||||||
let element = HTMLDListElement::new_inherited(localName, prefix, document);
|
let element = HTMLDListElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLDListElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLDListElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,13 @@ impl HTMLElementDerived for EventTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLElement {
|
impl HTMLElement {
|
||||||
pub fn new_inherited(type_id: HTMLElementTypeId, tag_name: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLElement {
|
pub fn new_inherited(type_id: HTMLElementTypeId,
|
||||||
|
tag_name: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLElement {
|
||||||
HTMLElement {
|
HTMLElement {
|
||||||
element: Element::new_inherited(ElementTypeId::HTMLElement(type_id), tag_name, ns!(HTML), prefix, document),
|
element:
|
||||||
|
Element::new_inherited(ElementTypeId::HTMLElement(type_id), tag_name, ns!(HTML), prefix, document),
|
||||||
style_decl: Default::default(),
|
style_decl: Default::default(),
|
||||||
dataset: Default::default(),
|
dataset: Default::default(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,9 @@ pub struct HTMLEmbedElement {
|
||||||
|
|
||||||
impl HTMLEmbedElementDerived for EventTarget {
|
impl HTMLEmbedElementDerived for EventTarget {
|
||||||
fn is_htmlembedelement(&self) -> bool {
|
fn is_htmlembedelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLEmbedElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLEmbedElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +33,9 @@ impl HTMLEmbedElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLEmbedElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLEmbedElement> {
|
||||||
let element = HTMLEmbedElement::new_inherited(localName, prefix, document);
|
let element = HTMLEmbedElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLEmbedElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLEmbedElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,19 +28,26 @@ pub struct HTMLFieldSetElement {
|
||||||
|
|
||||||
impl HTMLFieldSetElementDerived for EventTarget {
|
impl HTMLFieldSetElementDerived for EventTarget {
|
||||||
fn is_htmlfieldsetelement(&self) -> bool {
|
fn is_htmlfieldsetelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFieldSetElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFieldSetElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLFieldSetElement {
|
impl HTMLFieldSetElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLFieldSetElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLFieldSetElement {
|
||||||
HTMLFieldSetElement {
|
HTMLFieldSetElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLFieldSetElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLFieldSetElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLFieldSetElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLFieldSetElement> {
|
||||||
let element = HTMLFieldSetElement::new_inherited(localName, prefix, document);
|
let element = HTMLFieldSetElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLFieldSetElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLFieldSetElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
@ -105,10 +112,14 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLFieldSetElement> {
|
||||||
for descendant in child.r().traverse_preorder() {
|
for descendant in child.r().traverse_preorder() {
|
||||||
let descendant = descendant.root();
|
let descendant = descendant.root();
|
||||||
match descendant.r().type_id() {
|
match descendant.r().type_id() {
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) |
|
NodeTypeId::Element(
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) |
|
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) |
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) |
|
NodeTypeId::Element(
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => {
|
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) |
|
||||||
|
NodeTypeId::Element(
|
||||||
|
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) |
|
||||||
|
NodeTypeId::Element(
|
||||||
|
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => {
|
||||||
descendant.r().set_disabled_state(true);
|
descendant.r().set_disabled_state(true);
|
||||||
descendant.r().set_enabled_state(false);
|
descendant.r().set_enabled_state(false);
|
||||||
},
|
},
|
||||||
|
@ -144,10 +155,14 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLFieldSetElement> {
|
||||||
for descendant in child.r().traverse_preorder() {
|
for descendant in child.r().traverse_preorder() {
|
||||||
let descendant = descendant.root();
|
let descendant = descendant.root();
|
||||||
match descendant.r().type_id() {
|
match descendant.r().type_id() {
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) |
|
NodeTypeId::Element(
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) |
|
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) |
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) |
|
NodeTypeId::Element(
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => {
|
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) |
|
||||||
|
NodeTypeId::Element(
|
||||||
|
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) |
|
||||||
|
NodeTypeId::Element(
|
||||||
|
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => {
|
||||||
descendant.r().check_disabled_attribute();
|
descendant.r().check_disabled_attribute();
|
||||||
descendant.r().check_ancestors_disabled_state_for_form_control();
|
descendant.r().check_ancestors_disabled_state_for_form_control();
|
||||||
},
|
},
|
||||||
|
|
|
@ -26,7 +26,9 @@ pub struct HTMLFontElement {
|
||||||
|
|
||||||
impl HTMLFontElementDerived for EventTarget {
|
impl HTMLFontElementDerived for EventTarget {
|
||||||
fn is_htmlfontelement(&self) -> bool {
|
fn is_htmlfontelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFontElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFontElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +41,9 @@ impl HTMLFontElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLFontElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLFontElement> {
|
||||||
let element = HTMLFontElement::new_inherited(localName, prefix, document);
|
let element = HTMLFontElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLFontElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLFontElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,12 +51,16 @@ pub struct HTMLFormElement {
|
||||||
|
|
||||||
impl HTMLFormElementDerived for EventTarget {
|
impl HTMLFormElementDerived for EventTarget {
|
||||||
fn is_htmlformelement(&self) -> bool {
|
fn is_htmlformelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFormElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFormElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLFormElement {
|
impl HTMLFormElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLFormElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLFormElement {
|
||||||
HTMLFormElement {
|
HTMLFormElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLFormElement, localName, prefix, document),
|
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLFormElement, localName, prefix, document),
|
||||||
marked_for_reset: Cell::new(false),
|
marked_for_reset: Cell::new(false),
|
||||||
|
@ -64,7 +68,9 @@ impl HTMLFormElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLFormElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLFormElement> {
|
||||||
let element = HTMLFormElement::new_inherited(localName, prefix, document);
|
let element = HTMLFormElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLFormElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLFormElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,9 @@ pub struct HTMLFrameElement {
|
||||||
|
|
||||||
impl HTMLFrameElementDerived for EventTarget {
|
impl HTMLFrameElementDerived for EventTarget {
|
||||||
fn is_htmlframeelement(&self) -> bool {
|
fn is_htmlframeelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFrameElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFrameElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +33,9 @@ impl HTMLFrameElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLFrameElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLFrameElement> {
|
||||||
let element = HTMLFrameElement::new_inherited(localName, prefix, document);
|
let element = HTMLFrameElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLFrameElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLFrameElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,26 @@ pub struct HTMLFrameSetElement {
|
||||||
|
|
||||||
impl HTMLFrameSetElementDerived for EventTarget {
|
impl HTMLFrameSetElementDerived for EventTarget {
|
||||||
fn is_htmlframesetelement(&self) -> bool {
|
fn is_htmlframesetelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFrameSetElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLFrameSetElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLFrameSetElement {
|
impl HTMLFrameSetElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLFrameSetElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLFrameSetElement {
|
||||||
HTMLFrameSetElement {
|
HTMLFrameSetElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLFrameSetElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLFrameSetElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLFrameSetElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLFrameSetElement> {
|
||||||
let element = HTMLFrameSetElement::new_inherited(localName, prefix, document);
|
let element = HTMLFrameSetElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLFrameSetElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLFrameSetElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,19 +21,25 @@ pub struct HTMLHeadElement {
|
||||||
|
|
||||||
impl HTMLHeadElementDerived for EventTarget {
|
impl HTMLHeadElementDerived for EventTarget {
|
||||||
fn is_htmlheadelement(&self) -> bool {
|
fn is_htmlheadelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLHeadElement {
|
impl HTMLHeadElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLHeadElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLHeadElement {
|
||||||
HTMLHeadElement {
|
HTMLHeadElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLHeadElement, localName, prefix, document)
|
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLHeadElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLHeadElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLHeadElement> {
|
||||||
let element = HTMLHeadElement::new_inherited(localName, prefix, document);
|
let element = HTMLHeadElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLHeadElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLHeadElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,20 +30,29 @@ pub struct HTMLHeadingElement {
|
||||||
|
|
||||||
impl HTMLHeadingElementDerived for EventTarget {
|
impl HTMLHeadingElementDerived for EventTarget {
|
||||||
fn is_htmlheadingelement(&self) -> bool {
|
fn is_htmlheadingelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadingElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHeadingElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLHeadingElement {
|
impl HTMLHeadingElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>, level: HeadingLevel) -> HTMLHeadingElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>,
|
||||||
|
level: HeadingLevel) -> HTMLHeadingElement {
|
||||||
HTMLHeadingElement {
|
HTMLHeadingElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLHeadingElement, localName, prefix, document),
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLHeadingElement, localName, prefix, document),
|
||||||
level: level,
|
level: level,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>, level: HeadingLevel) -> Temporary<HTMLHeadingElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>,
|
||||||
|
level: HeadingLevel) -> Temporary<HTMLHeadingElement> {
|
||||||
let element = HTMLHeadingElement::new_inherited(localName, prefix, document, level);
|
let element = HTMLHeadingElement::new_inherited(localName, prefix, document, level);
|
||||||
Node::reflect_node(box element, document, HTMLHeadingElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLHeadingElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,9 @@ pub struct HTMLHRElement {
|
||||||
|
|
||||||
impl HTMLHRElementDerived for EventTarget {
|
impl HTMLHRElementDerived for EventTarget {
|
||||||
fn is_htmlhrelement(&self) -> bool {
|
fn is_htmlhrelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHRElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHRElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +33,9 @@ impl HTMLHRElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLHRElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLHRElement> {
|
||||||
let element = HTMLHRElement::new_inherited(localName, prefix, document);
|
let element = HTMLHRElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLHRElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLHRElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,9 @@ pub struct HTMLHtmlElement {
|
||||||
|
|
||||||
impl HTMLHtmlElementDerived for EventTarget {
|
impl HTMLHtmlElementDerived for EventTarget {
|
||||||
fn is_htmlhtmlelement(&self) -> bool {
|
fn is_htmlhtmlelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHtmlElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLHtmlElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +33,9 @@ impl HTMLHtmlElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLHtmlElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLHtmlElement> {
|
||||||
let element = HTMLHtmlElement::new_inherited(localName, prefix, document);
|
let element = HTMLHtmlElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLHtmlElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLHtmlElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding;
|
||||||
use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementMethods;
|
use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementMethods;
|
||||||
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
||||||
use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, EventCast};
|
use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, EventCast};
|
||||||
use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLElementCast, HTMLIFrameElementDerived};
|
use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLElementCast,
|
||||||
|
HTMLIFrameElementDerived};
|
||||||
use dom::bindings::conversions::ToJSValConvertible;
|
use dom::bindings::conversions::ToJSValConvertible;
|
||||||
use dom::bindings::error::{ErrorResult, Fallible};
|
use dom::bindings::error::{ErrorResult, Fallible};
|
||||||
use dom::bindings::error::Error::NotSupported;
|
use dom::bindings::error::Error::NotSupported;
|
||||||
|
@ -59,7 +60,9 @@ pub struct HTMLIFrameElement {
|
||||||
|
|
||||||
impl HTMLIFrameElementDerived for EventTarget {
|
impl HTMLIFrameElementDerived for EventTarget {
|
||||||
fn is_htmliframeelement(&self) -> bool {
|
fn is_htmliframeelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLIFrameElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,9 +194,12 @@ impl RawHTMLIFrameElementHelpers for HTMLIFrameElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLIFrameElement {
|
impl HTMLIFrameElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLIFrameElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLIFrameElement {
|
||||||
HTMLIFrameElement {
|
HTMLIFrameElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLIFrameElement, localName, prefix, document),
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLIFrameElement, localName, prefix, document),
|
||||||
subpage_id: Cell::new(None),
|
subpage_id: Cell::new(None),
|
||||||
containing_page_pipeline_id: Cell::new(None),
|
containing_page_pipeline_id: Cell::new(None),
|
||||||
sandbox: Cell::new(None),
|
sandbox: Cell::new(None),
|
||||||
|
@ -201,7 +207,9 @@ impl HTMLIFrameElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLIFrameElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLIFrameElement> {
|
||||||
let element = HTMLIFrameElement::new_inherited(localName, prefix, document);
|
let element = HTMLIFrameElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLIFrameElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLIFrameElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ use dom::attr::{AttrHelpers, AttrValue};
|
||||||
use dom::bindings::cell::DOMRefCell;
|
use dom::bindings::cell::DOMRefCell;
|
||||||
use dom::bindings::codegen::Bindings::HTMLImageElementBinding;
|
use dom::bindings::codegen::Bindings::HTMLImageElementBinding;
|
||||||
use dom::bindings::codegen::Bindings::HTMLImageElementBinding::HTMLImageElementMethods;
|
use dom::bindings::codegen::Bindings::HTMLImageElementBinding::HTMLImageElementMethods;
|
||||||
use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, EventTargetCast, HTMLElementCast, HTMLImageElementDerived};
|
use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, EventTargetCast, HTMLElementCast,
|
||||||
|
HTMLImageElementDerived};
|
||||||
use dom::bindings::global::GlobalRef;
|
use dom::bindings::global::GlobalRef;
|
||||||
use dom::bindings::js::{JSRef, LayoutJS, Rootable, Temporary};
|
use dom::bindings::js::{JSRef, LayoutJS, Rootable, Temporary};
|
||||||
use dom::bindings::refcounted::Trusted;
|
use dom::bindings::refcounted::Trusted;
|
||||||
|
@ -40,7 +41,9 @@ pub struct HTMLImageElement {
|
||||||
|
|
||||||
impl HTMLImageElementDerived for EventTarget {
|
impl HTMLImageElementDerived for EventTarget {
|
||||||
fn is_htmlimageelement(&self) -> bool {
|
fn is_htmlimageelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLImageElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLImageElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +146,9 @@ impl HTMLImageElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLImageElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLImageElement> {
|
||||||
let element = HTMLImageElement::new_inherited(localName, prefix, document);
|
let element = HTMLImageElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLImageElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLImageElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,9 @@ impl InputActivationState {
|
||||||
|
|
||||||
impl HTMLInputElementDerived for EventTarget {
|
impl HTMLInputElementDerived for EventTarget {
|
||||||
fn is_htmlinputelement(&self) -> bool {
|
fn is_htmlinputelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +131,9 @@ impl HTMLInputElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLInputElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLInputElement> {
|
||||||
let element = HTMLInputElement::new_inherited(localName, prefix, document);
|
let element = HTMLInputElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLInputElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLInputElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
@ -297,7 +301,8 @@ impl<'a> HTMLInputElementMethods for JSRef<'a, HTMLInputElement> {
|
||||||
make_setter!(SetFormAction, "formaction");
|
make_setter!(SetFormAction, "formaction");
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-input-formenctype
|
// https://html.spec.whatwg.org/multipage/#dom-input-formenctype
|
||||||
make_enumerated_getter!(FormEnctype, "application/x-www-form-urlencoded", ("text/plain") | ("multipart/form-data"));
|
make_enumerated_getter!(
|
||||||
|
FormEnctype, "application/x-www-form-urlencoded", ("text/plain") | ("multipart/form-data"));
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-input-formenctype
|
// https://html.spec.whatwg.org/multipage/#dom-input-formenctype
|
||||||
make_setter!(SetFormEnctype, "formenctype");
|
make_setter!(SetFormEnctype, "formenctype");
|
||||||
|
@ -678,9 +683,11 @@ impl<'a> Activatable for JSRef<'a, HTMLInputElement> {
|
||||||
// https://html.spec.whatwg.org/multipage/#reset-button-state-(type=reset):activation-behavior
|
// https://html.spec.whatwg.org/multipage/#reset-button-state-(type=reset):activation-behavior
|
||||||
// InputType::InputSubmit => (), // No behavior defined
|
// InputType::InputSubmit => (), // No behavior defined
|
||||||
InputType::InputCheckbox => {
|
InputType::InputCheckbox => {
|
||||||
// https://html.spec.whatwg.org/multipage/#checkbox-state-(type=checkbox):pre-click-activation-steps
|
/*
|
||||||
// cache current values of `checked` and `indeterminate`
|
https://html.spec.whatwg.org/multipage/#checkbox-state-(type=checkbox):pre-click-activation-steps
|
||||||
// we may need to restore them later
|
cache current values of `checked` and `indeterminate`
|
||||||
|
we may need to restore them later
|
||||||
|
*/
|
||||||
cache.indeterminate = self.Indeterminate();
|
cache.indeterminate = self.Indeterminate();
|
||||||
cache.checked = self.Checked();
|
cache.checked = self.Checked();
|
||||||
cache.checked_changed = self.checked_changed.get();
|
cache.checked_changed = self.checked_changed.get();
|
||||||
|
|
|
@ -19,19 +19,26 @@ pub struct HTMLLabelElement {
|
||||||
|
|
||||||
impl HTMLLabelElementDerived for EventTarget {
|
impl HTMLLabelElementDerived for EventTarget {
|
||||||
fn is_htmllabelelement(&self) -> bool {
|
fn is_htmllabelelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLabelElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLabelElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLLabelElement {
|
impl HTMLLabelElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLLabelElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLLabelElement {
|
||||||
HTMLLabelElement {
|
HTMLLabelElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLLabelElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLLabelElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLLabelElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLLabelElement> {
|
||||||
let element = HTMLLabelElement::new_inherited(localName, prefix, document);
|
let element = HTMLLabelElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLLabelElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLLabelElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,26 @@ pub struct HTMLLegendElement {
|
||||||
|
|
||||||
impl HTMLLegendElementDerived for EventTarget {
|
impl HTMLLegendElementDerived for EventTarget {
|
||||||
fn is_htmllegendelement(&self) -> bool {
|
fn is_htmllegendelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLegendElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLegendElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLLegendElement {
|
impl HTMLLegendElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLLegendElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLLegendElement {
|
||||||
HTMLLegendElement {
|
HTMLLegendElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLLegendElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLLegendElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLLegendElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLLegendElement> {
|
||||||
let element = HTMLLegendElement::new_inherited(localName, prefix, document);
|
let element = HTMLLegendElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLLegendElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLLegendElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,9 @@ pub struct HTMLLIElement {
|
||||||
|
|
||||||
impl HTMLLIElementDerived for EventTarget {
|
impl HTMLLIElementDerived for EventTarget {
|
||||||
fn is_htmllielement(&self) -> bool {
|
fn is_htmllielement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLIElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLIElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +33,9 @@ impl HTMLLIElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLLIElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLLIElement> {
|
||||||
let element = HTMLLIElement::new_inherited(localName, prefix, document);
|
let element = HTMLLIElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLLIElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLLIElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,9 @@ pub struct HTMLLinkElement {
|
||||||
|
|
||||||
impl HTMLLinkElementDerived for EventTarget {
|
impl HTMLLinkElementDerived for EventTarget {
|
||||||
fn is_htmllinkelement(&self) -> bool {
|
fn is_htmllinkelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +59,9 @@ impl HTMLLinkElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLLinkElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLLinkElement> {
|
||||||
let element = HTMLLinkElement::new_inherited(localName, prefix, document);
|
let element = HTMLLinkElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLLinkElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLLinkElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,25 @@ pub struct HTMLMapElement {
|
||||||
|
|
||||||
impl HTMLMapElementDerived for EventTarget {
|
impl HTMLMapElementDerived for EventTarget {
|
||||||
fn is_htmlmapelement(&self) -> bool {
|
fn is_htmlmapelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMapElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMapElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLMapElement {
|
impl HTMLMapElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLMapElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLMapElement {
|
||||||
HTMLMapElement {
|
HTMLMapElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMapElement, localName, prefix, document)
|
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMapElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLMapElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLMapElement> {
|
||||||
let element = HTMLMapElement::new_inherited(localName, prefix, document);
|
let element = HTMLMapElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLMapElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLMapElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@ pub struct HTMLMediaElement {
|
||||||
impl HTMLMediaElementDerived for EventTarget {
|
impl HTMLMediaElementDerived for EventTarget {
|
||||||
fn is_htmlmediaelement(&self) -> bool {
|
fn is_htmlmediaelement(&self) -> bool {
|
||||||
match *self.type_id() {
|
match *self.type_id() {
|
||||||
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMediaElement(_)))) => true,
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMediaElement(_)))) => true,
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +31,8 @@ impl HTMLMediaElement {
|
||||||
prefix: Option<DOMString>, document: JSRef<Document>)
|
prefix: Option<DOMString>, document: JSRef<Document>)
|
||||||
-> HTMLMediaElement {
|
-> HTMLMediaElement {
|
||||||
HTMLMediaElement {
|
HTMLMediaElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMediaElement(type_id), tag_name, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLMediaElement(type_id), tag_name, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,19 +20,25 @@ pub struct HTMLMetaElement {
|
||||||
|
|
||||||
impl HTMLMetaElementDerived for EventTarget {
|
impl HTMLMetaElementDerived for EventTarget {
|
||||||
fn is_htmlmetaelement(&self) -> bool {
|
fn is_htmlmetaelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMetaElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMetaElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLMetaElement {
|
impl HTMLMetaElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLMetaElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLMetaElement {
|
||||||
HTMLMetaElement {
|
HTMLMetaElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMetaElement, localName, prefix, document)
|
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMetaElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLMetaElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLMetaElement> {
|
||||||
let element = HTMLMetaElement::new_inherited(localName, prefix, document);
|
let element = HTMLMetaElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLMetaElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLMetaElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,25 @@ pub struct HTMLMeterElement {
|
||||||
|
|
||||||
impl HTMLMeterElementDerived for EventTarget {
|
impl HTMLMeterElementDerived for EventTarget {
|
||||||
fn is_htmlmeterelement(&self) -> bool {
|
fn is_htmlmeterelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMeterElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMeterElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLMeterElement {
|
impl HTMLMeterElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLMeterElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLMeterElement {
|
||||||
HTMLMeterElement {
|
HTMLMeterElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMeterElement, localName, prefix, document)
|
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMeterElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLMeterElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLMeterElement> {
|
||||||
let element = HTMLMeterElement::new_inherited(localName, prefix, document);
|
let element = HTMLMeterElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLMeterElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLMeterElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,26 @@ pub struct HTMLModElement {
|
||||||
|
|
||||||
impl HTMLModElementDerived for EventTarget {
|
impl HTMLModElementDerived for EventTarget {
|
||||||
fn is_htmlmodelement(&self) -> bool {
|
fn is_htmlmodelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLModElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLModElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLModElement {
|
impl HTMLModElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLModElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLModElement {
|
||||||
HTMLModElement {
|
HTMLModElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLModElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLModElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLModElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLModElement> {
|
||||||
let element = HTMLModElement::new_inherited(localName, prefix, document);
|
let element = HTMLModElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLModElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLModElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,20 +33,27 @@ pub struct HTMLObjectElement {
|
||||||
|
|
||||||
impl HTMLObjectElementDerived for EventTarget {
|
impl HTMLObjectElementDerived for EventTarget {
|
||||||
fn is_htmlobjectelement(&self) -> bool {
|
fn is_htmlobjectelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLObjectElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLObjectElement {
|
impl HTMLObjectElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLObjectElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLObjectElement {
|
||||||
HTMLObjectElement {
|
HTMLObjectElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLObjectElement, localName, prefix, document),
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLObjectElement, localName, prefix, document),
|
||||||
image: DOMRefCell::new(None),
|
image: DOMRefCell::new(None),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLObjectElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLObjectElement> {
|
||||||
let element = HTMLObjectElement::new_inherited(localName, prefix, document);
|
let element = HTMLObjectElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLObjectElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLObjectElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,25 @@ pub struct HTMLOListElement {
|
||||||
|
|
||||||
impl HTMLOListElementDerived for EventTarget {
|
impl HTMLOListElementDerived for EventTarget {
|
||||||
fn is_htmlolistelement(&self) -> bool {
|
fn is_htmlolistelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOListElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOListElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLOListElement {
|
impl HTMLOListElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLOListElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLOListElement {
|
||||||
HTMLOListElement {
|
HTMLOListElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLOListElement, localName, prefix, document)
|
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLOListElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLOListElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLOListElement> {
|
||||||
let element = HTMLOListElement::new_inherited(localName, prefix, document);
|
let element = HTMLOListElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLOListElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLOListElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,19 +26,26 @@ pub struct HTMLOptGroupElement {
|
||||||
|
|
||||||
impl HTMLOptGroupElementDerived for EventTarget {
|
impl HTMLOptGroupElementDerived for EventTarget {
|
||||||
fn is_htmloptgroupelement(&self) -> bool {
|
fn is_htmloptgroupelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptGroupElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptGroupElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLOptGroupElement {
|
impl HTMLOptGroupElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLOptGroupElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLOptGroupElement {
|
||||||
HTMLOptGroupElement {
|
HTMLOptGroupElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLOptGroupElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLOptGroupElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLOptGroupElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLOptGroupElement> {
|
||||||
let element = HTMLOptGroupElement::new_inherited(localName, prefix, document);
|
let element = HTMLOptGroupElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLOptGroupElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLOptGroupElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,19 +30,26 @@ pub struct HTMLOptionElement {
|
||||||
|
|
||||||
impl HTMLOptionElementDerived for EventTarget {
|
impl HTMLOptionElementDerived for EventTarget {
|
||||||
fn is_htmloptionelement(&self) -> bool {
|
fn is_htmloptionelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOptionElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLOptionElement {
|
impl HTMLOptionElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLOptionElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLOptionElement {
|
||||||
HTMLOptionElement {
|
HTMLOptionElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLOptionElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLOptionElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLOptionElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLOptionElement> {
|
||||||
let element = HTMLOptionElement::new_inherited(localName, prefix, document);
|
let element = HTMLOptionElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLOptionElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLOptionElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,19 +21,26 @@ pub struct HTMLOutputElement {
|
||||||
|
|
||||||
impl HTMLOutputElementDerived for EventTarget {
|
impl HTMLOutputElementDerived for EventTarget {
|
||||||
fn is_htmloutputelement(&self) -> bool {
|
fn is_htmloutputelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOutputElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLOutputElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLOutputElement {
|
impl HTMLOutputElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLOutputElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLOutputElement {
|
||||||
HTMLOutputElement {
|
HTMLOutputElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLOutputElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLOutputElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLOutputElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLOutputElement> {
|
||||||
let element = HTMLOutputElement::new_inherited(localName, prefix, document);
|
let element = HTMLOutputElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLOutputElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLOutputElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,26 @@ pub struct HTMLParagraphElement {
|
||||||
|
|
||||||
impl HTMLParagraphElementDerived for EventTarget {
|
impl HTMLParagraphElementDerived for EventTarget {
|
||||||
fn is_htmlparagraphelement(&self) -> bool {
|
fn is_htmlparagraphelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLParagraphElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLParagraphElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLParagraphElement {
|
impl HTMLParagraphElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLParagraphElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLParagraphElement {
|
||||||
HTMLParagraphElement {
|
HTMLParagraphElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLParagraphElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLParagraphElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLParagraphElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLParagraphElement> {
|
||||||
let element = HTMLParagraphElement::new_inherited(localName, prefix, document);
|
let element = HTMLParagraphElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLParagraphElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLParagraphElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,26 @@ pub struct HTMLParamElement {
|
||||||
|
|
||||||
impl HTMLParamElementDerived for EventTarget {
|
impl HTMLParamElementDerived for EventTarget {
|
||||||
fn is_htmlparamelement(&self) -> bool {
|
fn is_htmlparamelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLParamElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLParamElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLParamElement {
|
impl HTMLParamElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLParamElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLParamElement {
|
||||||
HTMLParamElement {
|
HTMLParamElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLParamElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLParamElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLParamElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLParamElement> {
|
||||||
let element = HTMLParamElement::new_inherited(localName, prefix, document);
|
let element = HTMLParamElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLParamElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLParamElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,26 @@ pub struct HTMLPreElement {
|
||||||
|
|
||||||
impl HTMLPreElementDerived for EventTarget {
|
impl HTMLPreElementDerived for EventTarget {
|
||||||
fn is_htmlpreelement(&self) -> bool {
|
fn is_htmlpreelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLPreElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLPreElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLPreElement {
|
impl HTMLPreElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLPreElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLPreElement {
|
||||||
HTMLPreElement {
|
HTMLPreElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLPreElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLPreElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLPreElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLPreElement> {
|
||||||
let element = HTMLPreElement::new_inherited(localName, prefix, document);
|
let element = HTMLPreElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLPreElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLPreElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,26 @@ pub struct HTMLProgressElement {
|
||||||
|
|
||||||
impl HTMLProgressElementDerived for EventTarget {
|
impl HTMLProgressElementDerived for EventTarget {
|
||||||
fn is_htmlprogresselement(&self) -> bool {
|
fn is_htmlprogresselement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLProgressElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLProgressElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLProgressElement {
|
impl HTMLProgressElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLProgressElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLProgressElement {
|
||||||
HTMLProgressElement {
|
HTMLProgressElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLProgressElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLProgressElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLProgressElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLProgressElement> {
|
||||||
let element = HTMLProgressElement::new_inherited(localName, prefix, document);
|
let element = HTMLProgressElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLProgressElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLProgressElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,26 @@ pub struct HTMLQuoteElement {
|
||||||
|
|
||||||
impl HTMLQuoteElementDerived for EventTarget {
|
impl HTMLQuoteElementDerived for EventTarget {
|
||||||
fn is_htmlquoteelement(&self) -> bool {
|
fn is_htmlquoteelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLQuoteElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLQuoteElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLQuoteElement {
|
impl HTMLQuoteElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLQuoteElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLQuoteElement {
|
||||||
HTMLQuoteElement {
|
HTMLQuoteElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLQuoteElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLQuoteElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLQuoteElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLQuoteElement> {
|
||||||
let element = HTMLQuoteElement::new_inherited(localName, prefix, document);
|
let element = HTMLQuoteElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLQuoteElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLQuoteElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,9 @@ pub struct HTMLScriptElement {
|
||||||
|
|
||||||
impl HTMLScriptElementDerived for EventTarget {
|
impl HTMLScriptElementDerived for EventTarget {
|
||||||
fn is_htmlscriptelement(&self) -> bool {
|
fn is_htmlscriptelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLScriptElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLScriptElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +85,8 @@ impl HTMLScriptElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>,
|
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>,
|
||||||
creator: ElementCreator) -> HTMLScriptElement {
|
creator: ElementCreator) -> HTMLScriptElement {
|
||||||
HTMLScriptElement {
|
HTMLScriptElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLScriptElement, localName, prefix, document),
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLScriptElement, localName, prefix, document),
|
||||||
already_started: Cell::new(false),
|
already_started: Cell::new(false),
|
||||||
parser_inserted: Cell::new(creator == ElementCreator::ParserCreated),
|
parser_inserted: Cell::new(creator == ElementCreator::ParserCreated),
|
||||||
non_blocking: Cell::new(creator != ElementCreator::ParserCreated),
|
non_blocking: Cell::new(creator != ElementCreator::ParserCreated),
|
||||||
|
|
|
@ -31,21 +31,28 @@ pub struct HTMLSelectElement {
|
||||||
|
|
||||||
impl HTMLSelectElementDerived for EventTarget {
|
impl HTMLSelectElementDerived for EventTarget {
|
||||||
fn is_htmlselectelement(&self) -> bool {
|
fn is_htmlselectelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static DEFAULT_SELECT_SIZE: u32 = 0;
|
static DEFAULT_SELECT_SIZE: u32 = 0;
|
||||||
|
|
||||||
impl HTMLSelectElement {
|
impl HTMLSelectElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLSelectElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLSelectElement {
|
||||||
HTMLSelectElement {
|
HTMLSelectElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLSelectElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLSelectElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLSelectElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLSelectElement> {
|
||||||
let element = HTMLSelectElement::new_inherited(localName, prefix, document);
|
let element = HTMLSelectElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLSelectElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLSelectElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,26 @@ pub struct HTMLSourceElement {
|
||||||
|
|
||||||
impl HTMLSourceElementDerived for EventTarget {
|
impl HTMLSourceElementDerived for EventTarget {
|
||||||
fn is_htmlsourceelement(&self) -> bool {
|
fn is_htmlsourceelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSourceElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSourceElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLSourceElement {
|
impl HTMLSourceElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLSourceElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLSourceElement {
|
||||||
HTMLSourceElement {
|
HTMLSourceElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLSourceElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLSourceElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLSourceElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLSourceElement> {
|
||||||
let element = HTMLSourceElement::new_inherited(localName, prefix, document);
|
let element = HTMLSourceElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLSourceElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLSourceElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,9 @@ pub struct HTMLSpanElement {
|
||||||
|
|
||||||
impl HTMLSpanElementDerived for EventTarget {
|
impl HTMLSpanElementDerived for EventTarget {
|
||||||
fn is_htmlspanelement(&self) -> bool {
|
fn is_htmlspanelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSpanElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSpanElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +33,9 @@ impl HTMLSpanElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLSpanElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLSpanElement> {
|
||||||
let element = HTMLSpanElement::new_inherited(localName, prefix, document);
|
let element = HTMLSpanElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLSpanElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLSpanElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,19 +27,25 @@ pub struct HTMLStyleElement {
|
||||||
|
|
||||||
impl HTMLStyleElementDerived for EventTarget {
|
impl HTMLStyleElementDerived for EventTarget {
|
||||||
fn is_htmlstyleelement(&self) -> bool {
|
fn is_htmlstyleelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLStyleElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLStyleElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLStyleElement {
|
impl HTMLStyleElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLStyleElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLStyleElement {
|
||||||
HTMLStyleElement {
|
HTMLStyleElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLStyleElement, localName, prefix, document)
|
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLStyleElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLStyleElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLStyleElement> {
|
||||||
let element = HTMLStyleElement::new_inherited(localName, prefix, document);
|
let element = HTMLStyleElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLStyleElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLStyleElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,26 @@ pub struct HTMLTableCaptionElement {
|
||||||
|
|
||||||
impl HTMLTableCaptionElementDerived for EventTarget {
|
impl HTMLTableCaptionElementDerived for EventTarget {
|
||||||
fn is_htmltablecaptionelement(&self) -> bool {
|
fn is_htmltablecaptionelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCaptionElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCaptionElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTableCaptionElement {
|
impl HTMLTableCaptionElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLTableCaptionElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLTableCaptionElement {
|
||||||
HTMLTableCaptionElement {
|
HTMLTableCaptionElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableCaptionElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableCaptionElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLTableCaptionElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLTableCaptionElement> {
|
||||||
let element = HTMLTableCaptionElement::new_inherited(localName, prefix, document);
|
let element = HTMLTableCaptionElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLTableCaptionElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLTableCaptionElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,8 @@ pub struct HTMLTableCellElement {
|
||||||
impl HTMLTableCellElementDerived for EventTarget {
|
impl HTMLTableCellElementDerived for EventTarget {
|
||||||
fn is_htmltablecellelement(&self) -> bool {
|
fn is_htmltablecellelement(&self) -> bool {
|
||||||
match *self.type_id() {
|
match *self.type_id() {
|
||||||
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement(_)))) => true,
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement(_)))) => true,
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +55,8 @@ impl HTMLTableCellElement {
|
||||||
document: JSRef<Document>)
|
document: JSRef<Document>)
|
||||||
-> HTMLTableCellElement {
|
-> HTMLTableCellElement {
|
||||||
HTMLTableCellElement {
|
HTMLTableCellElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableCellElement(type_id), tag_name, prefix, document),
|
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableCellElement(type_id),
|
||||||
|
tag_name, prefix, document),
|
||||||
background_color: Cell::new(None),
|
background_color: Cell::new(None),
|
||||||
colspan: Cell::new(None),
|
colspan: Cell::new(None),
|
||||||
width: Cell::new(LengthOrPercentageOrAuto::Auto),
|
width: Cell::new(LengthOrPercentageOrAuto::Auto),
|
||||||
|
|
|
@ -19,19 +19,26 @@ pub struct HTMLTableColElement {
|
||||||
|
|
||||||
impl HTMLTableColElementDerived for EventTarget {
|
impl HTMLTableColElementDerived for EventTarget {
|
||||||
fn is_htmltablecolelement(&self) -> bool {
|
fn is_htmltablecolelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableColElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableColElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTableColElement {
|
impl HTMLTableColElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLTableColElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLTableColElement {
|
||||||
HTMLTableColElement {
|
HTMLTableColElement {
|
||||||
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableColElement, localName, prefix, document)
|
htmlelement:
|
||||||
|
HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableColElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> Temporary<HTMLTableColElement> {
|
pub fn new(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> Temporary<HTMLTableColElement> {
|
||||||
let element = HTMLTableColElement::new_inherited(localName, prefix, document);
|
let element = HTMLTableColElement::new_inherited(localName, prefix, document);
|
||||||
Node::reflect_node(box element, document, HTMLTableColElementBinding::Wrap)
|
Node::reflect_node(box element, document, HTMLTableColElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,10 +28,13 @@ impl HTMLTableDataCellElementDerived for EventTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTableDataCellElement {
|
impl HTMLTableDataCellElement {
|
||||||
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLTableDataCellElement {
|
fn new_inherited(localName: DOMString,
|
||||||
|
prefix: Option<DOMString>,
|
||||||
|
document: JSRef<Document>) -> HTMLTableDataCellElement {
|
||||||
HTMLTableDataCellElement {
|
HTMLTableDataCellElement {
|
||||||
htmltablecellelement: HTMLTableCellElement::new_inherited(HTMLTableCellElementTypeId::HTMLTableDataCellElement,
|
htmltablecellelement:
|
||||||
localName, prefix, document)
|
HTMLTableCellElement::new_inherited(
|
||||||
|
HTMLTableCellElementTypeId::HTMLTableDataCellElement, localName, prefix, document)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,9 @@ pub struct HTMLTableElement {
|
||||||
|
|
||||||
impl HTMLTableElementDerived for EventTarget {
|
impl HTMLTableElementDerived for EventTarget {
|
||||||
fn is_htmltableelement(&self) -> bool {
|
fn is_htmltableelement(&self) -> bool {
|
||||||
*self.type_id() == EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableElement)))
|
*self.type_id() ==
|
||||||
|
EventTargetTypeId::Node(
|
||||||
|
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableElement)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue