mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:57:36 +00:00
LibHTML: Handle CSS declarations that don't end in ';'
This commit is contained in:
parent
2ac190dc5f
commit
59795aab41
1 changed files with 5 additions and 3 deletions
|
@ -114,12 +114,14 @@ public:
|
||||||
char consume_specific(char ch)
|
char consume_specific(char ch)
|
||||||
{
|
{
|
||||||
PARSE_ASSERT(peek() == ch);
|
PARSE_ASSERT(peek() == ch);
|
||||||
|
PARSE_ASSERT(index < css.length());
|
||||||
++index;
|
++index;
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
char consume_one()
|
char consume_one()
|
||||||
{
|
{
|
||||||
|
PARSE_ASSERT(index < css.length());
|
||||||
return css[index++];
|
return css[index++];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -237,12 +239,12 @@ public:
|
||||||
|
|
||||||
bool is_valid_property_name_char(char ch) const
|
bool is_valid_property_name_char(char ch) const
|
||||||
{
|
{
|
||||||
return !isspace(ch) && ch != ':';
|
return ch && !isspace(ch) && ch != ':';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_valid_property_value_char(char ch) const
|
bool is_valid_property_value_char(char ch) const
|
||||||
{
|
{
|
||||||
return ch != '!' && ch != ';';
|
return ch && ch != '!' && ch != ';';
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<StyleProperty> parse_property()
|
Optional<StyleProperty> parse_property()
|
||||||
|
@ -280,7 +282,7 @@ public:
|
||||||
consume_whitespace();
|
consume_whitespace();
|
||||||
is_important = true;
|
is_important = true;
|
||||||
}
|
}
|
||||||
if (peek() != '}')
|
if (peek() && peek() != '}')
|
||||||
consume_specific(';');
|
consume_specific(';');
|
||||||
|
|
||||||
return StyleProperty { parse_css_property_id(property_name), parse_css_value(property_value), is_important };
|
return StyleProperty { parse_css_property_id(property_name), parse_css_value(property_value), is_important };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue