Andreas Kling
a5db4c874e
LibWeb: Skip declaration parsing in block contents when not applicable
...
When parsing block contents, the CSS parser speculatively tries to parse
each item as a declaration first. If that fails, it restores the token
position and tries again as a qualified rule. This means every qualified
rule inside an at-rule block (e.g. @layer, @media) gets parsed twice:
once as a failed declaration (which consumes all tokens via
consume_the_remnants_of_a_bad_declaration), and then again successfully
as a rule.
Add a lookahead that checks for the `ident whitespace* ':'` pattern
before attempting declaration parsing. Since declarations must start
with this pattern per spec, we can skip the attempt entirely when it
doesn't match and go straight to qualified rule parsing.
This is a massive win on large Tailwind CSS stylesheets (like the one
used by chatgpt.com) where thousands of rules inside @layer blocks were
being double-parsed. On a 1.2MB Tailwind v4 stylesheet, parse time goes
from ~2000ms to ~95ms (21x speedup).
2026-03-23 09:28:23 +01:00
..
2026-03-23 09:28:23 +01:00
2026-03-21 18:20:09 -05:00
2025-08-23 16:04:36 -06:00
2025-10-27 14:50:54 +00:00
2026-01-09 10:00:58 +01:00
2026-01-09 10:00:58 +01:00
2025-04-20 18:43:11 +02:00
2026-01-13 10:09:22 +01:00
2026-03-09 14:36:18 +00:00
2026-03-09 14:36:18 +00:00
2025-11-20 16:27:07 +01:00
2026-01-09 10:00:58 +01:00
2025-10-22 00:01:30 +02:00
2026-02-13 21:54:06 +01:00
2026-02-13 21:54:06 +01:00
2025-05-14 02:01:59 -06:00
2025-09-04 13:31:24 +01:00
2026-03-20 16:08:32 -05:00
2026-02-27 16:25:53 +00:00
2026-02-27 16:25:53 +00:00
2026-03-21 18:20:09 -05:00
2026-03-21 18:20:09 -05:00
2026-02-27 16:25:53 +00:00
2026-02-27 16:25:53 +00:00
2026-02-27 16:25:53 +00:00
2026-02-27 12:10:44 +00:00
2026-02-11 20:02:28 +01:00
2025-10-02 13:46:04 +01:00
2025-09-11 17:06:44 +01:00
2026-03-21 23:16:32 -05:00
2026-03-21 23:16:32 -05:00
2025-04-20 18:43:11 +02:00
2026-02-03 09:58:47 +00:00
2026-02-23 11:21:09 +00:00
2026-02-03 09:58:47 +00:00
2025-10-27 14:50:54 +00:00
2026-02-14 20:22:40 +01:00
2026-01-13 10:40:00 +00:00
2026-01-05 16:15:58 +00:00
2025-04-04 10:40:32 +01:00
2026-02-24 15:44:32 +00:00
2026-02-24 15:44:32 +00:00
2026-03-20 16:08:32 -05:00
2026-03-20 16:08:32 -05:00
2026-02-17 12:25:27 +00:00
2026-03-20 16:08:32 -05:00
2026-03-20 16:08:32 -05:00
2026-02-17 12:25:27 +00:00
2026-02-11 20:02:28 +01:00
2025-10-14 13:41:47 +01:00
2025-10-14 13:41:47 +01:00
2025-09-15 08:47:10 +01:00
2026-03-21 10:29:54 +01:00
2026-02-12 16:23:12 +01:00
2025-12-08 13:30:53 +00:00
2025-12-04 16:24:04 +00:00
2025-12-04 16:24:04 +00:00
2025-03-19 13:53:00 +00:00
2025-12-04 16:24:04 +00:00
2025-12-04 16:24:04 +00:00
2026-01-09 17:14:20 +00:00
2026-01-09 17:14:20 +00:00
2025-08-21 10:21:54 +01:00
2025-12-04 16:24:04 +00:00
2025-12-04 16:24:04 +00:00
2025-12-04 16:24:04 +00:00
2025-12-04 16:24:04 +00:00
2025-04-25 16:43:43 +02:00
2025-12-04 16:24:04 +00:00
2025-12-04 16:24:04 +00:00
2025-05-16 11:01:39 +01:00
2026-01-09 17:14:20 +00:00
2026-01-09 17:14:20 +00:00
2025-08-29 11:57:10 +02:00
2026-01-12 11:51:15 +00:00
2026-01-12 11:51:15 +00:00
2025-08-29 11:57:10 +02:00
2026-01-12 11:51:15 +00:00
2026-01-12 11:51:15 +00:00
2025-08-29 11:57:10 +02:00
2026-01-12 11:51:15 +00:00
2026-01-12 11:51:15 +00:00
2025-08-29 11:57:10 +02:00
2026-01-12 11:51:15 +00:00
2026-01-12 11:51:15 +00:00
2025-08-29 11:57:10 +02:00
2026-01-12 11:51:15 +00:00
2026-01-12 11:51:15 +00:00
2025-08-29 11:57:10 +02:00
2026-01-12 11:51:15 +00:00
2026-01-12 11:51:15 +00:00
2025-08-29 11:57:10 +02:00
2025-10-14 13:41:47 +01:00
2026-01-09 17:14:20 +00:00
2025-08-29 11:57:10 +02:00
2025-10-14 13:41:47 +01:00
2025-10-14 13:41:47 +01:00
2025-09-24 12:27:05 +01:00
2025-12-04 16:24:04 +00:00
2025-12-04 16:24:04 +00:00
2025-07-11 10:57:19 +02:00
2025-12-04 16:24:04 +00:00
2025-12-04 16:24:04 +00:00
2025-12-04 16:24:04 +00:00
2025-12-04 16:24:04 +00:00
2025-04-25 08:48:29 +02:00
2025-08-29 11:57:10 +02:00
2025-08-29 11:57:10 +02:00
2025-09-02 10:41:33 +01:00
2026-01-12 11:51:15 +00:00
2026-01-12 11:51:15 +00:00
2026-01-12 11:51:15 +00:00
2025-10-02 13:46:04 +01:00
2025-05-15 09:53:29 +01:00
2025-05-15 09:53:29 +01:00
2025-12-04 16:24:04 +00:00
2025-12-04 16:24:04 +00:00
2025-05-15 09:53:29 +01:00
2025-11-13 15:47:00 +01:00
2025-10-14 13:41:47 +01:00
2025-09-24 12:27:05 +01:00
2026-01-09 15:20:06 +00:00
2026-01-09 10:54:37 +00:00
2026-01-09 17:14:20 +00:00
2025-10-14 13:41:47 +01:00
2025-09-24 12:27:05 +01:00
2026-03-20 16:08:32 -05:00
2026-03-20 16:08:32 -05:00
2026-02-17 12:25:27 +00:00
2026-03-20 16:08:32 -05:00
2025-10-07 10:32:59 +01:00
2026-01-09 17:14:20 +00:00
2025-10-14 13:41:47 +01:00
2025-09-24 12:27:05 +01:00
2026-01-09 17:14:20 +00:00
2025-10-14 13:41:47 +01:00
2025-09-24 12:27:05 +01:00
2026-01-09 17:14:20 +00:00
2025-10-14 13:41:47 +01:00
2025-09-24 12:27:05 +01:00
2026-01-09 17:14:20 +00:00
2025-10-14 13:41:47 +01:00
2025-09-24 12:27:05 +01:00
2025-11-06 11:43:06 -05:00
2026-02-11 20:02:28 +01:00
2025-03-19 13:53:00 +00:00
2026-03-19 14:17:46 +01:00
2026-02-11 20:02:28 +01:00
2025-03-19 13:53:00 +00:00
2025-12-04 16:24:04 +00:00
2025-12-04 16:24:04 +00:00
2025-08-13 09:47:50 +01:00
2026-03-21 10:29:54 +01:00
2026-03-21 10:29:54 +01:00
2026-02-24 14:36:40 +01:00
2025-11-03 10:21:51 -08:00
2025-10-14 13:41:47 +01:00
2025-08-21 10:21:54 +01:00
2025-12-04 16:24:04 +00:00
2025-12-04 16:24:04 +00:00
2025-07-11 10:57:19 +02:00
2025-09-24 12:27:05 +01:00
2025-10-14 13:41:47 +01:00
2025-09-24 12:27:05 +01:00
2026-02-28 10:24:37 -05:00
2025-10-14 13:41:47 +01:00
2025-09-24 12:27:05 +01:00
2026-02-18 08:02:45 -05:00
2026-02-18 08:02:45 -05:00
2026-01-09 17:14:20 +00:00
2025-10-14 13:41:47 +01:00
2025-09-24 12:27:05 +01:00
2026-01-09 17:14:20 +00:00
2026-01-09 17:14:20 +00:00
2025-08-22 09:48:30 +01:00
2026-02-28 10:24:37 -05:00
2025-10-14 13:41:47 +01:00
2025-09-02 10:41:33 +01:00
2025-09-24 12:27:05 +01:00
2025-09-24 12:27:05 +01:00
2025-08-21 10:21:54 +01:00
2026-02-13 14:57:15 +01:00
2026-02-13 14:57:15 +01:00
2026-01-09 10:54:37 +00:00
2026-03-21 07:40:25 +00:00
2025-08-08 15:19:03 +01:00
2025-08-08 15:19:03 +01:00
2026-02-24 10:05:09 +00:00
2026-02-21 15:53:22 +01:00
2026-02-21 15:53:22 +01:00
2026-03-21 18:21:31 -05:00
2026-03-21 18:21:31 -05:00
2025-09-04 13:31:24 +01:00
2025-09-04 13:31:24 +01:00
2025-08-13 09:47:50 +01:00
2026-03-18 13:21:57 +00:00
2025-08-07 16:38:29 +02:00
2026-03-04 19:35:45 +01:00
2026-01-09 10:54:11 +00:00
2026-02-16 12:09:23 +00:00
2026-02-16 12:09:23 +00:00
2026-01-09 10:00:58 +01:00
2026-01-09 10:00:58 +01:00
2026-03-23 09:03:57 +01:00
2026-03-22 14:05:44 +01:00
2026-03-23 09:03:57 +01:00
2026-02-24 15:44:32 +00:00
2026-03-23 09:03:57 +01:00
2026-02-24 15:44:32 +00:00
2026-01-06 12:24:42 +01:00
2026-01-06 12:24:42 +01:00
2026-01-06 12:24:42 +01:00
2026-01-06 12:24:42 +01:00
2026-03-20 16:08:32 -05:00
2026-03-22 14:05:44 +01:00
2026-01-09 10:00:58 +01:00
2026-01-09 10:00:58 +01:00
2026-01-09 10:00:58 +01:00
2026-01-09 10:00:58 +01:00
2026-02-02 20:33:05 +01:00
2026-02-21 21:46:34 +01:00
2026-03-21 23:16:32 -05:00
2026-02-19 11:27:06 +00:00
2025-07-14 09:32:05 +02:00
2026-03-18 13:21:57 +00:00
2026-03-20 15:56:50 -05:00
2026-02-16 12:09:23 +00:00
2025-09-04 13:31:24 +01:00
2025-09-04 13:31:24 +01:00
2026-02-14 22:58:21 +01:00
2025-12-01 11:00:33 +00:00
2025-05-23 10:17:58 +01:00
2026-02-09 21:44:47 +01:00
2026-02-09 21:44:47 +01:00
2026-03-09 14:36:18 +00:00
2025-12-04 16:24:04 +00:00
2026-02-11 20:02:28 +01:00
2026-03-11 21:16:44 +01:00
2025-04-20 18:43:11 +02:00
2025-05-14 02:01:59 -06:00
2026-01-09 10:00:58 +01:00
2026-01-09 10:00:58 +01:00
2025-09-12 13:45:41 +02:00
2025-10-27 14:50:54 +00:00
2025-05-16 16:42:10 +01:00
2025-05-16 16:42:10 +01:00
2026-02-24 10:05:09 +00:00
2026-02-24 10:05:09 +00:00
2026-01-09 10:00:58 +01:00
2026-01-09 10:00:58 +01:00
2026-03-16 08:44:50 +00:00
2025-08-13 09:47:50 +01:00
2025-10-27 14:50:54 +00:00
2026-02-23 18:44:26 +00:00
2026-02-23 18:44:26 +00:00
2026-03-06 13:13:44 +01:00
2025-03-26 09:47:45 +00:00
2025-08-18 16:52:39 +01:00
2026-01-09 10:00:58 +01:00
2026-01-09 10:00:58 +01:00
2026-01-16 20:34:58 +01:00
2025-12-12 10:17:00 +00:00
2025-08-14 10:27:08 +02:00
2026-01-08 15:27:30 +00:00
2025-12-15 14:12:39 +00:00
2026-03-21 21:42:44 -05:00
2026-03-21 21:42:44 -05:00
2025-09-07 15:55:16 +01:00
2026-01-06 10:50:06 +01:00
2026-01-09 10:00:58 +01:00
2026-02-02 20:33:05 +01:00
2026-01-09 10:00:58 +01:00
2026-03-03 17:14:19 +01:00
2026-02-18 08:02:45 -05:00
2026-03-21 23:16:32 -05:00
2026-03-09 18:35:46 +01:00
2026-02-17 20:44:46 +01:00
2026-01-15 19:50:53 +01:00
2026-03-10 17:56:42 +01:00
2026-03-09 18:35:46 +01:00
2025-11-12 11:19:37 +01:00
2025-11-12 11:19:37 +01:00
2025-12-02 12:47:10 +00:00
2025-10-04 22:57:00 +02:00
2025-08-13 09:47:50 +01:00
2026-02-13 14:57:15 +01:00
2025-10-02 13:46:04 +01:00
2025-08-15 09:21:28 +02:00
2026-03-21 23:16:32 -05:00
2026-02-24 22:35:03 +01:00
2025-04-09 18:45:57 +01:00
2025-08-23 16:04:36 -06:00
2025-03-13 16:56:28 -04:00
2025-09-26 22:30:20 +02:00
2026-03-21 10:29:54 +01:00
2025-08-23 16:04:36 -06:00
2025-12-04 16:24:04 +00:00
2025-10-07 10:32:59 +01:00
2026-02-06 10:47:50 +00:00
2025-08-23 16:04:36 -06:00
2026-01-09 10:00:58 +01:00
2026-01-09 10:00:58 +01:00
2025-06-15 15:59:02 +02:00
2025-04-20 18:43:11 +02:00
2025-05-14 02:01:59 -06:00
2025-09-11 17:06:44 +01:00
2026-02-19 11:27:06 +00:00
2026-02-19 11:27:06 +00:00
2026-02-20 22:01:44 +00:00
2026-02-20 22:01:44 +00:00
2026-03-04 19:35:45 +01:00
2025-10-10 15:37:45 +02:00