1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:27:43 +00:00

Browser+WebContent+WebDriver: Move Is Element Enabled to WebContent

This commit is contained in:
Timothy Flynn 2022-11-10 10:39:09 -05:00 committed by Linus Groh
parent 30d6a73d0e
commit 93e14799c5
16 changed files with 29 additions and 70 deletions

View file

@ -26,7 +26,6 @@
#include <LibWeb/Dump.h>
#include <LibWeb/Geometry/DOMRect.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/FormAssociatedElement.h>
#include <LibWeb/HTML/Scripting/ClassicScript.h>
#include <LibWeb/HTML/Storage.h>
#include <LibWeb/HTML/Window.h>
@ -525,26 +524,6 @@ static Gfx::IntRect calculate_absolute_rect_of_element(Web::Page const& page, We
};
}
Messages::WebContentServer::IsElementEnabledResponse ConnectionFromClient::is_element_enabled(i32 element_id)
{
auto element = find_element_by_id(element_id);
if (!element.has_value())
return { false };
auto* document = page().top_level_browsing_context().active_document();
if (!document)
return { false };
bool enabled = !document->is_xml_document();
if (enabled && is<Web::HTML::FormAssociatedElement>(*element)) {
auto& form_associated_element = dynamic_cast<Web::HTML::FormAssociatedElement&>(*element);
enabled = form_associated_element.enabled();
}
return { enabled };
}
Messages::WebContentServer::TakeElementScreenshotResponse ConnectionFromClient::take_element_screenshot(i32 element_id)
{
auto element = find_element_by_id(element_id);