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

RESOLVED FIXED in mozilla28

Status

()

RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: masayuki, Assigned: masayuki)

Tracking

Trunk
mozilla28
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [qa-])

Attachments

(1 attachment)

Comment hidden (empty)
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
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28

Updated

5 years ago
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.