Age | Commit message (Collapse) | Author |
|
For now, we only understand `none`, `normal`, `<image>` and `<string>`.
The various other functions and identifiers can be added later.
We can *almost* use a StyleValueList for this, except it's divided into
two parts - the content, and the optional "alt text". So, I've added a
new StyleValue for it.
|
|
This corresponds to `<time>` in the grammar.
|
|
This corresponds to `<resolution>` in the grammar.
|
|
This corresponds to `<frequency>` in the grammar.
|
|
This corresponds to `<angle>` in the grammar.
|
|
Length values: auto, 0px, 1px
Color values: black, white, transparent
|
|
Currently only "auto" and "pixelated" values are supported.
|
|
|
|
Depending on the type of the calc() expression, the percentage_basis has
to be the same dimension type. Several places were already passing `
{}` for this, so let's make that an empty Variant instead of an
undefined Length. :^)
|
|
We do not actually use these when rendering the shadow yet.
|
|
This is basically the same as `auto` in the spec, so let's just treat
them as identical for now. Gets rid of some Discord CSS parser
spam. :^)
|
|
|
|
|
|
None of these require any outside metrics, which is nice! I believe the
Values-4 spec would have us simplify them down into a single value at
parse time, but that's a yak for another day.
|
|
I unintentionally broke this in my LengthPercentage PR, but it was not
convenient to fix until now.
|
|
The previous static functions are now methods of their respective
CalcFoo structs, but the logic has not changed, only that they work
with CalculationResults instead of converting everything to floats.
|
|
calc() sub-expressions can return a variety of different types, which
then can be combined using the basic arithmetic operators. This class
should make that easier to deal with, instead of having to handle all
the possible combinations at each call site. :^)
We take the Layout::Node as a pointer not a reference, since later we'll
need to call these functions when resolving to `<number>` or `<integer>`
which don't use those, and we don't want to force users to pass them in
unnecessarily.
|
|
See https://www.w3.org/TR/css-values-3/#calc-type-checking
If the sub-expressions' types are incompatible, we discard the calc() as
invalid.
Had to do some minor rearranging/renaming of the Calc structs to make
the `resolve_foo_type()` templates work too.
|
|
|
|
The code is unchanged, just moved.
|
|
This lets us produce valid CSS in its to_string() method, instead of
always adding commas as before. :^)
Also, finally added a Formatter for StyleValues.
|
|
Many of these will need to change in the future in order to include
features we don't yet support, and touching StyleValue.h is a great way
to have to wait for all of LibWeb to rebuild. I'm hoping this saves me
time in the long run. :^)
|
|
This patch makes the property 'text-decoration-style' known throughout
all the places in LibWeb that care.
|
|
All `<percentage>`s in the CSS grammar are now represented by the
`Percentage` class, and `<length-percentage>` by `LengthPercentage`.
|
|
The flexbox logic confuses me so regressions are possible, though our
test page looks the same as before so it should be fine.
Renamed FlexBasis::Length -> LengthPercentage too, for clarity.
|
|
Not much needed changing this time, hurrah! :^)
|
|
Checking these for `auto` is awkward, but separating that will come
later. :^)
|
|
The visit_lengths() code is a bit awkward but we'll clean that up later.
|
|
Layout::Node still treats border radii as having a single value instead
of horizontal and vertical, but one less hack is nice, and helps with
conversion to LengthPercentage. :^)
|
|
This is in a slightly weird state, where Percentages are sometimes
Lengths and sometimes not, which I will be cleaning up in subsequent
commits, in an attempt not to change all of LibWeb in one go. :^)
|
|
|
|
This option is already enabled when building Lagom, so let's enable it
for the main build too. We will no longer be surprised by Lagom Clang
CI builds failing while everything compiles locally.
Furthermore, the stronger `-Wsuggest-override` warning is enabled in
this commit, which enforces the use of the `override` keyword in all
classes, not just those which already have some methods marked as
`override`. This works with both GCC and Clang.
|
|
|
|
This represents a property value that hasn't been converted to a
"proper" StyleValue yet. That is, it's either a custom property's value,
or a value that includes `var()` references, (or both!) since neither of
those can be fully resolved at parse time.
|
|
All of this is now passed along to `paint_background()`. :^)
(As always, "all" excludes the background-color since that's not a layer
property.)
|
|
This now outputs valid CSS representing the background, instead of
confusing debug info.
We can't guarantee that all the longhands have the same number of
values, since while that's always the case when parsing, we also create
BackgroundStyleValues when producing the resolved style, which just
combines the longhands together.
|
|
|
|
There's nothing really background-size-specific about this, but since
there is no `<size>` value type defined in the CSS spec at this time,
and background-size is the only user of it, I think this name makes more
sense. But I'm not 100% convinced.
|
|
...as opposed to storing StyleValues, which we have to later check are
IdentifierStyleValues, which store identifiers that we can convert to
Repeat values later. It's fewer allocations, and we can't end up with
invalid values by mistake. :^)
|
|
This is step 1 in removing the two `background-repeat-x/y`
pseudo-properties. Since adding the concept of compound StyleValues, we
don't need `background-repeat` to be split in two any more.
|
|
Including as part of the `background` shorthand. :^)
|
|
|
|
This required modifying the background-parsing code to use a
TokenStream, but that turned out to be pretty simple.
|
|
This is done a bit differently from other properties: using a
TokenStream instead of just a Vector of ComponentValues. The reason for
this is, we can then use call the same function when parsing the
`background` shorthand. Otherwise, we would have to know in advance how
many values to pass down, which basically would involve duplicating the
`background-position` parsing code inside `background`.
The StyleValue is PositionStyleValue, since it represents a
`<position>`: https://www.w3.org/TR/css-values-4/#typedef-position
Unfortunately, background-position's parsing is a bit different from
`<position>`'s, (background-position allows 3-value syntax and
`<position>` doesn't) so we'll need to come back and write a different
parsing function for that later.
|
|
This always felt awkward to me, and required a few other hacks to make
it work. Now, the request is only started when `load_bitmap()` is
called, which we do inside `NodeWithStyle::apply_style()`.
|
|
We have this information when parsing, and some properties specifically
only allow integers, so it makes sense to keep that around.
|
|
I think I broke this in my previous StyleValue clean-up. This prevented
properties like `foo: auto;` from parsing, if they did not accept
Lengths.
|
|
|
|
|
|
|