mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-15 14:51:52 +00:00
LibWeb/CSS: Allow Selector::absolutized() to return null
It's possible for absolutizing a selector to return an invalid selector (eg, it could cause `:has()` inside `:has()`) so we need to be able to express that.
This commit is contained in:
parent
3a43fa9e35
commit
da31c10ce1
Notes:
github-actions[bot]
2024-11-14 19:08:23 +00:00
Author: https://github.com/AtkinsSJ
Commit: da31c10ce1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2340
3 changed files with 31 additions and 14 deletions
|
@ -187,8 +187,10 @@ SelectorList const& CSSStyleRule::absolutized_selectors() const
|
|||
},
|
||||
};
|
||||
SelectorList absolutized_selectors;
|
||||
for (auto const& selector : selectors())
|
||||
absolutized_selectors.append(selector->absolutized(parent_selector));
|
||||
for (auto const& selector : selectors()) {
|
||||
if (auto absolutized = selector->absolutized(parent_selector))
|
||||
absolutized_selectors.append(absolutized.release_nonnull());
|
||||
}
|
||||
m_cached_absolutized_selectors = move(absolutized_selectors);
|
||||
} else {
|
||||
// NOTE: We can't actually replace & with :scope, because & has to have 0 specificity.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue