Reduce max line length from 150 to 120 characters

Part of https://github.com/servo/servo/issues/6041
This commit is contained in:
Corey Farwell 2015-05-23 19:49:53 -04:00
parent 7561f7b83f
commit 8e3f4bba85
141 changed files with 1161 additions and 497 deletions

View file

@ -213,7 +213,8 @@ impl<'a> CanvasPaintTask<'a> {
Canvas2dMsg::Fill => painter.fill(),
Canvas2dMsg::Stroke => painter.stroke(),
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)
}
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::SetGlobalAlpha(alpha) => painter.set_global_alpha(alpha),
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)
=> painter.put_image_data(imagedata, image_data_rect, dirty_rect),
}

View file

@ -30,9 +30,9 @@ unsafe impl Send for WebGLPaintTask {}
impl WebGLPaintTask {
fn new(size: Size2D<i32>) -> Result<WebGLPaintTask, &'static str> {
// TODO(ecoal95): Get the GLContextAttributes from the `GetContext` call
let context = try!(GLContext::create_offscreen_with_color_attachment(size,
GLContextAttributes::default(),
ColorAttachmentType::TextureWithSurface));
let context = try!(
GLContext::create_offscreen_with_color_attachment(
size, GLContextAttributes::default(), ColorAttachmentType::TextureWithSurface));
Ok(WebGLPaintTask {
size: size,
original_context_size: size,
@ -50,10 +50,13 @@ impl WebGLPaintTask {
CanvasWebGLMsg::CreateBuffer(chan) => self.create_buffer(chan),
CanvasWebGLMsg::DrawArrays(mode, first, count) => self.draw_arrays(mode, first, count),
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::GetShaderParameter(shader_id, param_id, 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::GetShaderParameter(shader_id, param_id, 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::CreateProgram(chan) => self.create_program(chan),
CanvasWebGLMsg::CreateShader(shader_type, chan) => self.create_shader(shader_type, chan),

View file

@ -151,7 +151,9 @@ impl Actor for ConsoleActor {
timeStamp: 0,
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" => {
@ -161,7 +163,9 @@ impl Actor for ConsoleActor {
timeStamp: 0,
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),

View file

@ -2,7 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/// 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
/// that perform more specific actions (tabs, addons, browser chrome, etc.)

View file

@ -914,15 +914,17 @@ impl<'a> PaintContext<'a> {
if accum_blur > Au(0) {
// Set the correct size.
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.
let old_transform = self.draw_target.get_transform();
let inflated_size = Rect(Point2D(0.0, 0.0), Size2D(size.width as AzFloat,
size.height as AzFloat));
let temporary_draw_target_bounds = old_transform.transform_rect(&inflated_size);
matrix = Matrix2D::identity().translate(-temporary_draw_target_bounds.origin.x as AzFloat,
-temporary_draw_target_bounds.origin.y as AzFloat).mul(&old_transform);
matrix = Matrix2D::identity().translate(
-temporary_draw_target_bounds.origin.x as AzFloat,
-temporary_draw_target_bounds.origin.y as AzFloat).mul(&old_transform);
}
let temporary_draw_target =

View file

@ -481,7 +481,8 @@ impl WorkerThreadProxy {
layer_buffer: Option<Box<LayerBuffer>>,
stacking_context: Arc<StackingContext>,
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> {

View file

@ -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) {
let font = (*matches).fonts.offset(i);
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)
} else {
panic!();
};
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
} else {
panic!();

View file

@ -198,7 +198,8 @@ impl Shaper {
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_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);
Shaper {

View file

@ -1344,7 +1344,8 @@ impl<'a> PostorderNodeMutTraversal for FlowConstructor<'a> {
};
(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::ProcessingInstruction)) |
Some(NodeTypeId::DocumentType) |

View file

@ -42,7 +42,8 @@ use std::iter::repeat;
use std::sync::Arc;
use style::computed_values::filter::Filter;
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::properties::ComputedValues;
use style::properties::style_structs::Border;
@ -477,7 +478,8 @@ impl FragmentDisplayListBuilding for Fragment {
(absolute_bounds.origin.x, absolute_bounds.origin.y)
}
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_y = Au(0);
(Au(0), Au(0))

View file

@ -131,7 +131,8 @@ impl MarginCollapseInfo {
let state = match self.state {
MarginCollapseState::AccumulatingCollapsibleTopMargin => {
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() {
LengthOrPercentage::Length(Au(0)) | LengthOrPercentage::Percentage(0.) => {
FinalMarginState::MarginsCollapseThrough

View file

@ -50,7 +50,8 @@ type Generation = u32;
/// 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
/// 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.
///

View file

@ -125,21 +125,24 @@ pub trait TLayoutNode {
fn get_renderer(&self) -> Option<Sender<CanvasMsg>> {
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())
}
}
fn get_canvas_width(&self) -> u32 {
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()
}
}
fn get_canvas_height(&self) -> u32 {
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()
}
}

View file

@ -311,7 +311,8 @@ impl MozBrowserEvent {
MozBrowserEvent::AsyncScroll | MozBrowserEvent::Close | MozBrowserEvent::ContextMenu |
MozBrowserEvent::Error | MozBrowserEvent::IconChange | MozBrowserEvent::LoadEnd |
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::TitleChange(ref new_title) => Some(new_title.clone()),
}

View file

@ -86,7 +86,8 @@ impl CookieStorage {
// http://tools.ietf.org/html/rfc6265#section-5.4
pub fn cookies_for_url(&mut self, url: &Url, source: CookieSource) -> Option<String> {
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));
// Step 1
c.appropriate_for_url(url, source)

View file

@ -53,7 +53,8 @@ pub struct 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 {
origin: origin,
url: url,
@ -80,18 +81,22 @@ pub trait CORSCache {
/// Remove old entries
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;
/// 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
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;
/// 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
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>);
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();
let BasicCORSCache(ref mut buf) = *self;
let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme &&
@ -116,7 +122,8 @@ impl BasicCORSCache {
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
self.cleanup();
let BasicCORSCache(ref mut buf) = *self;
@ -135,7 +142,8 @@ impl CORSCache for BasicCORSCache {
#[allow(dead_code)]
fn clear (&mut self, request: CacheRequestDetails) {
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);
}
@ -143,7 +151,9 @@ impl CORSCache for BasicCORSCache {
fn cleanup(&mut self) {
let BasicCORSCache(buf) = self.clone();
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);
}
@ -156,7 +166,8 @@ impl CORSCache for BasicCORSCache {
Some(_) => true,
None => {
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
}
}

View file

@ -224,7 +224,8 @@ impl Request {
}
/// [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
let mut response: Option<Response> = None;
// Step 2
@ -333,7 +334,9 @@ impl Request {
self.same_origin_data = false;
// Step 10
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
// if cors_flag && location_url.origin() != self.url.origin() { self.origin = None; }
// Substep 2
@ -387,7 +390,9 @@ impl Request {
}
/// [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
Response::network_error()
}

View file

@ -56,7 +56,8 @@ pub struct Response {
pub status: Option<StatusCode>,
pub headers: Headers,
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>>,
}

View file

@ -36,7 +36,8 @@ use std::boxed::FnBox;
pub fn factory(cookies_chan: Sender<ControlMsg>, devtools_chan: Option<Sender<DevtoolsControlMsg>>)
-> Box<FnBox(LoadData, LoadConsumer, Arc<MIMEClassifier>) + Send> {
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) => {
if c.preflight {
// 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;
} else {
// 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
// TODO: Send this message only if load_data has a pipeline_id that is not None
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();
}

View file

@ -332,7 +332,8 @@ impl ImageCache {
url: url,
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();
}
}
}

View file

@ -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, _))| {
(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_sb: SubLevel = FromStr::from_str(&sublevel).unwrap();
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
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_clone = setup_chan.clone();
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>> {
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 mut host_table = HashMap::new();
let lines: Vec<&str> = hostsfile_content.split('\n').collect();
@ -191,8 +194,10 @@ struct ResourceManager {
}
impl ResourceManager {
fn new(from_client: Receiver<ControlMsg>, user_agent: Option<String>,
resource_task: Sender<ControlMsg>, devtools_channel: Option<Sender<DevtoolsControlMsg>>) -> ResourceManager {
fn new(from_client: Receiver<ControlMsg>,
user_agent: Option<String>,
resource_task: Sender<ControlMsg>,
devtools_channel: Option<Sender<DevtoolsControlMsg>>) -> ResourceManager {
ResourceManager {
from_client: from_client,
user_agent: user_agent,
@ -250,7 +255,8 @@ impl ResourceManager {
let loader = match &*load_data.url.scheme {
"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),
"about" => from_factory(about_loader::factory),
_ => {

View file

@ -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
/// 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 data = self.select_data_mut(storage_type);
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
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 data = self.select_data_mut(storage_type);
let old_value = data.get_mut(&origin).and_then(|entry| {

View file

@ -8,7 +8,8 @@ use syntax::ptr::P;
use syntax::ast::{MetaItem, Expr};
use syntax::ast;
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 {
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`
///
/// The expansion basically calls `trace()` on all of the fields of the struct/enum, erroring if they do not implement the method.
pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: Annotatable, push: &mut FnMut(Annotatable)) {
/// The expansion basically calls `trace()` on all of the fields of the struct/enum, erroring if they do not
/// implement the method.
pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: Annotatable,
push: &mut FnMut(Annotatable)) {
let trait_def = TraitDef {
span: span,
attributes: Vec::new(),
@ -44,7 +47,8 @@ pub fn expand_jstraceable(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item:
name: "trace",
generics: ty::LifetimeBounds::empty(),
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(),
attributes: vec![quote_attr!(cx, #[inline(always)])],
is_unsafe: false,

View file

@ -8,7 +8,8 @@
//!
//! - `#[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
//! - `#[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]`.
//! Use this for structs that correspond to a DOM type

View file

@ -22,7 +22,8 @@ impl LintPass for InheritancePass {
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
// #[_dom_struct_marker] here without also checking for #[dom_struct]
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 ctr > 0 {
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;
}

View file

@ -13,7 +13,8 @@ declare_lint!(PRIVATIZE, Deny,
/// 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;
impl LintPass for PrivatizePass {
@ -21,13 +22,19 @@ impl LintPass for PrivatizePass {
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") {
for field in def.fields.iter() {
match field.node {
ast::StructField_ { kind: ast::NamedField(ident, visibility), .. } if visibility == Public => {
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));
}
_ => {}
}

View file

@ -15,14 +15,17 @@ declare_lint!(UNROOTED_MUST_ROOT, Deny,
/// 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:
///
/// - 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 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;
// 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) {
match ty.node {
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(..) => {
match cx.tcx.def_map.borrow()[&ty.id] {
def::PathResolution{ base_def: def::DefTy(def_id, _), .. } => {
@ -51,7 +55,12 @@ impl LintPass for UnrootedPass {
lint_array!(UNROOTED_MUST_ROOT)
}
/// 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) {
ast_map::Node::NodeItem(item) => item,
_ => cx.tcx.map.expect_item(cx.tcx.map.get_parent(id)),

View file

@ -9,12 +9,14 @@ use syntax::ast;
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 ast::ItemStruct(ref def, _) = item.node {
let struct_name = item.ident;
// 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
Some(f) => {
let field_name = f.node.ident();

View file

@ -83,6 +83,7 @@ pub fn unsafe_context(map: &ast_map::Map, id: ast::NodeId) -> bool {
_ => 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.
}
}

View file

@ -339,7 +339,11 @@ pub struct 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 {
origin: origin,
url: url,
@ -354,9 +358,12 @@ impl CORSCacheEntry {
impl CORSCache {
/// https://fetch.spec.whatwg.org/#concept-cache-clear
#[allow(dead_code)]
fn clear (&mut self, request: &CORSRequest) {
fn clear(&mut self, request: &CORSRequest) {
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);
}
@ -364,12 +371,16 @@ impl CORSCache {
fn cleanup(&mut self) {
let CORSCache(buf) = self.clone();
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);
}
/// 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();
let CORSCache(ref mut buf) = *self;
// 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()
}
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
self.cleanup();
let CORSCache(ref mut buf) = *self;

View file

@ -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())
} else if rval.is_string() {
//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() {
EvaluateJSReply::NullValue
} else {
@ -95,7 +96,10 @@ pub fn handle_get_layout(page: &Rc<Page>, pipeline: PipelineId, node_id: String,
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 elem: JSRef<Element> = ElementCast::to_ref(node.r()).expect("should be getting layout of element");

View file

@ -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 reflector in (**dom_collection).iter() {
trace_reflector(tracer, "", reflector.reflector());

View file

@ -66,7 +66,8 @@ impl Blob {
}
// 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
let bytes: Option<Vec<u8>> = Some(blobParts.into_bytes());
let typeString = if is_ascii_printable(&blobPropertyBag.type_) {

View file

@ -118,7 +118,8 @@ unsafe fn GetSubframeWindow(cx: *mut JSContext, proxy: *mut JSObject, id: jsid)
}
#[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);
if let Some(window) = window {
let window = window.root();
@ -145,7 +146,8 @@ unsafe extern fn getOwnPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObje
}
#[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() {
// Spec says to Reject whether this is a supported index or not,
// 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)]
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);
if let Some(window) = window {
let window = window.root();
@ -191,7 +194,8 @@ unsafe extern fn get(cx: *mut JSContext, proxy: *mut JSObject, receiver: *mut JS
}
#[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() {
// Reject (which means throw if and only if strict) the set.
// FIXME: Throw
@ -205,12 +209,14 @@ unsafe extern fn set(cx: *mut JSContext, proxy: *mut JSObject, _receiver: *mut J
static PROXY_HANDLER: ProxyTraps = ProxyTraps {
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
as unsafe extern "C" fn(*mut JSContext, *mut JSObject,
jsid, bool, *mut JSPropertyDescriptor)
-> 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,
delete_: None,
enumerate: None,
@ -218,7 +224,8 @@ static PROXY_HANDLER: ProxyTraps = ProxyTraps {
has: None,
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),
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,
iterate: None,

View file

@ -221,7 +221,8 @@ impl CanvasRenderingContext2D {
renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::GetImageData(source_rect, image_size, sender))).unwrap();
let imagedata = receiver.recv().unwrap();
// 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();
@ -820,7 +821,9 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
}
}
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
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 sy = *sy;
let sw = *sw;
@ -871,7 +878,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
// XXX:
// 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,
// 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_rect = Rect(Point2D(dx, dy), image_data_size);
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();
}
@ -896,7 +905,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
// XXX:
// 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,
// 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));
let dirty_rect = Some(Rect(Point2D(dirtyX, dirtyY),
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();
}
@ -919,7 +930,8 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
let y1 = *y1;
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(),
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
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 y0 = *y0;
let r0 = *r0;
@ -936,10 +949,12 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
let r1 = *r1;
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(),
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

View file

@ -56,7 +56,11 @@ impl CloseEvent {
init: &CloseEventBinding::CloseEventInit)
-> Fallible<Temporary<CloseEvent>> {
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,
init.code, init.reason.clone()))
}

View file

@ -41,7 +41,11 @@ impl CustomEvent {
global,
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();
ev.r().InitCustomEvent(global.get_cx(), type_, bubbles, cancelable, detail);
Temporary::from_rooted(ev.r())

View file

@ -381,7 +381,8 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
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) {
Vacant(entry) => {
@ -764,7 +765,8 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
match key {
Key::Space if !prevented && state == KeyState::Released => {
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 => {
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::HTMLElement(HTMLElementTypeId::HTMLOptionElement)) |
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
}
}

View file

@ -96,7 +96,8 @@ impl<'a> DOMExceptionMethods for JSRef<'a, DOMException> {
DOMErrorName::URLMismatchError => "The given URL does not match another URL.",
DOMErrorName::QuotaExceededError => "The quota has been exceeded.",
DOMErrorName::TimeoutError => "The operation timed out.",
DOMErrorName::InvalidNodeTypeError => "The supplied node is incorrect or has an incorrect ancestor for this operation.",
DOMErrorName::InvalidNodeTypeError =>
"The supplied node is incorrect or has an incorrect ancestor for this operation.",
DOMErrorName::DataCloneError => "The object can not be cloned.",
DOMErrorName::EncodingError => "The encoding operation (either encoded or decoding) failed."
};

View file

@ -129,12 +129,14 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
{
// 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());
{
// 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());
// Step 6.
@ -142,7 +144,8 @@ impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
None => (),
Some(title_str) => {
// 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());
// Step 6.2.

View file

@ -151,9 +151,14 @@ impl Element {
}
}
pub fn new(local_name: DOMString, namespace: Namespace, 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)
pub fn new(local_name: DOMString,
namespace: Namespace,
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>> {
let mut attributes = RootedVec::new();
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

View file

@ -97,7 +97,11 @@ impl ErrorEvent {
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_,
bubbles, cancelable,

View file

@ -38,20 +38,27 @@ pub struct HTMLAnchorElement {
impl HTMLAnchorElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLAnchorElement, localName, prefix, document),
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLAnchorElement, localName, prefix, document),
rel_list: Default::default(),
}
}
#[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);
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")) {
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(
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())

View file

@ -26,19 +26,26 @@ pub struct HTMLAppletElement {
impl HTMLAppletElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLAppletElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLAppletElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLAppletElementBinding::Wrap)
}

View file

@ -29,7 +29,9 @@ pub struct HTMLAreaElement {
impl HTMLAreaElementDerived for EventTarget {
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)]
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);
Node::reflect_node(box element, document, HTMLAreaElementBinding::Wrap)
}

View file

@ -28,14 +28,19 @@ impl HTMLAudioElementDerived for EventTarget {
}
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 {
htmlmediaelement: HTMLMediaElement::new_inherited(HTMLMediaElementTypeId::HTMLAudioElement, localName, prefix, document)
htmlmediaelement:
HTMLMediaElement::new_inherited(HTMLMediaElementTypeId::HTMLAudioElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLAudioElementBinding::Wrap)
}

View file

@ -19,7 +19,9 @@ pub struct HTMLBaseElement {
impl HTMLBaseElementDerived for EventTarget {
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)]
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);
Node::reflect_node(box element, document, HTMLBaseElementBinding::Wrap)
}

View file

@ -32,7 +32,9 @@ pub struct HTMLBodyElement {
impl HTMLBodyElementDerived for EventTarget {
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)))
}
}

View file

@ -19,7 +19,9 @@ pub struct HTMLBRElement {
impl HTMLBRElementDerived for EventTarget {
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)]
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);
Node::reflect_node(box element, document, HTMLBRElementBinding::Wrap)
}

View file

@ -45,21 +45,28 @@ pub struct HTMLButtonElement {
impl HTMLButtonElementDerived for EventTarget {
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 {
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 {
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
button_type: Cell::new(ButtonType::ButtonSubmit)
}
}
#[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);
Node::reflect_node(box element, document, HTMLButtonElementBinding::Wrap)
}
@ -96,7 +103,8 @@ impl<'a> HTMLButtonElementMethods for JSRef<'a, HTMLButtonElement> {
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");

View file

@ -47,14 +47,19 @@ pub struct HTMLCanvasElement {
impl HTMLCanvasElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLCanvasElement, localName, prefix, document),
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLCanvasElement, localName, prefix, document),
context_2d: Default::default(),
context_webgl: Default::default(),
width: Cell::new(DEFAULT_WIDTH),
@ -63,7 +68,9 @@ impl HTMLCanvasElement {
}
#[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);
Node::reflect_node(box element, document, HTMLCanvasElementBinding::Wrap)
}
@ -182,7 +189,9 @@ impl<'a> HTMLCanvasElementMethods for JSRef<'a, HTMLCanvasElement> {
let size = self.get_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" => {
if self.context_2d.get().is_some() {

View file

@ -19,19 +19,25 @@ pub struct HTMLDataElement {
impl HTMLDataElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDataElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLDataElementBinding::Wrap)
}

View file

@ -23,19 +23,26 @@ pub struct HTMLDataListElement {
impl HTMLDataListElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDataListElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLDataListElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLDataListElementBinding::Wrap)
}

View file

@ -25,20 +25,27 @@ pub struct HTMLDialogElement {
impl HTMLDialogElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDialogElement, localName, prefix, document),
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLDialogElement, localName, prefix, document),
return_value: DOMRefCell::new("".to_owned()),
}
}
#[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);
Node::reflect_node(box element, document, HTMLDialogElementBinding::Wrap)
}

View file

@ -19,19 +19,26 @@ pub struct HTMLDirectoryElement {
impl HTMLDirectoryElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDirectoryElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLDirectoryElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLDirectoryElementBinding::Wrap)
}

View file

@ -19,19 +19,25 @@ pub struct HTMLDivElement {
impl HTMLDivElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDivElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLDivElementBinding::Wrap)
}

View file

@ -19,19 +19,24 @@ pub struct HTMLDListElement {
impl HTMLDListElementDerived for EventTarget {
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 {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: JSRef<Document>) -> HTMLDListElement {
HTMLDListElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLDListElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLDListElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLDListElementBinding::Wrap)
}

View file

@ -54,9 +54,13 @@ impl HTMLElementDerived for EventTarget {
}
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 {
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(),
dataset: Default::default(),
}

View file

@ -19,7 +19,9 @@ pub struct HTMLEmbedElement {
impl HTMLEmbedElementDerived for EventTarget {
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)]
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);
Node::reflect_node(box element, document, HTMLEmbedElementBinding::Wrap)
}

View file

@ -28,19 +28,26 @@ pub struct HTMLFieldSetElement {
impl HTMLFieldSetElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLFieldSetElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLFieldSetElement, localName, prefix, document)
}
}
#[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);
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() {
let descendant = descendant.root();
match descendant.r().type_id() {
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => {
NodeTypeId::Element(
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) |
NodeTypeId::Element(
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_enabled_state(false);
},
@ -144,10 +155,14 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLFieldSetElement> {
for descendant in child.r().traverse_preorder() {
let descendant = descendant.root();
match descendant.r().type_id() {
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => {
NodeTypeId::Element(
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLButtonElement)) |
NodeTypeId::Element(
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLInputElement)) |
NodeTypeId::Element(
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLSelectElement)) |
NodeTypeId::Element(
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTextAreaElement)) => {
descendant.r().check_disabled_attribute();
descendant.r().check_ancestors_disabled_state_for_form_control();
},

View file

@ -26,7 +26,9 @@ pub struct HTMLFontElement {
impl HTMLFontElementDerived for EventTarget {
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)]
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);
Node::reflect_node(box element, document, HTMLFontElementBinding::Wrap)
}

View file

@ -51,12 +51,16 @@ pub struct HTMLFormElement {
impl HTMLFormElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLFormElement, localName, prefix, document),
marked_for_reset: Cell::new(false),
@ -64,7 +68,9 @@ impl HTMLFormElement {
}
#[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);
Node::reflect_node(box element, document, HTMLFormElementBinding::Wrap)
}

View file

@ -19,7 +19,9 @@ pub struct HTMLFrameElement {
impl HTMLFrameElementDerived for EventTarget {
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)]
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);
Node::reflect_node(box element, document, HTMLFrameElementBinding::Wrap)
}

View file

@ -19,19 +19,26 @@ pub struct HTMLFrameSetElement {
impl HTMLFrameSetElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLFrameSetElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLFrameSetElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLFrameSetElementBinding::Wrap)
}

View file

@ -21,19 +21,25 @@ pub struct HTMLHeadElement {
impl HTMLHeadElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLHeadElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLHeadElementBinding::Wrap)
}

View file

@ -30,20 +30,29 @@ pub struct HTMLHeadingElement {
impl HTMLHeadingElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLHeadingElement, localName, prefix, document),
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLHeadingElement, localName, prefix, document),
level: level,
}
}
#[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);
Node::reflect_node(box element, document, HTMLHeadingElementBinding::Wrap)
}

View file

@ -19,7 +19,9 @@ pub struct HTMLHRElement {
impl HTMLHRElementDerived for EventTarget {
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)]
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);
Node::reflect_node(box element, document, HTMLHRElementBinding::Wrap)
}

View file

@ -19,7 +19,9 @@ pub struct HTMLHtmlElement {
impl HTMLHtmlElementDerived for EventTarget {
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)]
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);
Node::reflect_node(box element, document, HTMLHtmlElementBinding::Wrap)
}

View file

@ -7,7 +7,8 @@ use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding;
use dom::bindings::codegen::Bindings::HTMLIFrameElementBinding::HTMLIFrameElementMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
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::error::{ErrorResult, Fallible};
use dom::bindings::error::Error::NotSupported;
@ -59,7 +60,9 @@ pub struct HTMLIFrameElement {
impl HTMLIFrameElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLIFrameElement, localName, prefix, document),
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLIFrameElement, localName, prefix, document),
subpage_id: Cell::new(None),
containing_page_pipeline_id: Cell::new(None),
sandbox: Cell::new(None),
@ -201,7 +207,9 @@ impl HTMLIFrameElement {
}
#[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);
Node::reflect_node(box element, document, HTMLIFrameElementBinding::Wrap)
}

View file

@ -7,7 +7,8 @@ use dom::attr::{AttrHelpers, AttrValue};
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::HTMLImageElementBinding;
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::js::{JSRef, LayoutJS, Rootable, Temporary};
use dom::bindings::refcounted::Trusted;
@ -40,7 +41,9 @@ pub struct HTMLImageElement {
impl HTMLImageElementDerived for EventTarget {
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)]
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);
Node::reflect_node(box element, document, HTMLImageElementBinding::Wrap)
}

