mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:58:11 +00:00
LibHTML: Add the currently visible viewport rect to RenderingContext
This will allow rendering code to skip various things sometimes. :^)
This commit is contained in:
parent
1bd2941467
commit
b4c0ea89d5
2 changed files with 7 additions and 0 deletions
|
@ -118,6 +118,7 @@ void HtmlView::paint_event(GPaintEvent& event)
|
||||||
|
|
||||||
RenderingContext context { painter };
|
RenderingContext context { painter };
|
||||||
context.set_should_show_line_box_borders(m_should_show_line_box_borders);
|
context.set_should_show_line_box_borders(m_should_show_line_box_borders);
|
||||||
|
context.set_viewport_rect(visible_content_rect());
|
||||||
layout_root()->render(context);
|
layout_root()->render(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <LibDraw/Rect.h>
|
||||||
|
|
||||||
class GPainter;
|
class GPainter;
|
||||||
|
|
||||||
class RenderingContext {
|
class RenderingContext {
|
||||||
|
@ -14,7 +16,11 @@ public:
|
||||||
bool should_show_line_box_borders() const { return m_should_show_line_box_borders; }
|
bool should_show_line_box_borders() const { return m_should_show_line_box_borders; }
|
||||||
void set_should_show_line_box_borders(bool value) { m_should_show_line_box_borders = value; }
|
void set_should_show_line_box_borders(bool value) { m_should_show_line_box_borders = value; }
|
||||||
|
|
||||||
|
Rect viewport_rect() const { return m_viewport_rect; }
|
||||||
|
void set_viewport_rect(const Rect& rect) { m_viewport_rect = rect; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GPainter& m_painter;
|
GPainter& m_painter;
|
||||||
|
Rect m_viewport_rect;
|
||||||
bool m_should_show_line_box_borders { false };
|
bool m_should_show_line_box_borders { false };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue