mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
LibWeb: Add .scaled_font() helper to Layout::Node
This returns the font scaled for the current zoom level.
This commit is contained in:
parent
f3c450559f
commit
7061a3d8e6
2 changed files with 11 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue