mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-31 15:32:51 +00:00
LibWeb: Implement HTMLInputElement's selected coordinates
When an <input type=image> button is clicked, we now send the (x,y) coordinates of the click event (relative to the image) along with the form submission data. Regarding the text test, we can currently only test this feature with dialogs. The headless-browser test infrastructure cannot yet handle the resulting navigation that would occur if we were to test with normal form submission.
This commit is contained in:
parent
36302388a3
commit
94c67c364d
Notes:
sideshowbarker
2024-07-17 02:39:10 +09:00
Author: https://github.com/trflynn89
Commit: 94c67c364d
Pull-request: https://github.com/SerenityOS/serenity/pull/23254
Issue: https://github.com/SerenityOS/serenity/issues/23239
6 changed files with 89 additions and 13 deletions
34
Tests/LibWeb/Text/input/HTML/form-image-submission.html
Normal file
34
Tests/LibWeb/Text/input/HTML/form-image-submission.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
<head>
|
||||
<!--
|
||||
These style rules ensure the (x,y) coordinates clicked below are the same as the resulting
|
||||
coordinates in the form submission event.
|
||||
-->
|
||||
<style type="text/css">
|
||||
dialog {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<dialog id="dialog" open>
|
||||
<form id="form" method="dialog">
|
||||
<input value="well hello friends!" />
|
||||
<input id="image" type="image" src="../../../Layout/input/120.png" />
|
||||
</form>
|
||||
</dialog>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
asyncTest(done => {
|
||||
let dialog = document.getElementById("dialog");
|
||||
let image = document.getElementById("image");
|
||||
|
||||
dialog.addEventListener("close", e => {
|
||||
println(dialog.returnValue);
|
||||
done();
|
||||
});
|
||||
|
||||
const imageRect = image.getBoundingClientRect();
|
||||
internals.click(imageRect.x + 10, imageRect.y + 20);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue