Bug 190026

Summary: Web Inspector: Canvas: replace constant numbers with their associated name on WebGL contexts
Product: WebKit Reporter: Devin Rousso <hi>
Component: Web InspectorAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, inspector-bugzilla-changes, joepeck, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 175485    
Attachments:
Description Flags
Patch
none
[Image] After Patch is applied
none
Patch none

Description Devin Rousso 2018-09-26 21:49:35 PDT
Any `GLenum` argument should come from a constant number defined on `WebGLRenderingContext.prototype`, meaning that we can (and should) show that text instead of the number value.  Developers are more likely to know the constant's name rather than its actual numerical value.
Comment 1 Devin Rousso 2018-09-26 22:19:49 PDT
Created attachment 350938 [details]
Patch
Comment 2 Devin Rousso 2018-09-26 22:20:20 PDT
Created attachment 350939 [details]
[Image] After Patch is applied

I'm not sure how to stylistically differentiate between constant values and swizzled values.  Feedback welcome :)
Comment 3 Joseph Pecoraro 2018-10-01 11:42:49 PDT
Comment on attachment 350938 [details]
Patch

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

r=me

> Source/WebInspectorUI/UserInterface/Models/RecordingAction.js:117
> +        let prototype = WI.RecordingAction._prototypeForType(type);
> +        for (let key in prototype) {
> +            let descriptor = Object.getOwnPropertyDescriptor(prototype, key);
> +            if (descriptor.value === value)
> +                return key;
> +        }

Nice!

Should we avoid a few keys? For example if we're in a spot with the value zero, there would be multiple options and it seems the first one we come across would be the one returned:

    NONE: 0
    NO_ERROR: 0
    POINTS: 0
    ZERO: 0

Or maybe we've just limited the constant indexes to a better set that will have useful non-ambugious constants.
Comment 4 Devin Rousso 2018-10-02 00:22:54 PDT
Created attachment 351349 [details]
Patch
Comment 5 WebKit Commit Bot 2018-10-02 01:00:45 PDT
Comment on attachment 351349 [details]
Patch

Clearing flags on attachment: 351349

Committed r236715: <https://trac.webkit.org/changeset/236715>
Comment 6 WebKit Commit Bot 2018-10-02 01:00:47 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2018-10-02 01:01:37 PDT
<rdar://problem/44932756>