Closed
Bug 577976
Opened 14 years ago
Closed 14 years ago
Cleanup multiple inheritance of nsICSSRule and nsCSSRule
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla5
People
(Reporter: craig.topper, Assigned: craig.topper)
References
(Blocks 1 open bug)
Details
Attachments
(6 files, 11 obsolete files)
(deleted),
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review |
nsICSSRule was the base class for all the other rule interfaces that are being removed by other bugs. nsCSSRule was then used to implement the common code for all the concrete rule classes that implemented those interfaces. This results in a bunch of virtual methods in the concrete classes to resolve the abiguity and forward to the implementation in nsCSSRule.
Now that the other interfaces are going away there is no need to preserve a pure interface inheritance path. At the very least we should make the rule classes inherit from nsCSSRule and then make nsCSSRule inherit from nsICSSRule. This will remove the multiple inheritance and allow the forwarding methods to be removed.
May go further and look into merging nsICSSRule and nsCSSRule to see if we can devirtualize some methods.
Assignee | ||
Comment 1•14 years ago
|
||
Attachment #456789 -
Flags: review?(dbaron)
Assignee | ||
Comment 2•14 years ago
|
||
Updated due to patches in other bugs
Attachment #456789 -
Attachment is obsolete: true
Attachment #456796 -
Flags: review?(dbaron)
Attachment #456789 -
Flags: review?(dbaron)
Assignee | ||
Comment 3•14 years ago
|
||
Attachment #456804 -
Flags: review?(dbaron)
Assignee | ||
Updated•14 years ago
|
Attachment #456796 -
Flags: review?(dbaron)
Assignee | ||
Updated•14 years ago
|
Attachment #456804 -
Flags: review?(dbaron)
Assignee | ||
Updated•14 years ago
|
Attachment #456796 -
Attachment is obsolete: true
Assignee | ||
Updated•14 years ago
|
Attachment #456804 -
Attachment is obsolete: true
Assignee | ||
Comment 4•14 years ago
|
||
Assignee | ||
Comment 5•14 years ago
|
||
Assignee | ||
Comment 6•14 years ago
|
||
Assignee | ||
Comment 7•14 years ago
|
||
Assignee | ||
Comment 8•14 years ago
|
||
Assignee | ||
Updated•14 years ago
|
Attachment #522563 -
Flags: review?(bzbarsky)
Assignee | ||
Updated•14 years ago
|
Attachment #522567 -
Flags: review?(bzbarsky)
Assignee | ||
Updated•14 years ago
|
Attachment #522569 -
Flags: review?(bzbarsky)
Assignee | ||
Updated•14 years ago
|
Attachment #522594 -
Flags: review?(bzbarsky)
Assignee | ||
Updated•14 years ago
|
Attachment #522595 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 9•14 years ago
|
||
That last one isn't exactly related but it's context heavily depends on the other patches.
Comment 10•14 years ago
|
||
Comment on attachment 522563 [details] [diff] [review]
Part 1: Make nsCSSRule inherit from nsICSSRule and remove inheritance of nsICSSRule from other classes
>+++ b/layout/style/nsCSSRule.h
>+ virtual already_AddRefed<nsIStyleSheet> GetStyleSheet() const;
>+ virtual void SetStyleSheet(nsCSSStyleSheet* aSheet);
>+ virtual void SetParentRule(mozilla::css::GroupRule* aRule);
Why do those need to be virtual?
r=me on the rest, but I'd like to understand why those are virtual before marking.
Comment 11•14 years ago
|
||
I guess I see why SetStyleSheet needs to be virtual. But why do the other two need it?
Comment 12•14 years ago
|
||
Comment on attachment 522567 [details] [diff] [review]
Part 2: Remove forwarding methods to nsCSSRule from Rule classes
>- nsCOMPtr<nsIStyleSheet> sheet = mOwnerRule->GetStyleSheet();
>+ nsCOMPtr<nsIStyleSheet> sheet = static_cast<nsCSSRule*>(mOwnerRule)->GetStyleSheet();
Is this needed due to shadowing?
If so, r=me.
Attachment #522567 -
Flags: review?(bzbarsky) → review+
Comment 13•14 years ago
|
||
Comment on attachment 522569 [details] [diff] [review]
Part 3: Rename nsCSSRule and put in css namespace
This looks like it did an hg rm of nsCSSRule.h and an hg add of Rule.h instead of doing an hg move. Please fix that?
Attachment #522569 -
Flags: review?(bzbarsky) → review-
Comment 14•14 years ago
|
||
Comment on attachment 522594 [details] [diff] [review]
Part 4: Move AddRef/Release back to nsCSSRule
r=me
Attachment #522594 -
Flags: review?(bzbarsky) → review+
Comment 15•14 years ago
|
||
Comment on attachment 522595 [details] [diff] [review]
Part 5: Remove AddRef from GetStyleSheet
r=me
Attachment #522595 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 16•14 years ago
|
||
(In reply to comment #11)
> I guess I see why SetStyleSheet needs to be virtual. But why do the other two
> need it?
Aren't they all virtual by virtue of the fact that they are pure virtual in nsICSSRule which is now Rule's base?
virtual already_AddRefed<nsIStyleSheet> GetStyleSheet() const = 0;
virtual void SetStyleSheet(nsCSSStyleSheet* aSheet) = 0;
virtual void SetParentRule(nsICSSGroupRule* aRule) = 0;
Assignee | ||
Comment 17•14 years ago
|
||
(In reply to comment #12)
> Comment on attachment 522567 [details] [diff] [review]
> Part 2: Remove forwarding methods to nsCSSRule from Rule classes
>
> >- nsCOMPtr<nsIStyleSheet> sheet = mOwnerRule->GetStyleSheet();
> >+ nsCOMPtr<nsIStyleSheet> sheet = static_cast<nsCSSRule*>(mOwnerRule)->GetStyleSheet();
>
> Is this needed due to shadowing?
>
> If so, r=me.
Yeah I got an error because there is a DOM version of GetStyleSheet on ImportRule and since the forwarding method was removed from ImportRule, the DOM version hides GetStyleSheet(). It also causes a bunch of warnings about it being hidden to fire too, but I don't know how to fix that without putting back forwarding.
Assignee | ||
Comment 18•14 years ago
|
||
Assignee | ||
Updated•14 years ago
|
Attachment #522569 -
Attachment is obsolete: true
Assignee | ||
Comment 19•14 years ago
|
||
Assignee | ||
Updated•14 years ago
|
Attachment #522594 -
Attachment is obsolete: true
Assignee | ||
Comment 20•14 years ago
|
||
Assignee | ||
Updated•14 years ago
|
Attachment #522595 -
Attachment is obsolete: true
Assignee | ||
Comment 21•14 years ago
|
||
Comment on attachment 524124 [details] [diff] [review]
Part 3: Rename nsCSSRule and put in css namespace
Fixed to rename the file properly
Attachment #524124 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 22•14 years ago
|
||
Had to update patch 4 and 5 to deal with changes from bug 577974.
Comment 23•14 years ago
|
||
> It also causes a bunch of warnings about it being hidden to fire too
I think you should be able to fix that with a |using nsCSSRule::GetStyleSheet;| or something in the header.... Might help the code that needed the cast too.
Comment 24•14 years ago
|
||
> Aren't they all virtual by virtue of the fact that they are pure virtual in
> nsICSSRule which is now Rule's base?
Ah, I see. OK.
Comment 25•14 years ago
|
||
Comment on attachment 522563 [details] [diff] [review]
Part 1: Make nsCSSRule inherit from nsICSSRule and remove inheritance of nsICSSRule from other classes
r=me
Attachment #522563 -
Flags: review?(bzbarsky) → review+
Comment 26•14 years ago
|
||
Comment on attachment 524124 [details] [diff] [review]
Part 3: Rename nsCSSRule and put in css namespace
r=me
Attachment #524124 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 27•14 years ago
|
||
Assignee | ||
Updated•14 years ago
|
Attachment #522567 -
Attachment is obsolete: true
Assignee | ||
Comment 28•14 years ago
|
||
Assignee | ||
Updated•14 years ago
|
Attachment #524139 -
Attachment is obsolete: true
Assignee | ||
Comment 29•14 years ago
|
||
Assignee | ||
Updated•14 years ago
|
Attachment #524124 -
Attachment is obsolete: true
Assignee | ||
Comment 30•14 years ago
|
||
Assignee | ||
Updated•14 years ago
|
Attachment #524125 -
Attachment is obsolete: true
Assignee | ||
Comment 31•14 years ago
|
||
Assignee | ||
Updated•14 years ago
|
Attachment #524126 -
Attachment is obsolete: true
Assignee | ||
Comment 32•14 years ago
|
||
I've added the using declaration which does fix the warning and removes the
need for the cast. I qualified it with a define from autoconf since comments in
configure suggest that this isn't supported by all compilers and I found other
places in the code that check the same define.
I suppose this means that the cast would still be needed by any compiler that
doesn't support using to resolve ambiguity so I'll upload another patch to
restore the cast that I removed before I thought of that.
Assignee | ||
Comment 33•14 years ago
|
||
Comment 34•14 years ago
|
||
I believe we have at least one use of ambiguity-resolving 'using' in our tree not conditioned on that define already, so I'm not terribly worried about compilers that don't support that right now. I'll land patches 1-5, and we can do 6 later if it becomes an issue...
Comment 35•14 years ago
|
||
Turns out Windows needs part 6. Pushed:
http://hg.mozilla.org/mozilla-central/rev/592aacaf042d
http://hg.mozilla.org/mozilla-central/rev/f2685fc02b6b
http://hg.mozilla.org/mozilla-central/rev/7e119e22b856
http://hg.mozilla.org/mozilla-central/rev/5d537abf7005
http://hg.mozilla.org/mozilla-central/rev/5235a5391635
http://hg.mozilla.org/mozilla-central/rev/b70744835d94
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.2
Assignee | ||
Comment 36•14 years ago
|
||
I failed to update nsICSSRule's IID in part 5. Is that something that needs to be fixed?
Comment 37•12 years ago
|
||
At this point, probably not... ;)
You need to log in
before you can comment on or make changes to this bug.
Description
•