View file

@ -105,7 +105,9 @@ impl InputActivationState {
impl HTMLInputElementDerived for EventTarget {
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)]
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);
Node::reflect_node(box element, document, HTMLInputElementBinding::Wrap)
}
@ -297,7 +301,8 @@ impl<'a> HTMLInputElementMethods for JSRef<'a, HTMLInputElement> {
make_setter!(SetFormAction, "formaction");
// 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
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
// InputType::InputSubmit => (), // No behavior defined
InputType::InputCheckbox => {
// https://html.spec.whatwg.org/multipage/#checkbox-state-(type=checkbox):pre-click-activation-steps
// cache current values of `checked` and `indeterminate`
// we may need to restore them later
/*
https://html.spec.whatwg.org/multipage/#checkbox-state-(type=checkbox):pre-click-activation-steps
cache current values of `checked` and `indeterminate`
we may need to restore them later
*/
cache.indeterminate = self.Indeterminate();
cache.checked = self.Checked();
cache.checked_changed = self.checked_changed.get();

View file

@ -19,19 +19,26 @@ pub struct HTMLLabelElement {
impl HTMLLabelElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLLabelElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLLabelElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLLabelElementBinding::Wrap)
}

View file

@ -19,19 +19,26 @@ pub struct HTMLLegendElement {
impl HTMLLegendElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLLegendElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLLegendElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLLegendElementBinding::Wrap)
}

