Bug 1607697 - Address clippy lints about nested branches. r=Gankro

Differential Revision: https://phabricator.services.mozilla.com/D59115

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Silva 2020-01-08 15:40:57 +00:00
Родитель 889e5a96f2
Коммит e78fd8f034
6 изменённых файлов: 41 добавлений и 49 удалений

Просмотреть файл

@ -2009,10 +2009,9 @@ impl TileCacheInstance {
// If the clip has the same spatial node, the relative transform
// will always be the same, so there's no need to depend on it.
let clip_node = &data_stores.clip[clip_instance.handle];
if clip_node.item.spatial_node_index != self.spatial_node_index {
if !prim_info.spatial_nodes.contains(&clip_node.item.spatial_node_index) {
prim_info.spatial_nodes.push(clip_node.item.spatial_node_index);
}
if clip_node.item.spatial_node_index != self.spatial_node_index
&& !prim_info.spatial_nodes.contains(&clip_node.item.spatial_node_index) {
prim_info.spatial_nodes.push(clip_node.item.spatial_node_index);
}
}
@ -2123,10 +2122,10 @@ impl TileCacheInstance {
// If a text run is on a child surface, the subpx mode will be
// correctly determined as we recurse through pictures in take_context.
if on_picture_surface && subpx_requested {
if !self.backdrop.rect.contains_rect(&pic_clip_rect) {
self.subpixel_mode = SubpixelMode::Deny;
}
if on_picture_surface
&& subpx_requested
&& !self.backdrop.rect.contains_rect(&pic_clip_rect) {
self.subpixel_mode = SubpixelMode::Deny;
}
}
}
@ -2175,13 +2174,13 @@ impl TileCacheInstance {
}
};
if is_suitable_backdrop {
if !prim_clip_chain.needs_mask && pic_clip_rect.contains_rect(&self.backdrop.rect) {
self.backdrop = BackdropInfo {
rect: pic_clip_rect,
kind: backdrop_candidate,
}
}
if is_suitable_backdrop
&& !prim_clip_chain.needs_mask
&& pic_clip_rect.contains_rect(&self.backdrop.rect) {
self.backdrop = BackdropInfo {
rect: pic_clip_rect,
kind: backdrop_candidate,
};
}
}
@ -4405,13 +4404,11 @@ impl PicturePrimitive {
debug_assert_eq!(surface_index, raster_config.surface_index);
// Check if any of the surfaces can't be rasterized in local space but want to.
if raster_config.establishes_raster_root {
if surface_rect.size.width > MAX_SURFACE_SIZE ||
surface_rect.size.height > MAX_SURFACE_SIZE
{
raster_config.establishes_raster_root = false;
state.are_raster_roots_assigned = false;
}
if raster_config.establishes_raster_root
&& (surface_rect.size.width > MAX_SURFACE_SIZE
|| surface_rect.size.height > MAX_SURFACE_SIZE) {
raster_config.establishes_raster_root = false;
state.are_raster_roots_assigned = false;
}
// Set the estimated and precise local rects. The precise local rect

Просмотреть файл

@ -2018,10 +2018,8 @@ impl PrimitiveStore {
let pic = &self.pictures[pic_index.0];
prim_instance.prim_origin = pic.precise_local_rect.origin;
if prim_instance.is_chased() {
if pic.estimated_local_rect != pic.precise_local_rect {
println!("\testimate {:?} adjusted to {:?}", pic.estimated_local_rect, pic.precise_local_rect);
}
if prim_instance.is_chased() && pic.estimated_local_rect != pic.precise_local_rect {
println!("\testimate {:?} adjusted to {:?}", pic.estimated_local_rect, pic.precise_local_rect);
}
let mut shadow_rect = pic.precise_local_rect;
@ -2253,9 +2251,11 @@ impl PrimitiveStore {
frame_state.scratch.push_debug_rect(debug_rect, debug_color, debug_color.scale_alpha(0.5));
}
} else if frame_context.debug_flags.contains(::api::DebugFlags::OBSCURE_IMAGES) {
if matches!(prim_instance.kind, PrimitiveInstanceKind::Image { .. } |
PrimitiveInstanceKind::YuvImage { .. })
{
let is_image = matches!(
prim_instance.kind,
PrimitiveInstanceKind::Image { .. } | PrimitiveInstanceKind::YuvImage { .. }
);
if is_image {
// We allow "small" images, since they're generally UI elements.
let rect = clipped_world_rect * frame_context.global_device_pixel_scale;
if rect.size.width > 70.0 && rect.size.height > 70.0 {

Просмотреть файл

@ -456,11 +456,10 @@ impl Document {
}
};
if self.hit_tester.is_some() {
if self.scroll_nearest_scrolling_ancestor(delta, node_index) {
self.hit_tester_is_valid = false;
self.frame_is_valid = false;
}
if self.hit_tester.is_some()
&& self.scroll_nearest_scrolling_ancestor(delta, node_index) {
self.hit_tester_is_valid = false;
self.frame_is_valid = false;
}
return DocumentOps {

Просмотреть файл

@ -3131,7 +3131,7 @@ impl Renderer {
doc_index == 0,
);
if let Some(_) = device_size {
if device_size.is_some() {
self.draw_frame_debug_items(&frame.debug_items);
}
if self.debug_flags.contains(DebugFlags::PROFILER_DBG) {

Просмотреть файл

@ -786,17 +786,15 @@ impl ResourceCache {
_ => {}
}
} else {
if let RasterizedBlob::NonTiled(ref mut queue) = *image {
// If our new rasterized rect overwrites items in the queue, discard them.
queue.retain(|img| {
!data.rasterized_rect.contains_rect(&img.rasterized_rect)
});
} else if let RasterizedBlob::NonTiled(ref mut queue) = *image {
// If our new rasterized rect overwrites items in the queue, discard them.
queue.retain(|img| {
!data.rasterized_rect.contains_rect(&img.rasterized_rect)
});
queue.push(data);
} else {
*image = RasterizedBlob::NonTiled(vec![data]);
}
queue.push(data);
} else {
*image = RasterizedBlob::NonTiled(vec![data]);
}
}
}

Просмотреть файл

@ -673,10 +673,8 @@ impl SceneBuilderThread {
if let &Some(ref hooks) = &self.hooks {
hooks.post_resource_update(&have_resources_updates);
}
} else {
if let &Some(ref hooks) = &self.hooks {
hooks.post_empty_scene_build();
}
} else if let Some(ref hooks) = self.hooks {
hooks.post_empty_scene_build();
}
}