Bug 190026 - Web Inspector: Canvas: replace constant numbers with their associated name on WebGL contexts
Summary: Web Inspector: Canvas: replace constant numbers with their associated name on...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on:
Blocks: WebInspectorCanvasTab
  Show dependency treegraph
 
Reported: 2018-09-26 21:49 PDT by Devin Rousso
Modified: 2018-10-02 01:01 PDT (History)
4 users (show)

See Also:


Attachments
Patch (10.20 KB, patch)
2018-09-26 22:19 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
[Image] After Patch is applied (175.91 KB, image/png)
2018-09-26 22:20 PDT, Devin Rousso
no flags Details
Patch (10.08 KB, patch)
2018-10-02 00:22 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>