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

Browser+WebContent+WebDriver: Move Get Element CSS Value to WebContent

This commit is contained in:
Timothy Flynn 2022-11-10 10:11:04 -05:00 committed by Linus Groh
parent 3c00d0e92b
commit 06f1b8825c
16 changed files with 39 additions and 121 deletions

View file

@ -20,7 +20,6 @@
#include <LibJS/Runtime/ConsoleObject.h>
#include <LibJS/Runtime/JSONObject.h>
#include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/Cookie/ParsedCookie.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/NodeList.h>
@ -495,44 +494,6 @@ void ConnectionFromClient::scroll_element_into_view(i32 element_id)
element->scroll_into_view(options);
}
Messages::WebContentServer::GetActiveDocumentsTypeResponse ConnectionFromClient::get_active_documents_type()
{
auto* active_document = page().top_level_browsing_context().active_document();
if (!active_document)
return { "" };
auto type = active_document->document_type();
switch (type) {
case Web::DOM::Document::Type::HTML:
return { "html" };
break;
case Web::DOM::Document::Type::XML:
return { "xml" };
break;
}
return { "" };
}
Messages::WebContentServer::GetComputedValueForElementResponse ConnectionFromClient::get_computed_value_for_element(i32 element_id, String const& property_name)
{
auto element = find_element_by_id(element_id);
if (!element.has_value())
return { "" };
auto property_id = Web::CSS::property_id_from_string(property_name);
auto computed_values = element->computed_css_values();
if (!computed_values)
return { "" };
auto style_value = computed_values->property(property_id);
return { style_value->to_string() };
}
Messages::WebContentServer::GetElementTextResponse ConnectionFromClient::get_element_text(i32 element_id)
{
auto element = find_element_by_id(element_id);