When setting colors for anchor tags using css-vars, the visited color in a css-variable override is taken even if other anchor tags on the same page (that are not using css-vars) don't exhibit the same behavior.
The first link on the page gets its styles from a --link-color-visited variable. An identical anchor tag (with the same href) that doesn't use a variable (only raw colors) doesn't appear to be visited.
Created attachment 408005 [details]
Created attachment 408018 [details]
Comment on attachment 408018 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=408018&action=review
> + auto originalLinkMatch = m_state.m_linkMatch;
This won’t do the right thing if the "return" below is done after changing m_state.m_linkMatch.
We have a class SetForScope designed for this kind of thing, that could make sure we get that right.
Created attachment 408059 [details]
TIL of SetForScope, thanks Darin! I think I've fixed it -- can you take another look?
Comment on attachment 408059 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=408059&action=review
> #include "StylePropertyShorthand.h"
> +#include <wtf/SetForScope.h>
WebKit coding style does not leave a space between these making it two paragraphs. But fine to land like this for now.
> + SetForScope<SelectorChecker::LinkMatchMask> scopedLinkMatchMutation(m_state.m_linkMatch, index);
Oh, looks like there is a better way to write it:
auto scopedLinkMatchMutation = SetForScope(m_state.m_linkMatch, index);
That way we don’t have to write out the type. But fine to land like this for now.
Committed r266656: <https://trac.webkit.org/changeset/266656>
All reviewed patches have been landed. Closing bug and clearing flags on attachment 408059 [details].