Closed Bug 939784 Opened 12 years ago Closed 12 years ago

Provide a notification when the applicable state of a style sheet changes

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: ttaubert, Assigned: ttaubert)

References

Details

(Keywords: dev-doc-needed)

Attachments

(1 file, 2 obsolete files)

Bug 839103 introduced a StyleSheetApplicableStateChange event but that is unfortunately unusable for SessionStore to be notified about page style changes for documents and their subdocuments as those events need to be enabled per document. For SessionStore we would need a simple observer notification like "style-sheet-applicable-state-changed" with the document as the subject. That would enable us to be notified about state changes efficiently without querying page style data every time or having to enable all style sheet change events.
Summary: Provide a notification when the applicable state of a style sheet changes. → Provide a notification when the applicable state of a style sheet changes
Why exactly does sessionstore care about which sheets are enabled for a document?
If there's no page style set for the main document, we will recurse into child documents to check whether they have a specific set of style sheets enabled: http://mxr.mozilla.org/mozilla-central/source/browser/components/sessionstore/src/PageStyle.jsm#32 This code is quite old and I don't understand it enough to say whether doing this all is necessary but it has been like that for some time. According to the specification we could/should update those collection routines anyway: http://dev.w3.org/csswg/cssom/#persisting-the-selected-css-style-sheet-set Alas, this doesn't really say anything about subframes, etc. I think this assumes that we would just serialize the selectedStyleSheetSet property for every frame? This would mean we need a notification in nsDocument::SetSelectedStyleSheetSet(). The current code also tries to cover cases where the web page doesn't use .selectedStyleSheetSet but the "disable" attribute on style sheets directly. Maybe we could get rid of that?
Oh, does sessionstore restore the selected stylesheet set or something?
Yes :)
Comment on attachment 8333848 [details] [diff] [review] 0001-Bug-939784-Provide-a-notification-when-the-applicabl.patch OK. r=me, and let's hope this doesn't regress performance too much. :( Make sure whatever you do in that notification is _very_ cheap.
Attachment #8333848 - Flags: review?(bzbarsky) → review+
(In reply to Boris Zbarsky [:bz] from comment #6) > OK. r=me, and let's hope this doesn't regress performance too much. :( > Make sure whatever you do in that notification is _very_ cheap. We don't need to be notified synchronously, would you be happier if this would be using a Runnable? Is that something we do for notifications elsewhere?
If we had a runnable that batched up the notifications, that might be better, yes.
Using a runnable now.
Attachment #8333848 - Attachment is obsolete: true
Attachment #8333903 - Flags: review?(bzbarsky)
That doesn't reduce the number of notifications compared to just doing it sync. We probably want to set a boolean member to suppress creation of new runnables while this one is pending.
(In reply to Boris Zbarsky [:bz] from comment #10) > That doesn't reduce the number of notifications compared to just doing it > sync. We probably want to set a boolean member to suppress creation of new > runnables while this one is pending. Good point.
Attachment #8333903 - Attachment is obsolete: true
Attachment #8333903 - Flags: review?(bzbarsky)
Attachment #8334436 - Flags: review?(bzbarsky)
Comment on attachment 8334436 [details] [diff] [review] 0001-Bug-939784-Provide-a-notification-when-the-applicabl.patch >+ NS_DispatchToCurrentThread(notification); >+ mPendingSSApplicableStateNotification = true; if (NS_SUCCEEDED(NS_DispatchToCurrentThread(notification)) { mPendingSSApplicableStateNotification = true; } And maybe call the boolean mSSApplicableStateNotificationPending? >+ bool mPendingSSApplicableStateNotification; Please put this over with the other boolean members. r=me wtoth that fixed.
Attachment #8334436 - Flags: review?(bzbarsky) → review+
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: