summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/Parser/Token.h
AgeCommit message (Collapse)Author
2021-07-31LibWeb: Make CSS 'An+B' parsing spec-compliantSam Atkins
Parsing this pattern from CSS tokens turns out to be slightly crazy, but thankfully well documented in the spec. The spec lists the cases in order of simple -> complicated, but this would cause problems in code, since `<n-dimension> <signed-.integer>` would never by reached, as `<n-dimension>` comes before. Instead, I have grouped them by their first token. Also renamed the NthChildPattern class to ANPlusBPattern, to match spec terminology.
2021-07-31LibWeb: Parse CSS selectors according to the specSam Atkins
The spec does not directly tell us how to parse selectors, so there are likely some bugs here, but I've used the spec language where possible. This is very much based on the previous selector parsing code. Any parse error inside a selector makes the entire SelectorList invalid, so nothing is returned.
2021-07-31LibWeb: Get CSS @import rules working in new parserSam Atkins
Also added css-import.html, which tests the 3 syntax variations on `@import` statements. Note that the optional media-query parameter to `@import` is not handled yet.
2021-07-22LibWeb: Implement ImageStyleValue parsingSam Atkins
Later we will want to make a distinction between URL and Image values, but this works for now.
2021-07-22LibWeb: Implement CSS color parsing from TokensSam Atkins
This was broken when we switched away from using StringStyleValues. While I was at it, I have implemented hsl/a() and the percentage syntax for rgb/a(). As a bonus, added `colors.html` as a test page for the various CSS color syntaxes, since nothing was testing rgb() or rgba() before. Much of the parsing code in LibGFX/Color.h seems to be centered around CSS color values, but this is not used by the new Parser. (And can't be used, because it requires a String value and we have a list of Tokens of some kind instead.) Maybe that should be removed from there when the new CSS parser is operational.
2021-07-11LibWeb: Increase clarity with CSS token debug loggingSam Atkins
Had to adjust some places that were using Token.to_string() for non-debug-logging purposes. Changed its name to to_debug_string() to make the usage clearer.
2021-07-11LibWeb: Implement CSS::parse_css_value()Sam Atkins
A lot of this is not spec-compliant and copied from the old parser. In future PRs, we can revise it.
2021-07-11LibWeb: Give CSS Token and StyleComponentValueRule matching is() funcsSam Atkins
The end goal here is to make the two classes mostly interchangeable, as the CSS spec requires that the various parser algorithms can take a stream of either class, and we want to have that functionality without needing to duplicate all of the code.
2021-07-11LibWeb: Rename CSS::Token::TokenType -> TypeSam Atkins
2021-07-11LibWeb: Add convenience methods to CSS::Parser::TokenSam Atkins
Some of these will be removed later, when we move to using is() exclusively.
2021-04-29Everywhere: Use "the SerenityOS developers." in copyright headersLinus Groh
We had some inconsistencies before: - Sometimes "The", sometimes "the" - Sometimes trailing ".", sometimes no trailing "." I picked the most common one (lowecase "the", trailing ".") and applied it to all copyright headers. By using the exact same string everywhere we can ensure nothing gets missed during a global search (and replace), and that these inconsistencies are not spread any further (as copyright headers are commonly copied to new files).
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-09LibWeb: Run clang-format on CSS/Parser/Token.hAndreas Kling
2021-03-09LibWeb: Add specification-based CSS tokenizerAndreas Kling
Original work by @stelar7 for #2628.