Bug 194232 - Use constants for pointer types
Summary: Use constants for pointer types
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-02-04 11:32 PST by Antoine Quint
Modified: 2019-02-04 14:30 PST (History)
9 users (show)

See Also:


Attachments
Patch (3.20 KB, patch)
2019-02-04 11:34 PST, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch (4.00 KB, patch)
2019-02-04 14:21 PST, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch for landing (4.00 KB, patch)
2019-02-04 14:25 PST, Antoine Quint
graouts: commit-queue+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2019-02-04 11:32:49 PST
Use constants for pointer types
Comment 1 Antoine Quint 2019-02-04 11:34:22 PST
Created attachment 361077 [details]
Patch
Comment 2 Sam Weinig 2019-02-04 13:49:58 PST
Comment on attachment 361077 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=361077&action=review

> Source/WebCore/dom/PointerEvent.h:90
> +    static const String& mousePointerType() { static NeverDestroyed<const String> mouse(MAKE_STATIC_STRING_IMPL("mouse")); return mouse; }
> +    static const String& penPointerType() { static NeverDestroyed<const String> pen(MAKE_STATIC_STRING_IMPL("pen")); return pen; }
> +    static const String& touchPointerType() { static NeverDestroyed<const String> touch(MAKE_STATIC_STRING_IMPL("touch")); return touch; }

Generally we put static NeverDestroyed variables like this in the cpp file so that we only end up with one (otherwise you get one per cpp that includes this header).
Comment 3 Antoine Quint 2019-02-04 14:21:57 PST
Created attachment 361099 [details]
Patch
Comment 4 Antoine Quint 2019-02-04 14:25:45 PST
Created attachment 361100 [details]
Patch for landing
Comment 5 Antoine Quint 2019-02-04 14:28:49 PST
Committed r240943: <https://trac.webkit.org/changeset/240943>
Comment 6 Radar WebKit Bug Importer 2019-02-04 14:30:13 PST
<rdar://problem/47799893>