View file

@ -19,7 +19,9 @@ pub struct HTMLLIElement {
impl HTMLLIElementDerived for EventTarget {
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)]
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);
Node::reflect_node(box element, document, HTMLLIElementBinding::Wrap)
}

View file

@ -44,7 +44,9 @@ pub struct HTMLLinkElement {
impl HTMLLinkElementDerived for EventTarget {
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)]
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);
Node::reflect_node(box element, document, HTMLLinkElementBinding::Wrap)
}

View file

@ -19,19 +19,25 @@ pub struct HTMLMapElement {
impl HTMLMapElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMapElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLMapElementBinding::Wrap)
}

View file

@ -19,7 +19,8 @@ pub struct HTMLMediaElement {
impl HTMLMediaElementDerived for EventTarget {
fn is_htmlmediaelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMediaElement(_)))) => true,
EventTargetTypeId::Node(
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLMediaElement(_)))) => true,
_ => false
}
}
@ -30,7 +31,8 @@ impl HTMLMediaElement {
prefix: Option<DOMString>, document: JSRef<Document>)
-> 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)
}
}

View file

@ -20,19 +20,25 @@ pub struct HTMLMetaElement {
impl HTMLMetaElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMetaElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLMetaElementBinding::Wrap)
}

View file

@ -19,19 +19,25 @@ pub struct HTMLMeterElement {
impl HTMLMeterElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLMeterElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLMeterElementBinding::Wrap)
}

View file

@ -19,19 +19,26 @@ pub struct HTMLModElement {
impl HTMLModElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLModElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLModElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLModElementBinding::Wrap)
}

View file

@ -33,20 +33,27 @@ pub struct HTMLObjectElement {
impl HTMLObjectElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLObjectElement, localName, prefix, document),
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLObjectElement, localName, prefix, document),
image: DOMRefCell::new(None),
}
}
#[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);
Node::reflect_node(box element, document, HTMLObjectElementBinding::Wrap)
}

View file

@ -19,19 +19,25 @@ pub struct HTMLOListElement {
impl HTMLOListElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLOListElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLOListElementBinding::Wrap)
}

View file

@ -26,19 +26,26 @@ pub struct HTMLOptGroupElement {
impl HTMLOptGroupElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLOptGroupElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLOptGroupElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLOptGroupElementBinding::Wrap)
}

View file

@ -30,19 +30,26 @@ pub struct HTMLOptionElement {
impl HTMLOptionElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLOptionElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLOptionElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLOptionElementBinding::Wrap)
}

View file

@ -21,19 +21,26 @@ pub struct HTMLOutputElement {
impl HTMLOutputElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLOutputElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLOutputElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLOutputElementBinding::Wrap)
}

View file

@ -19,19 +19,26 @@ pub struct HTMLParagraphElement {
impl HTMLParagraphElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLParagraphElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLParagraphElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLParagraphElementBinding::Wrap)
}

View file

@ -19,19 +19,26 @@ pub struct HTMLParamElement {
impl HTMLParamElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLParamElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLParamElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLParamElementBinding::Wrap)
}

View file

@ -19,19 +19,26 @@ pub struct HTMLPreElement {
impl HTMLPreElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLPreElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLPreElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLPreElementBinding::Wrap)
}

View file

@ -19,19 +19,26 @@ pub struct HTMLProgressElement {
impl HTMLProgressElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLProgressElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLProgressElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLProgressElementBinding::Wrap)
}

View file

@ -19,19 +19,26 @@ pub struct HTMLQuoteElement {
impl HTMLQuoteElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLQuoteElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLQuoteElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLQuoteElementBinding::Wrap)
}

View file

@ -75,7 +75,9 @@ pub struct HTMLScriptElement {
impl HTMLScriptElementDerived for EventTarget {
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>,
creator: ElementCreator) -> 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),
parser_inserted: Cell::new(creator == ElementCreator::ParserCreated),
non_blocking: Cell::new(creator != ElementCreator::ParserCreated),

