WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
210525
CSS :visited color taken on non-visited link when using CSS variables
https://bugs.webkit.org/show_bug.cgi?id=210525
Summary
CSS :visited color taken on non-visited link when using CSS variables
Adam_Dierkens
Reported
2020-04-14 17:38:06 PDT
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.
https://jsfiddle.net/rf1njobm/3/
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.
Attachments
Patch
(4.47 KB, patch)
2020-09-04 11:27 PDT
,
Tyler Wilcock
no flags
Details
Formatted Diff
Diff
Patch
(4.46 KB, patch)
2020-09-04 13:37 PDT
,
Tyler Wilcock
no flags
Details
Formatted Diff
Diff
Patch
(4.95 KB, patch)
2020-09-04 18:06 PDT
,
Tyler Wilcock
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2020-04-14 18:10:41 PDT
<
rdar://problem/61800412
>
Tyler Wilcock
Comment 2
2020-09-04 11:27:32 PDT
Created
attachment 408005
[details]
Patch
Tyler Wilcock
Comment 3
2020-09-04 13:37:19 PDT
Created
attachment 408018
[details]
Patch
Darin Adler
Comment 4
2020-09-04 17:08:22 PDT
Comment on
attachment 408018
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=408018&action=review
> Source/WebCore/style/StyleBuilder.cpp:190 > + 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.
Tyler Wilcock
Comment 5
2020-09-04 18:06:30 PDT
Created
attachment 408059
[details]
Patch
Tyler Wilcock
Comment 6
2020-09-04 19:43:01 PDT
TIL of SetForScope, thanks Darin! I think I've fixed it -- can you take another look?
Darin Adler
Comment 7
2020-09-04 23:20:15 PDT
Comment on
attachment 408059
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=408059&action=review
> Source/WebCore/style/StyleBuilder.cpp:43 > #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.
> Source/WebCore/style/StyleBuilder.cpp:220 > + 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.
EWS
Comment 8
2020-09-04 23:43:41 PDT
Committed
r266656
: <
https://trac.webkit.org/changeset/266656
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 408059
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug