mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-14 11:54:53 +03:00
LibWeb: Ignore parsed pseudo-element selectors & empty complex selectors
Currently we don't deal with them, so they shouldn't return a SimpleSelector - that'd be a false positive. Also don't produce a ComplexSelector if no SimpleSelector was parsed. This fixes a couple of rendering issues on awesomekling.github.io: link colours, footer size, content max-width (and possibly more!)
This commit is contained in:
parent
a427821dd1
commit
673527d314
Notes:
sideshowbarker
2024-07-19 06:43:50 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/673527d314a Pull-request: https://github.com/SerenityOS/serenity/pull/2189 Reviewed-by: https://github.com/awesomekling
@ -383,6 +383,12 @@ public:
|
||||
auto pseudo_name = String::copy(buffer);
|
||||
buffer.clear();
|
||||
|
||||
|
||||
// Ignore for now, otherwise we produce a "false positive" selector
|
||||
// and apply styles to the element itself, not its pseudo element
|
||||
if (is_pseudo_element)
|
||||
return {};
|
||||
|
||||
if (pseudo_name == "link")
|
||||
simple_selector.pseudo_class = Selector::SimpleSelector::PseudoClass::Link;
|
||||
else if (pseudo_name == "hover")
|
||||
@ -442,6 +448,9 @@ public:
|
||||
PARSE_ASSERT(simple_selectors.size() < 100);
|
||||
}
|
||||
|
||||
if (simple_selectors.is_empty())
|
||||
return {};
|
||||
|
||||
return Selector::ComplexSelector { relation, move(simple_selectors) };
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user