View file

@ -31,21 +31,28 @@ pub struct HTMLSelectElement {
impl HTMLSelectElementDerived for EventTarget {
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;
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLSelectElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLSelectElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLSelectElementBinding::Wrap)
}

View file

@ -19,19 +19,26 @@ pub struct HTMLSourceElement {
impl HTMLSourceElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLSourceElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLSourceElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLSourceElementBinding::Wrap)
}

View file

@ -19,7 +19,9 @@ pub struct HTMLSpanElement {
impl HTMLSpanElementDerived for EventTarget {
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)]
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);
Node::reflect_node(box element, document, HTMLSpanElementBinding::Wrap)
}

View file

@ -27,19 +27,25 @@ pub struct HTMLStyleElement {
impl HTMLStyleElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLStyleElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLStyleElementBinding::Wrap)
}

View file

@ -19,19 +19,26 @@ pub struct HTMLTableCaptionElement {
impl HTMLTableCaptionElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableCaptionElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableCaptionElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLTableCaptionElementBinding::Wrap)
}

View file

@ -41,7 +41,8 @@ pub struct HTMLTableCellElement {
impl HTMLTableCellElementDerived for EventTarget {
fn is_htmltablecellelement(&self) -> bool {
match *self.type_id() {
EventTargetTypeId::Node(NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement(_)))) => true,
EventTargetTypeId::Node(
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLTableCellElement(_)))) => true,
_ => false
}
}
@ -54,7 +55,8 @@ impl HTMLTableCellElement {
document: JSRef<Document>)
-> 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),
colspan: Cell::new(None),
width: Cell::new(LengthOrPercentageOrAuto::Auto),

View file

@ -19,19 +19,26 @@ pub struct HTMLTableColElement {
impl HTMLTableColElementDerived for EventTarget {
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 {
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 {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableColElement, localName, prefix, document)
htmlelement:
HTMLElement::new_inherited(HTMLElementTypeId::HTMLTableColElement, localName, prefix, document)
}
}
#[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);
Node::reflect_node(box element, document, HTMLTableColElementBinding::Wrap)
}

View file

@ -28,10 +28,13 @@ impl HTMLTableDataCellElementDerived for EventTarget {
}
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 {
htmltablecellelement: HTMLTableCellElement::new_inherited(HTMLTableCellElementTypeId::HTMLTableDataCellElement,
localName, prefix, document)
htmltablecellelement:
HTMLTableCellElement::new_inherited(
HTMLTableCellElementTypeId::HTMLTableDataCellElement, localName, prefix, document)
}
}

View file

@ -35,7 +35,9 @@ pub struct HTMLTableElement {
impl HTMLTableElementDerived for EventTarget {
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