mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 22:55:06 +00:00
LibHTML: Skip over CSS @media rules for now
This commit is contained in:
parent
6cbf8a3426
commit
fed668f20f
1 changed files with 29 additions and 0 deletions
|
@ -104,6 +104,16 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool next_is(const char* str) const
|
||||||
|
{
|
||||||
|
int len = strlen(str);
|
||||||
|
for (int i = 0; i < len; ++i) {
|
||||||
|
if (peek(i) != str[i])
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
char peek(int offset = 0) const
|
char peek(int offset = 0) const
|
||||||
{
|
{
|
||||||
if ((index + offset) < css.length())
|
if ((index + offset) < css.length())
|
||||||
|
@ -335,6 +345,25 @@ public:
|
||||||
|
|
||||||
void parse_rule()
|
void parse_rule()
|
||||||
{
|
{
|
||||||
|
// FIXME: We ignore @media rules for now.
|
||||||
|
if (next_is("@media")) {
|
||||||
|
while (peek() != '{')
|
||||||
|
consume_one();
|
||||||
|
int level = 0;
|
||||||
|
for (;;) {
|
||||||
|
auto ch = consume_one();
|
||||||
|
if (ch == '{') {
|
||||||
|
++level;
|
||||||
|
} else if (ch == '}') {
|
||||||
|
--level;
|
||||||
|
if (level == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
consume_whitespace_or_comments();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
parse_selector_list();
|
parse_selector_list();
|
||||||
consume_specific('{');
|
consume_specific('{');
|
||||||
parse_declaration();
|
parse_declaration();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue