1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:37:34 +00:00

Browser+WebContent+WebDriver: Move Get Element Rect to WebContent

This commit is contained in:
Timothy Flynn 2022-11-10 10:33:29 -05:00 committed by Linus Groh
parent 9dd62228c8
commit 30d6a73d0e
16 changed files with 65 additions and 79 deletions

View file

@ -611,10 +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_element_rect = [this](i32 element_id) {
return active_tab().view().get_element_rect(element_id);
};
new_tab.webdriver_endpoints().on_is_element_enabled = [this](i32 element_id) {
return active_tab().view().is_element_enabled(element_id);
};

View file

@ -146,17 +146,6 @@ void WebDriverConnection::scroll_element_into_view(i32 element_id)
}
}
Messages::WebDriverSessionClient::GetElementRectResponse WebDriverConnection::get_element_rect(i32 element_id)
{
dbgln("WebDriverConnection: get_element_rect {}", element_id);
if (auto browser_window = m_browser_window.strong_ref()) {
auto& tab = browser_window->active_tab();
if (tab.webdriver_endpoints().on_get_element_rect)
return { tab.webdriver_endpoints().on_get_element_rect(element_id) };
}
return { {} };
}
Messages::WebDriverSessionClient::IsElementEnabledResponse WebDriverConnection::is_element_enabled(i32 element_id)
{
dbgln("WebDriverConnection: is_element_enabled {}", element_id);

View file

@ -49,7 +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::GetElementRectResponse get_element_rect(i32 element_id) override;
virtual Messages::WebDriverSessionClient::IsElementEnabledResponse is_element_enabled(i32 element_id) override;
virtual Messages::WebDriverSessionClient::TakeScreenshotResponse take_screenshot() override;
virtual Messages::WebDriverSessionClient::TakeElementScreenshotResponse take_element_screenshot(i32 element_id) override;

View file

@ -24,7 +24,6 @@ public:
~WebDriverEndpoints() = default;
Function<void(i32 element_id)> on_scroll_element_into_view;
Function<Gfx::IntRect(i32 element_id)> on_get_element_rect;
Function<bool(i32 element_id)> on_is_element_enabled;
Function<Gfx::ShareableBitmap(i32 element_id)> on_take_element_screenshot;
Function<String()> on_serialize_source;

View file

@ -25,7 +25,6 @@ endpoint WebDriverSessionClient {
add_cookie(Web::Cookie::ParsedCookie cookie) =|
update_cookie(Web::Cookie::Cookie cookie) =|
scroll_element_into_view(i32 element_id) => ()
get_element_rect(i32 element_id) => (Gfx::IntRect rect)
is_element_enabled(i32 element_id) => (bool enabled)
take_screenshot() => (Gfx::ShareableBitmap data)
take_element_screenshot(i32 element_id) => (Gfx::ShareableBitmap data)