Commit Graph

2241 Commits

Author SHA1 Message Date
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
CUB3D 353d5a268b core: Add better handling of invalid arguments to BitmapData 2020-12-15 00:04:51 -08:00
CUB3D 9d46d67588 core+web+renderer: Add load/attach Bitmap and handling for invalid args with BitmapData 2020-12-15 00:04:51 -08:00
CUB3D 3c12fa6ee5 core: Implement BitmapData.floodFill and correct getPixel for invalid coordinates 2020-12-15 00:04:51 -08:00
CUB3D 3afd20063f core: Implement get/set pixel(32) functions 2020-12-15 00:04:51 -08:00
CUB3D e45e942a1f core: Start implementation for flash.display.BitmapData 2020-12-15 00:04:51 -08:00
dependabot-preview[bot] 843bc74292 build(deps): bump indexmap from 1.6.0 to 1.6.1
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/bluss/indexmap/releases)
- [Commits](https://github.com/bluss/indexmap/compare/1.6.0...1.6.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-14 17:49:16 -08:00
David Wendt acadcb8fc0 avm2: `Event` is a sealed class. 2020-12-14 16:46:33 -08:00
David Wendt f7f51dcde2 avm2: `EventPhase` and `PropagationMode` should be `Eq` 2020-12-14 16:46:33 -08:00
David Wendt 6caaf0d222 avm2: Implement all of the `Event` class constants.
I'm not writing tests for these, my wrists hurt enough as is.
2020-12-14 16:46:33 -08:00
David Wendt 8a787e6153 avm2: Implement `Event.toString` (which matches it's valueof behavior) 2020-12-14 16:46:33 -08:00
David Wendt dc32d7894c avm2: Remove redundant event phase accessor 2020-12-14 16:46:33 -08:00
David Wendt ec63ff55cb avm2: Implement `Event.stopPropagation` and `Event.stopImmediatePropagation`.
These aren't testable yet.
2020-12-14 16:46:33 -08:00
David Wendt d393a5f4f8 avm2: Implement `Event.preventDefault` and `Event.isDefaultPrevented` 2020-12-14 16:46:33 -08:00
David Wendt 8b9a804ae9 avm2: Implement `Event.formatToString`. 2020-12-14 16:46:33 -08:00