From ac0f0f2f407d4d241ebf141640647c559b0ada3d Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Tue, 3 Mar 2020 21:00:26 +0000 Subject: [PATCH] Bug 1618150 [wpt PR 21983] - Perform kNotInsideLink-related adjustments in ElementRuleCollector, a=testonly Automatic update from web-platform-tests Perform kNotInsideLink-related adjustments in ElementRuleCollector The link_match_type stored on the MatchedProperties object is only relevant and correct if we're inside a link, hence we need to override the effective link_match_type at some point. Previously, we would do this apply-time, and not as part of the rule- collection. This CL instead proposes that ElementRuleCollector take the link-status into account, and perform the adjustment before storing the link_match_type on MatchedProperties, such that no further adjustments are required later. This fixes a bug in the CSSCascade path, where we would incorrectly not apply anything for selectors such as *:not(:link):not(:visited), even for elements that are not inside links. (See AddLinkFilter in cascade_expansion.cc. We would switch on the value 0, and then enter the default case, causing a filter to be added on kProperty, which causes all properties to be rejected. This is correct for elements that are inside links, but not for elements that aren't). Bug: 1055715 Change-Id: I2b63de41753fb0fa7b637a4be5bd009c2f165fcf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2072223 Reviewed-by: Rune Lillesveen Commit-Queue: Anders Hartvoll Ruud Cr-Commit-Position: refs/heads/master{#744631} -- wpt-commits: 06114b9ab7eb85376ce6a1982fb850ba8c5c60ef wpt-pr: 21983 UltraBlame original commit: 84b018a46e90f3047afd8c896a8fdd407d10bc4a --- .../tests/css/selectors/not-links-ref.html | 10 ++++++++++ .../tests/css/selectors/not-links.html | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 testing/web-platform/tests/css/selectors/not-links-ref.html create mode 100644 testing/web-platform/tests/css/selectors/not-links.html diff --git a/testing/web-platform/tests/css/selectors/not-links-ref.html b/testing/web-platform/tests/css/selectors/not-links-ref.html new file mode 100644 index 000000000000..1efe5943f4e3 --- /dev/null +++ b/testing/web-platform/tests/css/selectors/not-links-ref.html @@ -0,0 +1,10 @@ + +Test that *:not(:link):not(:visited) does not match links + + Unvisited + Visited + Green +

+ Only "Green" should have a green background. +

+ diff --git a/testing/web-platform/tests/css/selectors/not-links.html b/testing/web-platform/tests/css/selectors/not-links.html new file mode 100644 index 000000000000..d49a86fd0ea7 --- /dev/null +++ b/testing/web-platform/tests/css/selectors/not-links.html @@ -0,0 +1,17 @@ + +Test that *:not(:link):not(:visited) does not match links + + + + + Unvisited + Visited + Green +

+ Only "Green" should have a green background. +

+