Last Comment Bug 99850 - changing document.linkColor more than once has no effect
: changing document.linkColor more than once has no effect
Status: VERIFIED FIXED
[CSS1-2.1][patch]
: testcase
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: Trunk
: x86 Windows 98
: P1 minor with 1 vote (vote)
: mozilla1.4alpha
Assigned To: David Baron :dbaron: ⌚️UTC-7 (busy September 14-25)
: Hixie (not reading bugmail)
Mentors:
http://dmoz.org/Bookmarks/R/rpfuller/...
Depends on:
Blocks: 188803
  Show dependency treegraph
 
Reported: 2001-09-15 21:54 PDT by Jesse Ruderman
Modified: 2007-12-17 22:13 PST (History)
2 users (show)
jruderman: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
testcase (933 bytes, text/html)
2001-09-16 07:38 PDT, David Baron :dbaron: ⌚️UTC-7 (busy September 14-25)
no flags Details
Attachment showing document.linkColor is changing, but not being painted (1014 bytes, text/html)
2002-07-19 14:56 PDT, Eli Friedman
no flags Details
patch (2.58 KB, patch)
2003-01-28 09:01 PST, David Baron :dbaron: ⌚️UTC-7 (busy September 14-25)
bzbarsky: review+
bzbarsky: superreview+
Details | Diff | Splinter Review

Description Jesse Ruderman 2001-09-15 21:54:43 PDT
Steps to reproduce:
1. Drag the personal homepagify bookmarklet from 
http://dmoz.org/Bookmarks/R/rpfuller/How_Not_to_Design_a_Web_Site/Bookmarklets/ 
onto your personal toolbar.
2. Go to http://www.cs.hmc.edu/~jruderma/s/
3. Click the bookmarklet a few times.

Result: the background and text colors keep changing, but the link colors and 
visited-link colors get "stuck" on the color they were set to the first time 
you activated the bookmarklet.


Changing the background color of a web page always works:
javascript:void(document.bgColor=Math.round(Math.random()*0x1000000));

But changing the link color only works the first time you do it:
javascript:void(document.linkColor=Math.round(Math.random()*0x1000000));
Comment 1 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2001-09-16 07:38:28 PDT
Created attachment 49501 [details]
testcase
Comment 2 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2001-09-16 07:48:18 PDT
This is vaguely similar to some issues from bug 87674.  I suspect the problem
here is that we need to invalidate some stuff in the rule tree when we change
one of the rules internally, as
HTMLStyleSheetImpl::Set{Link,VisitedLink,ActiveLink}Color do.  I'm not sure why
we don't see this problem with
HTMLStyleSheetImpl::SetDocument{Foreground,Background}Color.  hyatt?
Comment 3 Madhur Bhatia 2002-05-17 14:28:19 PDT
cc'ing myself
Comment 4 Eli Friedman 2002-07-19 14:56:58 PDT
Created attachment 92012 [details]
Attachment showing document.linkColor is changing, but not being painted

The modified script I am using modifies only the the linkColor attributes, then
sets the background of the DIVs to the colors the links are (it's pretty simple
if you look).  The color _is_ getting set, but is having no effect on the
links.	Weird.
Comment 5 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2002-07-21 06:55:52 PDT
It looks like the problem is that HTMLStyleSheetImpl::SetLinkColor needs to do
an appropriate ClearStyleData (probably via the document's StyleRuleChanged method).
Comment 6 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2003-01-28 09:01:08 PST
Created attachment 112873 [details] [diff] [review]
patch

This fixes the bug by moving towards style rule immutability -- it makes the
HTMLColorRule immutable.
Comment 7 David Baron :dbaron: ⌚️UTC-7 (busy September 14-25) 2003-02-22 13:51:36 PST
Fix checked in to trunk, 2003-02-22 11:15 PST.
Comment 8 Madhur Bhatia 2003-02-24 13:01:33 PST
verified with  attachment 92012 [details] on winXP trunk build 2003-02-24-04


Comment 9 Jesse Ruderman 2007-12-17 22:13:08 PST
I added a set of reftests for document.linkColor and <body link>.

Note You need to log in before you can comment on or make changes to this bug.