This patch implements rendering of the yellow rectangle around
a focused element after pressing Tab. Focus tracker which is responsible
for keeping track of the current focus is now also responsible
for keeping track of the highlight and rendering thereof.
This test verifies the behavior of duplicate (x,y) positions of objects.
Turns out, FP actually ignores other objects with the same position,
retaining only the first one.
This test tests a grid with randomized (x,y) positions,
depths, and SWF tag positions.
It proves that mainly the position on the screen
determines the automatic order.
Currently when clicking in a textbox, the cursor will only be placed
correctly if you click exactly on top of a letter. The basic purpose of
this commit is to make it so that clicking in the surrounding margin
will put the cursor in the closest available position, as in Flash Player.
The logic is a bit complex because a single row of text can contain
multiple layout boxes, each with a different Y offset (but all with the
same Y extent). To be accurate, we need to treat each layout box in the
row "as if" it had the same Y offset that the tallest box in its row has.
This commit also contains a fix for an issue where lower_from_text_spans
was passing the wrong text strings and indexes to fixup_line for
newlines, which needed to be fixed in order to be able to click to place
the cursor in an empty row that was created by newlines.
This has several advantages:
1. it allows using async variants of send and recv,
2. it adds consistency as until now Receiver was async,
and Sender was not.
Platform Racing 3 relies on 'Socket.connected' reporting 'false'
immediately after calling 'Socket.connect' - it internally buffers
data made when 'Socket.connected' is false
For some reason, FP8 doesn't show the events anymore on its test output, even though the test it has clearly outputs both the connection status and events.
Also, the AVM2 test needs a trailing newline like all the others.
See the comments for details. Our previous implementation
was 'too good', and broke Bloons Tower Defense 5 by
generating `Number`s that Flash Player would never generate.
Among other things:
- resizing `colors` should also resize `alphas` and `ratios`
- shrinking `ratios` should also shrink `colors` and `alphas`, but
growing it doesn't change the size
It seems that font styles in the default text format
are ignored when dealing with an HTML field.
This patch revisits the fix from feacbdc1 (#13615),
which assumed that `<font>` resets font style.
That does not seem to be the case, but rather the bug
was caused by the invalid default text format,
which forced the text to be bold, due to the bold
variant of the font being linked to the text field.
This patch reverts 2f84d468 (#1201), which assumed that
the default color for a text span has 100% alpha.
The test added here contradicts it and it seems that
the default color is in fact rgba(0,0,0,0).
Testing the original SWF suggests that the underlying problem
has been fixed since that time.
I've switched back to the original code for creating
the bitmap/bitmapdata, rather than relying on custom
initialization logic that we only used in loader.
To make sure that the Bitmap/BitmapData are only exposed
to ActionScript at the correct time, I've added a new flag
to control when 'LoaderInfo.content' becomes non-null
When ActionScript uses a ByteArray/Vector.<Number> as a shader input
or target, we create a temporary Rgba32Float texture, and copy the
input float32 bytes to/from the texture.
Unfortunately, wgpu doesn't seem to support an Rgb32Float (3-channel)
texture. When the shader uses 3 channels, we use a Rgba32Float
(4-channel) texture, and manually insert/remove padding for the
alpha channels. This isn't very efficient, but it's the simplest
solution.
The temporary textures themselves aren't cached anywhere - if this
becomes a performance issue, we could look into using some of our
existing wgpu texture/buffer pooling code.
The handling of images in Loader.loaderBytes is similar to
the handling of SWFs - some of the data is exposed immediately
following the 'Loader.loadBytes' call, but the DisplayObject isn't
loaded until later.
This requires moving `set_root_movie` into `UpdateContext`.
Now, we preload the entire movieclip immediately - Flash Player
does this regardless of the size of the SWF.
The 'Loader::load_complete' is delayed to the end of the frame
(which is when the root class is constructed for the loaded clip).
When handling dynamic properties, avmplus will always try to
parse the string key name as a uint. If it succeeds, then the
key will be stored internally as a integer (via Atom), which is
observable by property iteration. The intention appears to have
been to support `obj[25] = someVal`, but it causes `obj["25"]`
and `obj[25]` to map to the same key (though iterating over the
object's keys will always produce a `number`).
Currently in tests (input.json) it is possible to trigger Ctrl-V using:
{ "type": "TextControl", "code": "Paste" },
But there is no way of populating the clipboard.
This patch adds AutomatedEvent::SetClipboardText, so the clipboard
may be populated before pasting:
{ "type": "SetClipboardText", "text": "<value>" },
{ "type": "TextControl", "code": "Paste" },
Methods `onSetFocus` & `onKillFocus` are invoked when focus is changed
for `TextField`, `Button`, and `MovieClip`.
Multiple SWFs use these methods to listen to a focus change,
e.g. in order to implement placeholders for text fields.
We now validate the passed in profile, and return the selected profile
from 'Context3D.profile'. We don't yet alter the available
registers/textures based on the profile.
This is pretty straightforward, except for the fact that Flash
completely ignores the provided commands when the 'data' vector
is empty (if 'data' has even a single entry, then Flash will validate
that all of the commands have the correct amount of data to run).
One SWF that I tested relies on this behavior.
Casting the character to u8 and back to char caused some non-ASCII
non-control characters to be treated as control characters.
For instance the letter "ą" (U+0105) after casting to u8 and back
became ENQ (U+0005) which is a control character.
Some other letters worked, for instance the letter "ł" (U+0142)
became "B" (U+0042) and was not classified as a control character.
The test edittext_input was added to verify this behavior.
Our asc.jar doesn't seem to apply a version suffix to namespaces for
interface method definitions. This was causing these methods to
get marked as VM_INTERNAL when we loaded playerglobals, preventing SWF
from invoking these methods through the interface (e.g. having a
variable of type `IEventDispatcher`, and calling `dispatchEvent` on it)
This builds on our existing playerglobal versioning support
to add in AIR versioning. We closely follow the avmplus implementation:
* When an SWF is loaded, we chose either a FlashPlayer or AIR
APIVersion for its SWF version, based on our configured player runtime.
* When loading playerglobals, we look at the player runtime. In AIR
mode, we map FlashPlayer-versioned definitions to the closest AIR
version. This ensures that all runtime APIVersions are in the
same series (either AIR or FlashPlayer). In FlashPlayer mode,
all AIR-versioned definitions get mapped to VM_INTERNAL, hiding
them from user code.
Part of our existing api versioning code was implemented incorrectly.
Within playerglobals, we need to treat all unmarked namespaces as
VM_INTERNAL - this allows things like playerglobal script
initializer "initproperty" opcodes to see any VM_INTERNAL AIR
definitions (when we run under FlashPlayer mode). Previously, we
were using AllVersions, which would result in those VM_INTERNAL
definitions being hidden from other playerglobal code, which is
not correct.
Using this support, I've added a stub for the AIR-only
'flash.net.DatagramSocket'. I've also extended the test framework
with a new 'player_options.runtime' config option, which can be
set to "AIR" or "FlashPlayer" to configure the test runtime mode.
I've also added two new tests:
* 'air_hidden_lookup' runs under the FlashPlayer runtime, and verifies
that a list of classes (currently just "DatagramSocket" are
inacessible).
* 'air_datagram_socket', which uses `player_options.runtime = "AIR"`
to construct an instance of `flash.net.DatagramSocket`. We can
extend this test once we implement more of `DatagramSocket`
With this commit, we have all of the needed infrastructure to start
implementing and testing AIR-only classes and methods.
After some testing, and looking at OpenFL, I believe I've
determined the correct behavior for AGAL sampling:
Each time a Context3D.setProgram or Context3D.setSamplerStateAt
call is made, the sampler config for the used texture slot(s)
is updated with the new wrapping/filter behavior. For setProgram,
this comes from all of the 'tex' opcodes used within the program.
However, when the 'ignoresampler' flag is set in a 'tex' opcode,
the setProgram call does *not* override the existing sampler config.
As a result, that program will sample with the behavior determined
by the most recent setSamplerStateAt or setProgram call involving
the used texture slot(s).
Previously, we were always overriding the opcode sampler config
with the values from Context3D.setSamplerStateAt. However, I didn't
realize that the order of the calls matter, so none of my tests ended
up observing the effect of 'ignoresampler'.
We now need to process AGAL bytecode twice - a quick initial
parse to determine the sampler configs (which need to be updated
when we call 'setProgram'), and a second time when to build the
Naga module (which needs to wait until we have the vertex attributes
available, which can be changed by ActionScript after setting
the program).
This was causing the `Object.prototype.toString` to throw error 1050,
instead of returning `[object Array]`, which was causing quite a few avmplus test failures.
This makes them pass on aarch64 (for example, Android),
it looks nicer (no secret robot math), and more digits
are not necessary anyway. Also fix up formatting a bit.
This more closely aligns our code with the corresponding avmplus code.
A user-supplied index of '0' is special-cased, and we correctly
resume iteration when a public index mismatch is detected.
This ensures that this flag is set regardless of whether the
object is constructed by the timeline or from ActionScript
(it was previously only set when constructed by the timeline).
* core: Fix MorphShape inaccuracy on complex paths
It's inaccurate to interpolate the moveTo/lineTo deltas individually
because on complex paths they're often small integers, which won't
interpolate smoothly.
Instead, interpolate absolute positions.
Avmplus constructs a full `QName`, and uses the normal
Multiname matching logic. This would be a large refactor,
so I've just modified the existing method to properly
handle multiple namespaces.
I've also included a closely related fix - we should only treat
a multiname with the literal local name "@foo" as an attribute
when the namespace is the empty public namespace. We were incorrectly
reparsing multinames that contained multiple namespaces.