mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-26 20:26:53 +00:00
LibWeb: Serialize NumberStyleValue with 6 decimal places of precision
This commit is contained in:
parent
7182a537f3
commit
1a9dd70792
Notes:
github-actions[bot]
2025-08-11 16:12:11 +00:00
Author: https://github.com/Calme1709
Commit: 1a9dd70792
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5734
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/tcl3
2 changed files with 15 additions and 9 deletions
|
@ -14,7 +14,13 @@ namespace Web::CSS {
|
|||
|
||||
String NumberStyleValue::to_string(SerializationMode) const
|
||||
{
|
||||
return String::number(m_value);
|
||||
// FIXME: This should be moved into Serialize.cpp and used by applicable dimensions as well.
|
||||
// https://drafts.csswg.org/cssom/#serialize-a-css-value
|
||||
// <number>
|
||||
// A base-ten number using digits 0-9 (U+0030 to U+0039) in the shortest form possible, using "." to separate
|
||||
// decimals (if any), rounding the value if necessary to not produce more than 6 decimals, preceded by "-" (U+002D)
|
||||
// if it is negative.
|
||||
return MUST(String::formatted("{:.6}", m_value));
|
||||
}
|
||||
|
||||
Vector<Parser::ComponentValue> NumberStyleValue::tokenize() const
|
||||
|
|
|
@ -3,7 +3,7 @@ matrix(1, 2, 3, 4, 5, 6) => matrix(1, 2, 3, 4, 5, 6)
|
|||
matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) => matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
|
||||
perspective(none) => matrix(1, 0, 0, 1, 0, 0)
|
||||
perspective(0) => matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -1, 0, 0, 0, 1)
|
||||
perspective(4cm) => matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.006614303216338158, 0, 0, 0, 1)
|
||||
perspective(4cm) => matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, -0.006614, 0, 0, 0, 1)
|
||||
translate(1%, 2px) => matrix(1, 0, 0, 1, 7.828125, 2)
|
||||
translate3d(1%, 2px, 3em) => matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 7.828125, 2, 48, 1)
|
||||
translateX(1px) => matrix(1, 0, 0, 1, 1, 0)
|
||||
|
@ -21,11 +21,11 @@ scaleZ(1.5) => matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1.5, 0, 0, 0, 0, 1)
|
|||
scaleZ(150%) => matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1.5, 0, 0, 0, 0, 1)
|
||||
scale3d(1, 2, 1.5) => matrix3d(1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1.5, 0, 0, 0, 0, 1)
|
||||
scale3d(100%, 200%, 150%) => matrix3d(1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1.5, 0, 0, 0, 0, 1)
|
||||
rotate(1deg) => matrix(0.9998477101325989, 0.017452405765652657, -0.017452405765652657, 0.9998477101325989, 0, 0)
|
||||
rotateX(1rad) => matrix3d(1, 0, 0, 0, 0, 0.5403022766113281, 0.8414709568023682, 0, 0, -0.8414709568023682, 0.5403022766113281, 0, 0, 0, 0, 1)
|
||||
rotateY(1grad) => matrix3d(0.9998766183853149, 0, -0.015707317739725113, 0, 0, 1, 0, 0, 0.015707317739725113, 0, 0.9998766183853149, 0, 0, 0, 0, 1)
|
||||
rotate(1deg) => matrix(0.999848, 0.017452, -0.017452, 0.999848, 0, 0)
|
||||
rotateX(1rad) => matrix3d(1, 0, 0, 0, 0, 0.540302, 0.841471, 0, 0, -0.841471, 0.540302, 0, 0, 0, 0, 1)
|
||||
rotateY(1grad) => matrix3d(0.999877, 0, -0.015707, 0, 0, 1, 0, 0, 0.015707, 0, 0.999877, 0, 0, 0, 0, 1)
|
||||
rotateZ(1turn) => matrix(1, 0, 0, 1, 0, 0)
|
||||
rotate3d(0, 1, 0, 45rad) => matrix3d(0.5253220200538635, 0, -0.8509035110473633, 0, 0, 1, 0, 0, 0.8509035110473633, 0, 0.5253220200538635, 0, 0, 0, 0, 1)
|
||||
skew(1deg, 1rad) => matrix(1, 1.5574077367782593, 0.01745506562292576, 1, 0, 0)
|
||||
skewX(1deg) => matrix(1, 0, 0.01745506562292576, 1, 0, 0)
|
||||
skewY(1rad) => matrix(1, 1.5574077367782593, 0, 1, 0, 0)
|
||||
rotate3d(0, 1, 0, 45rad) => matrix3d(0.525322, 0, -0.850904, 0, 0, 1, 0, 0, 0.850904, 0, 0.525322, 0, 0, 0, 0, 1)
|
||||
skew(1deg, 1rad) => matrix(1, 1.557408, 0.017455, 1, 0, 0)
|
||||
skewX(1deg) => matrix(1, 0, 0.017455, 1, 0, 0)
|
||||
skewY(1rad) => matrix(1, 1.557408, 0, 1, 0, 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue