Commit Graph

2455 Commits

Author SHA1 Message Date
paq 48d59c0340 chore: Minor refactor names.rs 2021-02-02 10:16:41 -08:00
relrelb 074731e1a4 audio: Add Nellymoser support 2021-02-02 00:41:01 -08:00
Adrian Wielgosik 2c2a9367ae avm1: Respect case-(in)sensitivity in text bindings
Fixes #3031.
2021-02-01 18:09:32 -08:00
Mike Welsh 02d99c3686 core: CSMTextSettings tag alters text hit testing
Normally, a hit test on static text will consider the text glyphs.
However, a CSMTextSettings tag can change the text to use the
"advanced rendering engine", which causes hit tests to only consider
the bounds. This is toggled by the "Anti-alias for readibility"
setting in the Flash IDE.

Wire up the CSMTextSettings tag and adjust hit test behavior based
on this flag.

Fixes #2987.
2021-02-01 17:17:41 -08:00
Mads Marquart 1990e51639 avm2: Add UiBackend::display_unsupported_message
To allow displaying rich content when unsupported ActionScript 3 content is encountered.
2021-01-31 23:04:20 -08:00
Brian Gontowski 31dd2729e2 web: Add an onFSCommand callback into JavaScript 2021-01-31 18:03:31 -08:00
EmperorBale 4122e8a1b0
core: Implement TextField.password property 2021-01-31 12:26:58 -08:00
relrelb 7431cd9b10
core: Merge InputBackend into UiBackend 2021-01-30 16:36:45 -08:00
CUB3D 206ac43703 avm1: Correct ToInteger for undefined, null and object inputs 2021-01-29 19:44:32 -08:00
relrelb 02dfb23c67 core: Remove unneeded pub 2021-01-29 13:05:37 -08:00
relrelb eaf0441f9a avm1: Small refactors 2021-01-29 13:05:37 -08:00
relrelb beff73b815 core: Small refactor 2021-01-29 13:05:37 -08:00
dependabot-preview[bot] 67f793549e build(deps): bump flate2 from 1.0.19 to 1.0.20
Bumps [flate2](https://github.com/rust-lang/flate2-rs) from 1.0.19 to 1.0.20.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.19...1.0.20)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-29 11:43:05 -08:00
dependabot-preview[bot] 6f14490f84 build(deps): bump jpeg-decoder from 0.1.21 to 0.1.22
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder) from 0.1.21 to 0.1.22.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases)
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/image-rs/jpeg-decoder/compare/v0.1.21...v0.1.22)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-29 11:42:19 -08:00
Mike Welsh 477fa06daf avm1: Fix off-by-one error in String.lastIndexOf
Fixes #2873.

Co-authored-by: Toad06 <gd.productions@laposte.net>
2021-01-29 02:59:14 -08:00
Mike Welsh 92e4d781e7 tests: Add test for #2870 2021-01-28 16:36:42 -08:00
Mike Welsh 008f0f596c core: Clip event slices are from parent movie in PlaceObject
Since 19034b7, clip event scripts are returned as slices from the
SWF. This caused a panic when a movie was loaded into a clip,
because the loaded clip's `movie` would be used as the source for
clip events. However, clip events are placed by the parent's
PlaceObject tags, so the movie in this case should be the parent's
movie.

Fixes #2870.
2021-01-28 16:36:42 -08:00
Mads Marquart 39aa7536df core: Remove unsafe NonZeroU32 creation in shape utils 2021-01-28 14:39:35 -08:00
Mike Welsh 0f5bab3e78 core: Use dirty flag for updating sound transforms 2021-01-27 15:25:04 -08:00
Mike Welsh 7eb5389630 core: Avoid vec allocation in AudioManager::update_sounds 2021-01-27 15:25:04 -08:00
Mike Welsh a4699a3ca5 audio: Sound transforms apply to stream sounds
This unifies the code path for event sounds and stream sounds.
Both `AudioBackend::start_stream` and `start_sound` return a
`SoundHandle`. `stop_stream` is removed (`stop_sound` can be
used for both cases).

Also removes references to `CharacterId` from the `AudioBackend`
(instead, an increasing ID is returned to identiy streams while
loading).
2021-01-27 15:25:04 -08:00
Mike Welsh 4c33464115 tests: Add test for Sound 2021-01-27 15:25:04 -08:00
Mike Welsh 95ce2abf17 audio: Remove AudioBackend::stop_sounds_with_handle/is_sound_playing_with_handle 2021-01-27 15:25:04 -08:00
Mike Welsh da2dd3b36c core: Implement sound transforms and Sound.setPan 2021-01-27 15:25:04 -08:00
Mike Welsh 98e6c54c3b avm1: Implement Sound.onSoundComplete 2021-01-27 15:25:04 -08:00
Mike Welsh 34f60b127a core: Add AudioManager to handle actively playing sounds
Add an AudioManager struct to handle this list of actively playing
sounds. This will maintain information for each sound instance,
such as the owning display object, AVM1 object, etc.

This will allow us to implement the awkward AVM1 Sound API in a
fairly backend-agnostic way.
2021-01-27 15:25:04 -08:00
TÖRÖK Attila a89eb6b9b8 avm1: Implement BitmapData.perlinNoise() 2021-01-27 11:53:05 -08:00
Adrian Wielgosik 937b371e30 core: Support grayscale JPEGs 2021-01-26 17:14:27 -08:00
dependabot-preview[bot] 8172ddb1ba build(deps): bump rand from 0.8.2 to 0.8.3
Bumps [rand](https://github.com/rust-random/rand) from 0.8.2 to 0.8.3.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-26 08:52:20 -08:00
dependabot-preview[bot] 7856cdd3d7 build(deps): bump serde from 1.0.122 to 1.0.123
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.122 to 1.0.123.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.122...v1.0.123)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-25 14:14:33 -08:00
Mike Welsh 306d2ead7f core: Avoid panic in EditText::on_changed (fix #2809) 2021-01-24 19:52:30 -08:00
dependabot-preview[bot] 64983cde22 build(deps): bump serde from 1.0.121 to 1.0.122
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.121 to 1.0.122.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.121...v1.0.122)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-24 17:26:09 -08:00
dependabot-preview[bot] 32fd3fb71b build(deps): bump syn from 1.0.59 to 1.0.60
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.59 to 1.0.60.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.59...1.0.60)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-24 14:23:03 -08:00
paq e9ad1587a4 chore: Rename Namespace::public_namespace to Namespace::public 2021-01-24 11:53:43 -08:00
paq b58fcf3b05 chore: Use Namespace::public_namespace() instead of Namespace::package("") 2021-01-24 11:53:43 -08:00
dependabot-preview[bot] 239ccb3511 build(deps): bump jpeg-decoder from 0.1.20 to 0.1.21
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder) from 0.1.20 to 0.1.21.
- [Release notes](https://github.com/image-rs/jpeg-decoder/releases)
- [Changelog](https://github.com/image-rs/jpeg-decoder/blob/master/CHANGELOG.md)
- [Commits](https://github.com/image-rs/jpeg-decoder/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-24 11:52:39 -08:00
dependabot-preview[bot] 86b4c20809 build(deps): bump serde from 1.0.120 to 1.0.121
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.120 to 1.0.121.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.120...v1.0.121)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-23 14:12:08 -08:00
Adrian Wielgosik 0a64c34e73 Make avm11::Value Copy 2021-01-23 12:04:47 -08:00
Adrian Wielgosik 2065812d1a Preallocate AVM1 Values when preparing constant pool 2021-01-23 12:04:47 -08:00
relrelb 19662503ca swf: Convert ButtonActionCondition to bitflags 2021-01-23 11:59:24 -08:00
relrelb 7f4845d777 swf: Convert ButtonState to bitflags 2021-01-23 11:59:24 -08:00
paq c088c18517 chore: Remove Flash's recovery file and add it to .gitignore 2021-01-23 00:29:25 -08:00
dependabot-preview[bot] c0ac8a4a77 build(deps): bump syn from 1.0.58 to 1.0.59
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.58 to 1.0.59.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.58...1.0.59)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-23 00:29:02 -08:00
CUB3D 0cf3a4abed core: Invert pixel fill order for BitmapData.noise 2021-01-22 13:16:19 -08:00
CUB3D d57fd172f9 core: More special casing for noise 2021-01-22 13:16:19 -08:00
CUB3D 00fe7b6468 avm1: Generate correct values for negative seeds for BitmapData.noise() 2021-01-22 13:16:19 -08:00
CUB3D 9ba38784ef avm1: Properly implement BitmapData.noise() for positive seeds 2021-01-22 13:16:19 -08:00
Mike Welsh 82fd9dfd4e chore: Appease clippy 2021-01-21 18:52:43 -08:00
Mike Welsh 78f85d96f0 chore: Remove some debug spew 2021-01-21 18:22:42 -08:00
Aaron Hill b2f5f807de avm2: Print full multiname for "Property does not exist" errors (#2740)
This makes it easy to see when the error is a result of something in the
"flash" package being unimplemented.
2021-01-21 17:52:17 -08:00
relrelb b05c6540e1
chore: Migrate from enumset to bitflags 2021-01-21 16:35:46 -08:00
relrelb ab92bc1b98 tests: Add tests for target clip in SWF6 2021-01-21 14:52:52 -08:00
relrelb 286bf7ac3f tests: Add tests for target clip in SWF5 2021-01-21 14:52:52 -08:00
Toad06 9866a4baef web: Use enum instead of arbitrary values 2021-01-21 14:52:52 -08:00
Mike Welsh 60a95f3ea0 core: Gracefully handle tag length past EOF 2021-01-21 14:04:46 -08:00
Mike Welsh 34e0763cfe avm1: Don't unwrap in ColorTransform methods 2021-01-21 11:48:26 -08:00
Mike Welsh 6e7e5395aa tests: Add test for subclassing a native type 2021-01-21 11:48:26 -08:00
Mike Welsh 5582da9f8a avm1: create_bare_object should properly wire up proto
When a native class was extended, most native types were grabbing
their normal prototype instead of using the user's supplied prototype.
e.g. `class MyColorTransform extends ColorTransform`.
2021-01-21 11:48:26 -08:00
Mike Welsh a6ea28d9b4 avm1: Create proper underlying type when extending native objects (fix #2682) 2021-01-21 11:48:26 -08:00
Mike Welsh e8efe22dee tests: Add test for SWF5 string encoding 2021-01-20 15:02:31 -08:00
Mike Welsh 66256dd3be swf: SwfStr no longer contains encoding
SwfStr is now an unsized slice analogous to `str` or `bstr`.
The desired encoding must be supplied when converting to String.
2021-01-20 15:02:31 -08:00
Mike Welsh 61628a74fc swf: Rename and organize some util methods
* SwfRead -> SwfReadExt
 * SwfWrite -> SwfWriteExt
 * read_swf_header -> decompress_swf
 * read_swf -> parse_swf
2021-01-20 15:02:31 -08:00
Mike Welsh 1d9c11e145 swf: Add SwfStr type to handle encodings in SWF<6 2021-01-20 15:02:31 -08:00
Mike Welsh 19034b76e4 swf: Return slices in swf::Reader
Avoid copies by returning slices of the decompressed input.
2021-01-20 15:02:31 -08:00
klemens 9488a3fb97 spelling fixes 2021-01-18 22:07:39 -08:00
Mike Welsh da1e2801a2 chore: Appease clippy 2021-01-18 21:23:50 -08:00
relrelb c284a2e47e tests: Add export_assets 2021-01-15 11:48:29 -08:00
relrelb abfa08c964 core: Allow exports to be overridden
Per SWF19 p.54, the latter export name is used.
2021-01-15 11:48:29 -08:00
TÖRÖK Attila a01ea70514 core/avm1: Implement BitmapData.copyPixels() 2021-01-14 13:02:55 -08:00
cheezeygeek 1911708ad1 avm1: Fix onChange firing, remove unwraps, revert as_broadcaster 2021-01-13 15:47:20 -08:00
cheezeygeek b3cd9b0f89 avm1: Implement listeners and onChanged for TextField (close #2297) 2021-01-13 15:47:20 -08:00
Mike Welsh df82194823 tests: Add test for case insensitive Object.registerClass in SWF6 2021-01-13 15:38:38 -08:00
Mike Welsh 3c31336c93 chore: Rename some getters 2021-01-13 15:38:38 -08:00
Moulins 26a2b6e4f7 core: Add test for `Object.registerClass` return values 2021-01-13 15:38:38 -08:00
Moulins f394953331 core: Reimplement `Object.registerClass`.
Maintain an external mapping from symbol names to registered
constructors to properly handle `registerClass` being called on
not-yet-available symbols.

SWFs v6 and v7+ each have a separate global mapping, with
different case sensitivities.

Also returns the correct boolean value to the AVM.

Fixes #2343 and #1864.
2021-01-13 15:38:38 -08:00
Mike Welsh 9bb36885bb web: Add backgroundColor option and support bgcolor attribute
Add `backgroundColor` setting to the config options, allowing
a user to override the background color of an SWF. The polyfill
will now look for the `bgcolor` HTML attribute on the embed
and fill in this setting appropriately.
2021-01-13 11:57:19 -08:00
Mike Welsh 4820d5b044 core: Change Player::background_color to an Option
Player::background_color is now an Option. SetBackgroundColor will
change the background color of the player only when this is None,
i.e. only if no background color has yet been set.

This matches the behavior of the offical Flash Player, for example,
if a parent SWF is missing a SetBackgroundColor tag and loads a
child SWF, the child SWF's SetBackgroundColor tag takes effect.

This is anticipating adding a `bgcolor` option to the web builds,
allowing the HTML embed to override the bgcolor.
2021-01-13 11:57:19 -08:00
Adrian Wielgosik 7242bfb5f0
avm1: In ASSetPropFlags, don't crash on flags > 7 2021-01-13 11:55:35 -08:00
dependabot-preview[bot] a73e85ea6d build(deps): bump rand from 0.8.1 to 0.8.2
Bumps [rand](https://github.com/rust-random/rand) from 0.8.1 to 0.8.2.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.8.1...0.8.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-13 04:17:41 -08:00
Mike Welsh 63f2b4f02f avm1: Remove Error::ConstructorFailed
Not necessary now that native constructors can return differing
types. `new BitmapData` can return undefined.
2021-01-12 09:13:24 -08:00
Mike Welsh cd68d4f76a avm1: Properly implement Object constructor 2021-01-12 09:13:24 -08:00
Mike Welsh e93f3b5d3b tests: Add test for Object constructor 2021-01-12 09:13:24 -08:00
Mike Welsh df500282cd avm1: Use the return value of built-in ctors as `this`
* Built-in constructors now return the newly constructed object,
   which will be used as `this`. This allows for constructors such
   as `new Object` which can return differing types.
 * Adjust `FunctionObject::constructor` to take both a constructor
   and a function. Add `constructor_to_fn!` macro to turn most
   simple native constructors into a function that discards the
   return value.
 * Change `TObject::construct` to return `Value` instead of `Object`.
   This is necessary for constructors that return primitive values.
2021-01-12 09:13:24 -08:00
Mike Welsh 4e27818952 core: Don't recreate objects when switching button states
When switching button states, previously we cleared all children
and recreated children for the new state. Now any children that
exist in both states are persisted and not recreated.

Fixes #2354.
2021-01-11 14:06:22 -08:00
Mike Welsh 6b2b0eb2c6 core: Allow mouse picking of children inside buttons
Particularly fixes cases of button-inside-button (#2354).
2021-01-11 14:06:22 -08:00
Toad06 7480e836ec web: Changes from review 2021-01-11 13:16:00 -08:00
TÖRÖK Attila cce3a8199d web: Add a config option to disable the message about unsupported content 2021-01-10 16:02:23 -08:00
Mike Welsh 484ac03ca8 tests: Test removeMovieClip on non-movieclips 2021-01-09 18:31:04 -08:00
Mike Welsh bab88ede8c fix 2021-01-09 18:31:04 -08:00
MrCheeze ff15b67192 avm1: Allow RemoveSprite/removeMovieClip on any display object 2021-01-09 18:31:04 -08:00
Mike Welsh 6638aebde8 tests: Add test verifying proper getBytesTotal value 2021-01-09 14:29:19 -08:00
MrCheeze 5915f2a841 core: Return uncompressed length for getBytesLoaded/Total 2021-01-09 14:29:19 -08:00
Adrian Wielgosik 828dbcb00c Don't panic on invalid JPEG sizes in DefineBitsJpeg* 2021-01-08 13:38:41 -08:00
dependabot-preview[bot] f80d74a3d7 build(deps): bump smallvec from 1.6.0 to 1.6.1
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.6.0...v1.6.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-08 12:09:49 -08:00
relrelb 030ff398ef desktop: Handle fullscreen keyboard shortcut in its own case 2021-01-08 11:59:08 -08:00
relrelb abe608fd4d desktop: Add fullscreen keyboard shortcut 2021-01-07 12:49:36 -08:00
Mike Welsh 44e9185a5f core: Adjust culling area based on letterbox setting 2021-01-07 11:46:07 -08:00
Mike Welsh 01aca9f861 web: Remove upgrade_to_https param from Ruffle::new
Grab it from the `config` directly instead of using an extra param.
2021-01-07 11:46:07 -08:00
Mike Welsh bacb66b97b core: Move Letterbox to config module 2021-01-07 11:46:07 -08:00
Mike Welsh 8728804f28 web: Add letterbox config option 2021-01-07 11:46:07 -08:00
Mike Welsh e9da6a13f0 core: Add letterbox setting
Player::set_letterbox can be used to control the letterbox behavior.
 * Letterbox::Off => no letterbox (flash behavior)
 * Letterbox::Fullscreen => letterbox only in fullscreen (web default)
 * Letterbox::On => always letterbox (desktop default)
2021-01-07 11:46:07 -08:00
Mike Welsh 03b5edd4d1 render: Remove RenderBackend::draw_letterbox
Move letterbox draw logic to `Player`, using renderer.draw_rect
2021-01-07 11:46:07 -08:00
CUB3D 063c8a1234 chore: Fix formatting 2021-01-06 18:06:30 -08:00
CUB3D 01557fba5a core: Add flash.filters.GradientGlowFilter 2021-01-06 18:06:30 -08:00
CUB3D 0cab167e4c core: Add flash.filters.GradientBevelFilter + refactor existing filters 2021-01-06 18:06:30 -08:00
Moulins 02c591958e core/avm1: don't run onLoadInit handler if movie loading failed
Replace Loader::Movie::loader_complete flag by an enum to distinguish
between success and failure.

Fixes #2123
2021-01-06 16:00:58 -08:00
relrelb 468b2ca487
core: Ignore SetBackgroundColor in child movie clips 2021-01-06 16:00:11 -08:00
Callum Thomson 75081c8149
avm1: Implement flash.filters.ConvolutionFilter avm1 built-in 2021-01-04 18:26:11 -08:00
relrelb 9a8edda8a6 chore: Update lyon to 0.17.1 2021-01-04 18:08:14 -08:00
relrelb de761f5b7c chore: Update bitstream-io to 1.0.0 2021-01-04 15:23:36 -08:00
TÖRÖK Attila 21e071384d core/avm1: Handle object aliasing in BitmapData.copyChannel by cloning 2021-01-04 15:10:01 -08:00
dependabot-preview[bot] 51641dad60 build(deps): bump rand from 0.8.0 to 0.8.1
Bumps [rand](https://github.com/rust-random/rand) from 0.8.0 to 0.8.1.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.8.0...0.8.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-04 15:08:40 -08:00
Mike Welsh fae1d6fd6a chore: Appease clippy 2021-01-04 13:17:26 -08:00
Adrian Wielgosik de38bb48eb
core: Fake passage of time to fool busy-loop frame limiters 2021-01-04 12:19:20 -08:00
Kamil Gierada 49a69c8109
core: ADPCM decoder produces less artifacts 2021-01-02 16:44:28 -08:00
Mike Welsh 4c12f27e46 tests: Add tests for #1671 2021-01-02 16:19:08 -08:00
Mike Welsh 146d41c971 avm1: Bail out of swapDepths on dead clips 2021-01-02 16:19:08 -08:00
paq 72be136fb9 avm1: Implement unescape 2021-01-02 14:37:03 -08:00
dependabot-preview[bot] 219f4664d6 build(deps): bump minimp3 from 0.5.0 to 0.5.1
Bumps [minimp3](https://github.com/germangb/minimp3-rs) from 0.5.0 to 0.5.1.
- [Release notes](https://github.com/germangb/minimp3-rs/releases)
- [Commits](https://github.com/germangb/minimp3-rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-02 14:22:38 -08:00
CUB3D 03e69c5c0b core: Update DisplacementMapFilter tests 2021-01-02 03:12:07 -08:00
CUB3D 631d185014 core: Implmement flash.filters.DisplacementMapFilter 2021-01-02 03:12:07 -08:00
TÖRÖK Attila 3b14437b25 core/avm1: Implement BitmapData.scroll 2021-01-01 19:44:56 -08:00
dependabot-preview[bot] 83c32e8693 build(deps): bump syn from 1.0.56 to 1.0.57
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.56 to 1.0.57.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.56...1.0.57)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-01 13:46:35 -08:00
Mike Welsh a5b5ba46ba avm1: Unspecified arguments should be set to undefined (fix #2166)
Unspecified arguments should be set to undefined to prevent
assignments from leaking to the parent scope, for example:

```
function f(arg0) {
    arg0 = "BAD"; // Previously could set _root.arg0
}
f();
```
2020-12-31 20:01:05 -08:00
Mike Welsh 22ab8df8f5 tests: Add test for #2166 2020-12-31 20:01:05 -08:00
dependabot-preview[bot] 6a3b9f9f53 build(deps): bump smallvec from 1.5.1 to 1.6.0
Bumps [smallvec](https://github.com/servo/rust-smallvec) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.5.1...v1.6.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-31 14:37:38 -08:00
Mike Welsh 9b6295f33a render: Pass library to RenderBackend::register_shape (fix #2037)
Pass the movie library to `register_shape` methods so that bitmap
charcter IDs can be resolved immediately on the proper SWF.

This fixes #2037, which cause incorrect bitmaps to be used when
multiple movies were loaded.
2020-12-31 13:10:21 -08:00
Adrian Wielgosik 2b2a7c3c27 Remove redundant SystemPrototypes from UpdateContext. 2020-12-31 13:09:59 -08:00
Mike Welsh ea3b6f59df avm1: Implement XML.ignoreWhite 2020-12-30 16:00:39 -08:00
Mike Welsh caa2d8e383 tests: Add test for XML.ignoreWhite 2020-12-30 16:00:39 -08:00
Mike Welsh d736293425 avm1: Fix method calls with null/empty string name
`f[null]` should call `f["null"]`.
`f[undefined]`, `f[""]`, `f[o]` where o.toString returns the empty
string should call `f` directly.
2020-12-30 13:35:36 -08:00
CUB3D 5fb15c8f80 core: Support CallMethod with non-string method_name (fix #2160) 2020-12-30 13:35:36 -08:00
paq 4f980becb2 avm1: Implement escape 2020-12-30 12:42:03 -08:00
Mike Welsh 3ce4406434 core: Fix memory leak caused by unbound text variables
Text fields without variables would return as unbound in
EditText::try_bind_text_field_variable, causing them to be added
to the unbound textfield list even though they had no variable
setting. Return successful bidning by default to avoid adding
these textfields to the unbound list.
2020-12-29 14:18:07 -08:00
Mike Welsh 802aa9b7a7 avm1: Allow SharedObject creation even if URL is unknown (fix #2150)
Allow SharedObjects to be created even in the case that the movie
URL is None (for example, loading an SWF from bytes). Use a dummy
"localhost" URL.
2020-12-29 14:17:57 -08:00
Mike Welsh ff5ecf9754 avm1: Fix incorrect name used for SharedObject cache (fix #2149) 2020-12-29 14:17:57 -08:00
Callum Thomson 7b202bd2e7
avm1: Implement flash.filters.ColorMatrixFilter avm1 built-in 2020-12-29 03:10:46 -08:00
paq 8c86434e38 avm1: Implement Matrix.deltaTransformPoint 2020-12-28 01:17:00 -08:00
paq 8baa36e801 avm2: Implement isFinite 2020-12-27 23:02:39 -08:00
paq ce2d7efac3 avm2: Implement isNaN 2020-12-27 23:02:39 -08:00
Mike Welsh 7bdbb6c37d text: Fix masking of text area (fix #1496, #1554) 2020-12-27 23:01:24 -08:00
Mike Welsh 8d707bc6ab core: onKeyUp/Down method handlers fire only if clip has focus (fix #2120) 2020-12-27 16:08:27 -08:00
paq 7bfe3f7177 avm1: Implement Matrix.transformPoint (ruffle-rs#303) 2020-12-27 14:27:04 -08:00
Mike Welsh 8222d3095b desktop: Add --timedemo benchmark
Add --timedemo for benchmarking, which will run the given SWF as
quickly as possible for 5000 frames or the end of the root
timeline, whichever comes first. The total duration will be output
upon completion.
2020-12-26 23:59:12 -08:00
jmckiern a3b4074fc4 core: Fix multiline selection bug 2020-12-26 23:18:02 -08:00
jmckiern 208a69d715 core: Move caret to start or end of selection if shift is not held
Previously pressing left with a selection would set `selection.to = selection.start() - 1`, now it sets it to `selection.to = selection.start()`. The same is true for right/selection.end()
2020-12-26 23:18:02 -08:00
jmckiern 464f2b63a9 chore: Fix spelling mistake 2020-12-26 23:18:02 -08:00
jmckiern c277c1083b core: Render selected text as white with black background 2020-12-26 23:18:02 -08:00
jmckiern 0269c31dbc core: Change caret color to text color 2020-12-26 23:18:02 -08:00
dependabot-preview[bot] 1b4c8265b7 build(deps): bump syn from 1.0.55 to 1.0.56
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.55 to 1.0.56.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.55...1.0.56)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-26 14:01:15 -08:00
Sam Morrow 38bdb8b39a web/desktop: Add basic dialog handling (closes #1978) 2020-12-23 19:08:18 -08:00
Mike Welsh 367404ddd8 core: SharedObjects are bucketed by domain
Key SharedObjects on the domain and path where the SWF is hosted,
and implement the localPath and secure parameters.

Fix #855.
2020-12-22 14:18:06 -08:00
Callum Thomson e38d559b1e
avm1: Implement flash.filters.DropShadowFilter
Implements the AVM object for DropShadowFilter. Actual rendering is still TODO.
2020-12-22 14:17:12 -08:00
David Wendt b848e4c5ff avm2: Get rid of `RufflePrivate` and just use regular private namespaces scoped to our own domain. 2020-12-21 21:47:29 -08:00
David Wendt 30d8dc21be avm2: Remove weird `into` constructor on `EventHandler` 2020-12-21 21:47:29 -08:00
David Wendt 7baa3cc06d avm2: Seal the `EventDispatcher` class 2020-12-21 21:47:29 -08:00
David Wendt 3ff9b87261 avm2: `RufflePrivate` namespaces should be treated as private namespaces. 2020-12-21 21:47:29 -08:00
David Wendt 19219ad0c1 avm2: Implement `dispatchEvent`.
Event dispatch is a surprisingly complicated procedure, so this makes sure to test:

1. Event dispatch on bare dispatchers
2. Event dispatch on hierarchial dispatchers (movieclips)
3. Event cancellation (which is reported by `dispatchEvent`)
4. The implicit `this` on unbound event handlers. I'm not yet sure if this is a special property of event dispatch or if all unbound functions inherit their global scope as `this`.
5. The execution order of handlers on both bare and hierarchial dispatchers
6. Delegation to hierarchial dispatchers
7. Modification of the dispatch list during dispatch of an event. Surprisingly enough, you can add handlers to the event you're handling and expect them to execute, *if* you added them to a further object in the order *or* you added a bubble handler in the capture phase.
2020-12-21 21:47:29 -08:00
David Wendt f33e5f893a avm2: Allow builtins to get at the global scope. 2020-12-21 21:47:29 -08:00
David Wendt 8efaed40a0 avm2: `event.eventPhase` is enumerated from 1 2020-12-21 21:47:29 -08:00
David Wendt 87ff679898 avm2: Implement `EventDispatcher.willTrigger` 2020-12-21 21:47:29 -08:00
David Wendt a071800117 avm2: `EventDispatcher` should supercall, too. 2020-12-21 21:47:29 -08:00
David Wendt e8163e43ab avm2: Builtin constructors should supercall. 2020-12-21 21:47:29 -08:00
David Wendt be4e37a55c avm2: Implement `addEventListener`, `removeEventListener`, and `hasEventListener`. 2020-12-21 21:47:29 -08:00
David Wendt 2faf5259ca avm2: Add a representation for event dispatch lists.
For various reasons, we store the dispatch list for an object on a separate property of an `EventDispatcher` rather than dictating that all children of `EventDispatcher` use a specific object type. This is because `EventDispatcher` is a very general class with lots of object representations it needs to cover. So instead, we introduce a new object representation for a *property* and store it in a Ruffle private namespace that is as isolated from user code as alternate object representations are.
2020-12-21 21:47:29 -08:00
David Wendt b02897637f avm2: Add a new namespace type to store runtime-internal properties we don't want user code being able to access ever. 2020-12-21 21:47:29 -08:00
dependabot-preview[bot] 606fd28b3b build(deps): bump quote from 1.0.7 to 1.0.8
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.7 to 1.0.8.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.7...1.0.8)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-20 15:54:45 -08:00
Callum Thomson 69ab12fcc3
avm1: Add flash.filters.GlowFilter 2020-12-20 15:31:09 -08:00
dependabot-preview[bot] 820572f204 build(deps): bump syn from 1.0.54 to 1.0.55
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.54 to 1.0.55.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.54...1.0.55)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-20 15:19:11 -08:00
Mike Welsh 8a0e55d74a chore: Bump to rand 0.8 2020-12-19 14:33:12 -08:00
Mike Welsh 9d6e711006 tests: Add test for #2030 2020-12-19 02:14:27 -08:00
Mike Welsh 60d7c0a742 core: Fix incorrect bounds for Bitmap (fix #2030) 2020-12-19 02:14:27 -08:00
Mike Welsh 981a4de9c9 tests: Uncomment arguments.caller avm1 test 2020-12-19 01:46:20 -08:00
Mike Welsh 0dd8b24fec avm1: Implement arguments.caller 2020-12-19 01:46:20 -08:00
Mike Welsh a3f18b80b6 tests: Add test for TextField.replaceSel 2020-12-19 00:35:26 -08:00
Mike Welsh 62a3729b55 avm1: Implement TextField.replaceSel 2020-12-19 00:35:26 -08:00
Mike Welsh 042e9a444b tests: Add parseFloat tests 2020-12-18 02:50:09 -08:00
Mike Welsh 80d5d9cd0a avm1: Initial implementation of parseFloat 2020-12-18 02:50:09 -08:00
Mike Welsh 326a5b6212 core: Move device font to Library (fix #1995) 2020-12-17 23:20:22 -08:00
Mike Welsh a58073cabd core: Fix Collect impl for BitmapData (fix #2009) 2020-12-17 19:35:26 -08:00
Mike Welsh 72a24b9800 tests: Add tests for #1906 2020-12-17 18:07:01 -08:00
Mike Welsh 25cd4ee375 avm1: Color.setTransform/setRGB sets transformed-by-AS flag (fix #1906) 2020-12-17 18:07:01 -08:00
Mike Welsh 7cf217a911 swf: Use lzma-rs for LZMA SWFs (fix #405)
Pure Rust decoder that functions on desktop and wasm.
Enable lzma feature by default.

TODO: Switch to lzma-rs streaming API when stable on crates.io.
Currently decodes entire stream at once.
2020-12-17 16:40:21 -08:00
jmckiern beed570475 core: Add string_utils char boundary functions 2020-12-17 16:15:24 -08:00
jmckiern b81cb1a3eb core: Extend text input to deal with multibyte chars 2020-12-17 16:15:24 -08:00
David Wendt 09f9e99fbb avm2: Implement `rest` parameters in function calls. 2020-12-17 13:21:44 -08:00
David Wendt 453e013c2c avm2: Implement `arguments`. 2020-12-17 13:21:44 -08:00
David Wendt 217890f4a6 avm2: Implement `Function.apply` 2020-12-17 13:21:44 -08:00
Mike Welsh 369c5bda56 render: Implement Bitmap smoothing property 2020-12-15 00:04:51 -08:00
CUB3D 3556ffd778 chore: Fixes after rebase 2020-12-15 00:04:51 -08:00
CUB3D a92b8ffded core: All other changes from review 2020-12-15 00:04:51 -08:00
CUB3D ccd08f14d9 core: Fix naming and safety issues 2020-12-15 00:04:51 -08:00
CUB3D e483d0959f core: Remove unwraps 2020-12-15 00:04:51 -08:00
CUB3D 6f91352d41 chore: Fix clippy lints 2020-12-15 00:04:51 -08:00
CUB3D eea45d6ae6 core: Tidy up loadBitmap 2020-12-15 00:04:51 -08:00
CUB3D 23a9c7143a core: Support failiable constructors 2020-12-15 00:04:51 -08:00
CUB3D b3dd5c0c0b core+renderer: Fix corner cases 2020-12-15 00:04:51 -08:00
CUB3D 666c3db9c6 core: Refactor bitmapData 2020-12-15 00:04:51 -08:00
CUB3D 74ab728cff core: Format 2020-12-15 00:04:51 -08:00
CUB3D 22a7b1d340 core: Add handling of invalid arguments for getColorBoundsRect/colorTransform 2020-12-15 00:04:51 -08:00