mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:17:35 +00:00
Browser+WebContent+WebDriver: Move Is Element Selected to WebContent
This commit is contained in:
parent
560da56a1d
commit
04ea3992e9
16 changed files with 40 additions and 76 deletions
|
@ -28,8 +28,6 @@
|
|||
#include <LibWeb/Geometry/DOMRect.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/FormAssociatedElement.h>
|
||||
#include <LibWeb/HTML/HTMLInputElement.h>
|
||||
#include <LibWeb/HTML/HTMLOptionElement.h>
|
||||
#include <LibWeb/HTML/Scripting/ClassicScript.h>
|
||||
#include <LibWeb/HTML/Storage.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
@ -497,27 +495,6 @@ void ConnectionFromClient::scroll_element_into_view(i32 element_id)
|
|||
element->scroll_into_view(options);
|
||||
}
|
||||
|
||||
Messages::WebContentServer::IsElementSelectedResponse ConnectionFromClient::is_element_selected(i32 element_id)
|
||||
{
|
||||
auto element = find_element_by_id(element_id);
|
||||
if (!element.has_value())
|
||||
return { false };
|
||||
|
||||
bool selected = false;
|
||||
|
||||
if (is<Web::HTML::HTMLInputElement>(*element)) {
|
||||
auto& input = dynamic_cast<Web::HTML::HTMLInputElement&>(*element);
|
||||
using enum Web::HTML::HTMLInputElement::TypeAttributeState;
|
||||
|
||||
if (input.type_state() == Checkbox || input.type_state() == RadioButton)
|
||||
selected = input.checked();
|
||||
} else if (is<Web::HTML::HTMLOptionElement>(*element)) {
|
||||
selected = dynamic_cast<Web::HTML::HTMLOptionElement&>(*element).selected();
|
||||
}
|
||||
|
||||
return { selected };
|
||||
}
|
||||
|
||||
Messages::WebContentServer::GetElementAttributeResponse ConnectionFromClient::get_element_attribute(i32 element_id, String const& name)
|
||||
{
|
||||
auto element = find_element_by_id(element_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue