Skip to content

Commit

Permalink
More code refactoring (exampleVar to example_var)
Browse files Browse the repository at this point in the history
  • Loading branch information
bubbles231 committed Sep 18, 2016
1 parent 5fa5417 commit dbec9d8
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
8 changes: 4 additions & 4 deletions components/script/dom/browsingcontext.rs
Expand Up @@ -230,7 +230,7 @@ impl SessionHistoryEntry {
}

#[allow(unsafe_code)]
unsafe fn GetSubframeWindow(cx: *mut JSContext,
unsafe fn get_subframe_window(cx: *mut JSContext,
proxy: HandleObject,
id: HandleId)
-> Option<Root<Window>> {
Expand All @@ -251,7 +251,7 @@ unsafe extern "C" fn getOwnPropertyDescriptor(cx: *mut JSContext,
id: HandleId,
mut desc: MutableHandle<PropertyDescriptor>)
-> bool {
let window = GetSubframeWindow(cx, proxy, id);
let window = get_subframe_window(cx, proxy, id);
if let Some(window) = window {
rooted!(in(cx) let mut val = UndefinedValue());
window.to_jsval(cx, val.handle_mut());
Expand Down Expand Up @@ -300,7 +300,7 @@ unsafe extern "C" fn has(cx: *mut JSContext,
id: HandleId,
bp: *mut bool)
-> bool {
let window = GetSubframeWindow(cx, proxy, id);
let window = get_subframe_window(cx, proxy, id);
if window.is_some() {
*bp = true;
return true;
Expand All @@ -323,7 +323,7 @@ unsafe extern "C" fn get(cx: *mut JSContext,
id: HandleId,
vp: MutableHandleValue)
-> bool {
let window = GetSubframeWindow(cx, proxy, id);
let window = get_subframe_window(cx, proxy, id);
if let Some(window) = window {
window.to_jsval(cx, vp);
return true;
Expand Down
12 changes: 6 additions & 6 deletions components/script/dom/canvasrenderingcontext2d.rs
Expand Up @@ -1096,16 +1096,16 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
imagedata: &ImageData,
dx: Finite<f64>,
dy: Finite<f64>,
dirtyX: Finite<f64>,
dirtyY: Finite<f64>,
dirtyWidth: Finite<f64>,
dirtyHeight: Finite<f64>) {
dirty_x: Finite<f64>,
dirty_y: Finite<f64>,
dirty_width: Finite<f64>,
dirty_height: Finite<f64>) {
let data = imagedata.get_data_array();
let offset = Point2D::new(*dx, *dy);
let image_data_size = Size2D::new(imagedata.Width() as f64, imagedata.Height() as f64);

let dirty_rect = Rect::new(Point2D::new(*dirtyX, *dirtyY),
Size2D::new(*dirtyWidth, *dirtyHeight));
let dirty_rect = Rect::new(Point2D::new(*dirty_x, *dirty_y),
Size2D::new(*dirty_width, *dirty_height));
let msg = CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data,
offset,
image_data_size,
Expand Down
8 changes: 4 additions & 4 deletions components/script/dom/closeevent.rs
Expand Up @@ -17,16 +17,16 @@ use string_cache::Atom;
#[dom_struct]
pub struct CloseEvent {
event: Event,
wasClean: bool,
was_clean: bool,
code: u16,
reason: DOMString,
}

impl CloseEvent {
pub fn new_inherited(wasClean: bool, code: u16, reason: DOMString) -> CloseEvent {
pub fn new_inherited(was_clean: bool, code: u16, reason: DOMString) -> CloseEvent {
CloseEvent {
event: Event::new_inherited(),
wasClean: wasClean,
was_clean: was_clean,
code: code,
reason: reason,
}
Expand Down Expand Up @@ -77,7 +77,7 @@ impl CloseEvent {
impl CloseEventMethods for CloseEvent {
// https://html.spec.whatwg.org/multipage/#dom-closeevent-wasclean
fn WasClean(&self) -> bool {
self.wasClean
self.was_clean
}

// https://html.spec.whatwg.org/multipage/#dom-closeevent-code
Expand Down
4 changes: 2 additions & 2 deletions components/script/dom/console.rs
Expand Up @@ -101,11 +101,11 @@ fn timestamp_in_ms(time: Timespec) -> u64 {
(time.sec * 1000 + (time.nsec / 1000000) as i64) as u64
}

fn prepare_message(logLevel: LogLevel, message: DOMString) -> ConsoleMessage {
fn prepare_message(log_level: LogLevel, message: DOMString) -> ConsoleMessage {
// TODO: Sending fake values for filename, lineNumber and columnNumber in LogMessage; adjust later
ConsoleMessage {
message: String::from(message),
logLevel: logLevel,
logLevel: log_level,
filename: "test".to_owned(),
lineNumber: 1,
columnNumber: 1,
Expand Down
44 changes: 22 additions & 22 deletions components/script/dom/document.rs
Expand Up @@ -733,13 +733,13 @@ impl Document {
// https://w3c.github.io/uievents/#event-type-click
let client_x = client_point.x as i32;
let client_y = client_point.y as i32;
let clickCount = 1;
let click_count = 1;
let event = MouseEvent::new(&self.window,
DOMString::from(mouse_event_type_string),
EventBubbles::Bubbles,
EventCancelable::Cancelable,
Some(&self.window),
clickCount,
click_count,
client_x,
client_y,
client_x,
Expand Down Expand Up @@ -804,7 +804,7 @@ impl Document {
if now.duration_since(last_time) < DBL_CLICK_TIMEOUT &&
dist < DBL_CLICK_DIST_THRESHOLD as f64 {
// A double click has occurred if this click is within a certain time and dist. of previous click.
let clickCount = 2;
let click_count = 2;
let client_x = click_pos.x as i32;
let client_y = click_pos.y as i32;

Expand All @@ -813,7 +813,7 @@ impl Document {
EventBubbles::Bubbles,
EventCancelable::Cancelable,
Some(&self.window),
clickCount,
click_count,
client_x,
client_y,
client_x,
Expand Down Expand Up @@ -1617,7 +1617,7 @@ impl Document {
}

// https://html.spec.whatwg.org/multipage/#fire-a-focus-event
fn fire_focus_event(&self, focus_event_type: FocusEventType, node: &Node, relatedTarget: Option<&EventTarget>) {
fn fire_focus_event(&self, focus_event_type: FocusEventType, node: &Node, related_target: Option<&EventTarget>) {
let (event_name, does_bubble) = match focus_event_type {
FocusEventType::Focus => (DOMString::from("focus"), EventBubbles::DoesNotBubble),
FocusEventType::Blur => (DOMString::from("blur"), EventBubbles::DoesNotBubble),
Expand All @@ -1628,7 +1628,7 @@ impl Document {
EventCancelable::NotCancelable,
Some(&self.window),
0i32,
relatedTarget);
related_target);
let event = event.upcast::<Event>();
event.set_trusted(true);
let target = node.upcast();
Expand Down Expand Up @@ -2380,33 +2380,33 @@ impl DocumentMethods for Document {
// https://dom.spec.whatwg.org/#dom-document-createnodeiteratorroot-whattoshow-filter
fn CreateNodeIterator(&self,
root: &Node,
whatToShow: u32,
what_to_show: u32,
filter: Option<Rc<NodeFilter>>)
-> Root<NodeIterator> {
NodeIterator::new(self, root, whatToShow, filter)
NodeIterator::new(self, root, what_to_show, filter)
}

// https://w3c.github.io/touch-events/#idl-def-Document
fn CreateTouch(&self,
window: &Window,
target: &EventTarget,
identifier: i32,
pageX: Finite<f64>,
pageY: Finite<f64>,
screenX: Finite<f64>,
screenY: Finite<f64>)
page_x: Finite<f64>,
page_y: Finite<f64>,
screen_x: Finite<f64>,
screen_y: Finite<f64>)
-> Root<Touch> {
let clientX = Finite::wrap(*pageX - window.PageXOffset() as f64);
let clientY = Finite::wrap(*pageY - window.PageYOffset() as f64);
let client_x = Finite::wrap(*page_x - window.PageXOffset() as f64);
let client_y = Finite::wrap(*page_y - window.PageYOffset() as f64);
Touch::new(window,
identifier,
target,
screenX,
screenY,
clientX,
clientY,
pageX,
pageY)
screen_x,
screen_y,
client_x,
client_y,
page_x,
page_y)
}

// https://w3c.github.io/touch-events/#idl-def-document-createtouchlist(touch...)
Expand All @@ -2417,10 +2417,10 @@ impl DocumentMethods for Document {
// https://dom.spec.whatwg.org/#dom-document-createtreewalker
fn CreateTreeWalker(&self,
root: &Node,
whatToShow: u32,
what_to_show: u32,
filter: Option<Rc<NodeFilter>>)
-> Root<TreeWalker> {
TreeWalker::new(self, root, whatToShow, filter)
TreeWalker::new(self, root, what_to_show, filter)
}

// https://html.spec.whatwg.org/multipage/#document.title
Expand Down

0 comments on commit dbec9d8

Please sign in to comment.