mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 05:17:34 +00:00
Browser+WebContent+WebDriver: Move Get Element CSS Value to WebContent
This commit is contained in:
parent
3c00d0e92b
commit
06f1b8825c
16 changed files with 39 additions and 121 deletions
|
@ -611,14 +611,6 @@ void BrowserWindow::create_new_tab(URL url, bool activate)
|
|||
active_tab().view().scroll_element_into_view(element_id);
|
||||
};
|
||||
|
||||
new_tab.webdriver_endpoints().on_get_active_documents_type = [this]() {
|
||||
return active_tab().view().get_active_documents_type();
|
||||
};
|
||||
|
||||
new_tab.webdriver_endpoints().on_get_computed_value_for_element = [this](i32 element_id, String const& property_name) {
|
||||
return active_tab().view().get_computed_value_for_element(element_id, property_name);
|
||||
};
|
||||
|
||||
new_tab.webdriver_endpoints().on_get_element_text = [this](i32 element_id) {
|
||||
return active_tab().view().get_element_text(element_id);
|
||||
};
|
||||
|
|
|
@ -146,28 +146,6 @@ void WebDriverConnection::scroll_element_into_view(i32 element_id)
|
|||
}
|
||||
}
|
||||
|
||||
Messages::WebDriverSessionClient::GetActiveDocumentsTypeResponse WebDriverConnection::get_active_documents_type()
|
||||
{
|
||||
dbgln_if(WEBDRIVER_DEBUG, "WebDriverConnection: get_active_documents_type");
|
||||
if (auto browser_window = m_browser_window.strong_ref()) {
|
||||
auto& tab = browser_window->active_tab();
|
||||
if (tab.webdriver_endpoints().on_get_active_documents_type)
|
||||
return { tab.webdriver_endpoints().on_get_active_documents_type() };
|
||||
}
|
||||
return { "" };
|
||||
}
|
||||
|
||||
Messages::WebDriverSessionClient::GetComputedValueForElementResponse WebDriverConnection::get_computed_value_for_element(i32 element_id, String const& property_name)
|
||||
{
|
||||
dbgln_if(WEBDRIVER_DEBUG, "WebDriverConnection: get_computed_value_for_element");
|
||||
if (auto browser_window = m_browser_window.strong_ref()) {
|
||||
auto& tab = browser_window->active_tab();
|
||||
if (tab.webdriver_endpoints().on_get_computed_value_for_element)
|
||||
return { tab.webdriver_endpoints().on_get_computed_value_for_element(element_id, property_name) };
|
||||
}
|
||||
return { "" };
|
||||
}
|
||||
|
||||
Messages::WebDriverSessionClient::GetElementTextResponse WebDriverConnection::get_element_text(i32 element_id)
|
||||
{
|
||||
dbgln_if(WEBDRIVER_DEBUG, "WebDriverConnection: get_element_text");
|
||||
|
|
|
@ -49,8 +49,6 @@ public:
|
|||
virtual void add_cookie(Web::Cookie::ParsedCookie const&) override;
|
||||
virtual void update_cookie(Web::Cookie::Cookie const&) override;
|
||||
virtual void scroll_element_into_view(i32 element_id) override;
|
||||
virtual Messages::WebDriverSessionClient::GetActiveDocumentsTypeResponse get_active_documents_type() override;
|
||||
virtual Messages::WebDriverSessionClient::GetComputedValueForElementResponse get_computed_value_for_element(i32 element_id, String const& property_name) override;
|
||||
virtual Messages::WebDriverSessionClient::GetElementTextResponse get_element_text(i32 element_id) override;
|
||||
virtual Messages::WebDriverSessionClient::GetElementTagNameResponse get_element_tag_name(i32 element_id) override;
|
||||
virtual Messages::WebDriverSessionClient::GetElementRectResponse get_element_rect(i32 element_id) override;
|
||||
|
|
|
@ -24,8 +24,6 @@ public:
|
|||
~WebDriverEndpoints() = default;
|
||||
|
||||
Function<void(i32 element_id)> on_scroll_element_into_view;
|
||||
Function<String()> on_get_active_documents_type;
|
||||
Function<String(i32 element_id, String const&)> on_get_computed_value_for_element;
|
||||
Function<String(i32 element_id)> on_get_element_text;
|
||||
Function<String(i32 element_id)> on_get_element_tag_name;
|
||||
Function<Gfx::IntRect(i32 element_id)> on_get_element_rect;
|
||||
|
|
|
@ -25,8 +25,6 @@ endpoint WebDriverSessionClient {
|
|||
add_cookie(Web::Cookie::ParsedCookie cookie) =|
|
||||
update_cookie(Web::Cookie::Cookie cookie) =|
|
||||
scroll_element_into_view(i32 element_id) => ()
|
||||
get_active_documents_type() => (String type)
|
||||
get_computed_value_for_element(i32 element_id, String property_name) => (String computed_value)
|
||||
get_element_text(i32 element_id) => (String text)
|
||||
get_element_tag_name(i32 element_id) => (String tag_name)
|
||||
get_element_rect(i32 element_id) => (Gfx::IntRect rect)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue