Commit 45c100b4 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Empty ::-webkit-scrollbar rules should not affect scrollbars.

In the presence of ::-webkit-scrollbar rules, author styling is applied
to scrollbars, but only if they actually contain declarations. Before
introducing lazy parsing of declaration blocks, we would not consider
empty style rules for matching. With lazy parsing, we do not necessarily
know if the rule is empty before we perform the actual parsing. That
caused a discrepancy between sheets from <style> elements and external
stylesheets for empty scrollbar rules because <style> element sheets do
not do lazy parsing of declaration blocks.

To make this consistent, check if a matched style rule is empty before
we mark the ComputedStyle as having pseudo element style.

Bug: 897100
Change-Id: I8b808271ca322f42b5ae5e5627a5d17a81658885
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1874467Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708576}
parent ee6c75e0
...@@ -351,7 +351,8 @@ void ElementRuleCollector::DidMatchRule( ...@@ -351,7 +351,8 @@ void ElementRuleCollector::DidMatchRule(
dynamic_pseudo == kPseudoIdAfter) && dynamic_pseudo == kPseudoIdAfter) &&
!rule_data->Rule()->Properties().HasProperty(CSSPropertyID::kContent)) !rule_data->Rule()->Properties().HasProperty(CSSPropertyID::kContent))
return; return;
style_->SetHasPseudoElementStyle(dynamic_pseudo); if (!rule_data->Rule()->Properties().IsEmpty())
style_->SetHasPseudoElementStyle(dynamic_pseudo);
} else { } else {
matched_rules_.push_back(MatchedRule( matched_rules_.push_back(MatchedRule(
rule_data, result.specificity, cascade_order, rule_data, result.specificity, cascade_order,
......
<!doctype html>
<body style="overflow:scroll">You should see scrollbars.</body>
<!doctype html>
<link rel="stylesheet" href="data:text/css,body::-webkit-scrollbar{}">
<body style="overflow:scroll">You should see scrollbars.</body>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment