mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
Ladybird: Send window size and position to WebContent process
This commit is contained in:
parent
24d5bf8173
commit
b51090e83e
Notes:
sideshowbarker
2024-07-17 06:39:26 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/b51090e83e Pull-request: https://github.com/SerenityOS/serenity/pull/17776
@ -507,6 +507,22 @@ void BrowserWindow::copy_selected_text()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BrowserWindow::resizeEvent(QResizeEvent* event)
|
||||||
|
{
|
||||||
|
QWidget::resizeEvent(event);
|
||||||
|
for (auto& tab : m_tabs) {
|
||||||
|
tab->view().set_window_size({ frameSize().width(), frameSize().height() });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BrowserWindow::moveEvent(QMoveEvent* event)
|
||||||
|
{
|
||||||
|
QWidget::moveEvent(event);
|
||||||
|
for (auto& tab : m_tabs) {
|
||||||
|
tab->view().set_window_position({ event->pos().x(), event->pos().y() });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool BrowserWindow::eventFilter(QObject* obj, QEvent* event)
|
bool BrowserWindow::eventFilter(QObject* obj, QEvent* event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::MouseButtonRelease) {
|
if (event->type() == QEvent::MouseButtonRelease) {
|
||||||
|
@ -54,9 +54,12 @@ public slots:
|
|||||||
void copy_selected_text();
|
void copy_selected_text();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject* obj, QEvent* event);
|
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
virtual void resizeEvent(QResizeEvent*) override;
|
||||||
|
virtual void moveEvent(QMoveEvent*) override;
|
||||||
|
|
||||||
void debug_request(DeprecatedString const& request, DeprecatedString const& argument = "");
|
void debug_request(DeprecatedString const& request, DeprecatedString const& argument = "");
|
||||||
|
|
||||||
QTabWidget* m_tabs_container { nullptr };
|
QTabWidget* m_tabs_container { nullptr };
|
||||||
|
@ -452,6 +452,16 @@ void WebContentView::set_viewport_rect(Gfx::IntRect rect)
|
|||||||
client().async_set_viewport_rect(rect);
|
client().async_set_viewport_rect(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebContentView::set_window_size(Gfx::IntSize size)
|
||||||
|
{
|
||||||
|
client().async_set_window_size(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebContentView::set_window_position(Gfx::IntPoint position)
|
||||||
|
{
|
||||||
|
client().async_set_window_position(position);
|
||||||
|
}
|
||||||
|
|
||||||
void WebContentView::update_viewport_rect()
|
void WebContentView::update_viewport_rect()
|
||||||
{
|
{
|
||||||
auto scaled_width = int(viewport()->width() / m_inverse_pixel_scaling_ratio);
|
auto scaled_width = int(viewport()->width() / m_inverse_pixel_scaling_ratio);
|
||||||
|
@ -98,6 +98,8 @@ public:
|
|||||||
ErrorOr<String> dump_layout_tree();
|
ErrorOr<String> dump_layout_tree();
|
||||||
|
|
||||||
void set_viewport_rect(Gfx::IntRect);
|
void set_viewport_rect(Gfx::IntRect);
|
||||||
|
void set_window_size(Gfx::IntSize);
|
||||||
|
void set_window_position(Gfx::IntPoint);
|
||||||
|
|
||||||
Gfx::IntPoint to_content(Gfx::IntPoint) const;
|
Gfx::IntPoint to_content(Gfx::IntPoint) const;
|
||||||
Gfx::IntPoint to_widget(Gfx::IntPoint) const;
|
Gfx::IntPoint to_widget(Gfx::IntPoint) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user