REOPENED Bug 61697
a:hover fails to work if it is the same color as a:link
https://bugs.webkit.org/show_bug.cgi?id=61697
Summary a:hover fails to work if it is the same color as a:link
Joseph Pecoraro
Reported 2011-05-28 19:26:55 PDT
Created attachment 95279 [details] [REDUCTION] Test Case Reduction attached. This fails: <style> a:link { color: red; } a:hover { color: red; } <style> <a>Does not become red when hovered.</a> This works: <style> a:link { color: yellow; } a:hover { color: red; } <style> <a>Does become red when hovered.</a>
Attachments
[REDUCTION] Test Case (239 bytes, text/html)
2011-05-28 19:26 PDT, Joseph Pecoraro
no flags
Mihnea Ovidenie
Comment 1 2011-06-03 06:25:52 PDT
In the first case, the color does not change when hover, so technically there is no style difference. In this case, RenderStyle::diff returns StyleDifferenceEqual and the link is displayed using the color associated with the :visited style. Would it be an acceptable solution to modify RenderStyle::diff function to return StyleDifferenceRepaint when inherited_flags._insideLink != NotInsideLink?
Mustafizur Rahaman (rahaman)
Comment 2 2011-06-21 04:14:11 PDT
(In reply to comment #1) > In the first case, the color does not change when hover, so technically there is no style difference. In this case, RenderStyle::diff returns StyleDifferenceEqual and the link is displayed using the color associated with the :visited style. > > Would it be an acceptable solution to modify RenderStyle::diff function to return StyleDifferenceRepaint when inherited_flags._insideLink != NotInsideLink? when I first ran the test case in Safari, I saw the issue. But then when I cleared the history & reload the test case again, everything was working fine. Don't know why the behavior was different in the first case
Ahmad Saleem
Comment 3 2022-07-24 04:51:30 PDT
I am able to reproduce this bug in Safari 15.6 on macOS 12.5 using attached test case and upon hover on first line, it does not turn to red while all other browsers (Chrome Canary 106 and Firefox Nightly 104) does change the text to red upon hover. Just wanted to share update testing results. Thanks!
Ryosuke Niwa
Comment 4 2022-07-24 14:49:04 PDT
wow, this is such a bizarre bug.
Radar WebKit Bug Importer
Comment 5 2022-07-24 20:06:58 PDT
Ryosuke Niwa
Comment 6 2022-07-31 21:02:31 PDT
If I add a different background color, it would work as well so it's probably some style invalidation bug.
Tim Nguyen (:ntim)
Comment 7 2022-07-31 21:50:15 PDT Comment hidden (obsolete)
Tim Nguyen (:ntim)
Comment 8 2022-08-01 13:24:09 PDT Comment hidden (obsolete)
Alex Chan
Comment 9 2024-03-25 08:16:07 PDT
In case it's helpful, I encountered a similar behaviour where a:hover fails to work if it's the same as a, and there's a rule for a:visited. The rule for a:hover should override the a:visited, but it doesn't when it's the same as a plain a. I suspect this has the same root cause as this bug. This fails: <style> a { color: green; } a:visited { color: red; } a:hover { color: green; } </style> <a href="https://webkit.org">WebKit website</a> <br> <a href="https://developer.mozilla.org/en-US/">MDN Web Docs</a> This works: <style> a { color: green; } a:visited { color: red; } a:hover { color: blue; } </style> <a href="https://webkit.org">WebKit website</a> <br> <a href="https://developer.mozilla.org/en-US/">MDN Web Docs</a> This also works: <style> a { color: green; } a:visited { color: red; } a:hover { color: green; background: yellow; } </style> <a href="https://webkit.org">WebKit website</a> <br> <a href="https://developer.mozilla.org/en-US/">MDN Web Docs</a>
Ryosuke Niwa
Comment 10 2024-03-26 14:29:41 PDT
I can reproduce this on STP189.
Matthieu Dubet
Comment 11 2024-04-03 11:30:35 PDT
EWS
Comment 12 2024-05-28 16:34:36 PDT
Committed 279411@main (e451a390febd): <https://commits.webkit.org/279411@main> Reviewed commits have been landed. Closing PR #26797 and removing active labels.
WebKit Commit Bot
Comment 13 2024-05-30 00:20:26 PDT
Re-opened since this is blocked by bug 274889
Note You need to log in before you can comment on or make changes to this bug.