Since highlight has 3 states now, it's better represented by
describing the state instead of having a checkbox.
A re-focus button has been added to compensate for the fact
that the highlight cannot be automatically enabled anymore.
Some button events (e.g. KeyUp/KeyDown) seem to require a state when
the highlight is not visible, but is active (i.e. a focus is selected).
That is why this patch introduces a third possible state of
the highlight: ActiveHidden.
Button events are actually handled twofold:
1. KeyPress for printable characters is handled on TextInput,
2. KeyPress for special characters (e.g. enter, arrows)
is handled on KeyDown.
Before this patch, KeyPress was fired too early, so that for
special characters (2) it fired BEFORE KeyDown.
This was not a problem for printable characters, as they
fired on TextInput, which always fired separately after KeyDown.
This patch ensures that KeyPress is fired always in the proper order.
The option "Include Hidden" was not working properly,
as it did not exclude all hidden objects when disabled.
An object is hidden also when its ancestor is not visible.
This test verifies the behavior of focus hightlight when the
focused element is transformed; additionally, it verifies how
the active highlight behaves when _focusrect is set to false.
This ensures that highlight does not become outdated
(e.g. when the highlighted content moves).
Additionally, it makes the highlight have 3px independently of zoom.
This patch improves performance of matrix::round_to_i32()
by using f32::round_ties_even(), which has been stable
since 1.77.0, instead of a custom algorithm.
This patch improves performance of ecma_conversions::round_to_even():
1. by using f64::round_ties_even(), which has been stable
since 1.77.0, instead of a custom algorithm; and
2. by removing an unnecessary comparison to i32::MIN,
as casting a float to an integer automatically saturates
values smaller than the minimum integer value to the minimum
value of the integer type.
The logic of dropping the focus when it's removed
applies not only to TextFields but for every InteractiveObject.
This patch ensures that any focus is dropped when its parent is removed.