chore: cargo 1.47 changed the formatting algorithm

This commit is contained in:
David Wendt 2020-11-14 20:12:00 -05:00 committed by Mike Welsh
parent 365601f2d9
commit 8764831533
5 changed files with 34 additions and 18 deletions

View File

@ -10,8 +10,8 @@ use crate::avm2::value::Value;
use crate::avm2::Error;
use crate::context::UpdateContext;
use crate::display_object::{DisplayObject, TDisplayObject, TDisplayObjectContainer};
use gc_arena::{GcCell, MutationContext};
use enumset::EnumSet;
use gc_arena::{GcCell, MutationContext};
use std::cmp::min;
/// Implements `flash.display.DisplayObjectContainer`'s instance constructor.

View File

@ -26,7 +26,9 @@ mod text;
use crate::avm1::activation::Activation;
use crate::backend::input::MouseCursor;
pub use crate::display_object::container::{DisplayObjectContainer, TDisplayObjectContainer, Lists};
pub use crate::display_object::container::{
DisplayObjectContainer, Lists, TDisplayObjectContainer,
};
use crate::events::{ClipEvent, ClipEventResult};
pub use bitmap::Bitmap;
pub use button::Button;

View File

@ -5,25 +5,25 @@ use crate::display_object::button::Button;
use crate::display_object::movie_clip::MovieClip;
use crate::display_object::{Depth, DisplayObject, TDisplayObject};
use crate::string_utils::swf_string_eq_ignore_case;
use enumset::{EnumSet, EnumSetType};
use gc_arena::{Collect, MutationContext};
use ruffle_macros::enum_trait_object;
use enumset::{EnumSet, EnumSetType};
use std::cmp::Ordering;
use std::collections::BTreeMap;
use std::fmt::Debug;
use std::ops::{RangeBounds, Bound};
use std::ops::{Bound, RangeBounds};
/// The three lists that a display object container is supposed to maintain.
#[derive(EnumSetType)]
pub enum Lists {
/// The list that determines the order in which children are rendered.
///
///
/// This is directly manipulated by AVM2 code.
Render,
/// The list that determines the identity of children according to the
/// timeline and AVM1 code.
///
///
/// Manipulations of the depth list are generally propagated to the render
/// list, except in cases where children have been reordered by AVM2.
Depth,
@ -135,7 +135,7 @@ pub trait TDisplayObjectContainer<'gc>:
///
/// If the child was found on any of the container's lists, this function
/// will return `true`.
///
///
/// You can control which lists a child should be removed from with the
/// `from_lists` parameter. If a list is omitted from `from_lists`, then
/// not only will the child remain, but the return code will also not take
@ -569,7 +569,11 @@ impl<'gc> ChildContainer<'gc> {
None
}
} else if let Some((_, above_child)) = self.depth_list.range((Bound::Excluded(depth), Bound::Unbounded)).next() {
} else if let Some((_, above_child)) = self
.depth_list
.range((Bound::Excluded(depth), Bound::Unbounded))
.next()
{
let position = self
.render_list
.iter()
@ -658,7 +662,7 @@ impl<'gc> ChildContainer<'gc> {
///
/// If the child was found on any of the container's lists, this function
/// will return `true`.
///
///
/// You can control which lists a child should be removed from with the
/// `from_lists` parameter. If a list is omitted from `from_lists`, then
/// not only will the child remain, but the return code will also not take
@ -669,7 +673,8 @@ impl<'gc> ChildContainer<'gc> {
child: DisplayObject<'gc>,
from_lists: EnumSet<Lists>,
) -> bool {
let removed_from_depth_list = from_lists.contains(Lists::Depth) && self.remove_child_from_depth_list(child);
let removed_from_depth_list =
from_lists.contains(Lists::Depth) && self.remove_child_from_depth_list(child);
let removed_from_render_list = if from_lists.contains(Lists::Render) {
let render_list_position = self
@ -689,8 +694,9 @@ impl<'gc> ChildContainer<'gc> {
let removed_from_execution_list = if from_lists.contains(Lists::Execution) {
let present_on_execution_list = child.prev_sibling().is_none()
|| child.next_sibling().is_none()
|| (self.exec_list.is_some() && DisplayObject::ptr_eq(self.exec_list.unwrap(), child));
|| (self.exec_list.is_some()
&& DisplayObject::ptr_eq(self.exec_list.unwrap(), child));
self.remove_child_from_exec_list(context, child);
child.set_parent(context.gc_context, None);

View File

@ -1601,7 +1601,7 @@ impl<'gc> MovieClip<'gc> {
pub fn set_focusable(self, focusable: bool, context: &mut UpdateContext<'_, 'gc, '_>) {
self.0.write(context.gc_context).is_focusable = focusable;
}
/// Handle a RemoveObject tag when running a goto action.
#[inline]
fn goto_remove_object<'a>(
@ -1631,10 +1631,18 @@ impl<'gc> MovieClip<'gc> {
if let Some(child) = read.container.get_depth(depth) {
if !child.placed_by_script() {
drop(read);
self.0.write(context.gc_context).container.remove_child(context, child, EnumSet::all());
self.0.write(context.gc_context).container.remove_child(
context,
child,
EnumSet::all(),
);
} else {
drop(read);
self.0.write(context.gc_context).container.remove_child(context, child, Lists::Depth.into());
self.0.write(context.gc_context).container.remove_child(
context,
child,
Lists::Depth.into(),
);
}
}
}
@ -2842,7 +2850,7 @@ impl<'gc, 'a> MovieClip<'gc> {
} else {
reader.read_remove_object_2()
}?;
if let Some(child) = self.child_by_depth(remove_object.depth.into()) {
if !child.placed_by_script() {
self.remove_child(context, child, EnumSet::all());

View File

@ -1,16 +1,16 @@
pub use crate::bounding_box::BoundingBox;
pub use crate::color_transform::ColorTransform;
pub use crate::display_object::{
DisplayObject, DisplayObjectContainer, TDisplayObject, TDisplayObjectContainer, Lists
DisplayObject, DisplayObjectContainer, Lists, TDisplayObject, TDisplayObjectContainer,
};
pub use crate::{
impl_display_object, impl_display_object_container, impl_display_object_sansbounds,
};
pub use enumset::EnumSet;
pub use log::{error, info, trace, warn};
pub use std::ops::RangeBounds;
pub use swf::Matrix;
pub use swf::{CharacterId, Color, Twips};
pub use enumset::EnumSet;
/// A depth for a Flash display object in AVM1.
/// This is different than defined in `swf`; during execution, clips