mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:57:44 +00:00
LibWeb: Implement CSS color parsing from Tokens
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.
This commit is contained in:
parent
fabbd06de4
commit
7abfb18656
4 changed files with 195 additions and 9 deletions
|
@ -76,6 +76,8 @@ public:
|
|||
return m_value.string_view();
|
||||
}
|
||||
|
||||
bool is(NumberType number_type) const { return is(Token::Type::Number) && m_number_type == number_type; }
|
||||
|
||||
int integer() const
|
||||
{
|
||||
VERIFY(m_type == Type::Number && m_number_type == NumberType::Integer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue