diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-10-15 21:52:01 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-10-15 21:52:01 +0200 |
commit | b4c0ea89d57d17f773a825464fc3586c26ed5702 (patch) | |
tree | 5be475faba6185f2b0a196e40ee879a9fe57169c /Libraries | |
parent | 1bd29414672caca335c47e9c46ac6c194d918700 (diff) | |
download | serenity-b4c0ea89d57d17f773a825464fc3586c26ed5702.zip |
LibHTML: Add the currently visible viewport rect to RenderingContext
This will allow rendering code to skip various things sometimes. :^)
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibHTML/HtmlView.cpp | 1 | ||||
-rw-r--r-- | Libraries/LibHTML/RenderingContext.h | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/Libraries/LibHTML/HtmlView.cpp b/Libraries/LibHTML/HtmlView.cpp index 71552ecdd3..2a46a91ac5 100644 --- a/Libraries/LibHTML/HtmlView.cpp +++ b/Libraries/LibHTML/HtmlView.cpp @@ -118,6 +118,7 @@ void HtmlView::paint_event(GPaintEvent& event) RenderingContext context { painter }; context.set_should_show_line_box_borders(m_should_show_line_box_borders); + context.set_viewport_rect(visible_content_rect()); layout_root()->render(context); } diff --git a/Libraries/LibHTML/RenderingContext.h b/Libraries/LibHTML/RenderingContext.h index bfba539968..ee048035ab 100644 --- a/Libraries/LibHTML/RenderingContext.h +++ b/Libraries/LibHTML/RenderingContext.h @@ -1,5 +1,7 @@ #pragma once +#include <LibDraw/Rect.h> + class GPainter; class RenderingContext { @@ -14,7 +16,11 @@ public: 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; } + Rect viewport_rect() const { return m_viewport_rect; } + void set_viewport_rect(const Rect& rect) { m_viewport_rect = rect; } + private: GPainter& m_painter; + Rect m_viewport_rect; bool m_should_show_line_box_borders { false }; }; |