1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 20:07:34 +00:00

LibWeb: Fire a UIEvents::MouseEvent for HTMLElement.click()

This still is not perfectly correct but it's enough to trigger the
activation behavior of elements and gain us a point on Acid3. :^)
This commit is contained in:
sin-ack 2022-03-15 00:50:19 +00:00 committed by Andreas Kling
parent 29583104d2
commit b3df222e52

View file

@ -4,7 +4,6 @@
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
#include "AK/ReverseIterator.h"
#include <AK/StringBuilder.h> #include <AK/StringBuilder.h>
#include <LibJS/Interpreter.h> #include <LibJS/Interpreter.h>
#include <LibJS/Parser.h> #include <LibJS/Parser.h>
@ -25,6 +24,7 @@
#include <LibWeb/Painting/PaintableBox.h> #include <LibWeb/Painting/PaintableBox.h>
#include <LibWeb/UIEvents/EventNames.h> #include <LibWeb/UIEvents/EventNames.h>
#include <LibWeb/UIEvents/FocusEvent.h> #include <LibWeb/UIEvents/FocusEvent.h>
#include <LibWeb/UIEvents/MouseEvent.h>
namespace Web::HTML { namespace Web::HTML {
@ -396,7 +396,7 @@ bool HTMLElement::fire_a_synthetic_pointer_event(FlyString const& type, DOM::Ele
// 1. Let event be the result of creating an event using PointerEvent. // 1. Let event be the result of creating an event using PointerEvent.
// 2. Initialize event's type attribute to e. // 2. Initialize event's type attribute to e.
// FIXME: Actually create a PointerEvent! // FIXME: Actually create a PointerEvent!
auto event = DOM::Event::create(type); auto event = UIEvents::MouseEvent::create(type, 0.0, 0.0, 0.0, 0.0);
// 3. Initialize event's bubbles and cancelable attributes to true. // 3. Initialize event's bubbles and cancelable attributes to true.
event->set_bubbles(true); event->set_bubbles(true);