David Wendt
f298a23ec8
avm2: Ensure all bare function calls pull an appropriate `superclass_object`
2021-09-23 15:59:06 -06:00
David Wendt
7ef7b80395
avm2: Prototypes are not instances of their class
2021-09-23 15:59:06 -06:00
David Wendt
b8c086eb7a
avm2: Calls to object properties should use the new `call_property` method
2021-09-23 15:59:06 -06:00
David Wendt
7cefeb2b2a
avm2: Add a `constructprop` method for objects, too.
2021-09-23 15:59:06 -06:00
David Wendt
b07ad8070c
avm2: Make `get_property`, `set_property`, `init_property`, and various other derivative methods take a `Multiname` and run the search inside `Object`.
...
This also introduces a `call_property` method.
2021-09-23 15:59:06 -06:00
David Wendt
945cb2c4bf
avm2: Global class inheritance issues should report which class cannot be found
2021-09-23 15:59:06 -06:00
David Wendt
8f8134e4f4
avm2: Add private instance slots for `FrameLabel`'s properties
2021-09-23 15:59:06 -06:00
David Wendt
5ba2421225
avm2: Add private instance slots for `Scene`'s properties
2021-09-23 15:59:06 -06:00
David Wendt
97924d20ad
avm2: Add private instance slots for `Point`'s properties
2021-09-23 15:59:06 -06:00
David Wendt
dfc90984dc
avm2: Add private instance slots for `Rectangle`'s properties
2021-09-23 15:59:06 -06:00
David Wendt
81da1aad4b
avm2: `Video` is not a subclass of `flash.media.DisplayObject` (which doesn't exist)
2021-09-23 15:59:06 -06:00
EmperorBale
1874223224
avm2: Remove ignore_next
2021-09-23 00:01:50 +02:00
EmperorBale
31abe5d9d7
avm2: Specify that date should coerce to string by default
2021-09-23 00:01:50 +02:00
EmperorBale
64eb47a65c
avm2: Remove YearType
2021-09-23 00:01:50 +02:00
EmperorBale
bd6ca72510
avm2: Implement Date.parse
2021-09-23 00:01:50 +02:00
EmperorBale
10be7ef3bf
avm2: Implement toUTCString
2021-09-23 00:01:50 +02:00
EmperorBale
292a9bda4b
avm2: Implement toLocaleString, toLocaleTimeString, toDateString, toLocaleDateString
2021-09-23 00:01:50 +02:00
EmperorBale
b9fd7f5977
avm2: Implement toString, toTimeString
2021-09-23 00:01:50 +02:00
EmperorBale
931080cd49
avm2: Implement valueOf
2021-09-23 00:01:50 +02:00
EmperorBale
aca23b744e
chore: Appease clippy
2021-09-23 00:01:50 +02:00
EmperorBale
7f8e01b426
avm2: Implement UTC
2021-09-23 00:01:50 +02:00
EmperorBale
453486265f
avm2: Implement timezoneOffset
2021-09-23 00:01:50 +02:00
EmperorBale
0732efc9d9
avm2: Impement day, dayUTC
2021-09-23 00:01:50 +02:00
EmperorBale
fe584f7508
chore: Fix typos
2021-09-23 00:01:50 +02:00
EmperorBale
97da4d1b7b
avm2: Implement UTC variants
2021-09-23 00:01:50 +02:00
EmperorBale
0dc0bc9694
avm2: Implement month, fullYear
2021-09-23 00:01:50 +02:00
EmperorBale
273ae48654
avm2: Refactor date implementation
2021-09-23 00:01:50 +02:00
EmperorBale
6ab0d89040
avm2: Implement minutes, hours, date
2021-09-23 00:01:50 +02:00
EmperorBale
d5621c1ce7
avm2: Implement time, seconds, milliseconds
2021-09-23 00:01:50 +02:00
EmperorBale
32eb9d1579
avm2: Implement Dates instance initializer
2021-09-23 00:01:50 +02:00
EmperorBale
db550b035c
avm2: Add Date stub
2021-09-23 00:01:50 +02:00
relrelb
3463e50a72
avm1: Avoid `impl Into<Value<'gc>>` parameter in `Avm1::push`
...
This might create templatized functions leading to unnecessary code bloat.
So instead use just `Value<'gc>` parameters and add `.into()` in callers
where needed.
2021-09-22 23:13:13 +02:00
kmeisthax
42275f43f3
avm2: Properly make all classes an instance of `Class`. ( #57 )
...
* avm2: Properly make all classes an instance of `Class`.
Also, does this technically mean that `Class` is a metaclass?
* avm2: Remove `Function::from_method_and_proto` as it will no longer be needed
* avm2: Ensure builtin classes are also instances of `Class`.
This requires tying a veritable gordian knot of classes; everything needs to be allocated up-front, linked together, and then properly initialized later on. This necessitated splitting the whole class construction process up into three steps:
1. Allocation via `from_class_partial`, which does everything that can be done without any other classes
2. Weaving via `link_prototype` and `link_type`, which links all of the allocated parts together correctly. This also includes initializing `SystemClasses` and `SystemPrototypes`.
3. Initialization via `into_finished_class`, which must be done *after* the weave has finished.
Once complete you have core classes that are all instances of `Class`, along with prototypes that have their usual legacy quirks.
Note that this does *not* make prototypes instances of their class. We do need to do that, but doing so breaks ES3 legacy support. This is because we currently only work with bound methods, but need to be able to call unbound methods in `callproperty`.
* tests: Add a test for all core classes' instance-of relationships
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
f8c32d3a68
avm2: Fix get_own_class_definition users to use either instance_of or as_.
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
71e41e2c92
chore: cargo fmt
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
22482ed080
avm2: Remove unwrap in get_own_class_definition
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
7736818069
avm2: Rename as_class -> get_own_class_definition
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
26e60fa8ea
avm2: Rename as_class_object_really -> as_class_object
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
008162c514
avm2: Replace all uses of as_class_object by instance_of
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
4b7f8b3dbd
avm2: inner_class_definition is not an Option
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
3e1764aa1e
avm2: Reimplement as_class_object() in terms of other methods
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
e02feb919a
avm2: Reimplement as_class() in terms of other methods
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
4380978b2a
avm2: Move instance_allocator() to ClassObject
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
1d22009c6b
avm2: Drop seemingly-unused set_class_object()
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
f3ab6c9da3
avm2: Move as_class_params() to ClassObject
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
0679fd1a9e
amv2: Move superclass_object() to ClassObject
2021-09-22 00:29:37 +02:00
Adrian Wielgosik
2dfa875712
avm2: Move interfaces to ClassObject
2021-09-22 00:29:37 +02:00
Chris Midgley
6f0b026f13
chore: cargo fmt
2021-09-18 18:42:36 +02:00
Chris Midgley
7bab1de1e7
avm2: implement coerce_x opcodes
2021-09-18 18:42:36 +02:00
Adrian Wielgosik
ba35611c47
chore: cargo fmt
2021-09-18 18:37:46 +02:00
lukaszN
a76f2403ac
avm2: String rename PUBLIC_CLASS_METHODS to AS3_CLASS_METHODS
2021-09-18 18:37:46 +02:00
lukaszN
0f41193c3b
avm2: String.match match lastIndex behavior
2021-09-18 18:37:46 +02:00
lukaszN
d5588f3f90
avm2: String refactor index_of, match
2021-09-18 18:37:46 +02:00
lukaszN
42300d4a1e
avm2: String tests
2021-09-18 18:37:46 +02:00
lukaszN
4abde1500b
avm2: String fixes for tests
2021-09-18 18:37:46 +02:00
lukaszN
e24390ff58
avm2: String slice, substr, substring
2021-09-18 18:37:46 +02:00
lukaszN
d953fea5df
avm2: String match
2021-09-18 18:37:46 +02:00
lukaszN
91d63e4dc1
avm2: class methods can also live in the AS3 namespace
2021-09-18 18:37:46 +02:00
lukaszN
5e5d8e4fff
avm2: String concat, lastIndexOf, indexOf, fromCharCode
2021-09-18 18:37:46 +02:00
relrelb
1ab953887c
avm1: Simplify `Value::abstract_eq`
...
Make it return `bool` instead of a `Value` that can be either `true`
or `false`.
2021-09-18 17:47:25 +02:00
Chris Midgley
758d84f549
avm2: fix button typo
2021-09-18 15:26:52 +02:00
Chris Midgley
909428943b
avm2: implement bkpt, bkptline, timestamp as no-ops
2021-09-17 23:06:59 +02:00
relrelb
ff1c29d952
avm1: Simplify `Value::abstract_lt`
...
* Change its return type to `Option<bool>`.
* Use Rust's `f64::partial_cmp` to compare two numbers, which should
be more efficient.
2021-09-16 13:46:04 +03:00
relrelb
f92926af54
avm1: Correct `Math.{min,max}`
...
Don't use `abstract_lt` because it compares strings alphabetically,
unlike `Math.min` and `Math.max` that coerce to a number before comparing.
2021-09-16 02:38:34 -07:00
Moulins
73bce495c2
chore: move core::avm1::string::AvmString to core::string::AvmString
2021-09-13 03:30:17 -07:00
Moulins
87e8b44fe9
chore: move core::string_utils to core::string::utils
...
Also move case tables to a separate file.
2021-09-13 03:30:17 -07:00
Mike Welsh
d84f65874e
chore: Appease clippy
...
Debug/Clone dervies no longer squelch dead code warnings, see:
See https://github.com/rust-lang/rust/pull/85200
2021-09-11 21:50:52 -07:00
Mike Welsh
e3c05a021e
core: De-duplicate enums between Avm1Button and Avm2Button
...
Needed to appease clippy.
2021-09-11 21:50:52 -07:00
Ray Redondo
167b5a45de
avm2: move flash.display.IBitmapDrawable init
2021-09-11 15:47:20 -07:00
Ray Redondo
40d53cda59
avm2: make BitmapData and DisplayObject impl IBitmapDrawable
2021-09-11 15:47:20 -07:00
Ray Redondo
7f895473cb
avm2: IBitmapDrawable stub
2021-09-11 15:47:20 -07:00
David Wendt
1e0d259075
avm2: Allow nulling `Bitmap.bitmapData`.
...
One of the two tests in this PR relies upon the backend storing bitmap data, but the test rendering backend does not yet do this.
2021-09-11 12:11:35 -07:00
David Wendt
bfb6f03d62
avm2: Impl `Bitmap.smoothing`
...
Also, `smoothing` should be set at construction time even if we're setting up a timeline bitmap.
2021-09-11 12:11:35 -07:00
David Wendt
2ba0e12b7e
avm2: Stub `Bitmap.pixelSmoothing`
2021-09-11 12:11:35 -07:00
David Wendt
8ae669b96c
avm2: `BitmapData` should be traceable
2021-09-11 12:11:35 -07:00
David Wendt
31e3741982
avm2: Allow access to the `BitmapData` of a `Bitmap`.
2021-09-11 12:11:35 -07:00
David Wendt
7c5dc568f1
avm2: Impl `BitmapData.getPixel`.
...
This also changes the `bitmapdata_constr` test slightly to use a different starting value. Our premultiplied alpha calculations generate slightly different values from Flash Player which trips the test.
2021-09-11 12:11:35 -07:00
David Wendt
4c9bd0a6fe
avm2: Impl `BitmapData.transparent`
2021-09-11 12:11:35 -07:00
David Wendt
e18caa2fbf
core: Silence error relating to `Bitmap` symbol class associations
2021-09-11 12:11:35 -07:00
David Wendt
dca473fc2a
avm2: Impl `BitmapData.width` and `BitmapData.height`
2021-09-11 12:11:35 -07:00
David Wendt
335aec5be0
avm2: Implement `BitmapData`'s constructor.
...
This includes support for both embedded bitmap data (resolved via the SymbolClass mechanism) as well as empty bitmaps configured via arguments.
2021-09-11 12:11:35 -07:00
David Wendt
e5151d147d
core: When constructing a `Bitmap`, do not attempt to cache it's associated `BitmapData`'s handle.
...
Attempting to do so results in borrow-mut panics. Furthermore, it's unnecessary; the handle provided to this function is already derived from the bitmap data in this way.
2021-09-11 12:11:35 -07:00
David Wendt
54740d6093
core: Allow `BitmapData` to hold an AVM2 side.
2021-09-11 12:11:35 -07:00
David Wendt
10b98f72f5
core: Allow `Bitmap` to be reassociated with new `BitmapData`
2021-09-11 12:11:35 -07:00
David Wendt
a807cf7623
avm2: Stub `flash.display.BitmapData` & storage object
2021-09-11 12:11:35 -07:00
David Wendt
609b97cfb9
core: Allow `Bitmap`s to hold an AVM2 representation
2021-09-11 12:11:35 -07:00
Chris Midgley
bd26790f5b
avm1: Fix `this` inside watchers ( #5276 )
...
* fix: fix 'this' inside watchers
* tests: test value of 'this' in watcher
* lint: cargo fmt
2021-09-11 15:15:16 +03:00
relrelb
923201d2e4
chore: Appease clippy
2021-09-10 15:42:37 +02:00
Chris Midgley
3e04c2b0d2
dev: remove allow unused mut and corresponding mut
2021-09-09 19:06:49 -06:00
Daniel Jacobs
5ac9796ffd
web: Support salign, quality, & scale embed/object attributes (part of #4258 )
2021-09-08 16:25:47 -07:00
Tal Hayon
7d6eaf127d
core: Fix EditText width and height scaling ( close #3001 )
2021-09-08 02:39:01 -07:00
relrelb
c2fcc03c35
avm1: Remove `TObject::get_local` in favor of `TObject::get_local_stored`
...
`get_local` is basically equivalent to `get_local_stored` that also
handles virtual getters. So instead handle virtual getters in
`search_prototype`. This allows to inline the `get_local_sub` helper
methods into the implementations of `get_local_stored`.
The remaining usages of `get_local` were not exactly correct as they
all should ignore virtual getters. This change solves this as well
by using `get_local_stored` that ignores virtual getters.
2021-09-08 12:21:17 +03:00
relrelb
1f96c2fcb8
audio: Small cleanup
2021-09-07 18:28:17 -07:00
relrelb
65205ac6d7
audio: Store sound transform values in 30-bit integers
...
It seems like Flash stores sound transform values in 30-bit unsigned integers:
* Negative values are equivalent to their absolute value.
* Specifically, 0x40000000, -0x40000000 and -0x80000000 are equivalent to zero.
2021-09-07 18:28:17 -07:00
Chris Midgley
868706d775
avm1: call watcher, if defined, from virtual properties on prototype ( #4827 )
...
* avm1: extract get_watcher
* tests: add tests for TextField text watch
* avm1: call the watcher, if defined, from call_setter
* dev: shadow variable to avoid unused mut warning
* dev: remove value mutability
* chore: cargo fmt
* dev: unify virtual and stored property watcher cases
* tests: add test for watching prototyped property
* feat: when getting old values, ascend the proto chain ignoring virtual properties
* chore: lint
* dev: share complicated code
* chore: Small cleanups
Co-authored-by: relrelb <relrelbachar@gmail.com>
2021-09-08 03:41:18 +03:00
Mike Welsh
483995823f
core: Add symphonia as optional MP3 decoder
...
Add symphonia_mp3 feature to enable symphonia as an MP3 decoder.
This is a pure Rust MP3 decoder that could be used on web.
2021-09-07 16:48:34 -07:00
Mike Welsh
94d02fa653
core: Add AudioMixer to core
...
Pull out the audio mixing code from desktop and add it to core.
This will allow other backends to use it (such as the web audio
backend) to get consistent audio across all platforms.
2021-09-07 16:48:34 -07:00
Tal Hayon
4625ca0e0b
web: fix base param
2021-09-07 16:45:35 -07:00
Adrian Wielgosik
9bd0b624fd
avm2: Add more Event class stubs and constants
2021-09-05 11:56:21 +02:00
David Wendt
bc4f790031
avm2: Stub `SoundMixer.areSoundsInaccessible` and `SoundMixer.computeSpectrum`
2021-09-03 16:47:02 -06:00