Last Comment Bug 652268 - dynamic changes to link state of root element don't cause correct restyling
: dynamic changes to link state of root element don't cause correct restyling
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: Trunk
: All All
: P4 normal (vote)
: mozilla6
Assigned To: David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-04-22 16:55 PDT by David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch)
Modified: 2011-04-22 19:18 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (3.55 KB, patch)
2011-04-22 16:55 PDT, David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch)
bzbarsky: review+
Details | Diff | Splinter Review

Description David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2011-04-22 16:55:43 PDT
Created attachment 527885 [details] [diff] [review]
patch

Either bz pointed out this bug during reviews of some of the :visited work (bug 147777, etc.), or I noticed it while addressing comments.  I wrote a patch to fix it ages ago, but never got around to writing a test, which I just did.

In any case, when a style change on the root element includes a change only to the link visitedness or to link-ness, the style change doesn't take effect correctly because it's defeated by an incorrect check in the style context sharing code.

This patch fixes it.  I confirmed that the test fails without the patch and passes with it.
Comment 1 Boris Zbarsky [:bz] 2011-04-22 17:49:06 PDT
Comment on attachment 527885 [details] [diff] [review]
patch

I'm pretty sure I didn't point this out, but it certainly makes sense!  r=me
Comment 2 Boris Zbarsky [:bz] 2011-04-22 17:50:33 PDT
I wonder whether we can widen this optimization, by the way.  Seems like it should be valid any time oldContext and newContext have the same parent, whether that parent is null or not.  Though I don't know how often this situation arises.....
Comment 3 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2011-04-22 18:20:56 PDT
We already have the optimization for the other cases through sibling sharing, as long as we haven't blown past the cache length (currently 10).  See nsStyleContext::FindChildWithRules.
Comment 4 Boris Zbarsky [:bz] 2011-04-22 18:24:25 PDT
Oh, right.  OK, then!
Comment 5 David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) 2011-04-22 19:18:23 PDT
https://hg.mozilla.org/mozilla-central/rev/c73c4d6907fe

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