Closed Bug 181808 Opened 22 years ago Closed 22 years ago

we should use macros to implement nsIDocumentObserver

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: sicking, Assigned: sicking)

References

Details

Attachments

(1 file, 1 obsolete file)

We should have a set of macros that implement different parts of nsIDocumentObserver. This will buy us two things: 1. Clean up the code by having a lot less empty functions that just return NS_OK 2. Makes it easier to change the signature of a function since we won't have to change so freakin' many function-implementations I'll try to do this in stages to make it easier to figure out how to group functions into the macros
Attached patch first stab (obsolete) (deleted) — Splinter Review
I ended up implementing all macros and fix all implementors of nsIDocumentObserver. One interesting thing is that Begin/EndReflow is not implemented by any observers, and noone seems to call them either (only checked BeginReflow). So we should probably remove these notifications unless somebody has a greater plan that includes using them? Feel free to have oppinions on how i have grouped the functions into the different implementation-macros. I mostly grouped them according to functionality rather then analizying exactly how to get the minimum number of functions implemented outside the macros.
Attachment #107337 - Flags: superreview?(bzbarsky)
Attachment #107337 - Flags: review?(caillon)
Those seem pretty reasonable to me...
Comment on attachment 107337 [details] [diff] [review] first stab sr=bzbarsky.
Attachment #107337 - Flags: superreview?(bzbarsky) → superreview+
Comment on attachment 107337 [details] [diff] [review] first stab >Index: content/base/public/nsIDocumentObserver.h >+NS_IMETHODIMP _class::StyleSheetRemoved(nsIDocument* aDocument, \ >+ nsIStyleSheet* aStyleSheet) \ >+{ \ >+ return NS_OK; \ >+} \ >+NS_IMETHODIMP \ >+_class::StyleSheetDisabledStateChanged(nsIDocument* aDocument, \ Be consistent. You have the NS_IMETHODIMP on the same line as the class everywhere else; here they are on separate lines. But, actually I'd almost prefer you used this style (separate lines), since that is what content code uses everywhere else... On a separate note, I'm wondering if naming the macros |NS_IMPL_NSIDOCUMENTOBSERVER_IGNORE_*| is a better idea. It helps convey that we are really only implementing those methods just to ignore them because we don't care about them. NS_IMPL_NSIDOCUMENTOBSERVER_IGNORE_LOAD, NS_IMPL_NSIDOCUMENTOBSERVER_IGNORE_REFLOW, etc.... I suppose I will leave it up to you to decide, but I think those names are better (and I hope you have a good replace script if you agree :-) r=caillon
Attachment #107337 - Flags: review?(caillon) → review+
Blocks: 107567
Attached patch missed one (deleted) — Splinter Review
Attachment #107337 - Attachment is obsolete: true
Attachment #107347 - Flags: superreview+
checked in. Thanks for the reviews
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: