mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 20:42:21 +00:00
LibWeb: Fix broken conversion of CSS <resolution> dpi/dpcm to dppx
Also add a basic test that documents how these media features currently get serialized, even if they're not identical to other browsers yet.
This commit is contained in:
parent
b256e52586
commit
b63e393cef
Notes:
sideshowbarker
2024-07-17 01:11:48 +09:00
Author: https://github.com/awesomekling
Commit: b63e393cef
Pull-request: https://github.com/SerenityOS/serenity/pull/20770
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/MacDue
3 changed files with 33 additions and 2 deletions
|
@ -23,9 +23,9 @@ double Resolution::to_dots_per_pixel() const
|
|||
{
|
||||
switch (m_type) {
|
||||
case Type::Dpi:
|
||||
return m_value * 96; // 1in = 2.54cm = 96px
|
||||
return m_value / 96; // 1in = 2.54cm = 96px
|
||||
case Type::Dpcm:
|
||||
return m_value * (96.0 / 2.54); // 1cm = 96px/2.54
|
||||
return m_value / (96.0 / 2.54); // 1cm = 96px/2.54
|
||||
case Type::Dppx:
|
||||
return m_value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue