mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Fix some "unnecessary parentheses" warnings
This commit is contained in:
parent
6e3fba97bd
commit
897a5b39c5
8 changed files with 9 additions and 9 deletions
|
@ -548,7 +548,7 @@ impl SizeConstraint {
|
||||||
max_size = max_size.map(|x| max(x, min_size));
|
max_size = max_size.map(|x| max(x, min_size));
|
||||||
|
|
||||||
if let Some(border) = border {
|
if let Some(border) = border {
|
||||||
min_size = max((min_size - border), Au(0));
|
min_size = max(min_size - border, Au(0));
|
||||||
max_size = max_size.map(|x| max(x - border, Au(0)));
|
max_size = max_size.map(|x| max(x - border, Au(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -868,7 +868,7 @@ pub fn process_node_overflow_request<N: LayoutNode>(requested_node: N) -> NodeOv
|
||||||
let style = &*layout_node.as_element().unwrap().resolved_style();
|
let style = &*layout_node.as_element().unwrap().resolved_style();
|
||||||
let style_box = style.get_box();
|
let style_box = style.get_box();
|
||||||
|
|
||||||
NodeOverflowResponse(Some((Point2D::new(style_box.overflow_x, style_box.overflow_y))))
|
NodeOverflowResponse(Some(Point2D::new(style_box.overflow_x, style_box.overflow_y)))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process_margin_style_query<N: LayoutNode>(requested_node: N)
|
pub fn process_margin_style_query<N: LayoutNode>(requested_node: N)
|
||||||
|
|
|
@ -103,7 +103,7 @@ impl CSSRuleList {
|
||||||
let parent_stylesheet = &*self.parent_stylesheet;
|
let parent_stylesheet = &*self.parent_stylesheet;
|
||||||
let dom_rule = CSSRule::new_specific(&window, parent_stylesheet, new_rule);
|
let dom_rule = CSSRule::new_specific(&window, parent_stylesheet, new_rule);
|
||||||
self.dom_rules.borrow_mut().insert(index, MutNullableDom::new(Some(&*dom_rule)));
|
self.dom_rules.borrow_mut().insert(index, MutNullableDom::new(Some(&*dom_rule)));
|
||||||
Ok((idx))
|
Ok(idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// In case of a keyframe rule, index must be valid.
|
// In case of a keyframe rule, index must be valid.
|
||||||
|
|
|
@ -106,7 +106,7 @@ impl PerformanceObserverMethods for PerformanceObserver {
|
||||||
// step 2
|
// step 2
|
||||||
// There must be at least one valid entry type.
|
// There must be at least one valid entry type.
|
||||||
if entry_types.is_empty() {
|
if entry_types.is_empty() {
|
||||||
return Err((Error::Type("entryTypes cannot be empty".to_string())));
|
return Err(Error::Type("entryTypes cannot be empty".to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// step 3-4-5
|
// step 3-4-5
|
||||||
|
|
|
@ -39,14 +39,14 @@ impl Screen {
|
||||||
let (send, recv) = ipc::channel::<(Size2D<u32>)>().unwrap();
|
let (send, recv) = ipc::channel::<(Size2D<u32>)>().unwrap();
|
||||||
self.window.upcast::<GlobalScope>()
|
self.window.upcast::<GlobalScope>()
|
||||||
.script_to_constellation_chan().send(ScriptMsg::GetScreenSize(send)).unwrap();
|
.script_to_constellation_chan().send(ScriptMsg::GetScreenSize(send)).unwrap();
|
||||||
recv.recv().unwrap_or((Size2D::zero()))
|
recv.recv().unwrap_or(Size2D::zero())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn screen_avail_size(&self) -> Size2D<u32> {
|
fn screen_avail_size(&self) -> Size2D<u32> {
|
||||||
let (send, recv) = ipc::channel::<(Size2D<u32>)>().unwrap();
|
let (send, recv) = ipc::channel::<(Size2D<u32>)>().unwrap();
|
||||||
self.window.upcast::<GlobalScope>()
|
self.window.upcast::<GlobalScope>()
|
||||||
.script_to_constellation_chan().send(ScriptMsg::GetScreenAvailSize(send)).unwrap();
|
.script_to_constellation_chan().send(ScriptMsg::GetScreenAvailSize(send)).unwrap();
|
||||||
recv.recv().unwrap_or((Size2D::zero()))
|
recv.recv().unwrap_or(Size2D::zero())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ pub fn slice_to_str<F>(s: *const u8, l: usize, f: F) -> c_int where F: FnOnce(&s
|
||||||
/// All fields are initialized to zero. It is the caller's responsibility to ensure that the given
|
/// All fields are initialized to zero. It is the caller's responsibility to ensure that the given
|
||||||
/// type is a CEF type with `cef_base_t` as its first member.
|
/// type is a CEF type with `cef_base_t` as its first member.
|
||||||
pub unsafe fn create_cef_object<Base,Extra>(size: size_t) -> *mut Base {
|
pub unsafe fn create_cef_object<Base,Extra>(size: size_t) -> *mut Base {
|
||||||
let object = libc::calloc(1, (mem::size_of::<Base>() + mem::size_of::<Extra>())) as
|
let object = libc::calloc(1, mem::size_of::<Base>() + mem::size_of::<Extra>()) as
|
||||||
*mut cef_base_t;
|
*mut cef_base_t;
|
||||||
(*object).size = size;
|
(*object).size = size;
|
||||||
(*object).add_ref = Some(servo_add_ref as extern "C" fn(*mut cef_base_t) -> c_int);
|
(*object).add_ref = Some(servo_add_ref as extern "C" fn(*mut cef_base_t) -> c_int);
|
||||||
|
|
|
@ -199,7 +199,7 @@ cef_unimplemented_wrapper!(cef_string_t, String);
|
||||||
impl<'a> CefWrap<*const cef_string_t> for &'a [u16] {
|
impl<'a> CefWrap<*const cef_string_t> for &'a [u16] {
|
||||||
fn to_c(buffer: &'a [u16]) -> *const cef_string_t {
|
fn to_c(buffer: &'a [u16]) -> *const cef_string_t {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = libc::malloc(((buffer.len() + 1) * 2)) as *mut c_ushort;
|
let ptr = libc::malloc((buffer.len() + 1) * 2) as *mut c_ushort;
|
||||||
ptr::copy(buffer.as_ptr(), ptr, buffer.len());
|
ptr::copy(buffer.as_ptr(), ptr, buffer.len());
|
||||||
*ptr.offset(buffer.len() as isize) = 0;
|
*ptr.offset(buffer.len() as isize) = 0;
|
||||||
|
|
||||||
|
|
|
@ -4396,7 +4396,7 @@ pub extern "C" fn Servo_GetCustomPropertyValue(
|
||||||
None => return false,
|
None => return false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let name = unsafe { Atom::from((&*name)) };
|
let name = unsafe { Atom::from(&*name) };
|
||||||
let computed_value = match custom_properties.get(&name) {
|
let computed_value = match custom_properties.get(&name) {
|
||||||
Some(v) => v,
|
Some(v) => v,
|
||||||
None => return false,
|
None => return false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue