Merge adjacent identical impl sections

Prior to #7416 and #7401, many of these `impl` sections were not
identical
This commit is contained in:
Corey Farwell 2015-08-28 09:52:53 -04:00
parent 6431e8da43
commit 5ccb0d43ef
16 changed files with 0 additions and 52 deletions

View file

@ -77,10 +77,7 @@ impl Blob {
}; };
Ok(Blob::new(global, bytes, &typeString.to_ascii_lowercase())) Ok(Blob::new(global, bytes, &typeString.to_ascii_lowercase()))
} }
}
impl Blob {
pub fn read_out_buffer(&self, send: Sender<Vec<u8>>) { pub fn read_out_buffer(&self, send: Sender<Vec<u8>>) {
send.send(self.bytes.clone().unwrap_or(vec![])).unwrap(); send.send(self.bytes.clone().unwrap_or(vec![])).unwrap();
} }

View file

@ -407,10 +407,7 @@ impl CanvasRenderingContext2D {
Some(Rect::new(Point2D::new(x as f32, y as f32), Size2D::new(w as f32, h as f32))) Some(Rect::new(Point2D::new(x as f32, y as f32), Size2D::new(w as f32, h as f32)))
} }
}
impl CanvasRenderingContext2D {
pub fn get_renderer_id(&self) -> usize { pub fn get_renderer_id(&self) -> usize {
self.renderer_id self.renderer_id
} }

View file

@ -74,9 +74,7 @@ impl CSSStyleDeclaration {
GlobalRef::Window(global), GlobalRef::Window(global),
CSSStyleDeclarationBinding::Wrap) CSSStyleDeclarationBinding::Wrap)
} }
}
impl CSSStyleDeclaration {
fn get_computed_style(&self, property: &Atom) -> Option<DOMString> { fn get_computed_style(&self, property: &Atom) -> Option<DOMString> {
let owner = self.owner.root(); let owner = self.owner.root();
let node = NodeCast::from_ref(owner.r()); let node = NodeCast::from_ref(owner.r());

View file

@ -187,9 +187,7 @@ impl DedicatedWorkerGlobalScope {
own_sender, receiver); own_sender, receiver);
DedicatedWorkerGlobalScopeBinding::Wrap(runtime.cx(), scope) DedicatedWorkerGlobalScopeBinding::Wrap(runtime.cx(), scope)
} }
}
impl DedicatedWorkerGlobalScope {
pub fn run_worker_scope(init: WorkerGlobalScopeInit, pub fn run_worker_scope(init: WorkerGlobalScopeInit,
worker_url: Url, worker_url: Url,
id: PipelineId, id: PipelineId,
@ -242,10 +240,7 @@ impl DedicatedWorkerGlobalScope {
}, reporter_name, parent_sender, CommonScriptMsg::CollectReports); }, reporter_name, parent_sender, CommonScriptMsg::CollectReports);
}); });
} }
}
impl DedicatedWorkerGlobalScope {
pub fn script_chan(&self) -> Box<ScriptChan + Send> { pub fn script_chan(&self) -> Box<ScriptChan + Send> {
box WorkerThreadWorkerChan { box WorkerThreadWorkerChan {
sender: self.own_sender.clone(), sender: self.own_sender.clone(),
@ -269,10 +264,7 @@ impl DedicatedWorkerGlobalScope {
pub fn process_event(&self, msg: CommonScriptMsg) { pub fn process_event(&self, msg: CommonScriptMsg) {
self.handle_script_event(WorkerScriptMsg::Common(msg)); self.handle_script_event(WorkerScriptMsg::Common(msg));
} }
}
impl DedicatedWorkerGlobalScope {
#[allow(unsafe_code)] #[allow(unsafe_code)]
fn receive_event(&self) -> Result<MixedMessage, RecvError> { fn receive_event(&self) -> Result<MixedMessage, RecvError> {
let scope = WorkerGlobalScopeCast::from_ref(self); let scope = WorkerGlobalScopeCast::from_ref(self);

View file

@ -1090,10 +1090,7 @@ impl Document {
} }
document document
} }
}
impl Document {
fn create_node_list<F: Fn(&Node) -> bool>(&self, callback: F) -> Root<NodeList> { fn create_node_list<F: Fn(&Node) -> bool>(&self, callback: F) -> Root<NodeList> {
let window = self.window.root(); let window = self.window.root();
let doc = self.GetDocumentElement(); let doc = self.GetDocumentElement();

View file

@ -40,10 +40,7 @@ impl DOMTokenList {
GlobalRef::Window(window.r()), GlobalRef::Window(window.r()),
DOMTokenListBinding::Wrap) DOMTokenListBinding::Wrap)
} }
}
impl DOMTokenList {
fn attribute(&self) -> Option<Root<Attr>> { fn attribute(&self) -> Option<Root<Attr>> {
let element = self.element.root(); let element = self.element.root();
element.r().get_attribute(&ns!(""), &self.local_name) element.r().get_attribute(&ns!(""), &self.local_name)

View file

@ -163,10 +163,7 @@ impl EventTarget {
pub fn type_id<'a>(&'a self) -> &'a EventTargetTypeId { pub fn type_id<'a>(&'a self) -> &'a EventTargetTypeId {
&self.type_id &self.type_id
} }
}
impl EventTarget {
pub fn dispatch_event_with_target(&self, pub fn dispatch_event_with_target(&self,
target: &EventTarget, target: &EventTarget,
event: &Event) -> bool { event: &Event) -> bool {

View file

@ -44,9 +44,7 @@ impl HTMLCollection {
reflect_dom_object(box HTMLCollection::new_inherited(collection), reflect_dom_object(box HTMLCollection::new_inherited(collection),
GlobalRef::Window(window), HTMLCollectionBinding::Wrap) GlobalRef::Window(window), HTMLCollectionBinding::Wrap)
} }
}
impl HTMLCollection {
pub fn create(window: &Window, root: &Node, pub fn create(window: &Window, root: &Node,
filter: Box<CollectionFilter + 'static>) -> Root<HTMLCollection> { filter: Box<CollectionFilter + 'static>) -> Root<HTMLCollection> {
HTMLCollection::new(window, Collection(JS::from_ref(root), filter)) HTMLCollection::new(window, Collection(JS::from_ref(root), filter))

View file

@ -77,10 +77,7 @@ impl HTMLElement {
let element = HTMLElement::new_inherited(HTMLElementTypeId::HTMLElement, localName, prefix, document); let element = HTMLElement::new_inherited(HTMLElementTypeId::HTMLElement, localName, prefix, document);
Node::reflect_node(box element, document, HTMLElementBinding::Wrap) Node::reflect_node(box element, document, HTMLElementBinding::Wrap)
} }
}
impl HTMLElement {
fn is_body_or_frameset(&self) -> bool { fn is_body_or_frameset(&self) -> bool {
let eventtarget = EventTargetCast::from_ref(self); let eventtarget = EventTargetCast::from_ref(self);
eventtarget.is_htmlbodyelement() || eventtarget.is_htmlframesetelement() eventtarget.is_htmlbodyelement() || eventtarget.is_htmlframesetelement()

View file

@ -159,9 +159,7 @@ impl HTMLIFrameElement {
pub fn update_subpage_id(&self, new_subpage_id: SubpageId) { pub fn update_subpage_id(&self, new_subpage_id: SubpageId) {
self.subpage_id.set(Some(new_subpage_id)); self.subpage_id.set(Some(new_subpage_id));
} }
}
impl HTMLIFrameElement {
#[allow(unsafe_code)] #[allow(unsafe_code)]
pub fn get_width(&self) -> LengthOrPercentageOrAuto { pub fn get_width(&self) -> LengthOrPercentageOrAuto {
unsafe { unsafe {
@ -183,9 +181,7 @@ impl HTMLIFrameElement {
}).unwrap_or(LengthOrPercentageOrAuto::Auto) }).unwrap_or(LengthOrPercentageOrAuto::Auto)
} }
} }
}
impl HTMLIFrameElement {
fn new_inherited(localName: DOMString, fn new_inherited(localName: DOMString,
prefix: Option<DOMString>, prefix: Option<DOMString>,
document: &Document) -> HTMLIFrameElement { document: &Document) -> HTMLIFrameElement {

View file

@ -143,9 +143,7 @@ impl HTMLImageElement {
} }
} }
} }
}
impl HTMLImageElement {
fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLImageElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLImageElement {
HTMLImageElement { HTMLImageElement {
htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLImageElement, localName, prefix, document), htmlelement: HTMLElement::new_inherited(HTMLElementTypeId::HTMLImageElement, localName, prefix, document),

View file

@ -503,10 +503,7 @@ impl HTMLScriptElement {
pub fn mark_already_started(&self) { pub fn mark_already_started(&self) {
self.already_started.set(true); self.already_started.set(true);
} }
}
impl HTMLScriptElement {
fn dispatch_event(&self, fn dispatch_event(&self,
type_: DOMString, type_: DOMString,
bubbles: EventBubbles, bubbles: EventBubbles,

View file

@ -48,10 +48,7 @@ impl HTMLStyleElement {
let element = HTMLStyleElement::new_inherited(localName, prefix, document); let element = HTMLStyleElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLStyleElementBinding::Wrap) Node::reflect_node(box element, document, HTMLStyleElementBinding::Wrap)
} }
}
impl HTMLStyleElement {
pub fn parse_own_css(&self) { pub fn parse_own_css(&self) {
let node = NodeCast::from_ref(self); let node = NodeCast::from_ref(self);
let element = ElementCast::from_ref(self); let element = ElementCast::from_ref(self);

View file

@ -50,11 +50,7 @@ impl HTMLTableRowElement {
document, document,
HTMLTableRowElementBinding::Wrap) HTMLTableRowElementBinding::Wrap)
} }
}
impl HTMLTableRowElement {
pub fn get_background_color(&self) -> Option<RGBA> { pub fn get_background_color(&self) -> Option<RGBA> {
self.background_color.get() self.background_color.get()
} }

View file

@ -49,10 +49,7 @@ impl HTMLTableSectionElement {
let element = HTMLTableSectionElement::new_inherited(localName, prefix, document); let element = HTMLTableSectionElement::new_inherited(localName, prefix, document);
Node::reflect_node(box element, document, HTMLTableSectionElementBinding::Wrap) Node::reflect_node(box element, document, HTMLTableSectionElementBinding::Wrap)
} }
}
impl HTMLTableSectionElement {
pub fn get_background_color(&self) -> Option<RGBA> { pub fn get_background_color(&self) -> Option<RGBA> {
self.background_color.get() self.background_color.get()
} }

View file

@ -49,10 +49,7 @@ impl ImageData {
reflect_dom_object(imagedata, reflect_dom_object(imagedata,
global, ImageDataBinding::Wrap) global, ImageDataBinding::Wrap)
} }
}
impl ImageData {
#[allow(unsafe_code)] #[allow(unsafe_code)]
pub fn get_data_array(&self, global: &GlobalRef) -> Vec<u8> { pub fn get_data_array(&self, global: &GlobalRef) -> Vec<u8> {
unsafe { unsafe {