Sam Atkins
017d6c3314
LibWeb: Implement counter-[increment,reset,set] properties
...
These control the state of CSS counters.
Parsing code for `reversed(counter-name)` is implemented, but disabled
for now until we are able to resolve values for those.
2024-07-26 11:04:30 +01:00
Luke Warlow
6623177265
LibWeb: Implement support for scrollbar-gutter
...
This property is now correctly parsed.
Ladybird always uses overlay scrollbars so this property does nothing.
2024-07-04 13:22:40 +02:00
MacDue
5f17d9b34a
LibWeb: Add BasicShapeStyleValue to represent CSS basic shapes
...
See: https://www.w3.org/TR/css-shapes-1/#basic-shape-functions
This patch only implements the `polygon()` basic shape (with the rest
left as FIXMEs).
2024-05-26 07:55:50 +02:00
Matthew Olsson
5dce559ed8
LibWeb: Parse transition style values
2024-03-29 21:58:12 +01:00
Sam Atkins
3df3a85235
LibGfx+Userland: Move FontWeight enum into its own file
...
FontDatabase.h with its includes add up to quite a lot of code. In the
next commit, compiled GML files are going to need to access the
FontWeight enum, so let's allow them to do that without pulling in lots
of other things.
Also, change users to include FontWeight.h instead of FontDatabase.h
where appropriate.
2024-01-21 09:32:10 -05:00
Sam Atkins
b0317bb3a1
LibWeb: Implement Flex and FlexStyleValue types
2023-09-28 20:33:20 +01:00
Sam Atkins
aea112da71
LibWeb: Replace OverflowStyleValue with ShorthandStyleValue
2023-09-25 00:46:21 +01:00
Sam Atkins
e905072e47
LibWeb: Replace GridTrackPlacementShorthandStyleValue with ShorthandSV
2023-09-25 00:46:21 +01:00
Sam Atkins
8efac89a16
LibWeb: Replace TextDecorationStyleValue with ShorthandStyleValue
2023-09-25 00:46:21 +01:00
Sam Atkins
6e311902de
LibWeb: Replace PlaceItemsStyleValue with ShorthandStyleValue
2023-09-25 00:46:21 +01:00
Sam Atkins
8143d48161
LibWeb: Replace PlaceSelfStyleValue with ShorthandStyleValue
...
Turns out we were parsing `place-self` as a PlaceItemsStyleValue
sometimes, whoops.
2023-09-25 00:46:21 +01:00
Sam Atkins
1b0939b418
LibWeb: Replace PlaceContentStyleValue with ShorthandStyleValue
2023-09-25 00:46:21 +01:00
Sam Atkins
6758decc74
LibWeb: Replace ListStyleStyleValue with ShorthandStyleValue
2023-09-25 00:46:21 +01:00
Sam Atkins
f5cb2e8dc2
LibWeb: Replace GridTrackSizeListShorthandStyleValue with ShorthandSV
2023-09-25 00:46:21 +01:00
Sam Atkins
48f3603119
LibWeb: Replace GridAreaShorthandStyleValue with ShorthandStyleValue
2023-09-25 00:46:21 +01:00
Sam Atkins
23d59a6caf
LibWeb: Replace BorderStyleValue with ShorthandStyleValue
...
And also expand builtin values to the longhands, which we weren't doing
before.
2023-09-25 00:46:21 +01:00
Sam Atkins
9b4ddff6a9
LibWeb: Replace FontStyleValue with ShorthandStyleValue
...
Also, actually include font-variant since we were already parsing it but
throwing it away.
2023-09-20 12:17:16 +01:00
Sam Atkins
34591549b1
LibWeb: Replace BorderRadiusShorthandStyleValue with ShorthandStyleValue
2023-09-20 12:17:16 +01:00
Sam Atkins
34e0899ab0
LibWeb: Replace BackgroundStyleValue with ShorthandStyleValue
...
The `to_string()` for this is modified a little from the original,
because we have to calculate what the layer-count is then, instead of
having it already calculated.
2023-09-20 12:17:16 +01:00
Sam Atkins
1ae515c0b7
LibWeb: Replace FlexFlowStyleValue with ShorthandStyleValue
2023-09-20 12:17:16 +01:00
Sam Atkins
aa45b3dfe3
LibWeb: Replace FlexStyleValue with ShorthandStyleValue
...
We still need the custom parsing and to_string() logic, but nothing
else. :^)
2023-09-20 12:17:16 +01:00
Sam Atkins
d20254f1bc
LibWeb: Rename CompositeStyleValue -> ShorthandStyleValue
...
It's a shorthand, so let's call it that. :^)
2023-09-20 12:17:16 +01:00
Sam Atkins
6476dea898
LibWeb: Implement the math-depth CSS property
...
This one is a bit fun because it can be `add(<integer>)` or `auto-add`,
but children have to inherit the computed value not the specified one.
We also have to compute it before computing the font-size, because of
`font-size: math` which will be implemented later.
2023-09-11 17:03:22 +01:00
Sam Atkins
6367b6a3d0
LibWeb: Use x-macro for StyleValue::Type instead of manual boilerplate
...
This saves us from having to manually write these every time we add a
new type of StyleValue:
- bool is_foo() const;
- FooStyleValue const& as_foo() const;
- FooStyleValue& as_foo();
2023-08-20 17:59:36 +02:00
Andreas Kling
703c2bb06e
LibWeb: Add support for parsing grid-auto-flow CSS property
...
Co-Authored-By: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-08-20 15:36:18 +02:00
Sam Atkins
eca144a75e
LibWeb: Make absolutizing StyleValues infallible
2023-08-19 17:34:22 +02:00
Bastiaan van der Plaat
cc1f7d385c
LibWeb: Move font stretch width calc from StyleComputer to StyleValue
2023-08-09 05:48:32 +02:00
Aliaksandr Kalenik
da2cd73bcf
LibWeb: Add place-self css property support
2023-08-06 08:26:36 +02:00
Aliaksandr Kalenik
a8587fe54e
LibWeb: Add support for "place-items" CSS property
...
Adds support for place-items property which allows to specify both
align-items and justify-items in a single declaration.
2023-07-17 18:58:05 +02:00
Ali Mohammad Pur
dd073b2711
Meta/CodeGenerators+LibWeb: Implement parsing CSS easing functions
...
This only implements the parser bits, no functionality is implemented,
and no properties are parsed because of this.
2023-07-13 05:10:41 +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
Sam Atkins
5e3da93f1a
LibWeb: Add RatioStyleValue and parsing
2023-06-09 20:37:51 +02:00
Sam Atkins
1160d8186b
LibWeb: Implement IntegerStyleValue, for holding <integer>
...
Having one StyleValue for `<number>` and `<integer>` is making user code
more complicated than it needs to be. We know based on the property
being parsed, whether it wants a `<number>` or an `<integer>`, so we
can use separate StyleValue types for these.
2023-06-01 21:04:21 +02:00
Sam Atkins
ad8565011c
LibWeb: Rename NumericStyleValue -> NumberStyleValue
...
This is in preparation of splitting off a separate IntegerStyleValue.
2023-06-01 21:04:21 +02:00
FalseHonesty
dcead6f5eb
LibWeb: Add support for parsing place-content shorthand CSS property
2023-06-01 09:06:13 +02:00
Ali Mohammad Pur
279924242d
LibWeb: Add CSS CompositeStyleValue
...
This represents the value of properties assigned via their shorthands,
and is expanded when computing actual property values.
2023-05-29 05:35:41 +02:00
Sam Atkins
5cbf6eb930
LibWeb: Remove StyleValue::has/to_integer()
...
Only NumericStyleValue holds integers.
I'm not sure our current distinction between NumericStyleValue holding
an integer or non-integer is useful given it always returns a float.
:thonk:
2023-05-27 16:12:25 +02:00
Sam Atkins
f6fae315e3
LibWeb: Add CustomIdentStyleValue, along with parsing for it
...
This corresponds to the `<custom-ident>` type in CSS grammar.
2023-05-25 15:31:20 +01:00
Andreas Kling
82ddc813d5
LibWeb: Stop aggressively quantizing font-weight values
...
Before this change, we were quantizing to either 400, 700 or 900.
This caused us to treat 100/200/300 weighted fonts as if they were
interchangeable.
2023-05-24 20:58:46 +02:00
Andreas Kling
be10360350
LibWeb: Move resolution of font weights and slopes to StyleValue
...
This isn't exactly ideal factoring (though I'm not sure what is) but
this will make it possible to reuse this code in the parser.
2023-05-24 17:19:18 +02:00
Sam Atkins
d732a83de8
LibWeb: Propagate errors from absolutizing StyleValues
2023-05-06 08:07:28 +02:00
Emil Militzer
31e1be0438
LibWeb: Support multi-keyword syntax for CSS display property
...
The Display class already supported all specific values, and now they
will be parsed too. The display property now has a special type
DisplayStyleValue.
2023-05-02 20:27:28 +02:00
martinfalisse
22202715fc
LibWeb: Parse grid-template property
2023-04-30 05:56:10 +02:00
martinfalisse
bebf4363db
LibWeb: Change name of GridTrackSizeListStyleValue
...
Change the name of GridTrackSizeStyleValue to
GridTrackSizeListStyleValue which is more accurate.
2023-04-30 05:56:10 +02:00
Sam Atkins
0679b4e0b9
LibWeb: Wrap font metrics into a struct
...
Rather than passing an increasingly-unwieldy number of font parameters
individually to every function that resolves lengths, let's wrap them
up.
This is frustratingly close to being `Gfx::FontPixelMetrics`, but bitmap
fonts cause issues: We choose the closest font to what the CSS
requests, but that might have a wildly different size than what the
page expects, so we have to fudge the numbers.
No behaviour changes.
2023-04-29 16:23:50 +02:00
MacDue
2fbe5b969b
LibWeb: Add URLStyleValue to represent general url() values
...
This is primarily being added to support `fill: url(#gradient)` for
SVGs.
2023-04-28 09:42:28 +02:00
Sam Atkins
0f9f6aef81
LibWeb: Simplify StyleValue API now that auto isn't a length
...
Now that LengthStyleValue never contains `auto`, IdentifierStyleValue is
the only type that can hold an identifier. This lets us remove a couple
of virtual methods from StyleValue.
I've kept `has_auto()` and `to_identifier()` for convenience, but they
are now simple non-virtual methods.
2023-04-19 18:25:18 +02:00
Sam Atkins
bab968867d
LibWeb: Move StyleValue::absolutized() back where it belongs
...
I accidentally moved this when moving the CalculatedStyleValue methods,
and didn't notice because it was hidden in the middle. Oops!
2023-04-13 09:53:47 +02:00
MacDue
2a659693bc
LibWeb: Add EdgeStyleValue
...
This represents a single edge and offset, this will be needed for
the values of background-position-x/y.
2023-04-03 07:10:33 +02:00
Sam Atkins
1280d70d74
LibWeb: Split CalculatedStyleValue out of StyleValue.{h,cpp}
2023-03-30 21:29:50 +02:00