mirror of
https://github.com/RGBCube/serenity
synced 2025-06-29 01:42:11 +00:00
LibWeb: Add support for the lh and rlh length units
Resolving these units is somewhat tricky because of their interaction with both font-size and line-height, but this implementation seems to work as tested in http://wpt.live/css/css-values/lh-unit-001.html and http://wpt.live/css/css-values/lh-unit-002.html
This commit is contained in:
parent
8a8340b3cd
commit
554c4af90f
9 changed files with 128 additions and 31 deletions
|
@ -168,9 +168,10 @@ bool MediaFeature::compare(HTML::Window const& window, MediaFeatureValue left, C
|
|||
auto const& initial_font = window.associated_document().style_computer().initial_font();
|
||||
Gfx::FontPixelMetrics const& initial_font_metrics = initial_font.pixel_metrics();
|
||||
float initial_font_size = initial_font.presentation_size();
|
||||
float initial_line_height = initial_font_metrics.line_spacing();
|
||||
|
||||
left_px = left.length().to_px(viewport_rect, initial_font_metrics, initial_font_size, initial_font_size);
|
||||
right_px = right.length().to_px(viewport_rect, initial_font_metrics, initial_font_size, initial_font_size);
|
||||
left_px = left.length().to_px(viewport_rect, initial_font_metrics, initial_font_size, initial_font_size, initial_line_height, initial_line_height);
|
||||
right_px = right.length().to_px(viewport_rect, initial_font_metrics, initial_font_size, initial_font_size, initial_line_height, initial_line_height);
|
||||
}
|
||||
|
||||
switch (comparison) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue