diff options
author | Kenneth Myhra <kennethmyhra@gmail.com> | 2023-04-06 16:12:33 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-04-07 22:41:01 +0200 |
commit | ad5cbdc51bd1673bedf544b4e6332896a7706171 (patch) | |
tree | cb3e0d647508e4607a858b2426ca97e2a8a2b02f /Userland/Services/WebContent | |
parent | e0002aa9939c71deb32dc0065cba9e129e389ad5 (diff) | |
download | serenity-ad5cbdc51bd1673bedf544b4e6332896a7706171.zip |
LibWeb: Port {Mouse,UI,Wheel,}Event to new String
This ports MouseEvent, UIEvent, WheelEvent, and Event to new String.
They all had a dependency to T::create() in
WebDriverConnection::fire_an_event() and therefore had to be ported in
the same commit.
Diffstat (limited to 'Userland/Services/WebContent')
-rw-r--r-- | Userland/Services/WebContent/WebDriverConnection.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index 5fbc118deb..7b3401b0cd 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -38,6 +38,7 @@ #include <LibWeb/Page/Page.h> #include <LibWeb/Platform/EventLoopPlugin.h> #include <LibWeb/Platform/Timer.h> +#include <LibWeb/UIEvents/EventNames.h> #include <LibWeb/UIEvents/MouseEvent.h> #include <LibWeb/WebDriver/ExecuteScript.h> #include <LibWeb/WebDriver/Screenshot.h> @@ -307,7 +308,7 @@ static Optional<Web::DOM::Element&> container_for_element(Web::DOM::Element& ele } template<typename T> -static bool fire_an_event(DeprecatedString name, Optional<Web::DOM::Element&> target) +static bool fire_an_event(FlyString name, Optional<Web::DOM::Element&> target) { // FIXME: This is supposed to call the https://dom.spec.whatwg.org/#concept-event-fire DOM algorithm, // but that doesn't seem to be implemented elsewhere. So, we'll ad-hack it for now. :^) @@ -1322,13 +1323,13 @@ Messages::WebDriverClient::ElementClickResponse WebDriverConnection::element_cli auto parent_node = element_container; // 2. Fire a mouseOver event at parent node. - fire_an_event<Web::UIEvents::MouseEvent>("mouseOver", parent_node); + fire_an_event<Web::UIEvents::MouseEvent>(Web::UIEvents::EventNames::mouseover, parent_node); // 3. Fire a mouseMove event at parent node. - fire_an_event<Web::UIEvents::MouseEvent>("mouseMove", parent_node); + fire_an_event<Web::UIEvents::MouseEvent>(Web::UIEvents::EventNames::mousemove, parent_node); // 4. Fire a mouseDown event at parent node. - fire_an_event<Web::UIEvents::MouseEvent>("mouseDown", parent_node); + fire_an_event<Web::UIEvents::MouseEvent>(Web::UIEvents::EventNames::mousedown, parent_node); // 5. Run the focusing steps on parent node. Web::HTML::run_focusing_steps(parent_node.has_value() ? &*parent_node : nullptr); @@ -1336,7 +1337,7 @@ Messages::WebDriverClient::ElementClickResponse WebDriverConnection::element_cli // 6. If element is not disabled: if (!option_element.is_actually_disabled()) { // 1. Fire an input event at parent node. - fire_an_event<Web::DOM::Event>("input", parent_node); + fire_an_event<Web::DOM::Event>(Web::HTML::EventNames::input, parent_node); // 2. Let previous selectedness be equal to element selectedness. auto previous_selectedness = option_element.selected(); @@ -1353,14 +1354,14 @@ Messages::WebDriverClient::ElementClickResponse WebDriverConnection::element_cli // 4. If previous selectedness is false, fire a change event at parent node. if (!previous_selectedness) { - fire_an_event<Web::DOM::Event>("change", parent_node); + fire_an_event<Web::DOM::Event>(Web::HTML::EventNames::change, parent_node); } } // 7. Fire a mouseUp event at parent node. - fire_an_event<Web::UIEvents::MouseEvent>("mouseUp", parent_node); + fire_an_event<Web::UIEvents::MouseEvent>(Web::UIEvents::EventNames::mouseup, parent_node); // 8. Fire a click event at parent node. - fire_an_event<Web::UIEvents::MouseEvent>("click", parent_node); + fire_an_event<Web::UIEvents::MouseEvent>(Web::UIEvents::EventNames::click, parent_node); } // -> Otherwise else { |