summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/StyleValue.h
AgeCommit message (Collapse)Author
2022-02-25LibWeb: Parse the `content` propertySam Atkins
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.
2022-02-24LibWeb: Implement CSS Time classSam Atkins
This corresponds to `<time>` in the grammar.
2022-02-24LibWeb: Implement CSS Resolution classSam Atkins
This corresponds to `<resolution>` in the grammar.
2022-02-24LibWeb: Implement CSS Frequency classSam Atkins
This corresponds to `<frequency>` in the grammar.
2022-02-24LibWeb: Implement CSS Angle classSam Atkins
This corresponds to `<angle>` in the grammar.
2022-02-19LibWeb: Cache and reuse some very common StyleValue objectsAndreas Kling
Length values: auto, 0px, 1px Color values: black, white, transparent
2022-02-19LibWeb: Add support for CSS image-rendering propertyMaciej
Currently only "auto" and "pixelated" values are supported.
2022-02-18LibWeb: VERIFY when getting a length from an invalid StyleValueSam Atkins
2022-02-18LibWeb: Use a Variant for calc() percentage_basisSam Atkins
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. :^)
2022-02-08LibWeb: Parse spread-distance and `inset` parts of box-shadowSam Atkins
We do not actually use these when rendering the shadow yet.
2022-02-07LibWeb: Add `pointer-events: all`Sam Atkins
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. :^)
2022-02-04LibWeb: Implement CalculatedStyleValue::to_string()Sam Atkins
2022-02-04LibWeb: Distinguish between Integer and Number calc() valuesSam Atkins
2022-02-04LibWeb: Add resolving calc() to a number/integer/percentageSam Atkins
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.
2022-02-04LibWeb: Allow percentage tokens again when parsing calc()Sam Atkins
I unintentionally broke this in my LengthPercentage PR, but it was not convenient to fix until now.
2022-02-04LibWeb: Refactor calc() resolution logic using CalculationResultSam Atkins
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.
2022-02-04LibWeb: Implement CalculationResult type for calc() resultsSam Atkins
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.
2022-02-04LibWeb: Resolve type of calc() expressions at parse-timeSam Atkins
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.
2022-02-04LibWeb: Combine the two sets of calc() operator enumsSam Atkins
2022-02-04LibWeb: Move calc()-resolution code from Length to CalculatedStyleValueSam Atkins
The code is unchanged, just moved.
2022-02-03LibWeb: Allow comma- or space-separated StyleValueListsSam Atkins
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.
2022-02-03LibWeb: Move non-trivial StyleValue to_string() methods to cpp fileSam Atkins
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. :^)
2022-01-23LibWeb: Add new property 'text-decoration-style'Tobias Christiansen
This patch makes the property 'text-decoration-style' known throughout all the places in LibWeb that care.
2022-01-20LibWeb: Remove Length::Type::Percentage :^)Sam Atkins
All `<percentage>`s in the CSS grammar are now represented by the `Percentage` class, and `<length-percentage>` by `LengthPercentage`.
2022-01-20LibWeb: Convert flex-basis to LengthPercentageSam Atkins
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.
2022-01-20LibWeb: Convert background-position to LengthPercentageSam Atkins
Not much needed changing this time, hurrah! :^)
2022-01-20LibWeb: Convert background-size from Length to LengthPercentageSam Atkins
Checking these for `auto` is awkward, but separating that will come later. :^)
2022-01-20LibWeb: Convert border-radii from Length to LengthPercentage :^)Sam Atkins
The visit_lengths() code is a bit awkward but we'll clean that up later.
2022-01-20LibWeb: Remove BorderRadiusStyleValue::to_length() hackSam Atkins
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. :^)
2022-01-20LibWeb: Add PercentageStyleValue, and parse itSam Atkins
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. :^)
2022-01-20LibWeb: Alphabetize StyleValue classesSam Atkins
2021-12-11Everywhere: Fix -Winconsistent-missing-override warnings from ClangDaniel Bertalan
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.
2021-12-09LibWeb: Remove now-unused CustomStyleValueSam Atkins
2021-12-09LibWeb: Add new UnresolvedStyleValue classSam Atkins
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.
2021-11-17LibWeb: Store all background properties in BackgroundLayerDataSam Atkins
All of this is now passed along to `paint_background()`. :^) (As always, "all" excludes the background-color since that's not a layer property.)
2021-11-17LibWeb: Bring BackgroundStyleValue::to_string() to specSam Atkins
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.
2021-11-10LibWeb: Parse background-size as part of background shorthandSam Atkins
2021-11-10LibWeb: Add BackgroundSizeStyleValueSam Atkins
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.
2021-11-10LibWeb: Store Repeat values directly in BackgroundRepeatStyleValueSam Atkins
...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. :^)
2021-11-10LibWeb: Use BackgroundRepeatStyleValue in `background` shorthandSam Atkins
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.
2021-11-10LibWeb: Parse `background-clip` and `background-origin`Sam Atkins
Including as part of the `background` shorthand. :^)
2021-11-10LibWeb: Parse `background-attachment` as part of `background` propertySam Atkins
2021-11-10LibWeb: Add `background-position` to `background` propertySam Atkins
This required modifying the background-parsing code to use a TokenStream, but that turned out to be pretty simple.
2021-11-10LibWeb: Parse CSS `background-position` propertySam Atkins
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.
2021-10-23LibWeb: Move image resource request out of ImageStyleValue constructorSam Atkins
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()`.
2021-10-19LibWeb: Distinguish between integer and float in NumericStyleValueSam Atkins
We have this information when parsing, and some properties specifically only allow integers, so it makes sense to keep that around.
2021-10-18LibWeb: Make 'auto' LengthStyleValues return 'auto' identifierSam Atkins
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.
2021-10-18LibWeb: Use east const in StyleValue.{h,cpp}Sam Atkins
2021-10-15LibWeb: Use W3C urls for CSS-VALUES-3 spec linksSam Atkins
2021-10-09LibWeb: Add initial version of pointer-events CSS propertyhuwdp