mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
WebContent: Use available size for bitmap (#2701)
After adding the scrolling feature, content available space reduced and thus the bitmap size was always larger, than the inner size. This lead to the horizontal scrollbar always beeing engaged.
This commit is contained in:
parent
a8489967a3
commit
0f6c5783d3
Notes:
sideshowbarker
2024-07-19 05:09:51 +09:00
Author: https://github.com/kevmeyer Commit: https://github.com/SerenityOS/serenity/commit/0f6c5783d3a Pull-request: https://github.com/SerenityOS/serenity/pull/2701
1 changed files with 6 additions and 5 deletions
|
@ -48,7 +48,7 @@ void WebContentView::load(const URL& url)
|
|||
|
||||
void WebContentView::paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
GUI::Frame::paint_event(event);
|
||||
GUI::ScrollableWidget::paint_event(event);
|
||||
|
||||
GUI::Painter painter(*this);
|
||||
painter.add_clip_rect(frame_inner_rect());
|
||||
|
@ -61,11 +61,12 @@ void WebContentView::paint_event(GUI::PaintEvent& event)
|
|||
|
||||
void WebContentView::resize_event(GUI::ResizeEvent& event)
|
||||
{
|
||||
GUI::Widget::resize_event(event);
|
||||
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, event.size());
|
||||
GUI::ScrollableWidget::resize_event(event);
|
||||
|
||||
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGB32, available_size());
|
||||
m_bitmap = bitmap->to_bitmap_backed_by_shared_buffer();
|
||||
m_bitmap->shared_buffer()->share_with(client().server_pid());
|
||||
client().post_message(Messages::WebContentServer::SetViewportRect(Gfx::IntRect({ horizontal_scrollbar().value(), vertical_scrollbar().value() }, event.size())));
|
||||
client().post_message(Messages::WebContentServer::SetViewportRect(Gfx::IntRect({ horizontal_scrollbar().value(), vertical_scrollbar().value() }, m_bitmap->size())));
|
||||
request_repaint();
|
||||
}
|
||||
|
||||
|
@ -116,7 +117,7 @@ void WebContentView::notify_server_did_change_title(Badge<WebContentClient>, con
|
|||
|
||||
void WebContentView::did_scroll()
|
||||
{
|
||||
client().post_message(Messages::WebContentServer::SetViewportRect(Gfx::IntRect({ horizontal_scrollbar().value(), vertical_scrollbar().value() }, size())));
|
||||
client().post_message(Messages::WebContentServer::SetViewportRect(visible_content_rect()));
|
||||
request_repaint();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue