Commit Graph

1282 Commits

Author SHA1 Message Date
CUB3D a8f7638d99 core: Implement ColorTransform 2020-07-05 13:49:59 -07:00
dependabot-preview[bot] 328246dc10 build(deps): bump jpeg-decoder from 0.1.19 to 0.1.20
Bumps [jpeg-decoder](https://github.com/image-rs/jpeg-decoder) from 0.1.19 to 0.1.20.
- [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.19...v0.1.20)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-07-04 15:29:45 -07:00
Mike Welsh 7b4045f32b core: Remove some unneccessary `take` calls in tag functions 2020-07-03 18:52:26 -07:00
Mike Welsh 08569ae979 core: Limit tag parsing to slice of tag data 2020-07-03 18:52:26 -07:00
Nathan Adams c50c835790 avm1: Made Executable::Action take in a Gc to Avm1Function, reducing the size of the struct significantly 2020-07-03 18:47:34 -07:00
Nathan Adams c4980d0bf5 core: Make XMLName::node_name return Cow<str>. It's not always owned, and we don't always need it to be. 2020-07-03 17:30:59 -07:00
Nathan Adams c036e2cf88 avm1: Made f64_to_string return Cow<str> instead of String, as we sometimes return static values 2020-07-03 17:30:59 -07:00
Nathan Adams 938d644d7d core: Made PropertyMap::insert take &str instead of String, as ownership isn't always needed 2020-07-03 17:30:59 -07:00
Nathan Adams fb84999778 core: Made VacantEntry store a &str instead of a String, avoiding allocation until insertation is requested 2020-07-03 17:30:59 -07:00
Nathan Adams f4921fad45 core: Made PropertyMap::entry take &str instead of String. We often don't need ownership here. 2020-07-03 17:30:59 -07:00
Nathan Adams b5c06be8a2 avm1: Anonymous function names for debugging when not in debug mode 2020-07-03 17:24:20 -07:00
Nathan Adams 51321713b5 avm1: Show stack frame with the avm_debug feature 2020-07-03 17:24:20 -07:00
Nathan Adams c976cf8efb avm1: Replace action.avm() with activation.avm to help with borrow checker in next commit 2020-07-03 17:24:20 -07:00
Mike Welsh 07814fdf53 tests: Add test for Error 2020-07-02 20:58:01 -07:00
Jon Pacheco 48c65f02a1 avm1: Implement Error object (see #251) 2020-07-02 20:58:01 -07:00
Adrian Wielgosik 301d696670 Add a fast path for ASCII case conversions 2020-07-02 12:48:50 -07:00
Mike Welsh 3a4d432645 tests: Edit textfield_variable test for #777 2020-07-02 01:29:41 -07:00
Mike Welsh dd32acd8fc avm1: Empty text field does not initialize variable binding
If a text field with a variable binding is placed on the stage,
usually the variable is initialized with the initial text. However,
if the text field is empty, the variable remains undefined.

Fixes #777.
2020-07-02 01:29:41 -07:00
Mike Welsh b05da5ef0f avm1: CastOp fails for primitive values 2020-07-01 17:30:56 -07:00
Nathan Adams d86761db5d avm1: Implement try {..} catch {..} finally {..} - #731 2020-07-01 17:30:56 -07:00
Nathan Adams 7c0b0a7a57 avm1: Fix instanceof checks with primitives 2020-07-01 16:36:54 -07:00
Nathan Adams d1732dd3d6 avm1: Returning from with{} should return from the parent activation 2020-07-01 16:21:43 -07:00
Mike Welsh 4b4370b90d
avm: Refactor Avm1, move execution to StackFrame (merge #767)
AVM1 refactoring: moving execution from Avm1 to StackFrame
2020-07-01 15:56:09 -07:00
Nathan Adams 8bc3eedc43 avm1: Rename StackFrame to Activation now that they're merged 2020-07-02 00:09:43 +02:00
dependabot-preview[bot] 41e262d745 build(deps): bump libflate from 1.0.1 to 1.0.2
Bumps [libflate](https://github.com/sile/libflate) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/sile/libflate/releases)
- [Commits](https://github.com/sile/libflate/compare/1.0.1...1.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-07-01 11:43:31 -07:00
Nathan Adams 9b66b496d0 avm1: Fix double-borrow when calling a getter that calls another method 2020-07-01 18:53:16 +02:00
dependabot-preview[bot] aa9100395f build(deps): bump downcast-rs from 1.1.1 to 1.2.0
Bumps [downcast-rs](https://github.com/marcianx/downcast-rs) from 1.1.1 to 1.2.0.
- [Release notes](https://github.com/marcianx/downcast-rs/releases)
- [Changelog](https://github.com/marcianx/downcast-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/marcianx/downcast-rs/compare/v1.1.1...v1.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-30 17:32:47 -07:00
Nathan Adams 987375299b avm1: Replace 'run_in_avm' with just building a StackFrame object, letting Rust borrowchecker do our stack management for us 2020-06-30 21:57:51 +02:00
Nathan Adams 47a806a5ee avm1: Removed errors that are no longer possible to run into 2020-06-30 21:28:32 +02:00
Nathan Adams a989aa235a avm1: We don't need to lock StackFrames anymore, the borrow checker will steer us right 2020-06-30 21:26:57 +02:00
Nathan Adams 2288919663 avm1: We don't need to store data in StackFrame, it's only used when actually running data 2020-06-30 21:24:46 +02:00
Nathan Adams 45c3967deb avm1: Merge Activation into StackFrame 2020-06-30 21:08:42 +02:00
Nathan Adams d889b98043 avm1: Merge Activation::from_function and Activation::from_action as they're identical 2020-06-30 20:34:05 +02:00
Nathan Adams 6e4dd506da avm1: Activation doesn't need to be in a GcCell 2020-06-30 20:31:49 +02:00
Nathan Adams 4d24bc7f09 avm1: Removed pc from Activation, it's no longer needed 2020-06-30 19:42:18 +02:00
Nathan Adams 3e9c380ba1 avm1: Remove is_function from Activation, it's no longer needed 2020-06-30 19:40:21 +02:00
Nathan Adams ec4affcf10 avm1: Use child activations when already running from another activation 2020-06-29 10:13:59 +02:00
Nathan Adams aaa082fb60 avm1: Replace run_with_stack_frame with run_in_avm 2020-06-29 10:13:57 +02:00
Nathan Adams 0dd2ece371 avm1: Introduce parents to StackFrame, and move run_activation from avm1 to StackFrame 2020-06-29 10:12:17 +02:00
Nathan Adams 9b630bd305 avm1: Remove ReturnValue, it's no longer needed 2020-06-29 10:12:16 +02:00
Nathan Adams ab4304d634 avm1: Properly and more explicitly work around the double-borrow issue in setters 2020-06-29 10:10:38 +02:00
Nathan Adams a2103d906d avm1: Remove dead code from Avm1 2020-06-29 10:10:24 +02:00
Nathan Adams f85684fec0 avm1: Move current_swf_version and is_case_sensitive from avm1 to stackframe 2020-06-29 10:10:11 +02:00
Nathan Adams d470c52aea avm1: Move root_object, target_clip_or_root, target_clip and base_clip from avm1 to StackFrame 2020-06-29 10:09:57 +02:00
Nathan Adams ca305684db avm1: Removed unused return_value on Activation 2020-06-29 10:09:40 +02:00
Nathan Adams da8ca1379f avm1: Change from 'avm, context' to 'activation, context' and restructured to support this 2020-06-29 10:09:38 +02:00
Nathan Adams a841743962 avm1: Make current_stack_frame return a Result for easy chaining 2020-06-29 10:07:48 +02:00
Nathan Adams cdfd58d619 avm1: Move register get/setting from avm1 to StackFrame 2020-06-29 10:07:31 +02:00
Nathan Adams 63e66c29eb avm1: We already have our stack frame, don't refetch it in actions 2020-06-29 10:07:14 +02:00
Nathan Adams 3a093dddbd avm1: Run activations immediate, not queued up for some-time-later 2020-06-29 10:07:12 +02:00
Nathan Adams 10b8f4abaf avm1: Handle stack poping in avm 2020-06-29 08:55:50 +02:00
Nathan Adams 84a5fae43f avm1: Only perform stack-frame adjustments in one place, not scattered throughout actions 2020-06-29 08:51:34 +02:00
Nathan Adams 9109d89daa avm1: Allow for frame control in StackFrame from any action 2020-06-29 08:51:34 +02:00
Nathan Adams 329716bfe7 avm1: Don't refetch activation.data every action 2020-06-29 08:51:33 +02:00
Nathan Adams af72f68f0f avm1: Run entire stack frames at once 2020-06-29 08:51:33 +02:00
Nathan Adams c6b9de883f avm1: Add Activation to StackFrame, removing lots of get-and-unwraps 2020-06-29 08:51:33 +02:00
Nathan Adams 4d76e8b24d avm1: Move all actions from Avm1 to a new StackFrame 2020-06-29 08:51:33 +02:00
Mike Welsh 3bc3d4acb2 text: Fix bindings being incorrectly cleared in StageObject
Call to `Vec::retain` was backwards, causing bindings to be
incorrectly cleared/not cleared when a text field was removed.
2020-06-28 23:38:58 -07:00
Mike Welsh 93cf7a1386 text: Use retire_stack_frame after firing text bindings 2020-06-28 23:37:50 -07:00
Mike Welsh ed82d984d2 text: Properly set text field position when created dynamically 2020-06-28 18:36:10 -07:00
Mike Welsh 7eeda7d93e chore: clippy 2020-06-28 18:36:10 -07:00
Mike Welsh ef31a6bea4 text: Don't override TextField::set_matrix and other layout changes
Don't override set_matrix and set_x for TextFields, and leave the
bounds intact.

TODO: There are still some wrapping issues in the tests, but
this allows the simple case of single-line texts to render
correctly.
2020-06-28 18:36:10 -07:00
Mike Welsh b40f9d4c1a avm1: Implement TextField.html 2020-06-28 18:36:10 -07:00
Mike Welsh d97a515330 tests: Add text field variable test 2020-06-28 18:36:10 -07:00
Mike Welsh 618fa11acb avm1: Implement text field variable binding 2020-06-28 18:36:10 -07:00
Mike Welsh 51d66c53f0 core: Edit text sets variables on instantiation 2020-06-28 18:36:10 -07:00
Mike Welsh 12fca71b21 avm1: Move StageObjectData behind a GC pointer 2020-06-28 18:36:10 -07:00
Mike Welsh a922fd559f avm1: Add EditText variable property
Add `EditText::variable` as well as `TextField.variable` property.
This commit only adds the getter/setter and does not yet add the
binding functionality.
2020-06-28 18:36:10 -07:00
Mike Welsh dd50071240 core: Move frame and goto methods from MovieClipData to MovieClip 2020-06-28 18:36:10 -07:00
Mike Welsh 8da0f43412 tests: Add test for DefineLocal and issue #760 2020-06-28 15:15:45 -07:00
Mike Welsh 52fbb77e99 avm1: DefineLocal respects virtual properties and prototype chain (fix #760)
DefineLocal will call a virtual setter if the property already exists
on the local object, including the local object's prototype chain.

DefineLocal2 will also not overwrite a property if it already exists
on the local object, including the local object's prototype chain.
2020-06-28 15:15:45 -07:00
Mike Welsh 905f9d7ac6 core: Clear mouse down flag even if there is no hovered object 2020-06-27 23:34:19 -07:00
Mike Welsh a846d92d8c core: Don't fire rollOut events if clip is removed
Allows the inventory to work in The Room Tribute.
2020-06-27 21:24:49 -07:00
Mike Welsh 0833c15e25 tests: Add test for enumerating array indices 2020-06-27 20:25:45 -07:00
Mike Welsh 478d88b22d tests: Test hasOwnProperty for array indices in array_properties 2020-06-27 20:25:45 -07:00
Mike Welsh 8e3b96f1b1 tests: Add tests for non-string params in hasOwnProperty: 2020-06-27 20:25:45 -07:00
Mike Welsh ccf33eedf6 avm1: Array indices are enumerable 2020-06-27 20:25:45 -07:00
Mike Welsh ecc54d01f7 avm1: Disallow setting "" property
object[""] has no effect.
2020-06-27 20:25:45 -07:00
Mike Welsh ef82fc472e avm1: Object.hasOwnProperty should coerce_to_string 2020-06-27 20:25:45 -07:00
Mike Welsh b37b74e0b6 tests: Add test for __constructor__ being DontEnum 2020-06-27 18:54:01 -07:00
Mike Welsh 054194026e avm1: Mark __constructor__ and constructor as DontEnum 2020-06-27 18:54:01 -07:00
dependabot-preview[bot] 63beea22a2 build(deps): bump weak-table from 0.2.3 to 0.3.0
Bumps [weak-table](https://github.com/tov/weak-table-rs) from 0.2.3 to 0.3.0.
- [Release notes](https://github.com/tov/weak-table-rs/releases)
- [Changelog](https://github.com/tov/weak-table-rs/blob/master/release.toml)
- [Commits](https://github.com/tov/weak-table-rs/compare/0.2.3...0.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-27 16:08:52 -07:00
dependabot-preview[bot] 82a86d6139 build(deps): bump png from 0.16.5 to 0.16.6
Bumps [png](https://github.com/image-rs/image-png) from 0.16.5 to 0.16.6.
- [Release notes](https://github.com/image-rs/image-png/releases)
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image-png/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-27 16:08:11 -07:00
Nathan Adams 463b79f063 avm1: Implement Action::Throw 2020-06-25 02:03:15 -07:00
Nathan Adams 70e4a40f01 avm1: Allow for user errors inside avm1::error::Error 2020-06-25 02:03:15 -07:00
Mike Welsh 81d75c6256
text: Text formatting for EditText fields (merge #615)
First implementation of HTML parsing and formatting for text fields.
2020-06-24 23:06:11 -07:00
Mike Welsh 5d9701313e text: Fix TextField.embedFonts setter 2020-06-24 22:46:59 -07:00
Mike Welsh b2c96336fd text: Cull text field if offscreen 2020-06-24 22:46:54 -07:00
David Wendt 74af7b345c Adjust `BoxBounds` to use `Copy` instead of `Clone`. 2020-06-24 23:40:27 -04:00
David Wendt d7a257f93f Adjust `LayoutContext` and `LayoutBox` to construct a `Vec` of boxes rather than an intrusive, garbage-collected linked list. 2020-06-24 23:34:38 -04:00
David Wendt d281452fe1 Expose the device font flag to AVM1 code. 2020-06-24 22:55:50 -04:00
David Wendt 453cf6c0f1 Remove *extremely* out of date documentation on `BoxBounds`. 2020-06-24 22:36:36 -04:00
David Wendt 2723c3f6d9 Rename `Collec` to `CollectWrapper` 2020-06-24 22:34:04 -04:00
David Wendt 5b36522258 Remove out-of-date doccomment on `LayoutBox`. 2020-06-24 22:19:16 -04:00
David Wendt 0b8d0e8c85 Move the internal padding to a separate constant. 2020-06-24 21:53:58 -04:00
David Wendt e4d4d996f9 Don't push each line of text down with the leading adjustment.
We already adjust the cursor with the same adjustment, so we don't need to move the text down.
2020-06-24 21:32:59 -04:00
David Wendt bfb150ec05 Remove hardcoded 3px margin.
This was originally intended to correctly position text within the border, but it appears borders are weird and this doesn't jive with what unbordered text does.
2020-06-24 21:32:59 -04:00
Mike Welsh 0f794489a4 text: Don't create underline drawing if no underline exists 2020-06-24 12:53:51 -07:00
Mike Welsh 3558e42c34 text: Always fallback to Noto Sans if text field is set to use device fonts 2020-06-24 12:19:06 -07:00
Mike Welsh f591e1dafc text: process_html_entity returns a Cow 2020-06-24 11:56:20 -07:00