Commit Graph

2598 Commits

Author SHA1 Message Date
dependabot-preview[bot] f90d58703a build(deps): bump pretty_assertions from 0.7.1 to 0.7.2
Bumps [pretty_assertions](https://github.com/colin-kiegel/rust-pretty-assertions) from 0.7.1 to 0.7.2.
- [Release notes](https://github.com/colin-kiegel/rust-pretty-assertions/releases)
- [Changelog](https://github.com/colin-kiegel/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/colin-kiegel/rust-pretty-assertions/compare/v0.7.1...v0.7.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-15 14:30:00 -07:00
Mike Welsh a45a5c2bcb avm1: _levelN should shadow children instances with the same name
If a child clip is named `_level0`, accessing `_level0` should
return the level and not the child clip.

Move `DisplayObject::get_level_by_path` to `StageObject`, and
change it to return an `Option<Value>`, and return
`Some(Value::Undefined)` if the path is a valid level path but
the level is not occupied. This causes get/set of `_levelN` to
be swallowed, even if the level isn't populated.
2021-04-15 13:49:17 -07:00
Mike Welsh 34886933e5 avm1: Adjust precedence of children in StageObject::get
Children instances should shadow display object magic properties.
For example, a child named "_x" will be returned instead of the
parent's _x position in GetMember.
2021-04-15 13:49:17 -07:00
Mike Welsh 9224e85a2d avm1: Delete2 returns true only if a property was actually deleted
This was incorrectly returning true for children instances
(`delete "clip"`).
2021-04-15 13:49:17 -07:00
Mike Welsh d04989cf49 tests: Update stage_object_children test
Add a few tests for shadowing of child instances vs. display
object magic properties (for example, when a child clip is named
"_x" or "_level0").
2021-04-15 13:49:17 -07:00
desuwa 0d6c548be4 tests: Add tests for Player::run_actions at timer callbacks. 2021-04-15 13:48:27 -07:00
desuwa 3030f2098a avm1: Run Player::run_actions after every timer callback. 2021-04-15 13:48:27 -07:00
EmperorBale 04d80e5e4e chore: Fix more typos 2021-04-15 00:02:40 -07:00
EmperorBale 0ea02919b3 chore: Fix typo 2021-04-15 00:02:40 -07:00
EmperorBale d227c6cbce chore: Fix formatting 2021-04-15 00:02:40 -07:00
EmperorBale 153da75304 tests: Add test for IsType 2021-04-15 00:02:40 -07:00
EmperorBale cbf8d77006 avm2: Fix IsType 2021-04-15 00:02:40 -07:00
EmperorBale e4ba4b074a tests: Add test for AsType 2021-04-15 00:02:40 -07:00
EmperorBale ca2709f594 avm2: Implement AsType 2021-04-15 00:02:40 -07:00
EmperorBale 17acebb108 chore: Fix formatting 2021-04-15 00:02:40 -07:00
EmperorBale f459e18b1a tests: Update regression tests 2021-04-15 00:02:40 -07:00
EmperorBale 1d0c2b78b2 tests: Add test for AsTypeLate 2021-04-15 00:02:40 -07:00
EmperorBale c0a56b14c0 avm2: Implement AsTypeLate 2021-04-15 00:02:40 -07:00
Mike Welsh b9d84c0a82 chore: Appease clippy
Honor the branches-sharing-code lint.
2021-04-15 00:02:27 -07:00
Mike Welsh d87be39e3c avm2: Don't parse "inf" as Infinity 2021-04-14 21:51:48 -07:00
Mike Welsh b6945395a8 avm1: Don't parse "inf" as Infinity
Rust nightly 4/13 allows f64::parse to handle "infinity", case
insensitive. This broke cases such as `Number("Infinity")`, which
should return `NaN` in AVM1.

Additionally, Rust will now print "-0" for negative zero, when
previously it would print "0".

 * Return NaN for inf cases ("inf", "-Infinity", "+INF", etc.)
 * Add a test for `Number("inf")` (this was also incorrect before
   the latest nightly)
 * Add a special case for zero in `f64_to_string` to ensure
   that -0.0 gets coerced to "0".

For more info, see:
https://github.com/rust-lang/rfcs/issues/1074
2021-04-14 21:51:48 -07:00
Adrian Wielgosik b2bed7a18d
avm1: Add missing clearTimeout() (fix #4003) 2021-04-14 11:02:04 -07:00
Moulins f9bbe96812 core: Remove extra Option/Results from XmlNode getters
This removes some special cases and simplifies the code.
2021-04-11 14:16:48 -07:00
Moulins ae1a01d181 avm1: Allow XMLNode reparenting (closes #3962)
`XMLNode.{appendChild, insertNode}` can now be used to move
child nodes from a parent to another.

There are two special cases:
  - if the node is already a child of the destination, nothing happens
  - if moving the node would create a cycle, nothing happens
2021-04-11 14:16:48 -07:00
relrelb 20d6fcc128 chore: Remove unnecessary type annotations 2021-04-10 18:39:16 -07:00
Mike Welsh 11f40384da tests: Add test for loading into _root 2021-04-10 13:48:05 -07:00
Mike Welsh aa0707411c avm1: Update movie parameters when loading into _root/_level0
The movie framerate and dimensions should be changed when a movie
is loaded into _root or level 0.
2021-04-10 13:48:05 -07:00
David Wendt 7a781179aa core: Move all of the remaining AVM2 object allocation and/or construction into the `construct_frame` step. 2021-04-09 22:24:22 -07:00
David Wendt dc5b30e460 core: Remove "constructor ran" flag now that we can handle that with a local bool 2021-04-09 22:24:22 -07:00
David Wendt 27d09084fb core: Use the library's AVM type to determine how to name the root.
We cannot check it's constructed AVM value anymore because it is now named before construction.
2021-04-09 22:24:22 -07:00
David Wendt ebc5c3dd64 avm2: Ensure that objects are only *ever* constructed at frame construction time.
This ensures that root movie classes see their children in their constructor.
2021-04-09 22:24:22 -07:00
desuwa e8de3a5a20 tests: Add tests for `MovieClip.hitTest()` with shapeflag and masks. 2021-04-09 22:11:07 -07:00
desuwa 4f90b9d161 avm1: Support masks when mouse-picking. 2021-04-09 22:11:07 -07:00
relrelb f8b589fc24 core: Fix panic in remove_invalid_jpeg_data
`data` could be shorter than 4 bytes.
2021-04-09 14:47:19 -07:00
desuwa 755409673b avm2: Add tests for set_width / set_height setting the scale to non-finite values. 2021-04-07 17:42:28 -06:00
desuwa 3c2d467a5f avm1: Add tests for set_width / set_height setting the scale to non-finite values. 2021-04-07 17:42:28 -06:00
desuwa fa1fde7083 core: Ensure the new scale is finite when setting the width / height of display objects. 2021-04-07 17:42:28 -06:00
desuwa b7bf8334b2 core: Run `update_drag` earlier in the update cycle. Fix #1511 2021-04-06 15:48:06 -06:00
relrelb 732efb27c4 render: Fix RGB15 bitmaps decoding
Each row should be padded to 2.
2021-04-05 20:10:35 -06:00
David Wendt 5d198952e8 chore: Fix merge conflict mis-resolution 2021-04-05 16:18:37 -06:00
David Wendt 5cba07111e avm2: Impl `LoaderInfo.parameters` 2021-04-05 16:18:37 -06:00
David Wendt de1b0d4d0c core: Add support for an explicit loader URL (though nothing sets it yet) and expose it in `LoaderInfo`. 2021-04-05 16:18:37 -06:00
David Wendt 4eee8be911 avm2: Impl `SWFVersion` enumeration 2021-04-05 16:18:37 -06:00
David Wendt 4c314a47cc avm2: Impl `LoaderInfo.bytes` 2021-04-05 16:18:37 -06:00
David Wendt a9328b228f avm2: Allow writing to `ByteArrayStorage` 2021-04-05 16:18:37 -06:00
David Wendt f61ea0b290 chore: Clippy beta/nightly compliance 2021-04-05 16:18:37 -06:00
David Wendt 46bf1b33c4 avm2: Impl `LoaderInfo.width` 2021-04-05 16:18:37 -06:00
David Wendt 28a1cb4308 avm2: Impl `LoaderInfo.url` 2021-04-05 16:18:37 -06:00
David Wendt 5941d6cf66 avm2: Impl `LoaderInfo.swfVersion` 2021-04-05 16:18:37 -06:00
David Wendt 6814fb9c22 avm2: Stub `LoaderInfo.isURLInaccessible` 2021-04-05 16:18:37 -06:00