mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibHTML: Skip over CSS @media rules for now
This commit is contained in:
parent
6cbf8a3426
commit
fed668f20f
Notes:
sideshowbarker
2024-07-19 11:38:26 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/fed668f20fb
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
|
||||
{
|
||||
if ((index + offset) < css.length())
|
||||
|
@ -335,6 +345,25 @@ public:
|
|||
|
||||
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();
|
||||
consume_specific('{');
|
||||
parse_declaration();
|
||||
|
|
Loading…
Add table
Reference in a new issue