1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-07 12:37:35 +00:00

LibWeb: Don't tolerate unit-less lengths (except 0) in standards mode

"width: 500" is not a valid CSS property in standards mode and should
be ignored.

To plumb the quirks-mode flag into CSS parsing, this patch adds a new
CSS::ParsingContext object that must be passed to the CSS parser.
Currently it only allows you to check the quirks-mode flag. In the
future it will be a good place to put additional information needed
for things like relative URL resolution, etc.

This narrows <div class=parser> on ACID2 to the correct width. :^)
This commit is contained in:
Andreas Kling 2020-06-28 12:43:22 +02:00
parent c1acf67715
commit 9e642827fc
7 changed files with 221 additions and 112 deletions

View file

@ -63,7 +63,7 @@ void HTMLLinkElement::resource_did_load()
dbg() << "HTMLLinkElement: Resource did load, looks good! " << href();
auto sheet = parse_css(resource()->encoded_data());
auto sheet = parse_css(CSS::ParsingContext(document()), resource()->encoded_data());
if (!sheet) {
dbg() << "HTMLLinkElement: Failed to parse stylesheet: " << href();
return;