Sam Atkins
53f3ed026a
LibWeb: Mark CalculatedStyleValue::resolve_integer() as const
2023-09-11 17:03:22 +01:00
Aliaksandr Kalenik
0fb571c1c2
LibWeb: Add Length::resolved()
overload for CSSPixels
...
Since we always pass the px value as an argument to resolved(), we can
pass it directly as CSSPixels instead of wrapping it in Length. This
approach allows us to avoid converting to a double, resulting in fewer
precision issues.
2023-08-30 20:09:15 +02:00
Sam Atkins
c171810030
LibWeb: Make CalculatedStyleValue::dump() infallible
2023-08-22 17:51:48 +01:00
Sam Atkins
7fe97ee6c5
LibWeb: Make StyleValue::to_string() infallible
2023-08-22 17:51:48 +01:00
Sam Atkins
2038cb3c81
LibWeb: Make CSS math function parsing infallible
2023-08-19 17:34:22 +02:00
Sam Atkins
8a8cc18cf4
LibWeb: Make StyleValue constructors infallible
2023-08-19 17:34:22 +02:00
Sam Atkins
136dc7a1c3
LibWeb: Extract CalculationNode::constant_type_from_string() function
...
This is needed by some upcoming generated code. Renamed "PI" member to
"Pi" while I was at it.
2023-07-15 10:23:33 +02:00
Sam Atkins
e4a2bd7a44
LibWeb: Move RoundingMode to Enums.json
...
In the spec this is a `<rounding-strategy>`, so let's use that name.
This also fixes a bug where we were serializing `to-zero` as
`toward-zero`.
2023-07-15 10:23:33 +02:00
Ali Mohammad Pur
06c6c40df9
LibWeb+LibJS: Move some code around to make CSS/Parser parse faster
...
This makes it possible to include fewer full definitions of things,
which makes the file about 30% faster to compile.
2023-07-11 09:38:37 +03:30
Timothy Flynn
c911781c21
Everywhere: Remove needless trailing semi-colons after functions
...
This is a new option in clang-format-16.
2023-07-08 10:32:56 +01:00
Sam Atkins
f21a30e45f
LibWeb: Use CSSNumericType for CalculatedStyleValue resolved type
2023-07-06 09:28:16 +02:00
Sam Atkins
4d84080fdc
LibWeb: Implement "Determine the type of a calculation" algorithm
...
This is sitting alongside our old implementation for the moment.
2023-07-06 09:28:16 +02:00
Sam Atkins
434bac3c67
LibWeb: Return true for is_operator_node()
for math-function nodes
2023-07-06 09:28:16 +02:00
stelar7
d6db924d47
LibWeb: Implement CSS rem()
2023-06-17 12:13:28 +01:00
stelar7
dc042662d1
LibWeb: Implement CSS mod()
2023-06-17 12:13:28 +01:00
stelar7
b2230c826b
LibWeb: Implement CSS round()
2023-06-17 12:13:28 +01:00
stelar7
5727e276ea
LibWeb: Implement CSS exp()
2023-06-16 14:58:47 +01:00
stelar7
6dde49404a
LibWeb: Implement CSS log()
2023-06-16 14:58:47 +01:00
stelar7
fa37bb8b76
LibWeb: Implement CSS hypot()
2023-06-16 14:58:47 +01:00
stelar7
0d30fb5a6e
LibWeb: Implement CSS sqrt()
2023-06-16 14:58:47 +01:00
stelar7
9aed8ec7f0
LibWeb: Implement CSS pow()
2023-06-16 14:58:47 +01:00
stelar7
a9a62ad8c9
LibWeb: Implement CSS atan2()
2023-06-15 16:54:14 +01:00
stelar7
1aa84dfddd
LibWeb: Implement CSS atan()
2023-06-15 16:54:14 +01:00
stelar7
784e1cfb72
LibWeb: Implement CSS acos()
2023-06-15 16:54:14 +01:00
stelar7
708b5ef447
LibWeb: Implement CSS asin()
2023-06-15 16:54:14 +01:00
stelar7
64f0349a9e
LibWeb: Implement CSS tan()
2023-06-15 16:54:14 +01:00
stelar7
46a5efe388
LibWeb: Implement CSS cos()
2023-06-15 16:54:14 +01:00
stelar7
c73f476915
LibWeb: Implement CSS sin()
2023-06-15 16:54:14 +01:00
stelar7
ba7af82c5c
LibWeb: Parse css math constants
2023-06-15 15:40:55 +01:00
stelar7
e1e382152c
LibWeb: Implement CSS sign()
2023-06-15 12:26:34 +01:00
stelar7
79fc4c8a82
LibWeb: Implement CSS abs()
2023-06-15 12:26:34 +01:00
Andreas Kling
df8a96ee00
LibWeb: Add a way to resolve calc() values without a layout node
...
Instead of a layout node, you can pass a new Length::ResolutionContext
struct which contains everything needed to resolve calc() lengths.
2023-06-02 20:03:28 +02:00
stelar7
2ef6aa5f3d
LibWeb: Parse clamp()
css math function
2023-06-02 05:22:12 +02:00
stelar7
eaee0ecd88
LibWeb: Parse max()
css math function
2023-06-02 05:22:12 +02:00
stelar7
6a10821bfd
LibWeb: Parse min()
css math function
2023-06-02 05:22:12 +02:00
stelar7
421559d725
LibWeb: Change calc node representation from float to double
2023-05-31 10:56:32 +02:00
stelar7
344f37986f
LibWeb: Allow calculated values in transform
2023-05-31 05:57:53 +02:00
Sam Atkins
d16600a48b
LibWeb: Propagate errors from StyleValue construction
...
Turns out we create a lot of these, mostly from places that don't return
ErrorOr. The yak stack grows.
2023-05-06 08:07:28 +02:00
Sam Atkins
d0f80b40b2
LibWeb: Reimplement CalculatedStyleValue as a calculation node tree
...
VALUES-4 defines the internal representation of `calc()` as a tree of
calculation nodes. ( https://www.w3.org/TR/css-values-4/#calc-internal )
VALUES-3 lacked any definition here, so we had our own ad-hoc
implementation based around the spec grammar. This commit replaces that
with CalculationNodes representing each possible node in the tree.
There are no intended functional changes, though we do now support
nested calc() which previously did not work. For example:
`width: calc( 42 * calc(3 + 7) );`
I have added an example of this to our test page.
A couple of the layout tests that used `calc()` now return values that
are 0.5px different from before. There's no visual difference, so I
have updated the tests to use the new results.
2023-04-13 09:53:47 +02:00
Sam Atkins
1352f8820b
LibWeb: Simplify CalculatedStyleValue types to match CSS-VALUES-4 :^)
...
Level 4 drops the limitations of what types can be a denominator, which
means `<calc-number-sum>`, `<calc-number-product>` and
`<calc-number-value>` all go away.
2023-04-13 09:53:47 +02:00
Sam Atkins
1280d70d74
LibWeb: Split CalculatedStyleValue out of StyleValue.{h,cpp}
2023-03-30 21:29:50 +02:00