Closed Bug 930855 Opened 11 years ago Closed 11 years ago

Replace WidgetEvent::Is*DerivedClass() with As*Event()

Categories

(Core :: Widget, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

(Whiteboard: [qa-])

Attachments

(1 file)

      No description provided.
Attachment #822124 - Flags: review?(bugs)
Comment on attachment 822124 [details] [diff] [review]
Patch

I don't understand. Why replace non-virtual method with a virtual one?
Attachment #822124 - Flags: review?(bugs) → review-
Comment on attachment 822124 [details] [diff] [review]
Patch

(In reply to Olli Pettay [:smaug] from comment #2)
> Comment on attachment 822124 [details] [diff] [review]
> Patch
> 
> I don't understand. Why replace non-virtual method with a virtual one?

The reason is that the methods are non-virtual but they call virtual methods (As*Event()) internally. So, I believe that it doesn't make sense we keep having duplicated methods for different return type.
Attachment #822124 - Flags: review- → review?(bugs)
Comment on attachment 822124 [details] [diff] [review]
Patch

Ah, indeed.

(Though, I guess at some point we'll want IsFooEvent() methods which aren't virtual)
Attachment #822124 - Flags: review?(bugs) → review+
(In reply to Olli Pettay [:smaug] from comment #4)
> (Though, I guess at some point we'll want IsFooEvent() methods which aren't
> virtual)

As you said, if IsFooEvent() should return true even if an instance inherits the class, I don't think we need them because they're just wrappers of AsFooEvent() != nullptr, isn't it?

I was suggested that we should implement AsFooEvent() as non-virtual method, but the suggested patch was more complicated than current code. Therefore, it was not granted. See bug 920425 comment 14.
https://hg.mozilla.org/mozilla-central/rev/340cb402065a
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: