Summary: | Add downcast support for FullscreenClient. | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Jeremy Jones <jeremyj-wk> | ||||||
Component: | WebKit2 | Assignee: | Jeremy Jones <jeremyj-wk> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | commit-queue, simon.fraser, webkit-bug-importer | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | WebKit Nightly Build | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Attachments: |
|
Description
Jeremy Jones
2017-10-25 13:22:00 PDT
Created attachment 324878 [details]
Patch
Comment on attachment 324878 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=324878&action=review > Source/WebKit/UIProcess/Cocoa/FullscreenClient.h:44 > + static int type; > + bool isType(void* target) const override { return target == &type || API::FullscreenClient::isType(target);}; This is really weird. Why the generic types (int and void*) and not enums and classes? (In reply to Simon Fraser (smfr) from comment #2) > Comment on attachment 324878 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=324878&action=review > > > Source/WebKit/UIProcess/Cocoa/FullscreenClient.h:44 > > + static int type; > > + bool isType(void* target) const override { return target == &type || API::FullscreenClient::isType(target);}; > > This is really weird. Why the generic types (int and void*) and not enums > and classes? Are you suggesting something like: typedef int Type; typedef void* TypeRef; ... static Type type; bool isType(TypeRef target); Or are you suggesting API::FullscreenClient have something like: enum FullscreenClientType { APIFullscreenClientType, WebKitFullscreenClientType }; ... bool isType(FullscreenClientType type); In the latter case, it seems weird to me for the base class to be aware of all derived classes.
> Are you suggesting something like:
>
> typedef int Type;
> typedef void* TypeRef;
> ...
> static Type type;
> bool isType(TypeRef target);
>
>
> Or are you suggesting API::FullscreenClient have something like:
>
> enum FullscreenClientType {
> APIFullscreenClientType,
> WebKitFullscreenClientType
> };
> ...
> bool isType(FullscreenClientType type);
>
> In the latter case, it seems weird to me for the base class to be aware of
> all derived classes.
The latter. We do this all over the place.
Created attachment 326167 [details]
Patch
Comment on attachment 326167 [details] Patch Clearing flags on attachment: 326167 Committed r224558: <https://trac.webkit.org/changeset/224558> All reviewed patches have been landed. Closing bug. |