LibWeb: Cast to the correct type in Element::auto_directionality()

Previously, we always cast to a HTMLInputElement when getting the value
of an auto directionality form associated element. This caused
undefined behavior when determining the directionality of an element
that wasn't a HTMLInputElement.
This commit is contained in:
Tim Ledbetter 2024-05-28 06:42:08 +01:00 committed by Andreas Kling
commit d6297ec074
Notes: sideshowbarker 2024-07-16 23:52:22 +09:00
5 changed files with 86 additions and 59 deletions

View file

@ -0,0 +1,30 @@
Testing input element with type=text
Input matches :dir(ltr): true
Input matches :dir(rtl): false
Input matches :dir(ltr): true
Input matches :dir(rtl): false
Input matches :dir(ltr): false
Input matches :dir(rtl): true
Input matches :dir(ltr): true
Input matches :dir(rtl): false
Input matches :dir(ltr): false
Input matches :dir(rtl): true
Input matches :dir(ltr): true
Input matches :dir(rtl): false
Input matches :dir(ltr): true
Input matches :dir(rtl): false
Testing textarea element
Input matches :dir(ltr): true
Input matches :dir(rtl): false
Input matches :dir(ltr): true
Input matches :dir(rtl): false
Input matches :dir(ltr): false
Input matches :dir(rtl): true
Input matches :dir(ltr): true
Input matches :dir(rtl): false
Input matches :dir(ltr): false
Input matches :dir(rtl): true
Input matches :dir(ltr): true
Input matches :dir(rtl): false
Input matches :dir(ltr): true
Input matches :dir(rtl): false

View file

@ -1,14 +0,0 @@
Input matches :dir(ltr): true
Input matches :dir(rtl): false
Input matches :dir(ltr): true
Input matches :dir(rtl): false
Input matches :dir(ltr): false
Input matches :dir(rtl): true
Input matches :dir(ltr): true
Input matches :dir(rtl): false
Input matches :dir(ltr): false
Input matches :dir(rtl): true
Input matches :dir(ltr): true
Input matches :dir(rtl): false
Input matches :dir(ltr): true
Input matches :dir(rtl): false