summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout/Node.h
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2023-04-01 21:12:15 +0100
committerLinus Groh <mail@linusgroh.de>2023-04-01 22:39:47 +0100
commit7061a3d8e6ef3f32b9da5e6b65a331f6ff2e54a3 (patch)
tree22c5bc107edd8f828f205a51d5c8f0d4a1c978c8 /Userland/Libraries/LibWeb/Layout/Node.h
parentf3c450559fce1e8af9df0c7a160c34239cd4319d (diff)
downloadserenity-7061a3d8e6ef3f32b9da5e6b65a331f6ff2e54a3.zip
LibWeb: Add .scaled_font() helper to Layout::Node
This returns the font scaled for the current zoom level.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout/Node.h')
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h
index 271da99197..1022f2bfc9 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.h
+++ b/Userland/Libraries/LibWeb/Layout/Node.h
@@ -14,6 +14,7 @@
#include <LibJS/Heap/Handle.h>
#include <LibWeb/CSS/ComputedValues.h>
#include <LibWeb/CSS/StyleProperties.h>
+#include <LibWeb/FontCache.h>
#include <LibWeb/Forward.h>
#include <LibWeb/Layout/BoxModelMetrics.h>
#include <LibWeb/Painting/PaintContext.h>
@@ -117,6 +118,8 @@ public:
bool can_contain_boxes_with_position_absolute() const;
Gfx::Font const& font() const;
+ Gfx::Font const& scaled_font(PaintContext&) const;
+
CSS::ImmutableComputedValues const& computed_values() const;
CSSPixels line_height() const;
@@ -237,6 +240,11 @@ inline Gfx::Font const& Node::font() const
return parent()->font();
}
+inline Gfx::Font const& Node::scaled_font(PaintContext& context) const
+{
+ return *FontCache::the().scaled_font(font(), context.device_pixels_per_css_pixel());
+}
+
inline const CSS::ImmutableComputedValues& Node::computed_values() const
{
if (m_has_style)