Bug 178824 - Add downcast support for FullscreenClient.
Summary: Add downcast support for FullscreenClient.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jeremy Jones
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-25 13:22 PDT by Jeremy Jones
Modified: 2017-11-15 13:02 PST (History)
3 users (show)

See Also:


Attachments
Patch (5.31 KB, patch)
2017-10-25 13:24 PDT, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (4.87 KB, patch)
2017-11-06 16:38 PST, Jeremy Jones
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Jones 2017-10-25 13:22:00 PDT
Add downcast support for FullscreenClient.
Comment 1 Jeremy Jones 2017-10-25 13:24:28 PDT
Created attachment 324878 [details]
Patch
Comment 2 Simon Fraser (smfr) 2017-10-25 14:16:30 PDT
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?
Comment 3 Jeremy Jones 2017-10-26 13:02:47 PDT
(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.
Comment 4 Simon Fraser (smfr) 2017-10-26 13:09:52 PDT
> 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.
Comment 5 Jeremy Jones 2017-11-06 16:38:10 PST
Created attachment 326167 [details]
Patch
Comment 6 WebKit Commit Bot 2017-11-07 16:01:48 PST
Comment on attachment 326167 [details]
Patch

Clearing flags on attachment: 326167

Committed r224558: <https://trac.webkit.org/changeset/224558>
Comment 7 WebKit Commit Bot 2017-11-07 16:01:50 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2017-11-15 13:02:55 PST
<rdar://problem/35568682>